idx
int64
1
56k
question
stringlengths
15
155
answer
stringlengths
2
29.2k
question_cut
stringlengths
15
100
answer_cut
stringlengths
2
200
conversation
stringlengths
47
29.3k
conversation_cut
stringlengths
47
301
15,501
What is the "partial" in partial least squares methods?
I would like to answer this question, largely based on the historical perspective, which is quite interesting. Herman Wold, who invented partial least squares (PLS) approach, hasn't started using term PLS (or even mentioning term partial) right away. During the initial period (1966-1969), he referred to this approach as NILES - abbreviation of the term and title of his initial paper on this topic Nonlinear Estimation by Iterative Least Squares Procedures, published in 1966. As we can see, procedures that later will be called partial, have been referred to as iterative, focusing on the iterative nature of the procedure of estimating weights and latent variables (LVs). The "least squares" term comes from using ordinary least squares (OLS) regression to estimate other unknown parameters of a model (Wold, 1980). It seems that the term "partial" has its roots in the NILES procedures, which implemented "the idea of split the parameters of a model into subsets so they can be estimated in parts" (Sanchez, 2013, p. 216; emphasis mine). The first use of the term PLS has occurred in the paper Nonlinear iterative partial least squares (NIPALS) estimation procedures, which publication marks next period of PLS history - the NIPALS modeling period. 1970s and 1980s become the soft modeling period, when, influenced by Karl Joreskog's LISREL approach to SEM, Wold transforms NIPALS approach into soft modeling, which essentially has formed the core of the modern PLS approach (the term PLS becomes mainstream in the end of 1970s). 1990s, the next period in PLS history, which Sanchez (2013) calls "gap" period, is marked largely by decreasing of its use. Fortunately, starting from 2000s (consolidation period), PLS enjoyed its return as a very popular approach to SEM analysis, especially in social sciences. UPDATE (in response to amoeba's comment): Perhaps, Sanchez's wording is not ideal in the phrase that I've cited. I think that "estimated in parts" applies to latent blocks of variables. Wold (1980) describes the concept in detail. You're right that NIPALS was originally developed for PCA. The confusion stems from the fact that there exist both linear PLS and nonlinear PLS approaches. I think that Rosipal (2011) explains the differences very well (at least, this is the best explanation that I've seen so far). UPDATE 2 (further clarification): In response to concerns, expressed in amoeba's answer, I'd like to clarify some things. It seems to me that we need to distinguish the use of the word "partial" between NIPALS and PLS. That creates two separate questions about 1) the meaning of "partial" in NIPALS and 2) the meaning of "partial" in PLS (that's the original question by Phil2014). While I'm not sure about the former, I can offer further clarification about the latter. According to Wold, Sjöström and Eriksson (2001), The "partial" in PLS indicates that this is a partial regression, since ... In other words, "partial" stems from the fact that data decomposition by NIPALS algorithm for PLS may not include all components, hence "partial". I suspect that the same reason applies to NIPALS in general, if it's possible to use the algorithm on "partial" data. That would explain "P" in NIPALS. In terms of using the word "nonlinear" in NIPALS definition (do not confuse with nonlinear PLS, which represents nonlinear variant of the PLS approach!), I think that it refers not to the algorithm itself, but to nonlinear models, which can be analyzed, using linear regression-based NIPALS. UPDATE 3 (Herman Wold's explanation): While Herman Wold's 1969 paper seems to be the earliest paper on NIPALS, I have managed to find another one of the earliest papers on this topic. That is a paper by Wold (1974), where the "father" of PLS presents his rationale for using the word "partial" in NIPALS definition (p. 71): 3.1.4. NIPALS estimation: Iterative OLS. If one or more variables of the model are latent, the predictor relations involve not only unknown parameters, but also unknown variables, with the result that the estimation problem becomes nonlinear. As indicated in 3.1 (iii), NIPALS solves this problem by an iterative procedure, say with steps s = 1, 2, ... Each step s involves a finite number of OLS regressions, one for each predictor relation of the model. Each such regression gives proxy estimates for a sub-set of the unknown parameters and latent variables (hence the name partial least squares), and these proxy estimates are used in the next step of the procedure to calculate new proxy estimates. References Rosipal, R. (2011). Nonlinear partial least squares: An overview. In Lodhi H. and Yamanishi Y. (Eds.), Chemoinformatics and Advanced Machine Learning Perspectives: Complex Computational Methods and Collaborative Techniques, pp. 169-189. ACCM, IGI Global. Retrieved from http://aiolos.um.savba.sk/~roman/Papers/npls_book11.pdf Sanchez, G. (2013). PLS path modeling with R. Berkeley, CA: Trowchez Editions. Retrieved from http://gastonsanchez.com/PLS_Path_Modeling_with_R.pdf Wold, H. (1974). Causal flows with latent variables: Partings of the ways in the light of NIPALS modelling. European Economic Review, 5, 67-86. North Holland Publishing. Wold, H. (1980). Model construction and evaluation when theoretical knowledge is scarce: Theory and applications of partial least squares. In J. Kmenta and J. B. Ramsey (Eds.), Evaluation of econometric models, pp. 47-74. New York: Academic Press. Retrieved from http://www.nber.org/chapters/c11693 Wold, S., Sjöström, M., & Eriksson, L. (2001). PLS-regression: A basic tool of chemometrics. Chemometrics and Intelligent Laboratory Systems, 58, 109-130. doi:10.1016/S0169-7439(01)00155-1 Retrieved from http://www.libpls.net/publication/PLS_basic_2001.pdf
What is the "partial" in partial least squares methods?
I would like to answer this question, largely based on the historical perspective, which is quite interesting. Herman Wold, who invented partial least squares (PLS) approach, hasn't started using term
What is the "partial" in partial least squares methods? I would like to answer this question, largely based on the historical perspective, which is quite interesting. Herman Wold, who invented partial least squares (PLS) approach, hasn't started using term PLS (or even mentioning term partial) right away. During the initial period (1966-1969), he referred to this approach as NILES - abbreviation of the term and title of his initial paper on this topic Nonlinear Estimation by Iterative Least Squares Procedures, published in 1966. As we can see, procedures that later will be called partial, have been referred to as iterative, focusing on the iterative nature of the procedure of estimating weights and latent variables (LVs). The "least squares" term comes from using ordinary least squares (OLS) regression to estimate other unknown parameters of a model (Wold, 1980). It seems that the term "partial" has its roots in the NILES procedures, which implemented "the idea of split the parameters of a model into subsets so they can be estimated in parts" (Sanchez, 2013, p. 216; emphasis mine). The first use of the term PLS has occurred in the paper Nonlinear iterative partial least squares (NIPALS) estimation procedures, which publication marks next period of PLS history - the NIPALS modeling period. 1970s and 1980s become the soft modeling period, when, influenced by Karl Joreskog's LISREL approach to SEM, Wold transforms NIPALS approach into soft modeling, which essentially has formed the core of the modern PLS approach (the term PLS becomes mainstream in the end of 1970s). 1990s, the next period in PLS history, which Sanchez (2013) calls "gap" period, is marked largely by decreasing of its use. Fortunately, starting from 2000s (consolidation period), PLS enjoyed its return as a very popular approach to SEM analysis, especially in social sciences. UPDATE (in response to amoeba's comment): Perhaps, Sanchez's wording is not ideal in the phrase that I've cited. I think that "estimated in parts" applies to latent blocks of variables. Wold (1980) describes the concept in detail. You're right that NIPALS was originally developed for PCA. The confusion stems from the fact that there exist both linear PLS and nonlinear PLS approaches. I think that Rosipal (2011) explains the differences very well (at least, this is the best explanation that I've seen so far). UPDATE 2 (further clarification): In response to concerns, expressed in amoeba's answer, I'd like to clarify some things. It seems to me that we need to distinguish the use of the word "partial" between NIPALS and PLS. That creates two separate questions about 1) the meaning of "partial" in NIPALS and 2) the meaning of "partial" in PLS (that's the original question by Phil2014). While I'm not sure about the former, I can offer further clarification about the latter. According to Wold, Sjöström and Eriksson (2001), The "partial" in PLS indicates that this is a partial regression, since ... In other words, "partial" stems from the fact that data decomposition by NIPALS algorithm for PLS may not include all components, hence "partial". I suspect that the same reason applies to NIPALS in general, if it's possible to use the algorithm on "partial" data. That would explain "P" in NIPALS. In terms of using the word "nonlinear" in NIPALS definition (do not confuse with nonlinear PLS, which represents nonlinear variant of the PLS approach!), I think that it refers not to the algorithm itself, but to nonlinear models, which can be analyzed, using linear regression-based NIPALS. UPDATE 3 (Herman Wold's explanation): While Herman Wold's 1969 paper seems to be the earliest paper on NIPALS, I have managed to find another one of the earliest papers on this topic. That is a paper by Wold (1974), where the "father" of PLS presents his rationale for using the word "partial" in NIPALS definition (p. 71): 3.1.4. NIPALS estimation: Iterative OLS. If one or more variables of the model are latent, the predictor relations involve not only unknown parameters, but also unknown variables, with the result that the estimation problem becomes nonlinear. As indicated in 3.1 (iii), NIPALS solves this problem by an iterative procedure, say with steps s = 1, 2, ... Each step s involves a finite number of OLS regressions, one for each predictor relation of the model. Each such regression gives proxy estimates for a sub-set of the unknown parameters and latent variables (hence the name partial least squares), and these proxy estimates are used in the next step of the procedure to calculate new proxy estimates. References Rosipal, R. (2011). Nonlinear partial least squares: An overview. In Lodhi H. and Yamanishi Y. (Eds.), Chemoinformatics and Advanced Machine Learning Perspectives: Complex Computational Methods and Collaborative Techniques, pp. 169-189. ACCM, IGI Global. Retrieved from http://aiolos.um.savba.sk/~roman/Papers/npls_book11.pdf Sanchez, G. (2013). PLS path modeling with R. Berkeley, CA: Trowchez Editions. Retrieved from http://gastonsanchez.com/PLS_Path_Modeling_with_R.pdf Wold, H. (1974). Causal flows with latent variables: Partings of the ways in the light of NIPALS modelling. European Economic Review, 5, 67-86. North Holland Publishing. Wold, H. (1980). Model construction and evaluation when theoretical knowledge is scarce: Theory and applications of partial least squares. In J. Kmenta and J. B. Ramsey (Eds.), Evaluation of econometric models, pp. 47-74. New York: Academic Press. Retrieved from http://www.nber.org/chapters/c11693 Wold, S., Sjöström, M., & Eriksson, L. (2001). PLS-regression: A basic tool of chemometrics. Chemometrics and Intelligent Laboratory Systems, 58, 109-130. doi:10.1016/S0169-7439(01)00155-1 Retrieved from http://www.libpls.net/publication/PLS_basic_2001.pdf
What is the "partial" in partial least squares methods? I would like to answer this question, largely based on the historical perspective, which is quite interesting. Herman Wold, who invented partial least squares (PLS) approach, hasn't started using term
15,502
What is the "partial" in partial least squares methods?
In modern expositions of PLS there is nothing "partial": PLS looks for linear combinations among variables in $X$ and among variables in $Y$ that have maximal covariance. It is an easy eigenvector problem. That's it. See The Elements of Statistical Learning, Section 3.5.2, or e.g. Rosipal & Krämer, 2005, Overview and Recent Advances in Partial Least Squares. However, historically, as @Aleksandr nicely explains (+1), PLS was introduced by Wold who used his NIPALS algorithm to implement it; NIPALS stands for "nonlinear iterated partial least squares", so obviously P in PLS just got there from NIPALS. Moreover, NIPALS (as I remember reading elsewhere) was not initially developed for PLS; it was introduced for PCA. Now, NIPALS for PCA is a very simple algorithm. I can present it right here. Let $\newcommand{\X}{\mathbf X}\X$ be a centered data matrix with observation in rows. The goal is to find the first principal axis $\newcommand{\v}{\mathbf v}\v$ (eigenvector of the covariance matrix) and the first principal component $\newcommand{\p}{\mathbf p}\p$ (projection of the data onto $\v$). We initialize $\p$ randomly and then iterate the following steps until convergence: $\v = \X^\top \p (\p^\top \p)^{-1}$ Set $\|\v\|$ to $1$. $\p = \X \v (\v^\top \v)^{-1}$ That's it! So the real question is why did Wold call this algorithm "partial"? The answer (as I finally understood after @Aleksandr made his third update) is that Wold viewed $\v$ and $\p$ as two [sets of] parameters, together modeling the data matrix $\X$. The algorithm updates these parameters sequentially (steps #1 and #3), i.e. it updates only one part of the parameters at a time! Hence "partial". (Why he called it "nonlinear" I still don't understand though.) This term is remarkably misleading, because if this is "partial" then every expectation-maximization algorithm is "partial" too (in fact, NIPALS can be seen as a primitive form of EM, see Roweis 1998). I think PLS is a good candidate for The Most Misleading Term in Machine Learning contest. Alas, it is unlikely to change, despite the efforts of Wold Jr. (see @Momo's comment above).
What is the "partial" in partial least squares methods?
In modern expositions of PLS there is nothing "partial": PLS looks for linear combinations among variables in $X$ and among variables in $Y$ that have maximal covariance. It is an easy eigenvector pro
What is the "partial" in partial least squares methods? In modern expositions of PLS there is nothing "partial": PLS looks for linear combinations among variables in $X$ and among variables in $Y$ that have maximal covariance. It is an easy eigenvector problem. That's it. See The Elements of Statistical Learning, Section 3.5.2, or e.g. Rosipal & Krämer, 2005, Overview and Recent Advances in Partial Least Squares. However, historically, as @Aleksandr nicely explains (+1), PLS was introduced by Wold who used his NIPALS algorithm to implement it; NIPALS stands for "nonlinear iterated partial least squares", so obviously P in PLS just got there from NIPALS. Moreover, NIPALS (as I remember reading elsewhere) was not initially developed for PLS; it was introduced for PCA. Now, NIPALS for PCA is a very simple algorithm. I can present it right here. Let $\newcommand{\X}{\mathbf X}\X$ be a centered data matrix with observation in rows. The goal is to find the first principal axis $\newcommand{\v}{\mathbf v}\v$ (eigenvector of the covariance matrix) and the first principal component $\newcommand{\p}{\mathbf p}\p$ (projection of the data onto $\v$). We initialize $\p$ randomly and then iterate the following steps until convergence: $\v = \X^\top \p (\p^\top \p)^{-1}$ Set $\|\v\|$ to $1$. $\p = \X \v (\v^\top \v)^{-1}$ That's it! So the real question is why did Wold call this algorithm "partial"? The answer (as I finally understood after @Aleksandr made his third update) is that Wold viewed $\v$ and $\p$ as two [sets of] parameters, together modeling the data matrix $\X$. The algorithm updates these parameters sequentially (steps #1 and #3), i.e. it updates only one part of the parameters at a time! Hence "partial". (Why he called it "nonlinear" I still don't understand though.) This term is remarkably misleading, because if this is "partial" then every expectation-maximization algorithm is "partial" too (in fact, NIPALS can be seen as a primitive form of EM, see Roweis 1998). I think PLS is a good candidate for The Most Misleading Term in Machine Learning contest. Alas, it is unlikely to change, despite the efforts of Wold Jr. (see @Momo's comment above).
What is the "partial" in partial least squares methods? In modern expositions of PLS there is nothing "partial": PLS looks for linear combinations among variables in $X$ and among variables in $Y$ that have maximal covariance. It is an easy eigenvector pro
15,503
Why isn't bayesian statistics more popular for statistical process control?
WARNING I wrote this answer a long time ago with very little idea what I was talking about. I can't delete it because it's been accepted, but I can't stand behind most of the content. This is a very long answer and I hope it'll be helpful in some way. SPC isn't my area, but I think these comments are general enough that they apply here. I'd argue that the most-oft-cited advantage -- the ability to incorporate prior beliefs -- is a weak advantage applied/empirical fields. That's because you need to quantify your prior. Even if I can say "well, level z is definitely implausible," I can't for the life of me tell you what should happen below z. Unless authors start publishing their raw data in droves, my best guesses for priors are conditional moments taken from previous work that may or may not have been fitted under similar conditions to the ones you're facing. Basically, Bayesian techniques (at least on a conceptual level) are excellent for when you have a strong assumption/idea/model and want to take it to data, then see how wrong or not wrong you turn out to be. But often you are not looking to see whether you're right about one particular model for your business process; more likely you have no model, and are looking to see what your process is going to do. You do not want to push your conclusions around, you want your data to push your conclusions. If you have enough data, that's what will happen anyway, but in that case why bother with the prior? Perhaps that's overly skeptical and risk-averse, but I've never heard of an optimistic businessman that was also successful. There is no way to quantify your uncertainty about your own beliefs, and you would rather not run the risk of being overconfident in the wrong thing. So you set an uninformative prior and the advantage disappears. This is interesting in the SPC case because unlike in, say, digital marketing, your business processes aren't forever in an unpredictable state of flux. My impression is that business processes tend to change deliberately and incrementally. That is, you have a long time to build up good, safe priors. But recall that priors are all about propagating uncertainty. Subjectivity aside, Bayesianism has the advantage that it objectively propagates uncertainty across deeply-nested data generating processes. That, to me, is really what Bayesian statistics is good for. And if you're looking for reliability of your process well beyond the 1-in-20 "significance" cutoff, it seems like you would want to account for as much uncertainty as possible. So where are the Bayesian models? First off, they're hard to implement. To put it bluntly, I can teach OLS to a mechanical engineer in 15 minutes and have him cranking out regressions and t-tests in Matlab in another 5. To use Bayes, I first need to decide what kind of model I'm fitting, and then see if there's a ready-made library for it in a language someone at my company knows. If not, I have to use BUGS or Stan. And then I have to run simulations to get even a basic answer, and that takes about 15 minutes on an 8-core i7 machine. So much for rapid prototyping. And second off, by the time you get an answer, you've spent two hours of coding and waiting, only to get the same result as you could have with frequentist random effects with clustered standard errors. Maybe this is all presumptuous and wrongheaded and I don't understand SPC at all. But I see it in academia and in for-profit social science constantly, and I'd be surprised if things were different in other fields. I liken Bayesianism to a very high-quality chef knife, a stockpot, and a sautee pan; frequentism is like a kitchen full of As-Seen-On-TV tools like banana slicers and pasta pots with holes in the lid for easy draining. If you're a practiced cook with lots of experience in the kitchen--indeed, in your own kitchen of substantive knowledge, which is clean and organized and you know where everything is located--you can do amazing things with your small selection of elegant, high-quality tools. Or, you can use a bunch of different little ad-hoc* tools, that require zero skill to use, to make a meal that's simple, really not half bad, and has a couple basic flavors that get the point across. You just got home from the data mines and you're hungry for results; which cook are you? *Bayes is just as ad-hoc, but less transparently so. How much wine goes in your coq au vin? No idea, you eyeball it because you're a pro. Or, you can't tell the difference between a Pinot Grigio and a Pinot Noir but the first recipe on Epicurious said to use 2 cups of the red one so that's what you're going to do. Which one is more "ad-hoc?"
Why isn't bayesian statistics more popular for statistical process control?
WARNING I wrote this answer a long time ago with very little idea what I was talking about. I can't delete it because it's been accepted, but I can't stand behind most of the content. This is a very
Why isn't bayesian statistics more popular for statistical process control? WARNING I wrote this answer a long time ago with very little idea what I was talking about. I can't delete it because it's been accepted, but I can't stand behind most of the content. This is a very long answer and I hope it'll be helpful in some way. SPC isn't my area, but I think these comments are general enough that they apply here. I'd argue that the most-oft-cited advantage -- the ability to incorporate prior beliefs -- is a weak advantage applied/empirical fields. That's because you need to quantify your prior. Even if I can say "well, level z is definitely implausible," I can't for the life of me tell you what should happen below z. Unless authors start publishing their raw data in droves, my best guesses for priors are conditional moments taken from previous work that may or may not have been fitted under similar conditions to the ones you're facing. Basically, Bayesian techniques (at least on a conceptual level) are excellent for when you have a strong assumption/idea/model and want to take it to data, then see how wrong or not wrong you turn out to be. But often you are not looking to see whether you're right about one particular model for your business process; more likely you have no model, and are looking to see what your process is going to do. You do not want to push your conclusions around, you want your data to push your conclusions. If you have enough data, that's what will happen anyway, but in that case why bother with the prior? Perhaps that's overly skeptical and risk-averse, but I've never heard of an optimistic businessman that was also successful. There is no way to quantify your uncertainty about your own beliefs, and you would rather not run the risk of being overconfident in the wrong thing. So you set an uninformative prior and the advantage disappears. This is interesting in the SPC case because unlike in, say, digital marketing, your business processes aren't forever in an unpredictable state of flux. My impression is that business processes tend to change deliberately and incrementally. That is, you have a long time to build up good, safe priors. But recall that priors are all about propagating uncertainty. Subjectivity aside, Bayesianism has the advantage that it objectively propagates uncertainty across deeply-nested data generating processes. That, to me, is really what Bayesian statistics is good for. And if you're looking for reliability of your process well beyond the 1-in-20 "significance" cutoff, it seems like you would want to account for as much uncertainty as possible. So where are the Bayesian models? First off, they're hard to implement. To put it bluntly, I can teach OLS to a mechanical engineer in 15 minutes and have him cranking out regressions and t-tests in Matlab in another 5. To use Bayes, I first need to decide what kind of model I'm fitting, and then see if there's a ready-made library for it in a language someone at my company knows. If not, I have to use BUGS or Stan. And then I have to run simulations to get even a basic answer, and that takes about 15 minutes on an 8-core i7 machine. So much for rapid prototyping. And second off, by the time you get an answer, you've spent two hours of coding and waiting, only to get the same result as you could have with frequentist random effects with clustered standard errors. Maybe this is all presumptuous and wrongheaded and I don't understand SPC at all. But I see it in academia and in for-profit social science constantly, and I'd be surprised if things were different in other fields. I liken Bayesianism to a very high-quality chef knife, a stockpot, and a sautee pan; frequentism is like a kitchen full of As-Seen-On-TV tools like banana slicers and pasta pots with holes in the lid for easy draining. If you're a practiced cook with lots of experience in the kitchen--indeed, in your own kitchen of substantive knowledge, which is clean and organized and you know where everything is located--you can do amazing things with your small selection of elegant, high-quality tools. Or, you can use a bunch of different little ad-hoc* tools, that require zero skill to use, to make a meal that's simple, really not half bad, and has a couple basic flavors that get the point across. You just got home from the data mines and you're hungry for results; which cook are you? *Bayes is just as ad-hoc, but less transparently so. How much wine goes in your coq au vin? No idea, you eyeball it because you're a pro. Or, you can't tell the difference between a Pinot Grigio and a Pinot Noir but the first recipe on Epicurious said to use 2 cups of the red one so that's what you're going to do. Which one is more "ad-hoc?"
Why isn't bayesian statistics more popular for statistical process control? WARNING I wrote this answer a long time ago with very little idea what I was talking about. I can't delete it because it's been accepted, but I can't stand behind most of the content. This is a very
15,504
Why isn't bayesian statistics more popular for statistical process control?
In my humble opinion, Bayesian statistics suffers from some drawbacks that conflict with its widespread use (in SPC but in other research sectors as well): It is more difficult to get estimates vs. its frequentist counterpart (the widest part of classes on statistics adopt the frequentist approach. By the way, it would be interesting to investigate if this is the cause or the effect of the limited popularity of Bayesian statistics). Very often Bayesian statistics imposes choices about different ways of dealing with the same problem (e.g., which is the best prior?), not just click-and-see (anyway, this approach should not be encouraged under the frequentist framework, either). Bayesian statistics has some topics which are difficult to manage by less than very experienced statisticians (e.g., improper priors); It requires sensitivity analyses (usually avoided under the frequentist framework), and exceptions made for some topics, such as missing data analysis. It has only one (laudably, free downloadable) software available for calculation. It takes more time to be an autonomous researcher with Bayesian than with frequentist tools.
Why isn't bayesian statistics more popular for statistical process control?
In my humble opinion, Bayesian statistics suffers from some drawbacks that conflict with its widespread use (in SPC but in other research sectors as well): It is more difficult to get estimates vs. i
Why isn't bayesian statistics more popular for statistical process control? In my humble opinion, Bayesian statistics suffers from some drawbacks that conflict with its widespread use (in SPC but in other research sectors as well): It is more difficult to get estimates vs. its frequentist counterpart (the widest part of classes on statistics adopt the frequentist approach. By the way, it would be interesting to investigate if this is the cause or the effect of the limited popularity of Bayesian statistics). Very often Bayesian statistics imposes choices about different ways of dealing with the same problem (e.g., which is the best prior?), not just click-and-see (anyway, this approach should not be encouraged under the frequentist framework, either). Bayesian statistics has some topics which are difficult to manage by less than very experienced statisticians (e.g., improper priors); It requires sensitivity analyses (usually avoided under the frequentist framework), and exceptions made for some topics, such as missing data analysis. It has only one (laudably, free downloadable) software available for calculation. It takes more time to be an autonomous researcher with Bayesian than with frequentist tools.
Why isn't bayesian statistics more popular for statistical process control? In my humble opinion, Bayesian statistics suffers from some drawbacks that conflict with its widespread use (in SPC but in other research sectors as well): It is more difficult to get estimates vs. i
15,505
Why isn't bayesian statistics more popular for statistical process control?
One reason is that Bayesian statistics was frozen out of the mainstream until around 1990. When I was studying statistics in the 1970s it was almost heresy (not everywhere, but in most graduate programs). It didn't help that most of the interesting problems were intractable. As a result, nearly everyone who is teaching statistics today (and reviewing articles for journals, and designing curricula) is trained as a frequentist. Things started to change around 1990 with the popularization of Markov Chain Monte Carlo (MCMC) methods which are gradually finding their way into packages like SAS and Stata. Personally I think they will be much more common in 10 years though in specialized applications (SPC) they may not have much of an advantage. One group that is woking make Bayesian analysis more widely available is the group developing the STAN package (mc-stan.org).
Why isn't bayesian statistics more popular for statistical process control?
One reason is that Bayesian statistics was frozen out of the mainstream until around 1990. When I was studying statistics in the 1970s it was almost heresy (not everywhere, but in most graduate progr
Why isn't bayesian statistics more popular for statistical process control? One reason is that Bayesian statistics was frozen out of the mainstream until around 1990. When I was studying statistics in the 1970s it was almost heresy (not everywhere, but in most graduate programs). It didn't help that most of the interesting problems were intractable. As a result, nearly everyone who is teaching statistics today (and reviewing articles for journals, and designing curricula) is trained as a frequentist. Things started to change around 1990 with the popularization of Markov Chain Monte Carlo (MCMC) methods which are gradually finding their way into packages like SAS and Stata. Personally I think they will be much more common in 10 years though in specialized applications (SPC) they may not have much of an advantage. One group that is woking make Bayesian analysis more widely available is the group developing the STAN package (mc-stan.org).
Why isn't bayesian statistics more popular for statistical process control? One reason is that Bayesian statistics was frozen out of the mainstream until around 1990. When I was studying statistics in the 1970s it was almost heresy (not everywhere, but in most graduate progr
15,506
Qualitively what is Cross Entropy
To encode an event occurring with probability $p$ you need at least $\log_2(1/p)$ bits (why? see my answer on "What is the role of the logarithm in Shannon's entropy?"). So in optimal encoding the average length of encoded message is $$ \sum_i p_i \log_2(\tfrac{1}{p_i}), $$ that is, Shannon entropy of the original probability distribution. However, if for probability distribution $P$ you use encoding which is optimal for a different probability distribution $Q$, then the average length of the encoded message is $$ \sum_i p_i \text{code_length($i$)} = \sum_i p_i \log_2(\tfrac{1}{q_i}), $$ is cross entropy, which is greater than $\sum_i p_i \log_2(\tfrac{1}{p_i})$. As an example, consider alphabet of four letters (A, B, C, D), but with A and B having the same frequency and C and D not appearing at all. So the probability is $P=(\tfrac{1}{2}, \tfrac{1}{2}, 0, 0)$. Then if we want to encode it optimally, we encode A as 0 and B as 1, so we get one bit of encoded message per one letter. (And it is exactly Shannon entropy of our probability distribution.) But if we have the same probability $P$, but we encode it according to distribution where all letters are equally probably $Q=(\tfrac{1}{4},\tfrac{1}{4},\tfrac{1}{4},\tfrac{1}{4})$, then we get two bits per letter (for example, we encode A as 00, B as 01, C as 10 and D as 11).
Qualitively what is Cross Entropy
To encode an event occurring with probability $p$ you need at least $\log_2(1/p)$ bits (why? see my answer on "What is the role of the logarithm in Shannon's entropy?"). So in optimal encoding the ave
Qualitively what is Cross Entropy To encode an event occurring with probability $p$ you need at least $\log_2(1/p)$ bits (why? see my answer on "What is the role of the logarithm in Shannon's entropy?"). So in optimal encoding the average length of encoded message is $$ \sum_i p_i \log_2(\tfrac{1}{p_i}), $$ that is, Shannon entropy of the original probability distribution. However, if for probability distribution $P$ you use encoding which is optimal for a different probability distribution $Q$, then the average length of the encoded message is $$ \sum_i p_i \text{code_length($i$)} = \sum_i p_i \log_2(\tfrac{1}{q_i}), $$ is cross entropy, which is greater than $\sum_i p_i \log_2(\tfrac{1}{p_i})$. As an example, consider alphabet of four letters (A, B, C, D), but with A and B having the same frequency and C and D not appearing at all. So the probability is $P=(\tfrac{1}{2}, \tfrac{1}{2}, 0, 0)$. Then if we want to encode it optimally, we encode A as 0 and B as 1, so we get one bit of encoded message per one letter. (And it is exactly Shannon entropy of our probability distribution.) But if we have the same probability $P$, but we encode it according to distribution where all letters are equally probably $Q=(\tfrac{1}{4},\tfrac{1}{4},\tfrac{1}{4},\tfrac{1}{4})$, then we get two bits per letter (for example, we encode A as 00, B as 01, C as 10 and D as 11).
Qualitively what is Cross Entropy To encode an event occurring with probability $p$ you need at least $\log_2(1/p)$ bits (why? see my answer on "What is the role of the logarithm in Shannon's entropy?"). So in optimal encoding the ave
15,507
Conditional expectation of exponential random variable
$\ldots$ by the memoryless property the distribution of $X|X > x$ is the same as that of $X$ but shifted to the right by $x$. Let $f_X(t)$ denote the probability density function (pdf) of $X$. Then, the mathematical formulation for what you correctly state $-$ namely, the conditional pdf of $X$ given that $\{X > x\}$ is the same as that of $X$ but shifted to the right by $x$ $-$ is that $f_{X \mid X > x}(t) = f_X(t-x)$. Hence, $E[X\mid X > x]$, the expected value of $X$ given that $\{X > x\}$ is $$\begin{align} E[X\mid X > x] &= \int_{-\infty}^\infty t f_{X \mid X > x}(t)\,\mathrm dt\\ &= \int_{-\infty}^\infty t f_X(t-x)\,\mathrm dt\\ &= \int_{-\infty}^\infty (x+u) f_X(u)\,\mathrm du &\scriptstyle{\text{on substituting}~u = t-x}\\ &= x + E[X]. \end{align}$$ Note that we have not explicitly used the density of $X$ in the calculation, and don't even need to integrate explicitly if we simply remember that (i) the area under a pdf is $1$ and (ii) the definition of expected value of a continuous random variable in terms of its pdf.
Conditional expectation of exponential random variable
$\ldots$ by the memoryless property the distribution of $X|X > x$ is the same as that of $X$ but shifted to the right by $x$. Let $f_X(t)$ denote the probability density function (pdf) of $X$. Then,
Conditional expectation of exponential random variable $\ldots$ by the memoryless property the distribution of $X|X > x$ is the same as that of $X$ but shifted to the right by $x$. Let $f_X(t)$ denote the probability density function (pdf) of $X$. Then, the mathematical formulation for what you correctly state $-$ namely, the conditional pdf of $X$ given that $\{X > x\}$ is the same as that of $X$ but shifted to the right by $x$ $-$ is that $f_{X \mid X > x}(t) = f_X(t-x)$. Hence, $E[X\mid X > x]$, the expected value of $X$ given that $\{X > x\}$ is $$\begin{align} E[X\mid X > x] &= \int_{-\infty}^\infty t f_{X \mid X > x}(t)\,\mathrm dt\\ &= \int_{-\infty}^\infty t f_X(t-x)\,\mathrm dt\\ &= \int_{-\infty}^\infty (x+u) f_X(u)\,\mathrm du &\scriptstyle{\text{on substituting}~u = t-x}\\ &= x + E[X]. \end{align}$$ Note that we have not explicitly used the density of $X$ in the calculation, and don't even need to integrate explicitly if we simply remember that (i) the area under a pdf is $1$ and (ii) the definition of expected value of a continuous random variable in terms of its pdf.
Conditional expectation of exponential random variable $\ldots$ by the memoryless property the distribution of $X|X > x$ is the same as that of $X$ but shifted to the right by $x$. Let $f_X(t)$ denote the probability density function (pdf) of $X$. Then,
15,508
Conditional expectation of exponential random variable
For $x>0$, the event $\{X>x\}$ has probability $P\{X>x\}=1-F_X(x)=e^{-\lambda x} > 0$. Hence, $$ \newcommand{\E}{\mathbb{E}} \E[X\mid X> x] = \frac{\E[X\,I_{\{X>x\}}]}{P\{X>x\}} \, , $$ but $$ \E[X\,I_{\{X>x\}}] = \int_x^\infty t\,\lambda\,e^{-\lambda t}\,dt = (*) $$ (using Feynman's trick, vindicated by the Dominated Convergence Theorem, because it is fun) $$ (*) = -\lambda \int_x^\infty \frac{d}{d\lambda}(e^{-\lambda t}) \,dt = -\lambda \frac{d}{d\lambda} \int_x^\infty e^{-\lambda t} \,dt $$ $$ = -\lambda \frac{d}{d\lambda} \left(\frac{1}{\lambda} \int_x^\infty \lambda\,e^{-\lambda t} \,dt\right) = -\lambda\frac{d}{d\lambda}\left(\frac{1}{\lambda}\left(1 - F_X(x)\right)\right) $$ $$ = -\lambda\frac{d}{d\lambda}\left(\frac{e^{-\lambda x}}{\lambda}\right) = \left(\frac{1}{\lambda}+x\right)e^{-\lambda x} \, , $$ which gives the desired result $$ \E[X\mid X>x] = \frac{1}{\lambda}+x = \E[X] + x \, . $$
Conditional expectation of exponential random variable
For $x>0$, the event $\{X>x\}$ has probability $P\{X>x\}=1-F_X(x)=e^{-\lambda x} > 0$. Hence, $$ \newcommand{\E}{\mathbb{E}} \E[X\mid X> x] = \frac{\E[X\,I_{\{X>x\}}]}{P\{X>x\}} \, , $$ but $$ \E[
Conditional expectation of exponential random variable For $x>0$, the event $\{X>x\}$ has probability $P\{X>x\}=1-F_X(x)=e^{-\lambda x} > 0$. Hence, $$ \newcommand{\E}{\mathbb{E}} \E[X\mid X> x] = \frac{\E[X\,I_{\{X>x\}}]}{P\{X>x\}} \, , $$ but $$ \E[X\,I_{\{X>x\}}] = \int_x^\infty t\,\lambda\,e^{-\lambda t}\,dt = (*) $$ (using Feynman's trick, vindicated by the Dominated Convergence Theorem, because it is fun) $$ (*) = -\lambda \int_x^\infty \frac{d}{d\lambda}(e^{-\lambda t}) \,dt = -\lambda \frac{d}{d\lambda} \int_x^\infty e^{-\lambda t} \,dt $$ $$ = -\lambda \frac{d}{d\lambda} \left(\frac{1}{\lambda} \int_x^\infty \lambda\,e^{-\lambda t} \,dt\right) = -\lambda\frac{d}{d\lambda}\left(\frac{1}{\lambda}\left(1 - F_X(x)\right)\right) $$ $$ = -\lambda\frac{d}{d\lambda}\left(\frac{e^{-\lambda x}}{\lambda}\right) = \left(\frac{1}{\lambda}+x\right)e^{-\lambda x} \, , $$ which gives the desired result $$ \E[X\mid X>x] = \frac{1}{\lambda}+x = \E[X] + x \, . $$
Conditional expectation of exponential random variable For $x>0$, the event $\{X>x\}$ has probability $P\{X>x\}=1-F_X(x)=e^{-\lambda x} > 0$. Hence, $$ \newcommand{\E}{\mathbb{E}} \E[X\mid X> x] = \frac{\E[X\,I_{\{X>x\}}]}{P\{X>x\}} \, , $$ but $$ \E[
15,509
Grid search on k-fold cross validation
Yes, this would be a violation as the test data for folds 2-10 of the outer cross-validation would have been part of the training data for fold 1 which were used to determine the values of the kernel and regularisation parameters. This means that some information about the test data has potentially leaked into the design of the model, which potentially gives an optimistic bias to the performance evaluation, that is most optimistic for models that are very sensitive to the setting of the hyper-parameters (i.e. it most stongly favours models with an undesirable feature). This bias is likely to be strongest for small datasets, such as this one, as the variance of the model selection criterion is largest for small datasets, which encourages over-fitting the model selection criterion, which means more information about the test data can leak through. I wrote a paper on this a year or two ago as I was rather startled by the magnitude of the bias deviations from full nested cross-validation can introduce, which can easily swamp the difference in performance between classifier systems. The paper is "On Over-fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation" Gavin C. Cawley, Nicola L. C. Talbot; JMLR 11(Jul):2079−2107, 2010. Essentially tuning the hyper-parameters should be considered an integral part of fitting the model, so each time you train the SVM on a new sample of data, independently retune the hyper-parameters for that sample. If you follow that rule, you probably can't go too far wrong. It is well worth the computational expense to get an unbiased performance estimate, as otherwise you run the risk of drawing the wrong conclusions from your experiment.
Grid search on k-fold cross validation
Yes, this would be a violation as the test data for folds 2-10 of the outer cross-validation would have been part of the training data for fold 1 which were used to determine the values of the kernel
Grid search on k-fold cross validation Yes, this would be a violation as the test data for folds 2-10 of the outer cross-validation would have been part of the training data for fold 1 which were used to determine the values of the kernel and regularisation parameters. This means that some information about the test data has potentially leaked into the design of the model, which potentially gives an optimistic bias to the performance evaluation, that is most optimistic for models that are very sensitive to the setting of the hyper-parameters (i.e. it most stongly favours models with an undesirable feature). This bias is likely to be strongest for small datasets, such as this one, as the variance of the model selection criterion is largest for small datasets, which encourages over-fitting the model selection criterion, which means more information about the test data can leak through. I wrote a paper on this a year or two ago as I was rather startled by the magnitude of the bias deviations from full nested cross-validation can introduce, which can easily swamp the difference in performance between classifier systems. The paper is "On Over-fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation" Gavin C. Cawley, Nicola L. C. Talbot; JMLR 11(Jul):2079−2107, 2010. Essentially tuning the hyper-parameters should be considered an integral part of fitting the model, so each time you train the SVM on a new sample of data, independently retune the hyper-parameters for that sample. If you follow that rule, you probably can't go too far wrong. It is well worth the computational expense to get an unbiased performance estimate, as otherwise you run the risk of drawing the wrong conclusions from your experiment.
Grid search on k-fold cross validation Yes, this would be a violation as the test data for folds 2-10 of the outer cross-validation would have been part of the training data for fold 1 which were used to determine the values of the kernel
15,510
Grid search on k-fold cross validation
After doing the grid search for each surrogate model, you can and should check a few things: variation of the optimized parameters (here $\gamma$ and $C$). Are the optimal parameters stable? If not, you're very likely in trouble. Compare the reported performance of the inner and outer cross validation. If the inner (i.e. tuning) cross validation looks much better than the outer (validation of the final model), then you're in trouble, too: you are overfitting. There is a substantial risk, that the tuned parameters are not optimal at all. However, if the outer cross validation is done properly (all test sets are truly independent of the respective surrogate models), then at least you still have an unbiased (!) estimate of the model's performance. But you cannot be sure that it is optimal. How pronounced is the optimum? Does the performance degrade quickly for suboptimal parameters? How good is the optimal performance? There's a whole lot to say about overfitting by model selection. However, it is good to keep in mind that both variance and optimistic bias can really hurt variance means that you may accidentally end up quite far away from the truly optimal hyper-parameters. but also bias can hurt: if you are overfitting, you can run into situations where many models look perfect to the inner cross validation (but they aren't really). In that case, the tuning can go astray because it doesn't recognize the differences between the models. If the bias depends on the hyper-parameters, you are in big trouble. If you are interested in an example and you can read German, I could put my Diplom thesis online. In my experience, tuning hyperparameters is an extremely effective idea for overfitting... Now, if you realize that you are overfitting, you have mainly two options: report that the optimization had a problem with overfitting but that you did a proper outer validation which resulted in ... (outer cross validation results). restrict the complexity of the model. One way of doing this is fixing hyper-parameters: As an alternative to tuning the hyper-parameters to each training set, you could pre-specify (hyper)parameters (i.e. fix them beforehand). I do that as much as possible for my models as I usually have even fewer cases than you have, see below. However, this fixing must really and honestly be done beforehand: e.g. I asked a colleague for his optimized parameters on a similar data set (independent experiment) or do a pre-experiment, including grid search on the parameters. That first experiment is then used to fix some experimental parameters as well as model parameters for the real experiment and data analysis. See below for further explanations. Of course it is possible to do proper testing on automatically optimized models (double or nested validation), but your sample size may not allow splitting the data twice. In that situation, it is IMHO much better to report an honest estimate for a model that was built using professional experience on how to choose modeling parameters than reporting an overoptimistic estimate on some kind of automatically optimized model. Another point of view on the situation is that you have to trade off worse performance due to setting aside yet another bunch of cases for parameter optimization (smaller training sample size => worse model, but "optimal" parameters) worse performance due to suboptimal parameter fixing by the expert (but on larger training data). Some similar thoughts on a similar question: https://stats.stackexchange.com/a/27761/4598 On the fixing of parameters and Dikran Marsupial's comments I'm using the term hyper-parameters as Dikran Marsupial uses it in his paper (link in his answer) I work with spectroscopic data. This is a kind of measurement where the data analysis and modelling often includes quite a bit of pre-processing. This can be seen as hyper-parameters (e.g. what order of polynomial should be used for the baseline? What measurement channels should be included?). There are other decisions that are closer to your svm parameters, e.g. how many principal components to use if a PCA is done for dimensionality reduction before the "real" model is trained? And sometimes I also use SVM classification, so I have to decide on SVM parameters. Now, IMHO the best way to fix hyper-parameters is if you have reasons that come from the application. E.g. I usually decide on what kind of baseline to use by physical/chemical/biological reasons (i.e. knowledge about the specimen and the spectroscopic behaviour that follows from that). However, I'm not aware of such an argumentation which helps with SVM parameters... The case of pre-experiments I mentioned above looks as follows: we take data of a bunch of cells (want to distinguish different cell lines). Spectra are analysed, iterated double cross validation SVM is run (spent a night or two on the computation server). I observed that in the vast majoritiy of cases the same $\gamma$ and $C$ are selected as optimal. The remaining cases are a neighbour combination. This and other neighbour hyper-parameter combinations have very similar performance (one or two additional misclassifications) I also observe a certain overfitting: the outer cross validation isn't quite as good as the tuning results. That is as expected. Still, there are differences in performance over the tuning range of the hyper-parameters, and the performance over the tuning grid looks reasonably smooth. Good. My conclusion is: while I cannot be sure that the final hyper-parameters are optimal, the outer cross validation gives me a proper estimate of the performance of the surrogate models. During the experimental part, we decided on some changes in the experimental set-up (things that don't affect the signal to noise of the data, but that go one step further in automatization of the instrument) We improve the experimental settings and acquire new spectra. As cells are, they need to be grown freshly. I.e. the new data set are even independent culture batches. Now I face the decision: Should I "skip" the inner cross validation and just go with the hyper-parameters I determined with the old data? As mentioned above, I run the risk that these pre-determined hyper-parameters are not optimal. But neither can I be sure to get truly optimal hyper-parameters by doing the inner (tuning) cross validation. However, the tuning on the old data was stable. Doing the optimization I'll train on less samples: As I have anyways Too Few Samples(TM) I have to expect to obtain worse models if I set more samples aside for a second round of cross validation. So in that case, I decided to go with fixed parameters (by experience on similar data and knowing that in the future we'll have to do our "homework" including among other things re-checking these decisions with large data). Note that the important thing is that I skip the inner (tuning cross validation), not the outer one. With fixed hyper-parameters I get an unbiased estimate of the performance of a possibly suboptimal model. It is true that this estimate is subject to high variance, but this variance is basically the same whether I do the inner tuning or not. Skipping the outer cross vaidation I'd get an optimistically biased estimate of a tuned model - which depending on the application and data can be worthless (if very much overoptimistic) and optimistic bias may be plainly inacceptable.
Grid search on k-fold cross validation
After doing the grid search for each surrogate model, you can and should check a few things: variation of the optimized parameters (here $\gamma$ and $C$). Are the optimal parameters stable? If not,
Grid search on k-fold cross validation After doing the grid search for each surrogate model, you can and should check a few things: variation of the optimized parameters (here $\gamma$ and $C$). Are the optimal parameters stable? If not, you're very likely in trouble. Compare the reported performance of the inner and outer cross validation. If the inner (i.e. tuning) cross validation looks much better than the outer (validation of the final model), then you're in trouble, too: you are overfitting. There is a substantial risk, that the tuned parameters are not optimal at all. However, if the outer cross validation is done properly (all test sets are truly independent of the respective surrogate models), then at least you still have an unbiased (!) estimate of the model's performance. But you cannot be sure that it is optimal. How pronounced is the optimum? Does the performance degrade quickly for suboptimal parameters? How good is the optimal performance? There's a whole lot to say about overfitting by model selection. However, it is good to keep in mind that both variance and optimistic bias can really hurt variance means that you may accidentally end up quite far away from the truly optimal hyper-parameters. but also bias can hurt: if you are overfitting, you can run into situations where many models look perfect to the inner cross validation (but they aren't really). In that case, the tuning can go astray because it doesn't recognize the differences between the models. If the bias depends on the hyper-parameters, you are in big trouble. If you are interested in an example and you can read German, I could put my Diplom thesis online. In my experience, tuning hyperparameters is an extremely effective idea for overfitting... Now, if you realize that you are overfitting, you have mainly two options: report that the optimization had a problem with overfitting but that you did a proper outer validation which resulted in ... (outer cross validation results). restrict the complexity of the model. One way of doing this is fixing hyper-parameters: As an alternative to tuning the hyper-parameters to each training set, you could pre-specify (hyper)parameters (i.e. fix them beforehand). I do that as much as possible for my models as I usually have even fewer cases than you have, see below. However, this fixing must really and honestly be done beforehand: e.g. I asked a colleague for his optimized parameters on a similar data set (independent experiment) or do a pre-experiment, including grid search on the parameters. That first experiment is then used to fix some experimental parameters as well as model parameters for the real experiment and data analysis. See below for further explanations. Of course it is possible to do proper testing on automatically optimized models (double or nested validation), but your sample size may not allow splitting the data twice. In that situation, it is IMHO much better to report an honest estimate for a model that was built using professional experience on how to choose modeling parameters than reporting an overoptimistic estimate on some kind of automatically optimized model. Another point of view on the situation is that you have to trade off worse performance due to setting aside yet another bunch of cases for parameter optimization (smaller training sample size => worse model, but "optimal" parameters) worse performance due to suboptimal parameter fixing by the expert (but on larger training data). Some similar thoughts on a similar question: https://stats.stackexchange.com/a/27761/4598 On the fixing of parameters and Dikran Marsupial's comments I'm using the term hyper-parameters as Dikran Marsupial uses it in his paper (link in his answer) I work with spectroscopic data. This is a kind of measurement where the data analysis and modelling often includes quite a bit of pre-processing. This can be seen as hyper-parameters (e.g. what order of polynomial should be used for the baseline? What measurement channels should be included?). There are other decisions that are closer to your svm parameters, e.g. how many principal components to use if a PCA is done for dimensionality reduction before the "real" model is trained? And sometimes I also use SVM classification, so I have to decide on SVM parameters. Now, IMHO the best way to fix hyper-parameters is if you have reasons that come from the application. E.g. I usually decide on what kind of baseline to use by physical/chemical/biological reasons (i.e. knowledge about the specimen and the spectroscopic behaviour that follows from that). However, I'm not aware of such an argumentation which helps with SVM parameters... The case of pre-experiments I mentioned above looks as follows: we take data of a bunch of cells (want to distinguish different cell lines). Spectra are analysed, iterated double cross validation SVM is run (spent a night or two on the computation server). I observed that in the vast majoritiy of cases the same $\gamma$ and $C$ are selected as optimal. The remaining cases are a neighbour combination. This and other neighbour hyper-parameter combinations have very similar performance (one or two additional misclassifications) I also observe a certain overfitting: the outer cross validation isn't quite as good as the tuning results. That is as expected. Still, there are differences in performance over the tuning range of the hyper-parameters, and the performance over the tuning grid looks reasonably smooth. Good. My conclusion is: while I cannot be sure that the final hyper-parameters are optimal, the outer cross validation gives me a proper estimate of the performance of the surrogate models. During the experimental part, we decided on some changes in the experimental set-up (things that don't affect the signal to noise of the data, but that go one step further in automatization of the instrument) We improve the experimental settings and acquire new spectra. As cells are, they need to be grown freshly. I.e. the new data set are even independent culture batches. Now I face the decision: Should I "skip" the inner cross validation and just go with the hyper-parameters I determined with the old data? As mentioned above, I run the risk that these pre-determined hyper-parameters are not optimal. But neither can I be sure to get truly optimal hyper-parameters by doing the inner (tuning) cross validation. However, the tuning on the old data was stable. Doing the optimization I'll train on less samples: As I have anyways Too Few Samples(TM) I have to expect to obtain worse models if I set more samples aside for a second round of cross validation. So in that case, I decided to go with fixed parameters (by experience on similar data and knowing that in the future we'll have to do our "homework" including among other things re-checking these decisions with large data). Note that the important thing is that I skip the inner (tuning cross validation), not the outer one. With fixed hyper-parameters I get an unbiased estimate of the performance of a possibly suboptimal model. It is true that this estimate is subject to high variance, but this variance is basically the same whether I do the inner tuning or not. Skipping the outer cross vaidation I'd get an optimistically biased estimate of a tuned model - which depending on the application and data can be worthless (if very much overoptimistic) and optimistic bias may be plainly inacceptable.
Grid search on k-fold cross validation After doing the grid search for each surrogate model, you can and should check a few things: variation of the optimized parameters (here $\gamma$ and $C$). Are the optimal parameters stable? If not,
15,511
Grid search on k-fold cross validation
You should fix $\gamma$ and $C$ initially. Then do $k$-fold cross validation to get a single test error estimate, $terr(\gamma,C)$. Then do a two-dimensional grid search, varying $\gamma$ and $C$ separately to generate a test error matrix. To speed things up people typically use a logarithmic grid, $\gamma,C \in \{ 2^{-n_l}, 2^{-n_l+1}, \dots, 2^{n_u}\}$ (usually $\gamma$ is on a smaller scale). The key I think is to look for some smoothness in the surface around the local minimums (or each 1-dim projection) and not just take the global minimum. Remember for Gaussian kernel SVMs $\gamma$ is like $(p\sigma)^{-1}$ parameter for Multivariate Normal data with $p$ independent components. So if you have an understanding of the variability of predictor distances it can help determine a grid for $\gamma$, especially if feature correlation is not too strong. $C$ is how much slack you get if there is no perfect separating plane so the weaker the relationship between the predictors and class labels the smaller in theory $C$ should be (less penalization for missclassification).
Grid search on k-fold cross validation
You should fix $\gamma$ and $C$ initially. Then do $k$-fold cross validation to get a single test error estimate, $terr(\gamma,C)$. Then do a two-dimensional grid search, varying $\gamma$ and $C$ sepa
Grid search on k-fold cross validation You should fix $\gamma$ and $C$ initially. Then do $k$-fold cross validation to get a single test error estimate, $terr(\gamma,C)$. Then do a two-dimensional grid search, varying $\gamma$ and $C$ separately to generate a test error matrix. To speed things up people typically use a logarithmic grid, $\gamma,C \in \{ 2^{-n_l}, 2^{-n_l+1}, \dots, 2^{n_u}\}$ (usually $\gamma$ is on a smaller scale). The key I think is to look for some smoothness in the surface around the local minimums (or each 1-dim projection) and not just take the global minimum. Remember for Gaussian kernel SVMs $\gamma$ is like $(p\sigma)^{-1}$ parameter for Multivariate Normal data with $p$ independent components. So if you have an understanding of the variability of predictor distances it can help determine a grid for $\gamma$, especially if feature correlation is not too strong. $C$ is how much slack you get if there is no perfect separating plane so the weaker the relationship between the predictors and class labels the smaller in theory $C$ should be (less penalization for missclassification).
Grid search on k-fold cross validation You should fix $\gamma$ and $C$ initially. Then do $k$-fold cross validation to get a single test error estimate, $terr(\gamma,C)$. Then do a two-dimensional grid search, varying $\gamma$ and $C$ sepa
15,512
What is the procedure for "bootstrap validation" (a.k.a. "resampling cross-validation")?
Short answer: Both validation techniques involve training and testing a number of models. Long answer about how to do it best: That of course depends. But here a some thoughts that I use to guide my decisions about resampling validation. I'm chemometrician, so these strategies and also the terms are more or less closely related to analytical-chemical problems. To explain my thoughts a bit, I think of validation as measuring model quality, and of training as measuring model parameters - this leads to quite powerful analogy to every other kind of measurement. There are two different points of view to these approaches with respect to validation: a traditional point of view for resampling validation is: the resampled data set (sometimes called surrogate data set or subset) is practically the same as the original (real) data set. Therefore, a "surrogate model" fit to the surrogate data set is practically the same as the model fit with the whole real data set. But some samples are left out of the surrogate data set, the model is independent of these. Thus, I take those left out or out-of-bootstrap samples as independent validation set for the surrogate model and use the result as approximation of the whole-data-model. However, the surrogate model often is not really equivalent with the whole-data-model: less samples were used for training (even for the bootstrap, the number of different samples is less). As long as the learning curve is increasing, the surrogate model is on average a bit worse than the whole-data-model. This is the well-known pessimistic bias of resampling validation (if you end up with an optimistic bias, that is usually an indicator that the left-out/oob test set was not independent of the model). The second point of view is that the resampled data set is a perturbed version of the whole data set. Examining how the surrogate models (or their predictions for the left-out/oob samples) differ from the whole-data-model then tells something about model stability with respect to the training data. From this perspective, the surrogate models are something like repeated measurements. Say your task is to measure the content of some mineral of a whole train of ore. The ore is not homogeneous. So you take physical samples from different locations and then look at the overall content and its variation across the train. Similarly, if you think you model may not be stable, you can look at the overall performance and variation of the surrogate models. If you take that thought further, your approach (1) tells something about how much predictions of the same model vary for different samples of size $n$. Your approach (2) is closer to the usual approaches. But as Momo already wrote, validation usually wants to measure the performance for unknown cases. Thus you need to take care the testing is not done with cases that are already known to the model. In other words, only the left-out cases are tested. That is repeated many times (each model leaves out a different set of cases) in order to (a) measure and (b) average out as good as possible the variations due the finite (small) sample sizes (for both testing and training). I usually resample cases, e.g. one case = all measurements of one patient. Then the out-of-bag are all patients of which no measurements occur in the training data. This is useful if you know that measurements of one case are more similar to each other than to measurements of other cases (or at least you cannot exclude this possibility). Not that resampling validation allows you to measure performance for unknown samples. If in addition you want to measure the performance for unknown future samples (instrumental drift!), then you need a test set that is measured "in the future" i.e. a certain time after all training samples were measured. In analytical chemistry, this is needed e.g. if you want to find out how often you need to redo the calibration of your instrument (for each determination, daily, weekly, monthly, ...) Bootstrap vs. cross validation terminology: resampling with replacement is often called bootstrap, resampling without replacement cross-validation. Both can have some kind of stratification. Historically, the splitting for cross validation (at least in chemometrics) has often been done in a non-random fashion, e.g. a 3-fold cross validation of the form abcabc..abc (data set sorted wrt. the outcome) for calibration/regression if you have very few cases (physical samples), and you want to make sure that your whole data range is covered. Both techniques are usually repeated/iterated a number of times. Again for historical reasons and at least in chemometrics, k-fold cross validation often means training and testing k models (each tested with the 1/kth of the data that was not involved in training). If such a random splitting is repeated, people call it iterated or repeated cross validation. Also, the number of unique samples can (approximately) be chosen: for cross-validation via the $k$ of $k$-fold or the $n$ of leave-$n$-out cross validation. For bootstrap, you can draw more or less than $n$ samples into the subsample (this is rarely done). Note that the bootstrap is not appropriate for some model fitting techniques that first remove duplicate measurements. Some variants of the bootstrap exist, e.g. .632-bootstrap and .632+-bootstrap Bootstrap resampling is said to be better (faster convergence, less iterations needed) than iterated $k$-fold cross validation. In a study for the kind of data I deal with, however, we found little overall difference: out-of-bootstrap had less variance but more bias than iterated $k$-fold cross validation.
What is the procedure for "bootstrap validation" (a.k.a. "resampling cross-validation")?
Short answer: Both validation techniques involve training and testing a number of models. Long answer about how to do it best: That of course depends. But here a some thoughts that I use to guide my
What is the procedure for "bootstrap validation" (a.k.a. "resampling cross-validation")? Short answer: Both validation techniques involve training and testing a number of models. Long answer about how to do it best: That of course depends. But here a some thoughts that I use to guide my decisions about resampling validation. I'm chemometrician, so these strategies and also the terms are more or less closely related to analytical-chemical problems. To explain my thoughts a bit, I think of validation as measuring model quality, and of training as measuring model parameters - this leads to quite powerful analogy to every other kind of measurement. There are two different points of view to these approaches with respect to validation: a traditional point of view for resampling validation is: the resampled data set (sometimes called surrogate data set or subset) is practically the same as the original (real) data set. Therefore, a "surrogate model" fit to the surrogate data set is practically the same as the model fit with the whole real data set. But some samples are left out of the surrogate data set, the model is independent of these. Thus, I take those left out or out-of-bootstrap samples as independent validation set for the surrogate model and use the result as approximation of the whole-data-model. However, the surrogate model often is not really equivalent with the whole-data-model: less samples were used for training (even for the bootstrap, the number of different samples is less). As long as the learning curve is increasing, the surrogate model is on average a bit worse than the whole-data-model. This is the well-known pessimistic bias of resampling validation (if you end up with an optimistic bias, that is usually an indicator that the left-out/oob test set was not independent of the model). The second point of view is that the resampled data set is a perturbed version of the whole data set. Examining how the surrogate models (or their predictions for the left-out/oob samples) differ from the whole-data-model then tells something about model stability with respect to the training data. From this perspective, the surrogate models are something like repeated measurements. Say your task is to measure the content of some mineral of a whole train of ore. The ore is not homogeneous. So you take physical samples from different locations and then look at the overall content and its variation across the train. Similarly, if you think you model may not be stable, you can look at the overall performance and variation of the surrogate models. If you take that thought further, your approach (1) tells something about how much predictions of the same model vary for different samples of size $n$. Your approach (2) is closer to the usual approaches. But as Momo already wrote, validation usually wants to measure the performance for unknown cases. Thus you need to take care the testing is not done with cases that are already known to the model. In other words, only the left-out cases are tested. That is repeated many times (each model leaves out a different set of cases) in order to (a) measure and (b) average out as good as possible the variations due the finite (small) sample sizes (for both testing and training). I usually resample cases, e.g. one case = all measurements of one patient. Then the out-of-bag are all patients of which no measurements occur in the training data. This is useful if you know that measurements of one case are more similar to each other than to measurements of other cases (or at least you cannot exclude this possibility). Not that resampling validation allows you to measure performance for unknown samples. If in addition you want to measure the performance for unknown future samples (instrumental drift!), then you need a test set that is measured "in the future" i.e. a certain time after all training samples were measured. In analytical chemistry, this is needed e.g. if you want to find out how often you need to redo the calibration of your instrument (for each determination, daily, weekly, monthly, ...) Bootstrap vs. cross validation terminology: resampling with replacement is often called bootstrap, resampling without replacement cross-validation. Both can have some kind of stratification. Historically, the splitting for cross validation (at least in chemometrics) has often been done in a non-random fashion, e.g. a 3-fold cross validation of the form abcabc..abc (data set sorted wrt. the outcome) for calibration/regression if you have very few cases (physical samples), and you want to make sure that your whole data range is covered. Both techniques are usually repeated/iterated a number of times. Again for historical reasons and at least in chemometrics, k-fold cross validation often means training and testing k models (each tested with the 1/kth of the data that was not involved in training). If such a random splitting is repeated, people call it iterated or repeated cross validation. Also, the number of unique samples can (approximately) be chosen: for cross-validation via the $k$ of $k$-fold or the $n$ of leave-$n$-out cross validation. For bootstrap, you can draw more or less than $n$ samples into the subsample (this is rarely done). Note that the bootstrap is not appropriate for some model fitting techniques that first remove duplicate measurements. Some variants of the bootstrap exist, e.g. .632-bootstrap and .632+-bootstrap Bootstrap resampling is said to be better (faster convergence, less iterations needed) than iterated $k$-fold cross validation. In a study for the kind of data I deal with, however, we found little overall difference: out-of-bootstrap had less variance but more bias than iterated $k$-fold cross validation.
What is the procedure for "bootstrap validation" (a.k.a. "resampling cross-validation")? Short answer: Both validation techniques involve training and testing a number of models. Long answer about how to do it best: That of course depends. But here a some thoughts that I use to guide my
15,513
What is the procedure for "bootstrap validation" (a.k.a. "resampling cross-validation")?
I don't know about "best" (which probably depends on what you use it for), but I use bootstrap validation to estimate error on new data the following way ( third way if you like): Draw a training set of N observations from the original data (of size N) with replacement. Fit the model to the training data. Evaluate the model on the out-of-bag (oob) samples What is out of bag is not always clearly defined. Often it is all those observations that weren't part of the training set. More stricter would it be (I use it this way) to only have observations in the oob sample that have a realisation of the whole predictor vector that is not part of the training set (which is especially useful if you have many factors). Even stricter is to use an oob sample that contains only those observations who have a different realisation of the predictor variable on the predictors chosen in the model (especially useful if the model is found with some variable selection procedure, e.g. trees). Then I usually repeat this a number k of times and aggregate results over the k-folds (mean or median or whatever statistic is handy). The model chosen this way can then be fitted to the overall data set (as in your option 2) to additionally gauge if there still is a tendency to overfit (the performance measure should be not too far off from the bootstrap samples). If I have more models or a parameter grid or similar, I fit them all to each training set and evaluate them all on each oob sample. It is also possible to not use a training set twice, but for every model or tuning parameter combination to draw a new training/oob pair. See e.g. The Design and Analysis of Benchmarking Experiments.
What is the procedure for "bootstrap validation" (a.k.a. "resampling cross-validation")?
I don't know about "best" (which probably depends on what you use it for), but I use bootstrap validation to estimate error on new data the following way ( third way if you like): Draw a training set
What is the procedure for "bootstrap validation" (a.k.a. "resampling cross-validation")? I don't know about "best" (which probably depends on what you use it for), but I use bootstrap validation to estimate error on new data the following way ( third way if you like): Draw a training set of N observations from the original data (of size N) with replacement. Fit the model to the training data. Evaluate the model on the out-of-bag (oob) samples What is out of bag is not always clearly defined. Often it is all those observations that weren't part of the training set. More stricter would it be (I use it this way) to only have observations in the oob sample that have a realisation of the whole predictor vector that is not part of the training set (which is especially useful if you have many factors). Even stricter is to use an oob sample that contains only those observations who have a different realisation of the predictor variable on the predictors chosen in the model (especially useful if the model is found with some variable selection procedure, e.g. trees). Then I usually repeat this a number k of times and aggregate results over the k-folds (mean or median or whatever statistic is handy). The model chosen this way can then be fitted to the overall data set (as in your option 2) to additionally gauge if there still is a tendency to overfit (the performance measure should be not too far off from the bootstrap samples). If I have more models or a parameter grid or similar, I fit them all to each training set and evaluate them all on each oob sample. It is also possible to not use a training set twice, but for every model or tuning parameter combination to draw a new training/oob pair. See e.g. The Design and Analysis of Benchmarking Experiments.
What is the procedure for "bootstrap validation" (a.k.a. "resampling cross-validation")? I don't know about "best" (which probably depends on what you use it for), but I use bootstrap validation to estimate error on new data the following way ( third way if you like): Draw a training set
15,514
What distribution is most commonly used to model server response time?
The Log-Normal distribution is the one I find best at describing latencies of server response times across all the user base over a period of time. You may see some examples at the aptly-named site lognormal.com whose in the business of measuring site latency distribution over time and more. I have no affiliation with the site except for being a happy user. Here's how the distribution looks like; response (e.g web page load) time vs number of responses: Note that in this chart, the load-time (X-axis) scale is linear. If you switch the x-axis to a log-scale, the shape of the distribution would look more normal (bell-shaped) on the right side of the peak.
What distribution is most commonly used to model server response time?
The Log-Normal distribution is the one I find best at describing latencies of server response times across all the user base over a period of time. You may see some examples at the aptly-named site lo
What distribution is most commonly used to model server response time? The Log-Normal distribution is the one I find best at describing latencies of server response times across all the user base over a period of time. You may see some examples at the aptly-named site lognormal.com whose in the business of measuring site latency distribution over time and more. I have no affiliation with the site except for being a happy user. Here's how the distribution looks like; response (e.g web page load) time vs number of responses: Note that in this chart, the load-time (X-axis) scale is linear. If you switch the x-axis to a log-scale, the shape of the distribution would look more normal (bell-shaped) on the right side of the peak.
What distribution is most commonly used to model server response time? The Log-Normal distribution is the one I find best at describing latencies of server response times across all the user base over a period of time. You may see some examples at the aptly-named site lo
15,515
What distribution is most commonly used to model server response time?
My research shows the best model is determined by a few things: 1) Are you concerned with the body, the tail, or both? If not "both", modeling a filtered dataset can be more useful. 2) Do you want a very simple or a very accurate one? i.e. how many parameters? If the answer to 1 was "both" and 2 was "simple", Pareto seems to work best. Otherwise, if 1 was "body" and 2 was "simple" - choose a filtered erlang model. If 1 was "both" and 2 was "accurate", you probably want a gaussian mixture model on your data in the log domain - effectively a lognormal fit. I've been researching this lately, and I didn't find the topic to be covered well enough on the public internet, so I just wrote a blog post detailing my research into this topic.
What distribution is most commonly used to model server response time?
My research shows the best model is determined by a few things: 1) Are you concerned with the body, the tail, or both? If not "both", modeling a filtered dataset can be more useful. 2) Do you want a v
What distribution is most commonly used to model server response time? My research shows the best model is determined by a few things: 1) Are you concerned with the body, the tail, or both? If not "both", modeling a filtered dataset can be more useful. 2) Do you want a very simple or a very accurate one? i.e. how many parameters? If the answer to 1 was "both" and 2 was "simple", Pareto seems to work best. Otherwise, if 1 was "body" and 2 was "simple" - choose a filtered erlang model. If 1 was "both" and 2 was "accurate", you probably want a gaussian mixture model on your data in the log domain - effectively a lognormal fit. I've been researching this lately, and I didn't find the topic to be covered well enough on the public internet, so I just wrote a blog post detailing my research into this topic.
What distribution is most commonly used to model server response time? My research shows the best model is determined by a few things: 1) Are you concerned with the body, the tail, or both? If not "both", modeling a filtered dataset can be more useful. 2) Do you want a v
15,516
Properties of logistic regressions
The behavior you are observing is the "typical" case in logistic regression, but is not always true. It also holds in much more generality (see below). It is the consequence of the confluence of three separate facts. The choice of modeling the log-odds as a linear function of the predictors, The use of maximum likelihood to obtain estimates of the coefficients in the logistic regression model, and The inclusion of an intercept term in the model. If any one of the above are not present, then the average estimated probabilities will not, in general, match the proportion of ones in the sample. However, (nearly) all statistical software uses maximum-likelihood estimation for such models, so, in practice, items 1 and 2 are essentially always present, and item 3 is usually present, except in special cases. Some details In the typical logistic regression framework, we observe the outcome of independent binomial trials with probability $p_i$. Let $y_i$ be the observed responses. Then the total likelihood is $$ \mathcal L = \prod_{i=1}^n p_i^{y_i} (1-p_i)^{1 - y_i} = \prod_{i=1}^n \exp( y_i \log(p_i/(1-p_i)) + \log(1-p_i)) \>, $$ and so the log-likelihood is $$ \ell = \sum_{i=1}^n y_i \log(p_i / (1-p_i)) + \sum_{i=1}^n \log(1-p_i) \> . $$ Now, we have a vector of predictors $\newcommand{\x}{\mathbf x}\x_i$ for each observation and from Fact 1 above, the logistic regression model posits that $$ \log \frac{p_i}{1-p_i} = \beta^T \x_i \>, $$ for some unknown vector of parameters $\beta$. Note: By rearranging this, we get that $p_i = 1/(1+e^{-\beta^T \x_i})$. Using maximum likelihood to fit the model (Fact 2) yields a set of equations to solve from considering $\partial \ell / \partial \beta = 0$. Observe that $$ \frac{\partial \ell}{\partial \beta} = \sum_i y_i \x_i - \sum_i \frac{\x_i}{1+\exp(-\beta^T \x_i)} = \sum_i y_i \x_i - \sum_i p_i \x_i \>, $$ by using the assumed linear relationship between the log-odds and the predictors. This means, that the MLE satisfies $$ \sum_i y_i \x_i = \sum_i \hat{p}_i \x_i \>, $$ since MLEs are invariant under transformations, hence $\hat{p}_i = (1+\exp(-\hat{\beta}^T \x_i))^{-1}$ in this case. Using Fact 3, if $\x_i$ has a component $j$ that is always 1 for every $i$, then $\sum_i y_i x_{ij} = \sum_i y_i = \sum_i \hat{p}_i$ and so the empirical proportion of positive responses matches the average of the fitted probabilities. A simulation The inclusion of an intercept is important. Here is an example in $R$ to demonstrate that the observed behavior may not occur when no intercept is present in the model. x <- rnorm(100) p <- 1/(1+exp(-3*x)) y <- runif(100) <= p mean(y) # Should be identical to mean(y) mean( predict( glm(y~x, family="binomial"), type="response" ) ) # Won't be identical (usually) to mean(y) mean( predict( glm(y~x+0, family="binomial"), type="response") ) General case: As alluded to above, the property that the mean response is equal to the average predicted mean holds in much greater generality for the class of generalized linear models fit by maximum likelihood, using the canonical link function, and including an intercept in the model. References Some good references for the associated theory are the following. A. Agresti (2002), Categorical Data Analysis, 2nd ed., Wiley. P. McCullagh and J. A. Nelder (1989), Generalized Linear Models, 2nd ed., Chapman & Hall. (Text from original authors of the general methods.)
Properties of logistic regressions
The behavior you are observing is the "typical" case in logistic regression, but is not always true. It also holds in much more generality (see below). It is the consequence of the confluence of three
Properties of logistic regressions The behavior you are observing is the "typical" case in logistic regression, but is not always true. It also holds in much more generality (see below). It is the consequence of the confluence of three separate facts. The choice of modeling the log-odds as a linear function of the predictors, The use of maximum likelihood to obtain estimates of the coefficients in the logistic regression model, and The inclusion of an intercept term in the model. If any one of the above are not present, then the average estimated probabilities will not, in general, match the proportion of ones in the sample. However, (nearly) all statistical software uses maximum-likelihood estimation for such models, so, in practice, items 1 and 2 are essentially always present, and item 3 is usually present, except in special cases. Some details In the typical logistic regression framework, we observe the outcome of independent binomial trials with probability $p_i$. Let $y_i$ be the observed responses. Then the total likelihood is $$ \mathcal L = \prod_{i=1}^n p_i^{y_i} (1-p_i)^{1 - y_i} = \prod_{i=1}^n \exp( y_i \log(p_i/(1-p_i)) + \log(1-p_i)) \>, $$ and so the log-likelihood is $$ \ell = \sum_{i=1}^n y_i \log(p_i / (1-p_i)) + \sum_{i=1}^n \log(1-p_i) \> . $$ Now, we have a vector of predictors $\newcommand{\x}{\mathbf x}\x_i$ for each observation and from Fact 1 above, the logistic regression model posits that $$ \log \frac{p_i}{1-p_i} = \beta^T \x_i \>, $$ for some unknown vector of parameters $\beta$. Note: By rearranging this, we get that $p_i = 1/(1+e^{-\beta^T \x_i})$. Using maximum likelihood to fit the model (Fact 2) yields a set of equations to solve from considering $\partial \ell / \partial \beta = 0$. Observe that $$ \frac{\partial \ell}{\partial \beta} = \sum_i y_i \x_i - \sum_i \frac{\x_i}{1+\exp(-\beta^T \x_i)} = \sum_i y_i \x_i - \sum_i p_i \x_i \>, $$ by using the assumed linear relationship between the log-odds and the predictors. This means, that the MLE satisfies $$ \sum_i y_i \x_i = \sum_i \hat{p}_i \x_i \>, $$ since MLEs are invariant under transformations, hence $\hat{p}_i = (1+\exp(-\hat{\beta}^T \x_i))^{-1}$ in this case. Using Fact 3, if $\x_i$ has a component $j$ that is always 1 for every $i$, then $\sum_i y_i x_{ij} = \sum_i y_i = \sum_i \hat{p}_i$ and so the empirical proportion of positive responses matches the average of the fitted probabilities. A simulation The inclusion of an intercept is important. Here is an example in $R$ to demonstrate that the observed behavior may not occur when no intercept is present in the model. x <- rnorm(100) p <- 1/(1+exp(-3*x)) y <- runif(100) <= p mean(y) # Should be identical to mean(y) mean( predict( glm(y~x, family="binomial"), type="response" ) ) # Won't be identical (usually) to mean(y) mean( predict( glm(y~x+0, family="binomial"), type="response") ) General case: As alluded to above, the property that the mean response is equal to the average predicted mean holds in much greater generality for the class of generalized linear models fit by maximum likelihood, using the canonical link function, and including an intercept in the model. References Some good references for the associated theory are the following. A. Agresti (2002), Categorical Data Analysis, 2nd ed., Wiley. P. McCullagh and J. A. Nelder (1989), Generalized Linear Models, 2nd ed., Chapman & Hall. (Text from original authors of the general methods.)
Properties of logistic regressions The behavior you are observing is the "typical" case in logistic regression, but is not always true. It also holds in much more generality (see below). It is the consequence of the confluence of three
15,517
Robust outlier detection in financial timeseries
The problem is definitely hard. Mechanical rules like the +/- N1 times standard deviations, or +/ N2 times MAD, or +/- N3 IQR or ... will fail because there are always some series that are different as for example: fixings like interbank rate may be constant for some time and then jump all of a sudden similarly for e.g. certain foreign exchanges coming off a peg certain instrument are implicitly spreads; these may be near zero for periods and all of a sudden jump manifold Been there, done that, ... in a previous job. You could try to bracket each series using arbitrage relations ships (e.g. assuming USD/EUR and EUR/JPY are presumed good, you can work out bands around what USD/JPY should be; likewise for derivatives off an underlying etc pp. Commercial data vendors expand some effort on this, and those of use who are clients of theirs know ... it still does not exclude errors.
Robust outlier detection in financial timeseries
The problem is definitely hard. Mechanical rules like the +/- N1 times standard deviations, or +/ N2 times MAD, or +/- N3 IQR or ... will fail because there are always some series that are different
Robust outlier detection in financial timeseries The problem is definitely hard. Mechanical rules like the +/- N1 times standard deviations, or +/ N2 times MAD, or +/- N3 IQR or ... will fail because there are always some series that are different as for example: fixings like interbank rate may be constant for some time and then jump all of a sudden similarly for e.g. certain foreign exchanges coming off a peg certain instrument are implicitly spreads; these may be near zero for periods and all of a sudden jump manifold Been there, done that, ... in a previous job. You could try to bracket each series using arbitrage relations ships (e.g. assuming USD/EUR and EUR/JPY are presumed good, you can work out bands around what USD/JPY should be; likewise for derivatives off an underlying etc pp. Commercial data vendors expand some effort on this, and those of use who are clients of theirs know ... it still does not exclude errors.
Robust outlier detection in financial timeseries The problem is definitely hard. Mechanical rules like the +/- N1 times standard deviations, or +/ N2 times MAD, or +/- N3 IQR or ... will fail because there are always some series that are different
15,518
Robust outlier detection in financial timeseries
I'll add some paper references when I'm back at a computer, but here are some simple suggestions: Definitely start by working with returns. This is critical to deal with the irregular spacing where you can naturally get big price gaps (especially around weekends). Then you can apply a simple filter to remove returns well outside the norm (eg. vs a high number of standard deviations). The returns will adjust to the new absolute level so large real changes will result in the loss of only one tick. I suggest using a two-pass filter with returns taken from 1 step and n steps to deal with clusters of outliers. Edit 1: Regarding the usage of prices rather than returns: asset prices tend to not be stationary, so IMO that can pose some additional challenges. To account for the irregularity and power law effects, I would advise some kind of adjustment if you want to include them in your filter. You can scale the price changes by the time interval or by volatility. You can refer to the "realized volatility" literture for some discussion on this. Also discussed in Dacorogna et. al. To account for the changes in volatility, you might try basing your volatility calculation from the same time of the day over the past week (using the seasonality).
Robust outlier detection in financial timeseries
I'll add some paper references when I'm back at a computer, but here are some simple suggestions: Definitely start by working with returns. This is critical to deal with the irregular spacing where yo
Robust outlier detection in financial timeseries I'll add some paper references when I'm back at a computer, but here are some simple suggestions: Definitely start by working with returns. This is critical to deal with the irregular spacing where you can naturally get big price gaps (especially around weekends). Then you can apply a simple filter to remove returns well outside the norm (eg. vs a high number of standard deviations). The returns will adjust to the new absolute level so large real changes will result in the loss of only one tick. I suggest using a two-pass filter with returns taken from 1 step and n steps to deal with clusters of outliers. Edit 1: Regarding the usage of prices rather than returns: asset prices tend to not be stationary, so IMO that can pose some additional challenges. To account for the irregularity and power law effects, I would advise some kind of adjustment if you want to include them in your filter. You can scale the price changes by the time interval or by volatility. You can refer to the "realized volatility" literture for some discussion on this. Also discussed in Dacorogna et. al. To account for the changes in volatility, you might try basing your volatility calculation from the same time of the day over the past week (using the seasonality).
Robust outlier detection in financial timeseries I'll add some paper references when I'm back at a computer, but here are some simple suggestions: Definitely start by working with returns. This is critical to deal with the irregular spacing where yo
15,519
Robust outlier detection in financial timeseries
I have (with some delay) changed my answer to reflect your concern about the lack of 'adaptability' of the unconditional mad/median. You can address the problem of time varying volatility with the robust statistics framework. This is done by using a robust estimator of the conditional variance (instead of the robust estimator of the unconditional variance I was suggesting earlier): the M-estimation of the GARCH model. Then you will have a robust, time varying estimate of $(\hat{\mu}_t,\hat{\sigma}_t)$ which are not the same as those produced by the usual GARCH fit. In particular, they are not driven by a few far away outliers. Because these estimate are not driven by them, you can use them to reliably flag the outliers using the historical distribution of the $$\frac{x_t-\hat{\mu}_t}{\hat{\sigma}_t}$$ You can find more information (and a link to an R package) in this paper: Boudt, K. and Croux, C. (2010). Robust M-Estimation of Multivariate GARCH Models.
Robust outlier detection in financial timeseries
I have (with some delay) changed my answer to reflect your concern about the lack of 'adaptability' of the unconditional mad/median. You can address the problem of time varying volatility with the rob
Robust outlier detection in financial timeseries I have (with some delay) changed my answer to reflect your concern about the lack of 'adaptability' of the unconditional mad/median. You can address the problem of time varying volatility with the robust statistics framework. This is done by using a robust estimator of the conditional variance (instead of the robust estimator of the unconditional variance I was suggesting earlier): the M-estimation of the GARCH model. Then you will have a robust, time varying estimate of $(\hat{\mu}_t,\hat{\sigma}_t)$ which are not the same as those produced by the usual GARCH fit. In particular, they are not driven by a few far away outliers. Because these estimate are not driven by them, you can use them to reliably flag the outliers using the historical distribution of the $$\frac{x_t-\hat{\mu}_t}{\hat{\sigma}_t}$$ You can find more information (and a link to an R package) in this paper: Boudt, K. and Croux, C. (2010). Robust M-Estimation of Multivariate GARCH Models.
Robust outlier detection in financial timeseries I have (with some delay) changed my answer to reflect your concern about the lack of 'adaptability' of the unconditional mad/median. You can address the problem of time varying volatility with the rob
15,520
What is the role, if any, of the Central Limit Theorem in Bayesian Inference?
The Frequentist needs asymptotics because the things they are interested in, like intervals which cover the true value 95% of the time or tests which have a false positive rate of less than 5% when the null hypothesis is true, typically do not exist. If the model is linear and the errors Gaussian, we can get exact confidence intervals, but rarely otherwise. However, we can build intervals which cover the truth asymptotically in very broad classes of models by exploiting a quadratic approximation of the likelihood. The Bayesian does not have this problem. Given a prior and posterior, the 95% credible interval is a very well defined concept: any interval which contains 95% of the posterior mass. Likewise, Bayes factors can be defined in terms of posterior quantities. Life is easier in the linear/Gaussian case because these quantities will be available in closed form. But even in the general case, we can precisely define these quantities mathematically, and thus use the tools of numerical analysis to compute approximations. Most prominent would be Markov-chain Monte Carlo. The Bayesian, given infinite computing power, can thus get arbitrarily close to "correct" credible intervals/posterior means/etc for any sample size and any model. [Of course, if the prior is not good, these quantities are utterly meaningless. Even if it is, they do not have any guarantee of relating to anything in the "real world" like a frequentist interval does; they are simply the results of "thinking rationally".] You also ask about how Bayesians might avail themselves of the CLT. This comes in handy if the Bayesian doesn't have infinite computing power. MCMC is guaranteed to work eventually, but it might take too long on your computer. If the reason the posterior is expensive to evaluate is because you have a lot of data, we can deploy a normal approximation to the posterior. Various ways exist to choose the parameters of the approximating normal; perhaps the most popular is the Laplace Approximation, which uses a quadratic approximation of the posterior near its mode (this might remind you of frequentist asymptotics).
What is the role, if any, of the Central Limit Theorem in Bayesian Inference?
The Frequentist needs asymptotics because the things they are interested in, like intervals which cover the true value 95% of the time or tests which have a false positive rate of less than 5% when th
What is the role, if any, of the Central Limit Theorem in Bayesian Inference? The Frequentist needs asymptotics because the things they are interested in, like intervals which cover the true value 95% of the time or tests which have a false positive rate of less than 5% when the null hypothesis is true, typically do not exist. If the model is linear and the errors Gaussian, we can get exact confidence intervals, but rarely otherwise. However, we can build intervals which cover the truth asymptotically in very broad classes of models by exploiting a quadratic approximation of the likelihood. The Bayesian does not have this problem. Given a prior and posterior, the 95% credible interval is a very well defined concept: any interval which contains 95% of the posterior mass. Likewise, Bayes factors can be defined in terms of posterior quantities. Life is easier in the linear/Gaussian case because these quantities will be available in closed form. But even in the general case, we can precisely define these quantities mathematically, and thus use the tools of numerical analysis to compute approximations. Most prominent would be Markov-chain Monte Carlo. The Bayesian, given infinite computing power, can thus get arbitrarily close to "correct" credible intervals/posterior means/etc for any sample size and any model. [Of course, if the prior is not good, these quantities are utterly meaningless. Even if it is, they do not have any guarantee of relating to anything in the "real world" like a frequentist interval does; they are simply the results of "thinking rationally".] You also ask about how Bayesians might avail themselves of the CLT. This comes in handy if the Bayesian doesn't have infinite computing power. MCMC is guaranteed to work eventually, but it might take too long on your computer. If the reason the posterior is expensive to evaluate is because you have a lot of data, we can deploy a normal approximation to the posterior. Various ways exist to choose the parameters of the approximating normal; perhaps the most popular is the Laplace Approximation, which uses a quadratic approximation of the posterior near its mode (this might remind you of frequentist asymptotics).
What is the role, if any, of the Central Limit Theorem in Bayesian Inference? The Frequentist needs asymptotics because the things they are interested in, like intervals which cover the true value 95% of the time or tests which have a false positive rate of less than 5% when th
15,521
What is the role, if any, of the Central Limit Theorem in Bayesian Inference?
The limit theorem is 'central' The central limit theorem (CLT) has a central role in all of statistics. That is why it is called central! It is not specific to frequentist or Bayesian statistics. Note the early (and possibly first ever) use of the term 'central limit theorem' by George Pólya who used it in the article "Über den zentralen Grenzwertsatz der Wahrscheinlichkeitsrechnung und das Momentenproblem" Das Auftreten der Gaußschen Wahrscheinlichkeitsdichte $e^{-x^2}$ bei wiederholten Versuchen, bei Messungsfehlern, die aus der Zusammensetsung von sehr vielen und sehr kleinen Elementarfehlern resultieren, bei Diffusionafurgängen usw. ist bekanntlich aus einem und demselben Grenzwertsatz zu erklären, der in der Wahrscheinlichkeitsrechnung ein zentralen Rolle spielt. emphasis is mine. The principle behind the limit is applied whenever we use a normal distribution The CLT describes the tendency of sums of variables to approach a normal distribution and that is independent from how you would wish to analyse the variables, whether it is frequentist or Bayesian. Such sums occur anyware. It is arguable that whenever a normal distribution is used, then it is indirectly an application of the central limit theorem. A normal distribution does not occur as an atomic distribution. There is nothing inherently normal distributed and when a normal distribution 'occurs' then it is always due to some process that sums several smaller variables (e.g like a Galton board where a ball is hitting multiple times a pin before ending up in a bin). And such sums can be approximated by a normal distribution. The use of the normal distribution can have other motivations. For instance, it is the maximum entropy distribution for a given mean and variance. But in that case, it still indirectly relates to the CLT as we can see a maximum entropy distribution as arrising from many random operations that preserve some parameters (like in the case of the normal distribution, the mean and variance are preserved). When we add up many variables with a given mean and variance, then the resulting distribution is likely gonna be something with a high entropy, ie something close to the normal distribution. The CLT is such a general principle that the question is like asking "what is the role of 'integration' in Bayesian statistics". Or fill in any other trivial process in place of CLT. Practical application of CLT It might be that in practice one observes a tendency for textbooks or statisticians/fields to often apply a particular technique, frequentist or Bayesian, and use relatively more or less often a normal approximation. But, that is in principle not related to those fields. In practice a particular technique might be preferred. For instance when approximating intervals, then one can use a normal distribution as approximation, but that is not a neccesity. One can also use a Monte Carlo simulation to estimate the distribution or sometimes there is a formula for the exact distribution. Possibly Bayesian approaches use the normal approximation less often because they are in a situation where they use Monte Carlo simulation/sampling already anyway (to find a solution for large intractable models). It can be that in particular fields the models are too complex to apply a normal distribution approximation and that those fields also often apply Bayesian techniques. That doesn't make the role of the CLT is smaller for Bayesian techniques. At least not in principle. There is a large amount of scientists that use nothing much more than simple things like ANOVA, chi-squared tests, ordinary least squares fits, or small variations of it. Those techniques happen to be frequentist and use a normal distribution approximation. Because of that it might seem like frequentist techniques often use the CLT but it doesn't rely on it in principle. Related: How would a bayesian estimate a mean from a large sample? Would you say this is a trade off between frequentist and Bayesian stats?
What is the role, if any, of the Central Limit Theorem in Bayesian Inference?
The limit theorem is 'central' The central limit theorem (CLT) has a central role in all of statistics. That is why it is called central! It is not specific to frequentist or Bayesian statistics. Note
What is the role, if any, of the Central Limit Theorem in Bayesian Inference? The limit theorem is 'central' The central limit theorem (CLT) has a central role in all of statistics. That is why it is called central! It is not specific to frequentist or Bayesian statistics. Note the early (and possibly first ever) use of the term 'central limit theorem' by George Pólya who used it in the article "Über den zentralen Grenzwertsatz der Wahrscheinlichkeitsrechnung und das Momentenproblem" Das Auftreten der Gaußschen Wahrscheinlichkeitsdichte $e^{-x^2}$ bei wiederholten Versuchen, bei Messungsfehlern, die aus der Zusammensetsung von sehr vielen und sehr kleinen Elementarfehlern resultieren, bei Diffusionafurgängen usw. ist bekanntlich aus einem und demselben Grenzwertsatz zu erklären, der in der Wahrscheinlichkeitsrechnung ein zentralen Rolle spielt. emphasis is mine. The principle behind the limit is applied whenever we use a normal distribution The CLT describes the tendency of sums of variables to approach a normal distribution and that is independent from how you would wish to analyse the variables, whether it is frequentist or Bayesian. Such sums occur anyware. It is arguable that whenever a normal distribution is used, then it is indirectly an application of the central limit theorem. A normal distribution does not occur as an atomic distribution. There is nothing inherently normal distributed and when a normal distribution 'occurs' then it is always due to some process that sums several smaller variables (e.g like a Galton board where a ball is hitting multiple times a pin before ending up in a bin). And such sums can be approximated by a normal distribution. The use of the normal distribution can have other motivations. For instance, it is the maximum entropy distribution for a given mean and variance. But in that case, it still indirectly relates to the CLT as we can see a maximum entropy distribution as arrising from many random operations that preserve some parameters (like in the case of the normal distribution, the mean and variance are preserved). When we add up many variables with a given mean and variance, then the resulting distribution is likely gonna be something with a high entropy, ie something close to the normal distribution. The CLT is such a general principle that the question is like asking "what is the role of 'integration' in Bayesian statistics". Or fill in any other trivial process in place of CLT. Practical application of CLT It might be that in practice one observes a tendency for textbooks or statisticians/fields to often apply a particular technique, frequentist or Bayesian, and use relatively more or less often a normal approximation. But, that is in principle not related to those fields. In practice a particular technique might be preferred. For instance when approximating intervals, then one can use a normal distribution as approximation, but that is not a neccesity. One can also use a Monte Carlo simulation to estimate the distribution or sometimes there is a formula for the exact distribution. Possibly Bayesian approaches use the normal approximation less often because they are in a situation where they use Monte Carlo simulation/sampling already anyway (to find a solution for large intractable models). It can be that in particular fields the models are too complex to apply a normal distribution approximation and that those fields also often apply Bayesian techniques. That doesn't make the role of the CLT is smaller for Bayesian techniques. At least not in principle. There is a large amount of scientists that use nothing much more than simple things like ANOVA, chi-squared tests, ordinary least squares fits, or small variations of it. Those techniques happen to be frequentist and use a normal distribution approximation. Because of that it might seem like frequentist techniques often use the CLT but it doesn't rely on it in principle. Related: How would a bayesian estimate a mean from a large sample? Would you say this is a trade off between frequentist and Bayesian stats?
What is the role, if any, of the Central Limit Theorem in Bayesian Inference? The limit theorem is 'central' The central limit theorem (CLT) has a central role in all of statistics. That is why it is called central! It is not specific to frequentist or Bayesian statistics. Note
15,522
What is the role, if any, of the Central Limit Theorem in Bayesian Inference?
Reproduced verbatim from the Wikipedia page: In Bayesian inference, the Bernstein-von Mises theorem provides the basis for using Bayesian credible sets for confidence statements in parametric models. It states that under some conditions, a posterior distribution converges in the limit of infinite data to a multivariate normal distribution centered at the maximum likelihood estimator with covariance matrix given ${\displaystyle n^{-1}I(\theta _{0})^{-1}}$, where $\theta _{0}$ is the true population parameter and ${\displaystyle I(\theta _{0})}$ is the Fisher information matrix at the true population parameter value. The Bernstein-von Mises theorem links Bayesian inference with frequentist inference. It assumes there is some true probabilistic process that generates the observations, as in frequentism, and then studies the quality of Bayesian methods of recovering that process, and making uncertainty statements about that process. In particular, it states that Bayesian credible sets of a certain credibility level $\alpha$ will asymptotically be confidence sets of confidence level $\alpha$, which allows for the interpretation of Bayesian credible sets. With the reference van der Vaart, A.W. (1998). "10.2 Bernstein–von Mises Theorem". Asymptotic Statistics. Cambridge University Press. ISBN 0-521-49603-9.
What is the role, if any, of the Central Limit Theorem in Bayesian Inference?
Reproduced verbatim from the Wikipedia page: In Bayesian inference, the Bernstein-von Mises theorem provides the basis for using Bayesian credible sets for confidence statements in parametric models.
What is the role, if any, of the Central Limit Theorem in Bayesian Inference? Reproduced verbatim from the Wikipedia page: In Bayesian inference, the Bernstein-von Mises theorem provides the basis for using Bayesian credible sets for confidence statements in parametric models. It states that under some conditions, a posterior distribution converges in the limit of infinite data to a multivariate normal distribution centered at the maximum likelihood estimator with covariance matrix given ${\displaystyle n^{-1}I(\theta _{0})^{-1}}$, where $\theta _{0}$ is the true population parameter and ${\displaystyle I(\theta _{0})}$ is the Fisher information matrix at the true population parameter value. The Bernstein-von Mises theorem links Bayesian inference with frequentist inference. It assumes there is some true probabilistic process that generates the observations, as in frequentism, and then studies the quality of Bayesian methods of recovering that process, and making uncertainty statements about that process. In particular, it states that Bayesian credible sets of a certain credibility level $\alpha$ will asymptotically be confidence sets of confidence level $\alpha$, which allows for the interpretation of Bayesian credible sets. With the reference van der Vaart, A.W. (1998). "10.2 Bernstein–von Mises Theorem". Asymptotic Statistics. Cambridge University Press. ISBN 0-521-49603-9.
What is the role, if any, of the Central Limit Theorem in Bayesian Inference? Reproduced verbatim from the Wikipedia page: In Bayesian inference, the Bernstein-von Mises theorem provides the basis for using Bayesian credible sets for confidence statements in parametric models.
15,523
Is supervised learning a subset of reinforcement learning?
It's true that any supervised learning problem can be cast as an equivalent reinforcement learning problem: Let states correspond to the input data. Let actions correspond to predictions of the output. Define reward as the negative of the loss function used for supervised learning. Maximize expected reward. In contrast, reinforcement learning problems can't generally be cast as supervised learning problems. So, from this perspective, supervised learning problems are a subset of reinforcement learning problems. But, trying to solve a supervised learning problem using a general reinforcement learning algorithm would be rather pointless; all this does is throw away structure that would have made the problem easier to solve. Various issues arise in reinforcement learning that aren't relevant to supervised learning. And, supervised learning can benefit from approaches that don't apply in the general reinforcement learning setting. So, although there are some common underlying principles and shared techniques between the fields, one doesn't typically see supervised learning discussed as a type of reinforcement learning. References Barto and Dietterich (2004). Reinforcement learning and its relationship to supervised learning.
Is supervised learning a subset of reinforcement learning?
It's true that any supervised learning problem can be cast as an equivalent reinforcement learning problem: Let states correspond to the input data. Let actions correspond to predictions of the output
Is supervised learning a subset of reinforcement learning? It's true that any supervised learning problem can be cast as an equivalent reinforcement learning problem: Let states correspond to the input data. Let actions correspond to predictions of the output. Define reward as the negative of the loss function used for supervised learning. Maximize expected reward. In contrast, reinforcement learning problems can't generally be cast as supervised learning problems. So, from this perspective, supervised learning problems are a subset of reinforcement learning problems. But, trying to solve a supervised learning problem using a general reinforcement learning algorithm would be rather pointless; all this does is throw away structure that would have made the problem easier to solve. Various issues arise in reinforcement learning that aren't relevant to supervised learning. And, supervised learning can benefit from approaches that don't apply in the general reinforcement learning setting. So, although there are some common underlying principles and shared techniques between the fields, one doesn't typically see supervised learning discussed as a type of reinforcement learning. References Barto and Dietterich (2004). Reinforcement learning and its relationship to supervised learning.
Is supervised learning a subset of reinforcement learning? It's true that any supervised learning problem can be cast as an equivalent reinforcement learning problem: Let states correspond to the input data. Let actions correspond to predictions of the output
15,524
Is bootstrapping standard errors and confidence intervals appropriate in regressions where homoscedasticity assumption is violated?
There are at least three (may be more) approaches to perform the bootstrap for linear regression with independent, but not identically distributed data. (If you have other violations of the "standard" assumptions, e.g., due to autocorrelations with time series data, or clustering due to sampling design, things get even more complicated). You can resample observation as a whole, i.e., take a sample with replacement of $(y_j^*, {\bf x}_j^*)$ from the original data $\{ (y_i, {\bf x}_i) \}$. This will be asymptotically equivalent to performing the Huber-White heteroskedasticity correction. You can fit your model, obtain the residuals $e_i = y_i - {\bf x}_i ' \hat\beta$, and resample independently ${\bf x}_j^*$ and $e_j^*$ with replacement from their respective empirical distributions, but this breaks down the heteroskedasticity patterns, if there are any, so I doubt this bootstrap is consistent. You can perform wild bootstrap in which you resample the sign of the residual, which controls for the conditional second moment (and, with some extra tweaks, for the conditional third moment, too). This would be the procedure I would recommend (provided that you can understand it and defend it to others when asked, "What did you do to control for heteroskedasticity? How do you know that it works?"). The ultimate reference is Wu (1986), but Annals are not exactly the picture book reading. UPDATES based on the OP's follow-up questions asked in the comments: The number of replicates seemed large to me; the only good discussion of this bootstrap parameter that I am aware of is in Efron & Tibshirani's Intro to Bootstrap book. I believe that generally similar corrections for the lack of distributional assumptions can be obtained with Huber/White standard errors. Cameron & Triverdi's textbook discuss equivalence of the pairs bootstrap and White's heteroskedasticity correction. The equivalence follows from the general robustness theory for $M$-estimates: both corrections are aimed at correcting the distributional assumptions, whatever they may be, with the minimal assumption of finite second moments of residuals, and independence between observations. See also Hausman and Palmer (2012) on more specific comparisons in finite samples (a version of this paper is available on one of the authors' websites) on comparison between the bootstrap and heteroskedasticity corrections.
Is bootstrapping standard errors and confidence intervals appropriate in regressions where homosceda
There are at least three (may be more) approaches to perform the bootstrap for linear regression with independent, but not identically distributed data. (If you have other violations of the "standard"
Is bootstrapping standard errors and confidence intervals appropriate in regressions where homoscedasticity assumption is violated? There are at least three (may be more) approaches to perform the bootstrap for linear regression with independent, but not identically distributed data. (If you have other violations of the "standard" assumptions, e.g., due to autocorrelations with time series data, or clustering due to sampling design, things get even more complicated). You can resample observation as a whole, i.e., take a sample with replacement of $(y_j^*, {\bf x}_j^*)$ from the original data $\{ (y_i, {\bf x}_i) \}$. This will be asymptotically equivalent to performing the Huber-White heteroskedasticity correction. You can fit your model, obtain the residuals $e_i = y_i - {\bf x}_i ' \hat\beta$, and resample independently ${\bf x}_j^*$ and $e_j^*$ with replacement from their respective empirical distributions, but this breaks down the heteroskedasticity patterns, if there are any, so I doubt this bootstrap is consistent. You can perform wild bootstrap in which you resample the sign of the residual, which controls for the conditional second moment (and, with some extra tweaks, for the conditional third moment, too). This would be the procedure I would recommend (provided that you can understand it and defend it to others when asked, "What did you do to control for heteroskedasticity? How do you know that it works?"). The ultimate reference is Wu (1986), but Annals are not exactly the picture book reading. UPDATES based on the OP's follow-up questions asked in the comments: The number of replicates seemed large to me; the only good discussion of this bootstrap parameter that I am aware of is in Efron & Tibshirani's Intro to Bootstrap book. I believe that generally similar corrections for the lack of distributional assumptions can be obtained with Huber/White standard errors. Cameron & Triverdi's textbook discuss equivalence of the pairs bootstrap and White's heteroskedasticity correction. The equivalence follows from the general robustness theory for $M$-estimates: both corrections are aimed at correcting the distributional assumptions, whatever they may be, with the minimal assumption of finite second moments of residuals, and independence between observations. See also Hausman and Palmer (2012) on more specific comparisons in finite samples (a version of this paper is available on one of the authors' websites) on comparison between the bootstrap and heteroskedasticity corrections.
Is bootstrapping standard errors and confidence intervals appropriate in regressions where homosceda There are at least three (may be more) approaches to perform the bootstrap for linear regression with independent, but not identically distributed data. (If you have other violations of the "standard"
15,525
Fast method for finding best metaparameters of SVM (that is faster than grid search)
The downside being of grid search being that the runtime grows as fast as the product of the number of options for each parameter. Here is an entry in Alex Smola's blog related to your question Here is a quote: [...] pick, say 1000 pairs (x,x’) at random from your dataset, compute the distance of all such pairs and take the median, the 0.1 and the 0.9 quantile. Now pick λ to be the inverse any of these three numbers. With a little bit of crossvalidation you will figure out which one of the three is best. In most cases you won’t need to search any further. I haven't tried this myself, but it does seem kind of promising.
Fast method for finding best metaparameters of SVM (that is faster than grid search)
The downside being of grid search being that the runtime grows as fast as the product of the number of options for each parameter. Here is an entry in Alex Smola's blog related to your question Here i
Fast method for finding best metaparameters of SVM (that is faster than grid search) The downside being of grid search being that the runtime grows as fast as the product of the number of options for each parameter. Here is an entry in Alex Smola's blog related to your question Here is a quote: [...] pick, say 1000 pairs (x,x’) at random from your dataset, compute the distance of all such pairs and take the median, the 0.1 and the 0.9 quantile. Now pick λ to be the inverse any of these three numbers. With a little bit of crossvalidation you will figure out which one of the three is best. In most cases you won’t need to search any further. I haven't tried this myself, but it does seem kind of promising.
Fast method for finding best metaparameters of SVM (that is faster than grid search) The downside being of grid search being that the runtime grows as fast as the product of the number of options for each parameter. Here is an entry in Alex Smola's blog related to your question Here i
15,526
Fast method for finding best metaparameters of SVM (that is faster than grid search)
If you make the assumption that there is a relatively smooth function underlying the grid of parameters, then there are certain things that you can do. For example, one simple heuristic is to start with a very coarse grid of parameters, and then use a finer grid around the best of the parameter settings from the coarse grid. This tends to work quite well in practice, with caveats of course. First is that the space is not necessarily smooth, and there could be local optima. The coarse grid may completely miss these and you could end up with a sub-optimal solution. Also note that if you have relatively few samples in your hold-out set, then you may have a lot of parameter settings that give the same score (error or whatever metric you're using). This can be particularly problematic if you are doing multi-class learning (e.g. using the one-versus-all method), and you have only a few examples from each class in your hold-out set. However, without resorting to nasty nonlinear optimisation techniques, this probably serves as a good starting point. There's a nice set of references here. In the past I've taken the approach that you can reasonably estimate a good range of kernel hyperparameters by inspection of the kernel (e.g. in the case of the RBF kernel, ensuring that the histogram of the kernel values gives a good spread of values, rather than being skewed towards 0 or 1 - and you can do this automatically too without too much work), meaning that you can narrow down the range before starting. You can then focus your search on any other parameters such as the regularisation/capacity parameter. However of course this only works with precomputed kernels, although you could estimate this on a random subset of points if you didn't want to use precomputed kernels, and I think that approach would be fine too.
Fast method for finding best metaparameters of SVM (that is faster than grid search)
If you make the assumption that there is a relatively smooth function underlying the grid of parameters, then there are certain things that you can do. For example, one simple heuristic is to start wi
Fast method for finding best metaparameters of SVM (that is faster than grid search) If you make the assumption that there is a relatively smooth function underlying the grid of parameters, then there are certain things that you can do. For example, one simple heuristic is to start with a very coarse grid of parameters, and then use a finer grid around the best of the parameter settings from the coarse grid. This tends to work quite well in practice, with caveats of course. First is that the space is not necessarily smooth, and there could be local optima. The coarse grid may completely miss these and you could end up with a sub-optimal solution. Also note that if you have relatively few samples in your hold-out set, then you may have a lot of parameter settings that give the same score (error or whatever metric you're using). This can be particularly problematic if you are doing multi-class learning (e.g. using the one-versus-all method), and you have only a few examples from each class in your hold-out set. However, without resorting to nasty nonlinear optimisation techniques, this probably serves as a good starting point. There's a nice set of references here. In the past I've taken the approach that you can reasonably estimate a good range of kernel hyperparameters by inspection of the kernel (e.g. in the case of the RBF kernel, ensuring that the histogram of the kernel values gives a good spread of values, rather than being skewed towards 0 or 1 - and you can do this automatically too without too much work), meaning that you can narrow down the range before starting. You can then focus your search on any other parameters such as the regularisation/capacity parameter. However of course this only works with precomputed kernels, although you could estimate this on a random subset of points if you didn't want to use precomputed kernels, and I think that approach would be fine too.
Fast method for finding best metaparameters of SVM (that is faster than grid search) If you make the assumption that there is a relatively smooth function underlying the grid of parameters, then there are certain things that you can do. For example, one simple heuristic is to start wi
15,527
Fast method for finding best metaparameters of SVM (that is faster than grid search)
I use simulated annealing for searching parameters. The behavior is governed by a few parameters: k is Boltzmann's constant. T_max is your starting temperature. T_min is your ending threshold. mu_T (μ) is how much you lower the temperature (T->T/μ) i is the number of iterations at each temperature z is a step size - you determine what exactly that means. I randomly move within old*(1±z). Take a starting point (set of parameter values). Get an energy for it (how well it fits to your data; I use chi-squared values). Look in a random direction ("take a step"). If the energy is lower than your current point, move there. If it's higher, move there with a probability p = e^{-(E_{i+1} - E_i)/(kT)}. Repeat, occasionally lowering T->T/μ every i iterations until you hit T_min. Play around with the parameters a bit and you should be able to find a set that works well and fast. And the GNU Scientific Library includes simulated annealing.
Fast method for finding best metaparameters of SVM (that is faster than grid search)
I use simulated annealing for searching parameters. The behavior is governed by a few parameters: k is Boltzmann's constant. T_max is your starting temperature. T_min is your ending threshold. mu_T (
Fast method for finding best metaparameters of SVM (that is faster than grid search) I use simulated annealing for searching parameters. The behavior is governed by a few parameters: k is Boltzmann's constant. T_max is your starting temperature. T_min is your ending threshold. mu_T (μ) is how much you lower the temperature (T->T/μ) i is the number of iterations at each temperature z is a step size - you determine what exactly that means. I randomly move within old*(1±z). Take a starting point (set of parameter values). Get an energy for it (how well it fits to your data; I use chi-squared values). Look in a random direction ("take a step"). If the energy is lower than your current point, move there. If it's higher, move there with a probability p = e^{-(E_{i+1} - E_i)/(kT)}. Repeat, occasionally lowering T->T/μ every i iterations until you hit T_min. Play around with the parameters a bit and you should be able to find a set that works well and fast. And the GNU Scientific Library includes simulated annealing.
Fast method for finding best metaparameters of SVM (that is faster than grid search) I use simulated annealing for searching parameters. The behavior is governed by a few parameters: k is Boltzmann's constant. T_max is your starting temperature. T_min is your ending threshold. mu_T (
15,528
Fast method for finding best metaparameters of SVM (that is faster than grid search)
If anyone is interested here are some of my thoughts on the subject: As @tdc suggested I'm doing coarse/fine grid search. This introduces two problems: In most cases I will get set of good metaparameter sets that have wildly different parametes --- i'm interpreting it in this way that these parameters are optimal solutions, but to be sure I should check all fine grids near all these good parameters (that would be take a lot of time), so for now I check only neighbourhood of bets metaparameter set. In most cases fine search doesn't increase SVM performance (that may be due to fact that I'm checking only neightbourhood of best point from coarse grid. I observed behaviour that most computing time is spent on metaparemeters sets that will not yield good results, for example: most metaparameter sets will compute in under 15 seconds (and best of them have error rate of 15%), and some take 15 minutes (and most of these have error rates bigger that 100%). So when doing grid search I kill points that take more than 30seconds to compute and assume they had infinite error. I use multiprocessing (which is simple enough)
Fast method for finding best metaparameters of SVM (that is faster than grid search)
If anyone is interested here are some of my thoughts on the subject: As @tdc suggested I'm doing coarse/fine grid search. This introduces two problems: In most cases I will get set of good metapara
Fast method for finding best metaparameters of SVM (that is faster than grid search) If anyone is interested here are some of my thoughts on the subject: As @tdc suggested I'm doing coarse/fine grid search. This introduces two problems: In most cases I will get set of good metaparameter sets that have wildly different parametes --- i'm interpreting it in this way that these parameters are optimal solutions, but to be sure I should check all fine grids near all these good parameters (that would be take a lot of time), so for now I check only neighbourhood of bets metaparameter set. In most cases fine search doesn't increase SVM performance (that may be due to fact that I'm checking only neightbourhood of best point from coarse grid. I observed behaviour that most computing time is spent on metaparemeters sets that will not yield good results, for example: most metaparameter sets will compute in under 15 seconds (and best of them have error rate of 15%), and some take 15 minutes (and most of these have error rates bigger that 100%). So when doing grid search I kill points that take more than 30seconds to compute and assume they had infinite error. I use multiprocessing (which is simple enough)
Fast method for finding best metaparameters of SVM (that is faster than grid search) If anyone is interested here are some of my thoughts on the subject: As @tdc suggested I'm doing coarse/fine grid search. This introduces two problems: In most cases I will get set of good metapara
15,529
Fast method for finding best metaparameters of SVM (that is faster than grid search)
If the kernel is radial, you can use this heuristic to get a proper $\sigma$ -- C optimisation is way easier then.
Fast method for finding best metaparameters of SVM (that is faster than grid search)
If the kernel is radial, you can use this heuristic to get a proper $\sigma$ -- C optimisation is way easier then.
Fast method for finding best metaparameters of SVM (that is faster than grid search) If the kernel is radial, you can use this heuristic to get a proper $\sigma$ -- C optimisation is way easier then.
Fast method for finding best metaparameters of SVM (that is faster than grid search) If the kernel is radial, you can use this heuristic to get a proper $\sigma$ -- C optimisation is way easier then.
15,530
"Moderation" versus "interaction"?
You should consider the two terms to be synonymous. Although they are used in slightly different ways, and come from different traditions within statistics ('interaction' is associated more with ANOVA, and 'moderator variable' is more associated with regression), there is no real difference in the underlying meaning. In fact, statistics is littered with synonymous terms that come from different traditions that mean the same thing. Should we call our X variables 'predictor variables', 'explanatory variables', 'factors', 'covariates', etc.? Does it matter? (No, not really.) The way to think about what an interaction is, is that if you were to explain your findings to someone you would use the word 'depends'. I will make up a story using your variables (I have no way of knowing if this is accurate or even plausible): Lets say someone asks you, "if people research a product, do they purchase it?" You might respond, "Well, it depends. For men, if they research a product, they typically end up buying one, but women enjoy looking at and thinking about products for its own sake; often, a woman will research a product, but have no intention of buying it. So, the relationship between researching a product and buying that product depends on sex." In this story, there is an interaction between product research and sex, or sex moderates the relationship between research and purchasing. (Again, I don't know if this story is remotely correct, and I hope no one is offended by it. I only use men and women because that's in the question. I don't mean to push any stereotypes.)
"Moderation" versus "interaction"?
You should consider the two terms to be synonymous. Although they are used in slightly different ways, and come from different traditions within statistics ('interaction' is associated more with ANOV
"Moderation" versus "interaction"? You should consider the two terms to be synonymous. Although they are used in slightly different ways, and come from different traditions within statistics ('interaction' is associated more with ANOVA, and 'moderator variable' is more associated with regression), there is no real difference in the underlying meaning. In fact, statistics is littered with synonymous terms that come from different traditions that mean the same thing. Should we call our X variables 'predictor variables', 'explanatory variables', 'factors', 'covariates', etc.? Does it matter? (No, not really.) The way to think about what an interaction is, is that if you were to explain your findings to someone you would use the word 'depends'. I will make up a story using your variables (I have no way of knowing if this is accurate or even plausible): Lets say someone asks you, "if people research a product, do they purchase it?" You might respond, "Well, it depends. For men, if they research a product, they typically end up buying one, but women enjoy looking at and thinking about products for its own sake; often, a woman will research a product, but have no intention of buying it. So, the relationship between researching a product and buying that product depends on sex." In this story, there is an interaction between product research and sex, or sex moderates the relationship between research and purchasing. (Again, I don't know if this story is remotely correct, and I hope no one is offended by it. I only use men and women because that's in the question. I don't mean to push any stereotypes.)
"Moderation" versus "interaction"? You should consider the two terms to be synonymous. Although they are used in slightly different ways, and come from different traditions within statistics ('interaction' is associated more with ANOV
15,531
"Moderation" versus "interaction"?
I think you have things mostly correct except for the part about "in interaction, M (which is gender in this case) affects other the IV." In an interaction (a true synonym for a moderator effect--not something different), there is no need for one predictor to influence the other or even be correlated with the other. All that is implied by "interaction" (or "moderator") is that the way one predictor relates to the outcome depends on the level of the other predictor.
"Moderation" versus "interaction"?
I think you have things mostly correct except for the part about "in interaction, M (which is gender in this case) affects other the IV." In an interaction (a true synonym for a moderator effect--not
"Moderation" versus "interaction"? I think you have things mostly correct except for the part about "in interaction, M (which is gender in this case) affects other the IV." In an interaction (a true synonym for a moderator effect--not something different), there is no need for one predictor to influence the other or even be correlated with the other. All that is implied by "interaction" (or "moderator") is that the way one predictor relates to the outcome depends on the level of the other predictor.
"Moderation" versus "interaction"? I think you have things mostly correct except for the part about "in interaction, M (which is gender in this case) affects other the IV." In an interaction (a true synonym for a moderator effect--not
15,532
"Moderation" versus "interaction"?
Moderation Vs Interaction Both moderation and interaction effects are very much similar to each other. Mathematically, they both can be modelled by using product term in the regression equation. Often researcher use the two terms as synonyms but there is a thin line between interaction and moderation. The difference between the two is broadly similar to the difference between correlation coefficient and regression coefficient. When we say X and Z interact in their effects on an outcome variable Y, and there is no real distinction between the role of X and the role of Z. They are both considered predictor variables. Then we identify this effect as interaction effect. While, in case we have clear distinction between the predictor and moderator variables (on the basis of theory) and we are interested to see the impact of predictor on response (affected by moderator), then this effect is known as moderation effect. One should carefully choose the term which is more suitable to answer one’s research question. For detailed comparison of these terms, refer http://learnerworld.tumblr.com/post/147085936920/interaction-moderationenjoystatisticswithme and http://learnerworld.tumblr.com/post/147089718705/mediationmoderationinteractionenjoystatisticswithme
"Moderation" versus "interaction"?
Moderation Vs Interaction Both moderation and interaction effects are very much similar to each other. Mathematically, they both can be modelled by using product term in the regression equation. Often
"Moderation" versus "interaction"? Moderation Vs Interaction Both moderation and interaction effects are very much similar to each other. Mathematically, they both can be modelled by using product term in the regression equation. Often researcher use the two terms as synonyms but there is a thin line between interaction and moderation. The difference between the two is broadly similar to the difference between correlation coefficient and regression coefficient. When we say X and Z interact in their effects on an outcome variable Y, and there is no real distinction between the role of X and the role of Z. They are both considered predictor variables. Then we identify this effect as interaction effect. While, in case we have clear distinction between the predictor and moderator variables (on the basis of theory) and we are interested to see the impact of predictor on response (affected by moderator), then this effect is known as moderation effect. One should carefully choose the term which is more suitable to answer one’s research question. For detailed comparison of these terms, refer http://learnerworld.tumblr.com/post/147085936920/interaction-moderationenjoystatisticswithme and http://learnerworld.tumblr.com/post/147089718705/mediationmoderationinteractionenjoystatisticswithme
"Moderation" versus "interaction"? Moderation Vs Interaction Both moderation and interaction effects are very much similar to each other. Mathematically, they both can be modelled by using product term in the regression equation. Often
15,533
"Moderation" versus "interaction"?
I think the most general model one can write regarding moderation of a variable z "in a relationship between y and x" is: y = f(x) + g(z) + h(x)z The marginal effect of x is f'(x)+h'(x)z, so the moderation effect is h'(x). Mike
"Moderation" versus "interaction"?
I think the most general model one can write regarding moderation of a variable z "in a relationship between y and x" is: y = f(x) + g(z) + h(x)z The marginal effect of x is f'(x)+h'(x)z, so the moder
"Moderation" versus "interaction"? I think the most general model one can write regarding moderation of a variable z "in a relationship between y and x" is: y = f(x) + g(z) + h(x)z The marginal effect of x is f'(x)+h'(x)z, so the moderation effect is h'(x). Mike
"Moderation" versus "interaction"? I think the most general model one can write regarding moderation of a variable z "in a relationship between y and x" is: y = f(x) + g(z) + h(x)z The marginal effect of x is f'(x)+h'(x)z, so the moder
15,534
Social network datasets
Check out the Stanford large network dataset collection: SNAP.
Social network datasets
Check out the Stanford large network dataset collection: SNAP.
Social network datasets Check out the Stanford large network dataset collection: SNAP.
Social network datasets Check out the Stanford large network dataset collection: SNAP.
15,535
Social network datasets
A huge twitter dataset that includes followers, not just tweets large collection of twitter datasets here
Social network datasets
A huge twitter dataset that includes followers, not just tweets large collection of twitter datasets here
Social network datasets A huge twitter dataset that includes followers, not just tweets large collection of twitter datasets here
Social network datasets A huge twitter dataset that includes followers, not just tweets large collection of twitter datasets here
15,536
Social network datasets
A large index of facebook pages was created and is available as a torrent (It is ~2.8Gb) http://btjunkie.org/torrent/Facebook-directory-personal-details-for-100-million-users/3979e54c73099d291605e7579b90838c2cd86a8e9575 Twitter datasets are tagged on Infochimps: http://infochimps.com/tags/twitter A lastfm dataset is available at http://mtg.upf.edu/node/1671
Social network datasets
A large index of facebook pages was created and is available as a torrent (It is ~2.8Gb) http://btjunkie.org/torrent/Facebook-directory-personal-details-for-100-million-users/3979e54c73099d291605e7579
Social network datasets A large index of facebook pages was created and is available as a torrent (It is ~2.8Gb) http://btjunkie.org/torrent/Facebook-directory-personal-details-for-100-million-users/3979e54c73099d291605e7579b90838c2cd86a8e9575 Twitter datasets are tagged on Infochimps: http://infochimps.com/tags/twitter A lastfm dataset is available at http://mtg.upf.edu/node/1671
Social network datasets A large index of facebook pages was created and is available as a torrent (It is ~2.8Gb) http://btjunkie.org/torrent/Facebook-directory-personal-details-for-100-million-users/3979e54c73099d291605e7579
15,537
Social network datasets
visit the Max Planck institute. They have also collected several datasets for OSNs.
Social network datasets
visit the Max Planck institute. They have also collected several datasets for OSNs.
Social network datasets visit the Max Planck institute. They have also collected several datasets for OSNs.
Social network datasets visit the Max Planck institute. They have also collected several datasets for OSNs.
15,538
Social network datasets
Just found this: 476 million Twitter tweets (via @yarapavan).
Social network datasets
Just found this: 476 million Twitter tweets (via @yarapavan).
Social network datasets Just found this: 476 million Twitter tweets (via @yarapavan).
Social network datasets Just found this: 476 million Twitter tweets (via @yarapavan).
15,539
Social network datasets
We have curated a Twitter dataset for friends of users in 2009 and then in 2009. You can find more information here: http://strict.dista.uninsubria.it/?p=364
Social network datasets
We have curated a Twitter dataset for friends of users in 2009 and then in 2009. You can find more information here: http://strict.dista.uninsubria.it/?p=364
Social network datasets We have curated a Twitter dataset for friends of users in 2009 and then in 2009. You can find more information here: http://strict.dista.uninsubria.it/?p=364
Social network datasets We have curated a Twitter dataset for friends of users in 2009 and then in 2009. You can find more information here: http://strict.dista.uninsubria.it/?p=364
15,540
Social network datasets
Check out kaggle.com , they have some contests about social networks and they give out datasets. Also, Stanford's SNAP is a great resource. And it has research works to boot.
Social network datasets
Check out kaggle.com , they have some contests about social networks and they give out datasets. Also, Stanford's SNAP is a great resource. And it has research works to boot.
Social network datasets Check out kaggle.com , they have some contests about social networks and they give out datasets. Also, Stanford's SNAP is a great resource. And it has research works to boot.
Social network datasets Check out kaggle.com , they have some contests about social networks and they give out datasets. Also, Stanford's SNAP is a great resource. And it has research works to boot.
15,541
Social network datasets
Facebook social graph, application installations and Last.fm users, events, groups at http://odysseas.calit2.uci.edu/research/ Two datasets (collected April-May 2009) which contain representative samples of ~1 million users Facebook-wide, with a few annotated properties: for each sampled user, the friend list, privacy settings, and network membership are included. A third dataset ( collected Feb 2008) includes a bipartite graph that represents application installations by Facebook users. A fourth dataset with Daily Active Users and application installations over 6 months (collected Sept 2007-Feb 2008). A fifth dataset that includes a representative sample of Last.fm users obtained using multigraph sampling (collected July 2010).
Social network datasets
Facebook social graph, application installations and Last.fm users, events, groups at http://odysseas.calit2.uci.edu/research/ Two datasets (collected April-May 2009) which contain representative samp
Social network datasets Facebook social graph, application installations and Last.fm users, events, groups at http://odysseas.calit2.uci.edu/research/ Two datasets (collected April-May 2009) which contain representative samples of ~1 million users Facebook-wide, with a few annotated properties: for each sampled user, the friend list, privacy settings, and network membership are included. A third dataset ( collected Feb 2008) includes a bipartite graph that represents application installations by Facebook users. A fourth dataset with Daily Active Users and application installations over 6 months (collected Sept 2007-Feb 2008). A fifth dataset that includes a representative sample of Last.fm users obtained using multigraph sampling (collected July 2010).
Social network datasets Facebook social graph, application installations and Last.fm users, events, groups at http://odysseas.calit2.uci.edu/research/ Two datasets (collected April-May 2009) which contain representative samp
15,542
Social network datasets
A good resource for finding datasets is: /r/datasets on Reddit. A quick glance at that page reveals this source, which might contain something useful for you.
Social network datasets
A good resource for finding datasets is: /r/datasets on Reddit. A quick glance at that page reveals this source, which might contain something useful for you.
Social network datasets A good resource for finding datasets is: /r/datasets on Reddit. A quick glance at that page reveals this source, which might contain something useful for you.
Social network datasets A good resource for finding datasets is: /r/datasets on Reddit. A quick glance at that page reveals this source, which might contain something useful for you.
15,543
Social network datasets
This paper uses a facebook dataset that is available here. Here is the description from the authors: The data includes the complete set of nodes and links (and some demographic information) from 100 US colleges and universities from a single-time snapshot in September 2005.
Social network datasets
This paper uses a facebook dataset that is available here. Here is the description from the authors: The data includes the complete set of nodes and links (and some demographic information) from 10
Social network datasets This paper uses a facebook dataset that is available here. Here is the description from the authors: The data includes the complete set of nodes and links (and some demographic information) from 100 US colleges and universities from a single-time snapshot in September 2005.
Social network datasets This paper uses a facebook dataset that is available here. Here is the description from the authors: The data includes the complete set of nodes and links (and some demographic information) from 10
15,544
How to visualize 3D contingency matrix?
I would try some kind of 3D heatmap, mosaic plot or a sieve plot (available in the vcd package). Isn't the base mosaicplot() function working with three-way table? (at least mosaic3d() in the vcdExtra package should work, see e.g. http://datavis.ca/R/) Here's an example (including a conditional plot): A <- sample(c(T,F), 100, replace=T) B <- sample(c(T,F), 100, replace=T) C <- sample(c(T,F), 100, replace=T) tab <- table(A,B,C) library(vcd) sieve(tab, shade=TRUE) cotabplot(tab) library(vcdExtra) mosaic3d(tab, type="expected", box=TRUE) Actually, the rendering of mosaic3d() rely on the rgl package, so it is hard to give a pretty picture of the result.
How to visualize 3D contingency matrix?
I would try some kind of 3D heatmap, mosaic plot or a sieve plot (available in the vcd package). Isn't the base mosaicplot() function working with three-way table? (at least mosaic3d() in the vcdExtra
How to visualize 3D contingency matrix? I would try some kind of 3D heatmap, mosaic plot or a sieve plot (available in the vcd package). Isn't the base mosaicplot() function working with three-way table? (at least mosaic3d() in the vcdExtra package should work, see e.g. http://datavis.ca/R/) Here's an example (including a conditional plot): A <- sample(c(T,F), 100, replace=T) B <- sample(c(T,F), 100, replace=T) C <- sample(c(T,F), 100, replace=T) tab <- table(A,B,C) library(vcd) sieve(tab, shade=TRUE) cotabplot(tab) library(vcdExtra) mosaic3d(tab, type="expected", box=TRUE) Actually, the rendering of mosaic3d() rely on the rgl package, so it is hard to give a pretty picture of the result.
How to visualize 3D contingency matrix? I would try some kind of 3D heatmap, mosaic plot or a sieve plot (available in the vcd package). Isn't the base mosaicplot() function working with three-way table? (at least mosaic3d() in the vcdExtra
15,545
How to visualize 3D contingency matrix?
I recently came across a paper by Hadley Wickham and I was reminded of this question (I must spend too much time on the site!) Wickham, Hadley and Heike Hofmann. 2011. Product plots. IEEE Transactions on Visualization and Computer Graphics (Proc. Infovis `11). Pre-print PDF Abstract We propose a new framework for visualising tables of counts, proportions and probabilities. We call our framework product plots, alluding to the computation of area as a product of height and width, and the statistical concept of generating a joint distribution from the product of conditional and marginal distributions. The framework, with extensions, is sufficient to encompass over 20 visualisations previously described in fields of statistical graphics and infovis, including bar charts, mosaic plots, treemaps, equal area plots and fluctuation diagrams. I know it is typical to try to give greater explanation, but I don't think I can do any better job than the abstract and posting some pictures! The novel examples they present in the right most images (I believe) meet your requirements without imposing a hierarchy.
How to visualize 3D contingency matrix?
I recently came across a paper by Hadley Wickham and I was reminded of this question (I must spend too much time on the site!) Wickham, Hadley and Heike Hofmann. 2011. Product plots. IEEE Transacti
How to visualize 3D contingency matrix? I recently came across a paper by Hadley Wickham and I was reminded of this question (I must spend too much time on the site!) Wickham, Hadley and Heike Hofmann. 2011. Product plots. IEEE Transactions on Visualization and Computer Graphics (Proc. Infovis `11). Pre-print PDF Abstract We propose a new framework for visualising tables of counts, proportions and probabilities. We call our framework product plots, alluding to the computation of area as a product of height and width, and the statistical concept of generating a joint distribution from the product of conditional and marginal distributions. The framework, with extensions, is sufficient to encompass over 20 visualisations previously described in fields of statistical graphics and infovis, including bar charts, mosaic plots, treemaps, equal area plots and fluctuation diagrams. I know it is typical to try to give greater explanation, but I don't think I can do any better job than the abstract and posting some pictures! The novel examples they present in the right most images (I believe) meet your requirements without imposing a hierarchy.
How to visualize 3D contingency matrix? I recently came across a paper by Hadley Wickham and I was reminded of this question (I must spend too much time on the site!) Wickham, Hadley and Heike Hofmann. 2011. Product plots. IEEE Transacti
15,546
Hyper parameters tuning: Random search vs Bayesian optimization
I think that the answer here is the same as everywhere in data science: it depends on the data :-) It might happen that one method outperforms another (here https://arimo.com/data-science/2016/bayesian-optimization-hyperparameter-tuning/ people compare Bayesian hyperparameter optimization and achieve a better result on the San Francisco crime kaggle challenge than with random search), however I doubt that there is a general rule for that. You can see a nice gif here (http://blog.revolutionanalytics.com/2016/06/bayesian-optimization-of-machine-learning-models.html) where people show the 'path' that Bayesian optimization takes in the landscape of hyperparameters, in particular, it does not seem as if it outperforms random search in general... I think the reason why people tend to use Bayesian hyperparameter optimization is that it just takes less training steps in order to achieve a comparable result as compared to random search with a sufficiently high number of experiments. Summarising in one sentence: *When training time is critical, use Bayesian hyperparameter optimization and if time is not an issue, select one of both... * Usually I am too lazy to implement the Bayesian stuff with Gaussian Processes if I can achieve the same result with random search... I just train Gradient Bossting ensembles on 'few' data, so for me, time is not an issue...
Hyper parameters tuning: Random search vs Bayesian optimization
I think that the answer here is the same as everywhere in data science: it depends on the data :-) It might happen that one method outperforms another (here https://arimo.com/data-science/2016/bayesia
Hyper parameters tuning: Random search vs Bayesian optimization I think that the answer here is the same as everywhere in data science: it depends on the data :-) It might happen that one method outperforms another (here https://arimo.com/data-science/2016/bayesian-optimization-hyperparameter-tuning/ people compare Bayesian hyperparameter optimization and achieve a better result on the San Francisco crime kaggle challenge than with random search), however I doubt that there is a general rule for that. You can see a nice gif here (http://blog.revolutionanalytics.com/2016/06/bayesian-optimization-of-machine-learning-models.html) where people show the 'path' that Bayesian optimization takes in the landscape of hyperparameters, in particular, it does not seem as if it outperforms random search in general... I think the reason why people tend to use Bayesian hyperparameter optimization is that it just takes less training steps in order to achieve a comparable result as compared to random search with a sufficiently high number of experiments. Summarising in one sentence: *When training time is critical, use Bayesian hyperparameter optimization and if time is not an issue, select one of both... * Usually I am too lazy to implement the Bayesian stuff with Gaussian Processes if I can achieve the same result with random search... I just train Gradient Bossting ensembles on 'few' data, so for me, time is not an issue...
Hyper parameters tuning: Random search vs Bayesian optimization I think that the answer here is the same as everywhere in data science: it depends on the data :-) It might happen that one method outperforms another (here https://arimo.com/data-science/2016/bayesia
15,547
Hyper parameters tuning: Random search vs Bayesian optimization
Bayesian optimization is better, because it makes smarter decisions. You can check this article in order to learn more: Hyperparameter optimization for neural networks. This articles also has info about pros and cons for both methods + some extra techniques like grid search and Tree-structured parzen estimators. Even though it was written in order to show pros and cons of different methods for neural networks the main knowledge is generalizable for any other machine learning domains
Hyper parameters tuning: Random search vs Bayesian optimization
Bayesian optimization is better, because it makes smarter decisions. You can check this article in order to learn more: Hyperparameter optimization for neural networks. This articles also has info abo
Hyper parameters tuning: Random search vs Bayesian optimization Bayesian optimization is better, because it makes smarter decisions. You can check this article in order to learn more: Hyperparameter optimization for neural networks. This articles also has info about pros and cons for both methods + some extra techniques like grid search and Tree-structured parzen estimators. Even though it was written in order to show pros and cons of different methods for neural networks the main knowledge is generalizable for any other machine learning domains
Hyper parameters tuning: Random search vs Bayesian optimization Bayesian optimization is better, because it makes smarter decisions. You can check this article in order to learn more: Hyperparameter optimization for neural networks. This articles also has info abo
15,548
Hyper parameters tuning: Random search vs Bayesian optimization
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. Of note, Bayesian hyperparameter optimization is a sequential process, so it may take longer than some other approaches able to search or be conducted in parallel.
Hyper parameters tuning: Random search vs Bayesian optimization
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
Hyper parameters tuning: Random search vs Bayesian optimization Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. Of note, Bayesian hyperparameter optimization is a sequential process, so it may take longer than some other approaches able to search or be conducted in parallel.
Hyper parameters tuning: Random search vs Bayesian optimization Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
15,549
How to run linear regression in a parallel/distributed way for big data setting?
Short Answer: Yes, running linear regression in parallel has been done. For example, Xiangrui Meng et al. (2016) for Machine Learning in Apache Spark. The way it works is using stochastic gradient descent (SGD). In section 3, core features, the author mentioned: Generalized linear models are learned via optimization algorithms which parallelize gradient computation, using fast C++-based linear algebra libraries for worker computations. An example on how SGD works can be found in my answer here: How could stochastic gradient descent save time comparing to standard gradient descent? Long Answer: Note, the notation is not consistent with the link I provided, I feel matrix notation is better in this question. To do a linear regression we are trying to do $$\text{minimize}~\|X\beta-y\|^2$$ The derivative is $$2X^T(X\beta-y)$$ In small data settings, we can set the derivative to $0$ and solve it directly. (e.g., QR decomposition in R.) In big data settings, the data matrix $X$ is too big to be stored in memory, and may be hard to solve directly. (I am not familiar with how to do QR decomposition or Cholesky decomposition for huge matrices). One way to parallelize this is by trying to use an iterative method: stochastic gradient descent, where we can approximate the gradient using a subset of the data. (If we use $X_s$, $y_s$ to represent a subset of the data, the gradient can be approximated by $2X_s^T(X_s\beta-y_s)$, and we can update $\beta$ with the approximated gradient). In addition, for the $R^2$ statistic, we can compute $R^2$ for all data in parallel or approximate it by using a subset of the data. Intuition on how it works (mapreduce paradigm): I keep saying approximation using a subset; the intuition for why this works can be described in the following example: suppose I have 100 billion data points and we want to calculate the average of all data points. Suppose conducting such an operation takes a very long time, and further that the whole data cannot be stored in memory. What we can do is to just take a subset, say 1 billion items, and calculate the average of these. The approximation thus produced should not be far away from the truth (i.e., using the whole data). To parallelize, we can use 100 computers, with each of them taking a different subset of the 1 billion data points and calculating the average of these. (Commonly referred to as the MAP step). Finally, run another average on these 100 numbers (a.k.a. the REDUCE step). Note the "mapreduce paradigm" would work well in some cases, but not well in others. For the example, the "average" operation mentioned earlier is very easy, because we know $\text{mean}(<x,y>)=\text{mean}(x)+\text{mean(y)}$, (assuming the length of $x$ and $y$ are the same). For some iterative methods, i.e., the current iteration is dependent on previous iteration results, it is hard to parallelize. Stochastic gradient descent solves this problem by approximating the gradient using a subset of data. And details can be found in @user20160 's answer. References: Xiangrui Meng et al. (2016). MLlib: Machine Learning in Apache Spark
How to run linear regression in a parallel/distributed way for big data setting?
Short Answer: Yes, running linear regression in parallel has been done. For example, Xiangrui Meng et al. (2016) for Machine Learning in Apache Spark. The way it works is using stochastic gradient des
How to run linear regression in a parallel/distributed way for big data setting? Short Answer: Yes, running linear regression in parallel has been done. For example, Xiangrui Meng et al. (2016) for Machine Learning in Apache Spark. The way it works is using stochastic gradient descent (SGD). In section 3, core features, the author mentioned: Generalized linear models are learned via optimization algorithms which parallelize gradient computation, using fast C++-based linear algebra libraries for worker computations. An example on how SGD works can be found in my answer here: How could stochastic gradient descent save time comparing to standard gradient descent? Long Answer: Note, the notation is not consistent with the link I provided, I feel matrix notation is better in this question. To do a linear regression we are trying to do $$\text{minimize}~\|X\beta-y\|^2$$ The derivative is $$2X^T(X\beta-y)$$ In small data settings, we can set the derivative to $0$ and solve it directly. (e.g., QR decomposition in R.) In big data settings, the data matrix $X$ is too big to be stored in memory, and may be hard to solve directly. (I am not familiar with how to do QR decomposition or Cholesky decomposition for huge matrices). One way to parallelize this is by trying to use an iterative method: stochastic gradient descent, where we can approximate the gradient using a subset of the data. (If we use $X_s$, $y_s$ to represent a subset of the data, the gradient can be approximated by $2X_s^T(X_s\beta-y_s)$, and we can update $\beta$ with the approximated gradient). In addition, for the $R^2$ statistic, we can compute $R^2$ for all data in parallel or approximate it by using a subset of the data. Intuition on how it works (mapreduce paradigm): I keep saying approximation using a subset; the intuition for why this works can be described in the following example: suppose I have 100 billion data points and we want to calculate the average of all data points. Suppose conducting such an operation takes a very long time, and further that the whole data cannot be stored in memory. What we can do is to just take a subset, say 1 billion items, and calculate the average of these. The approximation thus produced should not be far away from the truth (i.e., using the whole data). To parallelize, we can use 100 computers, with each of them taking a different subset of the 1 billion data points and calculating the average of these. (Commonly referred to as the MAP step). Finally, run another average on these 100 numbers (a.k.a. the REDUCE step). Note the "mapreduce paradigm" would work well in some cases, but not well in others. For the example, the "average" operation mentioned earlier is very easy, because we know $\text{mean}(<x,y>)=\text{mean}(x)+\text{mean(y)}$, (assuming the length of $x$ and $y$ are the same). For some iterative methods, i.e., the current iteration is dependent on previous iteration results, it is hard to parallelize. Stochastic gradient descent solves this problem by approximating the gradient using a subset of data. And details can be found in @user20160 's answer. References: Xiangrui Meng et al. (2016). MLlib: Machine Learning in Apache Spark
How to run linear regression in a parallel/distributed way for big data setting? Short Answer: Yes, running linear regression in parallel has been done. For example, Xiangrui Meng et al. (2016) for Machine Learning in Apache Spark. The way it works is using stochastic gradient des
15,550
How to run linear regression in a parallel/distributed way for big data setting?
As @hxd1011 mentioned, one approach is to formulate linear regression as an optimization problem, then solve it using an iterative algorithm (e.g. stochastic gradient descent). This approach can be parallelized but there are a couple important questions: 1) How should be problem be broken into subproblems? 2) Given that optimization algorithms like SGD are inherently sequential, how should solutions to the subproblems be combined to obtain a global solution? Zinkevich et al. (2010) describe some previous approaches to parallelizing across multiple machines: 1) Parallelize SGD as follows: Split the data across multiple machines. At each step, each local machine estimates the gradient using a subset of the data. All gradient estimates are passed to a central machine, which aggregates them to perform a global parameter update. The downside of this approach is that it requires heavy network communication, which reduces efficiency. 2) Partition the data evenly across local machines. Each machine solves the problem exactly for its own subset of the data, using a batch solver. Final parameter estimates from the local machines are averaged to produce a global solution. The benefit of this approach is that it requires very little network communication, but the downside is that the parameter estimates can be suboptimal. They propose a new approach: 3) Allow each local machine to randomly draw data points. Run SGD on each machine. Finally, average the parameters across machines to obtain a global solution. Like (2), this method requires little network communication. But, the parameter estimates are better because each machine is allowed to access a larger fraction of the data. The parallelized optimization approach is very general, and applies to many machine learning algorithms (not just linear regression). Another alternative would be to use parallel/distributed matrix decomposition algorithms or linear solvers. Least squares linear regression has special structure that allows it to be solved using matrix decomposition methods. This is how you'd typically solve it in the case of a smaller data set that fits in memory. This can be parallelized by distributing blocks of the matrix across multiple machines, then solving the problem using parallel/distributed matrix computations. Given that this approach is more specialized to solving linear systems, it would be interesting to see how its performance compares to the more general distributed optimization approach. If anyone can provide more information about this, I'd be glad to hear. References: Zinkevich et al. (2010). Parallelized Stochastic Gradient Descent.
How to run linear regression in a parallel/distributed way for big data setting?
As @hxd1011 mentioned, one approach is to formulate linear regression as an optimization problem, then solve it using an iterative algorithm (e.g. stochastic gradient descent). This approach can be pa
How to run linear regression in a parallel/distributed way for big data setting? As @hxd1011 mentioned, one approach is to formulate linear regression as an optimization problem, then solve it using an iterative algorithm (e.g. stochastic gradient descent). This approach can be parallelized but there are a couple important questions: 1) How should be problem be broken into subproblems? 2) Given that optimization algorithms like SGD are inherently sequential, how should solutions to the subproblems be combined to obtain a global solution? Zinkevich et al. (2010) describe some previous approaches to parallelizing across multiple machines: 1) Parallelize SGD as follows: Split the data across multiple machines. At each step, each local machine estimates the gradient using a subset of the data. All gradient estimates are passed to a central machine, which aggregates them to perform a global parameter update. The downside of this approach is that it requires heavy network communication, which reduces efficiency. 2) Partition the data evenly across local machines. Each machine solves the problem exactly for its own subset of the data, using a batch solver. Final parameter estimates from the local machines are averaged to produce a global solution. The benefit of this approach is that it requires very little network communication, but the downside is that the parameter estimates can be suboptimal. They propose a new approach: 3) Allow each local machine to randomly draw data points. Run SGD on each machine. Finally, average the parameters across machines to obtain a global solution. Like (2), this method requires little network communication. But, the parameter estimates are better because each machine is allowed to access a larger fraction of the data. The parallelized optimization approach is very general, and applies to many machine learning algorithms (not just linear regression). Another alternative would be to use parallel/distributed matrix decomposition algorithms or linear solvers. Least squares linear regression has special structure that allows it to be solved using matrix decomposition methods. This is how you'd typically solve it in the case of a smaller data set that fits in memory. This can be parallelized by distributing blocks of the matrix across multiple machines, then solving the problem using parallel/distributed matrix computations. Given that this approach is more specialized to solving linear systems, it would be interesting to see how its performance compares to the more general distributed optimization approach. If anyone can provide more information about this, I'd be glad to hear. References: Zinkevich et al. (2010). Parallelized Stochastic Gradient Descent.
How to run linear regression in a parallel/distributed way for big data setting? As @hxd1011 mentioned, one approach is to formulate linear regression as an optimization problem, then solve it using an iterative algorithm (e.g. stochastic gradient descent). This approach can be pa
15,551
How to run linear regression in a parallel/distributed way for big data setting?
Long, long, before map reduce I solved this. Below is reference to an old paper of mine in Journal of Econometrics 1980. It was for parallel nonlinear maximum likelihood and would work for M-estimation. The method is exact for regressions. Split data into k subsets on k processors/units (could be done sequentially as well.) Do k regressions keep the regression coefficients an the X'X matrix for each. Call these b1,...,bk and W1,...,Wk respectively then the overall regression coefficients is given by b=inverse(W1+..+Wk)*(W1*b1+...+Wk*bk) one needs another pass through the data to calculate the residuals using b for the parameters to get sigma^2 the estimated error variance, R^2 overall F and the like. Then the covariance matrix of b is given exactly by sigma^2 (inverse(W1+..+Wk)). Above * indicates matrix multiplication. https://www.sciencedirect.com/science/article/pii/0304407680900950
How to run linear regression in a parallel/distributed way for big data setting?
Long, long, before map reduce I solved this. Below is reference to an old paper of mine in Journal of Econometrics 1980. It was for parallel nonlinear maximum likelihood and would work for M-estimatio
How to run linear regression in a parallel/distributed way for big data setting? Long, long, before map reduce I solved this. Below is reference to an old paper of mine in Journal of Econometrics 1980. It was for parallel nonlinear maximum likelihood and would work for M-estimation. The method is exact for regressions. Split data into k subsets on k processors/units (could be done sequentially as well.) Do k regressions keep the regression coefficients an the X'X matrix for each. Call these b1,...,bk and W1,...,Wk respectively then the overall regression coefficients is given by b=inverse(W1+..+Wk)*(W1*b1+...+Wk*bk) one needs another pass through the data to calculate the residuals using b for the parameters to get sigma^2 the estimated error variance, R^2 overall F and the like. Then the covariance matrix of b is given exactly by sigma^2 (inverse(W1+..+Wk)). Above * indicates matrix multiplication. https://www.sciencedirect.com/science/article/pii/0304407680900950
How to run linear regression in a parallel/distributed way for big data setting? Long, long, before map reduce I solved this. Below is reference to an old paper of mine in Journal of Econometrics 1980. It was for parallel nonlinear maximum likelihood and would work for M-estimatio
15,552
How to run linear regression in a parallel/distributed way for big data setting?
As far as I understand, the formulas for the intercept and the slope in a simple linear regression model can be rewritten as expressions on various sums that don't contain the mean value, so that these sums can be calculated in parallel during a map phase or similar: sum(x) sum(y) sum(x*x) sum(x*y) In a final phase that is done in a single instance, the actual regression is calculated: slope = beta = (sum(x*y) - sum(x)*sum(y)/n)/(sum(x*x) - sum(x)*sum(x)/n) intercept = alpha = (sum(y) - beta*sum(x))/n A similar approach could be used to calculate linear regression parameters using SQL aggregates. Sorry, I haven't tested this in great detail, but simulating a few cases in an Excel spreadsheet resulted in the same regression line that Excel produced.
How to run linear regression in a parallel/distributed way for big data setting?
As far as I understand, the formulas for the intercept and the slope in a simple linear regression model can be rewritten as expressions on various sums that don't contain the mean value, so that thes
How to run linear regression in a parallel/distributed way for big data setting? As far as I understand, the formulas for the intercept and the slope in a simple linear regression model can be rewritten as expressions on various sums that don't contain the mean value, so that these sums can be calculated in parallel during a map phase or similar: sum(x) sum(y) sum(x*x) sum(x*y) In a final phase that is done in a single instance, the actual regression is calculated: slope = beta = (sum(x*y) - sum(x)*sum(y)/n)/(sum(x*x) - sum(x)*sum(x)/n) intercept = alpha = (sum(y) - beta*sum(x))/n A similar approach could be used to calculate linear regression parameters using SQL aggregates. Sorry, I haven't tested this in great detail, but simulating a few cases in an Excel spreadsheet resulted in the same regression line that Excel produced.
How to run linear regression in a parallel/distributed way for big data setting? As far as I understand, the formulas for the intercept and the slope in a simple linear regression model can be rewritten as expressions on various sums that don't contain the mean value, so that thes
15,553
Are PCA components of multivariate Gaussian data statistically independent?
I will start with an intuitive demonstration. I generated $n=100$ observations (a) from a strongly non-Gaussian 2D distribution, and (b) from a 2D Gaussian distribution. In both cases I centered the data and performed the singular value decomposition $\mathbf X=\mathbf{USV}^\top$. Then for each case I made a scatter plot of the first two columns of $\mathbf U$, one against another. Note that it is usually columns of $\mathbf{US}$ that are called "principal components" (PCs); columns of $\mathbf U$ are PCs scaled to have unit norm; still, in this answer I am focusing on columns of $\mathbf U$. Here are the scatter-plots: I think that statements such as "PCA components are uncorrelated" or "PCA components are dependent/independent" are usually made about one specific sample matrix $\mathbf X$ and refer to the correlations/dependencies across rows (see e.g. @ttnphns's answer here). PCA yields a transformed data matrix $\mathbf U$, where rows are observations and columns are PC variables. I.e. we can see $\mathbf U$ as a sample, and ask what is the sample correlation between PC variables. This sample correlation matrix is of course given by $\mathbf U^\top \mathbf U=\mathbf I$, meaning that the sample correlations between PC variables are zero. This is what people mean when they say that "PCA diagonalizes the covariance matrix", etc. Conclusion 1: in PCA coordinates, any data have zero correlation. This is true for the both scatterplots above. However, it is immediately obvious that the two PC variables $x$ and $y$ on the left (non-Gaussian) scatterplot are not independent; even though they have zero correlation, they are strongly dependent and in fact related by a $y\approx a(x-b)^2$. And indeed, it is well-known that uncorrelated does not mean independent. On the contrary, the two PC variables $x$ and $y$ on the right (Gaussian) scatterplot seem to be "pretty much independent". Computing mutual information between them (which is a measure of statistical dependence: independent variables have zero mutual information) by any standard algorithm will yield a value very close to zero. It will not be exactly zero, because it is never exactly zero for any finite sample size (unless fine-tuned); moreover, there are various methods to compute mutual information of two samples, giving slightly different answers. But we can expect that any method will yield an estimate of mutual information that is very close to zero. Conclusion 2: in PCA coordinates, Gaussian data are "pretty much independent", meaning that standard estimates of dependency will be around zero. The question, however, is more tricky, as shown by the long chain of comments. Indeed, @whuber rightly points out that PCA variables $x$ and $y$ (columns of $\mathbf U$) must be statistically dependent: the columns have to be of unit length and have to be orthogonal, and this introduces a dependency. E.g. if some value in the first column is equal to $1$, then the corresponding value in the second column must be $0$. This is true, but is only practically relevant for very small $n$, such as e.g. $n=3$ (with $n=2$ after centering there is only one PC). For any reasonable sample size, such as $n=100$ shown on my figure above, the effect of the dependency will be negligible; columns of $\mathbf U$ are (scaled) projections of Gaussian data, so they are also Gaussian, which makes it practically impossible for one value to be close to $1$ (this would require all other $n-1$ elements to be close to $0$, which is hardly a Gaussian distribution). Conclusion 3: strictly speaking, for any finite $n$, Gaussian data in PCA coordinates are dependent; however, this dependency is practically irrelevant for any $n\gg 1$. We can make this precise by considering what happens in the limit of $n \to \infty$. In the limit of infinite sample size, the sample covariance matrix is equal to the population covariance matrix $\mathbf \Sigma$. So if the data vector $X$ is sampled from $\vec X \sim \mathcal N(0,\boldsymbol \Sigma)$, then the PC variables are $\vec Y = \Lambda^{-1/2}V^\top \vec X/(n-1)$ (where $\Lambda$ and $V$ are eigenvalues and eigenvectors of $\boldsymbol \Sigma$) and $\vec Y \sim \mathcal N(0, \mathbf I/(n-1))$. I.e. PC variables come from a multivariate Gaussian with diagonal covariance. But any multivariate Gaussian with diagonal covariance matrix decomposes into a product of univariate Gaussians, and this is the definition of statistical independence: \begin{align} \mathcal N(\mathbf 0,\mathrm{diag}(\sigma^2_i)) &= \frac{1}{(2\pi)^{k/2} \det(\mathrm{diag}(\sigma^2_i))^{1/2}} \exp\left[-\mathbf x^\top \mathrm{diag}(\sigma^2_i) \mathbf x/2\right]\\&=\frac{1}{(2\pi)^{k/2} (\prod_{i=1}^k \sigma_i^2)^{1/2}} \exp\left[-\sum_{i=1}^k \sigma^2_i x_i^2/2\right] \\&=\prod\frac{1}{(2\pi)^{1/2}\sigma_i} \exp\left[-\sigma_i^2 x^2_i/2\right] \\&= \prod \mathcal N(0,\sigma^2_i). \end{align} Conclusion 4: asymptotically ($n \to \infty$) PC variables of Gaussian data are statistically independent as random variables, and sample mutual information will give the population value zero. I should note that it is possible to understand this question differently (see comments by @whuber): to consider the whole matrix $\mathbf U$ a random variable (obtained from the random matrix $\mathbf X$ via a specific operation) and ask if any two specific elements $U_{ij}$ and $U_{kl}$ from two different columns are statistically independent across different draws of $\mathbf X$. We explored this question in this later thread. Here are all four interim conclusions from above: In PCA coordinates, any data have zero correlation. In PCA coordinates, Gaussian data are "pretty much independent", meaning that standard estimates of dependency will be around zero. Strictly speaking, for any finite $n$, Gaussian data in PCA coordinates are dependent; however, this dependency is practically irrelevant for any $n\gg 1$. Asymptotically ($n \to \infty$) PC variables of Gaussian data are statistically independent as random variables, and sample mutual information will give the population value zero.
Are PCA components of multivariate Gaussian data statistically independent?
I will start with an intuitive demonstration. I generated $n=100$ observations (a) from a strongly non-Gaussian 2D distribution, and (b) from a 2D Gaussian distribution. In both cases I centered the d
Are PCA components of multivariate Gaussian data statistically independent? I will start with an intuitive demonstration. I generated $n=100$ observations (a) from a strongly non-Gaussian 2D distribution, and (b) from a 2D Gaussian distribution. In both cases I centered the data and performed the singular value decomposition $\mathbf X=\mathbf{USV}^\top$. Then for each case I made a scatter plot of the first two columns of $\mathbf U$, one against another. Note that it is usually columns of $\mathbf{US}$ that are called "principal components" (PCs); columns of $\mathbf U$ are PCs scaled to have unit norm; still, in this answer I am focusing on columns of $\mathbf U$. Here are the scatter-plots: I think that statements such as "PCA components are uncorrelated" or "PCA components are dependent/independent" are usually made about one specific sample matrix $\mathbf X$ and refer to the correlations/dependencies across rows (see e.g. @ttnphns's answer here). PCA yields a transformed data matrix $\mathbf U$, where rows are observations and columns are PC variables. I.e. we can see $\mathbf U$ as a sample, and ask what is the sample correlation between PC variables. This sample correlation matrix is of course given by $\mathbf U^\top \mathbf U=\mathbf I$, meaning that the sample correlations between PC variables are zero. This is what people mean when they say that "PCA diagonalizes the covariance matrix", etc. Conclusion 1: in PCA coordinates, any data have zero correlation. This is true for the both scatterplots above. However, it is immediately obvious that the two PC variables $x$ and $y$ on the left (non-Gaussian) scatterplot are not independent; even though they have zero correlation, they are strongly dependent and in fact related by a $y\approx a(x-b)^2$. And indeed, it is well-known that uncorrelated does not mean independent. On the contrary, the two PC variables $x$ and $y$ on the right (Gaussian) scatterplot seem to be "pretty much independent". Computing mutual information between them (which is a measure of statistical dependence: independent variables have zero mutual information) by any standard algorithm will yield a value very close to zero. It will not be exactly zero, because it is never exactly zero for any finite sample size (unless fine-tuned); moreover, there are various methods to compute mutual information of two samples, giving slightly different answers. But we can expect that any method will yield an estimate of mutual information that is very close to zero. Conclusion 2: in PCA coordinates, Gaussian data are "pretty much independent", meaning that standard estimates of dependency will be around zero. The question, however, is more tricky, as shown by the long chain of comments. Indeed, @whuber rightly points out that PCA variables $x$ and $y$ (columns of $\mathbf U$) must be statistically dependent: the columns have to be of unit length and have to be orthogonal, and this introduces a dependency. E.g. if some value in the first column is equal to $1$, then the corresponding value in the second column must be $0$. This is true, but is only practically relevant for very small $n$, such as e.g. $n=3$ (with $n=2$ after centering there is only one PC). For any reasonable sample size, such as $n=100$ shown on my figure above, the effect of the dependency will be negligible; columns of $\mathbf U$ are (scaled) projections of Gaussian data, so they are also Gaussian, which makes it practically impossible for one value to be close to $1$ (this would require all other $n-1$ elements to be close to $0$, which is hardly a Gaussian distribution). Conclusion 3: strictly speaking, for any finite $n$, Gaussian data in PCA coordinates are dependent; however, this dependency is practically irrelevant for any $n\gg 1$. We can make this precise by considering what happens in the limit of $n \to \infty$. In the limit of infinite sample size, the sample covariance matrix is equal to the population covariance matrix $\mathbf \Sigma$. So if the data vector $X$ is sampled from $\vec X \sim \mathcal N(0,\boldsymbol \Sigma)$, then the PC variables are $\vec Y = \Lambda^{-1/2}V^\top \vec X/(n-1)$ (where $\Lambda$ and $V$ are eigenvalues and eigenvectors of $\boldsymbol \Sigma$) and $\vec Y \sim \mathcal N(0, \mathbf I/(n-1))$. I.e. PC variables come from a multivariate Gaussian with diagonal covariance. But any multivariate Gaussian with diagonal covariance matrix decomposes into a product of univariate Gaussians, and this is the definition of statistical independence: \begin{align} \mathcal N(\mathbf 0,\mathrm{diag}(\sigma^2_i)) &= \frac{1}{(2\pi)^{k/2} \det(\mathrm{diag}(\sigma^2_i))^{1/2}} \exp\left[-\mathbf x^\top \mathrm{diag}(\sigma^2_i) \mathbf x/2\right]\\&=\frac{1}{(2\pi)^{k/2} (\prod_{i=1}^k \sigma_i^2)^{1/2}} \exp\left[-\sum_{i=1}^k \sigma^2_i x_i^2/2\right] \\&=\prod\frac{1}{(2\pi)^{1/2}\sigma_i} \exp\left[-\sigma_i^2 x^2_i/2\right] \\&= \prod \mathcal N(0,\sigma^2_i). \end{align} Conclusion 4: asymptotically ($n \to \infty$) PC variables of Gaussian data are statistically independent as random variables, and sample mutual information will give the population value zero. I should note that it is possible to understand this question differently (see comments by @whuber): to consider the whole matrix $\mathbf U$ a random variable (obtained from the random matrix $\mathbf X$ via a specific operation) and ask if any two specific elements $U_{ij}$ and $U_{kl}$ from two different columns are statistically independent across different draws of $\mathbf X$. We explored this question in this later thread. Here are all four interim conclusions from above: In PCA coordinates, any data have zero correlation. In PCA coordinates, Gaussian data are "pretty much independent", meaning that standard estimates of dependency will be around zero. Strictly speaking, for any finite $n$, Gaussian data in PCA coordinates are dependent; however, this dependency is practically irrelevant for any $n\gg 1$. Asymptotically ($n \to \infty$) PC variables of Gaussian data are statistically independent as random variables, and sample mutual information will give the population value zero.
Are PCA components of multivariate Gaussian data statistically independent? I will start with an intuitive demonstration. I generated $n=100$ observations (a) from a strongly non-Gaussian 2D distribution, and (b) from a 2D Gaussian distribution. In both cases I centered the d
15,554
Understanding bootstrapping for validation and model selection
First you have to decide if you really need model selection, or you just need to model. In the majority of situations, depending on dimensionality, fitting a flexible comprehensive model is preferred. The bootstrap is a great way to estimate the performance of a model. The simplest thing to estimate is variance. More to your original point, the bootstrap can estimate the likely future performance of a given modeling procedure, on new data not yet realized. If using resampling (bootstrap or cross-validation) to both choose model tuning parameters and to estimate the model, you will need a double bootstrap or nested cross-validation. In general the bootstrap requires fewer model fits (often around 300) than cross-validation (10-fold cross-validation should be repeated 50-100 times for stability). Some simulation studies may be found at http://biostat.mc.vanderbilt.edu/rms
Understanding bootstrapping for validation and model selection
First you have to decide if you really need model selection, or you just need to model. In the majority of situations, depending on dimensionality, fitting a flexible comprehensive model is preferred
Understanding bootstrapping for validation and model selection First you have to decide if you really need model selection, or you just need to model. In the majority of situations, depending on dimensionality, fitting a flexible comprehensive model is preferred. The bootstrap is a great way to estimate the performance of a model. The simplest thing to estimate is variance. More to your original point, the bootstrap can estimate the likely future performance of a given modeling procedure, on new data not yet realized. If using resampling (bootstrap or cross-validation) to both choose model tuning parameters and to estimate the model, you will need a double bootstrap or nested cross-validation. In general the bootstrap requires fewer model fits (often around 300) than cross-validation (10-fold cross-validation should be repeated 50-100 times for stability). Some simulation studies may be found at http://biostat.mc.vanderbilt.edu/rms
Understanding bootstrapping for validation and model selection First you have to decide if you really need model selection, or you just need to model. In the majority of situations, depending on dimensionality, fitting a flexible comprehensive model is preferred
15,555
Understanding bootstrapping for validation and model selection
Consider using the bootstrap for model averaging. The paper below could help, as it compares a bootstrap model averaging approach to (the more commonly used?) Bayesian modeling averaging, and lays out a recipe for performing the model averaging. Bootstrap model averaging in time series studies of particulate matter air pollution and mortality
Understanding bootstrapping for validation and model selection
Consider using the bootstrap for model averaging. The paper below could help, as it compares a bootstrap model averaging approach to (the more commonly used?) Bayesian modeling averaging, and lays out
Understanding bootstrapping for validation and model selection Consider using the bootstrap for model averaging. The paper below could help, as it compares a bootstrap model averaging approach to (the more commonly used?) Bayesian modeling averaging, and lays out a recipe for performing the model averaging. Bootstrap model averaging in time series studies of particulate matter air pollution and mortality
Understanding bootstrapping for validation and model selection Consider using the bootstrap for model averaging. The paper below could help, as it compares a bootstrap model averaging approach to (the more commonly used?) Bayesian modeling averaging, and lays out
15,556
When to check model assumptions
Some general observations: First, we tend to spend a lot of time using non-robust models when there are many robust options that have equal or greater statistical power. Semiparametric (ordinal) regression for continuous Y is one class of model that is not used often enough. Such models (e.g., the proportional odds model) do not depend on how Y is transformed (as long as the transformation is rank-preserving) and are not affected by outliers in Y (they have the same problems as parametric models with regard to outliers in X). Routine use of semiparametric models would result in fewer assumptions in need of checking. Second, goodness of fit needs to be judged against alternatives. What if a more flexible, well-fitting model requires many more parameters and the net effect is overfitting that makes predictions unreliable and/or makes confidence intervals too wide? Almost always, some kind of analysis is required, and the badness of fit of a proposed model should not rule the day, when the proposed alternative analysis is actually worse. On the second point, it is often more useful to think of assessment of goodness of fit in terms of a contest between the proposed model and a more general model. A fully worked out example is here. In that example the proposed model is a proportional odds model in which the effect of a treatment on lowering the odds that $Y\geq j$ is assumed to be the same for all $j$ save the lowest value. There are at least two alternative models: a partial proportional odds model that relaxes this assumption with respect to treatment, and a multinomial logistic model that relaxes the assumption with respect to all predictors. I cast model checking as a contest between these models and use two metrics for comparison: AIC and bootstrap confidence intervals for differences in predicted probabilities of various $Y=j$ from pairs of models. I also show formal likelihood ratio $\chi^2$ tests of goodness of fit by pairwise comparison of these three models. I show that there is a cost of not assuming proportional odds. The above setting is exactly analogous to comparing (1) a linear model with constant variance with (2) a linear model that allows the residual variance $\sigma^2$ to be a function of X. For continuous Y a very cogent approach in my view is to hope for a simple linear model but to allow for departures from that. A Bayesian model could put priors on the amount of variation of $\sigma^2$ and on the amount of non-normality of residuals. By tilting the model towards normal residuals and constant $\sigma^2$ but allowing for departures from those as the sample size allows, one obtains a general solution that does not require binary model choices. A simple example of this is the Bayesian $t$-test.
When to check model assumptions
Some general observations: First, we tend to spend a lot of time using non-robust models when there are many robust options that have equal or greater statistical power. Semiparametric (ordinal) regr
When to check model assumptions Some general observations: First, we tend to spend a lot of time using non-robust models when there are many robust options that have equal or greater statistical power. Semiparametric (ordinal) regression for continuous Y is one class of model that is not used often enough. Such models (e.g., the proportional odds model) do not depend on how Y is transformed (as long as the transformation is rank-preserving) and are not affected by outliers in Y (they have the same problems as parametric models with regard to outliers in X). Routine use of semiparametric models would result in fewer assumptions in need of checking. Second, goodness of fit needs to be judged against alternatives. What if a more flexible, well-fitting model requires many more parameters and the net effect is overfitting that makes predictions unreliable and/or makes confidence intervals too wide? Almost always, some kind of analysis is required, and the badness of fit of a proposed model should not rule the day, when the proposed alternative analysis is actually worse. On the second point, it is often more useful to think of assessment of goodness of fit in terms of a contest between the proposed model and a more general model. A fully worked out example is here. In that example the proposed model is a proportional odds model in which the effect of a treatment on lowering the odds that $Y\geq j$ is assumed to be the same for all $j$ save the lowest value. There are at least two alternative models: a partial proportional odds model that relaxes this assumption with respect to treatment, and a multinomial logistic model that relaxes the assumption with respect to all predictors. I cast model checking as a contest between these models and use two metrics for comparison: AIC and bootstrap confidence intervals for differences in predicted probabilities of various $Y=j$ from pairs of models. I also show formal likelihood ratio $\chi^2$ tests of goodness of fit by pairwise comparison of these three models. I show that there is a cost of not assuming proportional odds. The above setting is exactly analogous to comparing (1) a linear model with constant variance with (2) a linear model that allows the residual variance $\sigma^2$ to be a function of X. For continuous Y a very cogent approach in my view is to hope for a simple linear model but to allow for departures from that. A Bayesian model could put priors on the amount of variation of $\sigma^2$ and on the amount of non-normality of residuals. By tilting the model towards normal residuals and constant $\sigma^2$ but allowing for departures from those as the sample size allows, one obtains a general solution that does not require binary model choices. A simple example of this is the Bayesian $t$-test.
When to check model assumptions Some general observations: First, we tend to spend a lot of time using non-robust models when there are many robust options that have equal or greater statistical power. Semiparametric (ordinal) regr
15,557
When to check model assumptions
Some remarks: Model assumptions are never fulfilled in reality, and there is therefore no way to make sure or even check that they are fulfilled. The correct question is not whether model assumptions are fulfilled, but rather whether violations of the model assumptions can be suspected that mislead the interpretation of the results. Note that standard model misspecification tests are not always good at assessing this. Of course this depends on knowledge about what kinds of violations of the model assumptions have what kind of impact. Regarding standard ANOVA, extreme outliers are known to be harmful; skewness may make inference based on means questionable; difference in variances in the first place raises the question how to interpret the obviously existing differences between groups if differences in variance are much clearer and more characteristic of the situation than differences in means. Some literature suggests that what impact heteroscedasticity has and how much of a problem it is depends on the group sizes and whether bigger variance occurs in a smaller or larger group. Mild violations of these model assumptions are very often harmless in that characteristics of the test behaviour are not affected much. Also, with larger numbers of observations, the Central Limit Theorem will justify the application of normal theory for most non-normal distributions. Dependence between observations though can very often be harmful and should be modelled if it is clear enough to be detected. Note that dependence is as much a problem for any non-parametric, robust, or "model-free" alternatives to ANOVA as for standard ANOVA. Note also (example given in the preprint) that there are situations in which standard ANOVA is better than robust/non-parametric alternatives even if standard ANOVA model assumptions are violated whereas non-parametric assumptions hold (this may happen for example for lighter tailed distributions than the normal)! This is because parametric theory is often concerned about optimality (which is lost in theory if assumptions are not met, but the parametric method can still be rather good), whereas nonparametric and robust theory are often concerned about general minimum/worst case quality assurances, which means that these methods, even though legitimate, may not be particularly good in some cases even where their assumptions are fulfilled. This isn't always the case: there are situations in which standard ANOVA breaks down and nonparametric/robust alternatives are much better, particularly with outliers. Robust methods may be slightly better than standard ANOVA in case of heteroscedasticity but nonparametric alternatives such as Kruskal-Wallis or permutation testing may not (I'm actually not sure, not even whether this has been investigated in detail; the last statement is rather my intuition). Permutation tests will also still be affected by outliers as long as their test statistic is non-robust! The message here is that nonparametric/robust/"model free" approaches are not a silver bullet. Technically (as also mentioned in our paper which is cited as "this preprint" in the question) applying misspecification tests, and then running an ANOVA on the same data conditionally on not having rejected model assumptions will invalidate the standard ANOVA-tests as correctly written in a comment by @rep_ho. This is due to the "misspecification paradox": see https://stats.stackexchange.com/a/592495/247165 Advice by @Björn is good to test model assumptions on independent (hopefully equally distributed) data where possible. Note also that this problem does apply not only to formal misspecification testing, but also to looking at data visualisation (of the same data) and making decisions about whether to run the standard ANOVA dependent on these visualisations. However, given that model assumptions never hold anyway, violation of assumptions due to the misspecification paradox is usually preferable to leaving some bigger problems undetected because of not checking the model assumptions. There are even some situations in which one can show that misspecification testing will not affect the characteristics of the later ANOVA in case the assumed model held before misspecification testing, namely where the misspecification test is independent of the finally used statistic. This happens for example when running misspecification tests on only the residuals in the linear model, and then running a standard normality-based test only if normality is not rejected. Generally the formal impact of misspecification testing and looking at data will be small under the assumed model if fulfilled assumptions are rejected with low probability, i.e., testing at low level, or, when looking at the data, really only rejecting the model if violations are clear and strong. Now getting to recommendations what to do actually, I don't have a general recipe. When doing consultation, whatever I do or advise will depend on all available background information about the subject matter and aim of the study. This concerns for example the question whether the mean is an appropriate good statistic to summarise group-wise results in case of skewness or heteroscedasticity. It also concerns potential consequences of type I and type II errors (outliers will not normally cause type I errors, but can increase the probability of type II errors big time), and more generally how "strongly" results will be interpreted. The first thing to do is always, if possible before having seen the data, to think about potentially harmful model assumption violations that could occur in the given situation. Are potential sources for dependence known? These should then be modelled or people should think hard about methods for data gathering where these problems don't occur. Dependence can be harmful, even in cases where it is hard or impossible to detect from the data! See https://arxiv.org/abs/2108.09227. Also if I know in advance that outliers can be expected to occur for this kind of data, I'd use something robust or nonparametric. On the other hand, there are situations in which the occurrence of outliers can be ruled out because the value range of outcomes is limited, and it can also with good reasons be expected that there is enough variation that not almost all observations concentrate on one side of the scale (in which case stray observations on the other side could still be seen as outliers). I'm a curious person and just the fact that a certain test or check rejects the model assumption wouldn't stop me from running a method that uses this assumption if I'd have used it otherwise. For a number of checks (based on residuals) this is necessary anyway. If I don't have any indication before seeing the data against standard ANOVA (see above), I'd run it. (Obviously "legal" and procedural concerns such as pre-registration have to be taken into account.) I'd also look at visual model diagnostics. I don't necessarily use formal misspecification tests because given the earlier discussion I know what kind of deviations from the model I look for, and misspecification tests don't know that. However, somebody with less experience and knowledge about these things will often do better running a formal misspecification test than not doing anything at all; also regularly running misspecification tests and comparing them with the visual impression gives us experience about what kind of apparent deviations from the model can still be compatible with random variation. So I run misspecification tests for informing my intuition rather than for making formal decisions about how to proceed. Anyway, such diagnostics may or may not prompt me to run a nonparametric or robust alternative on top of the standard ANOVA rather than "instead". Most importantly, I will also look at the raw data and boxplots. The question that I ask here is not in the first place "are the model assumptions violated?" (That's anyway the case.) Rather I ask: "Do I get the impression that the message from looking at the data about group differences is in line with what my tests say?" If yes, I can interpret the test results with some confidence (also possibly confirmed by the observation that standard ANOVA and an alternative approach convey the same message). If not I try to understand exactly how the data led the tests astray (or how my intuition went wrong - this may happen, too), and I may then explain both what I see and why one or more test results are not in line with it. (This can also concern meaningless significant results because of a so large sample that a meaninglessly small effect came out significant; or on the other hand insignificance even if a too small sample visually suggests differences between groups. Obviously one should also look at effect sizes and confidence intervals.) Overall I'm probably closest to option 2 in the list in the question.
When to check model assumptions
Some remarks: Model assumptions are never fulfilled in reality, and there is therefore no way to make sure or even check that they are fulfilled. The correct question is not whether model assumptions
When to check model assumptions Some remarks: Model assumptions are never fulfilled in reality, and there is therefore no way to make sure or even check that they are fulfilled. The correct question is not whether model assumptions are fulfilled, but rather whether violations of the model assumptions can be suspected that mislead the interpretation of the results. Note that standard model misspecification tests are not always good at assessing this. Of course this depends on knowledge about what kinds of violations of the model assumptions have what kind of impact. Regarding standard ANOVA, extreme outliers are known to be harmful; skewness may make inference based on means questionable; difference in variances in the first place raises the question how to interpret the obviously existing differences between groups if differences in variance are much clearer and more characteristic of the situation than differences in means. Some literature suggests that what impact heteroscedasticity has and how much of a problem it is depends on the group sizes and whether bigger variance occurs in a smaller or larger group. Mild violations of these model assumptions are very often harmless in that characteristics of the test behaviour are not affected much. Also, with larger numbers of observations, the Central Limit Theorem will justify the application of normal theory for most non-normal distributions. Dependence between observations though can very often be harmful and should be modelled if it is clear enough to be detected. Note that dependence is as much a problem for any non-parametric, robust, or "model-free" alternatives to ANOVA as for standard ANOVA. Note also (example given in the preprint) that there are situations in which standard ANOVA is better than robust/non-parametric alternatives even if standard ANOVA model assumptions are violated whereas non-parametric assumptions hold (this may happen for example for lighter tailed distributions than the normal)! This is because parametric theory is often concerned about optimality (which is lost in theory if assumptions are not met, but the parametric method can still be rather good), whereas nonparametric and robust theory are often concerned about general minimum/worst case quality assurances, which means that these methods, even though legitimate, may not be particularly good in some cases even where their assumptions are fulfilled. This isn't always the case: there are situations in which standard ANOVA breaks down and nonparametric/robust alternatives are much better, particularly with outliers. Robust methods may be slightly better than standard ANOVA in case of heteroscedasticity but nonparametric alternatives such as Kruskal-Wallis or permutation testing may not (I'm actually not sure, not even whether this has been investigated in detail; the last statement is rather my intuition). Permutation tests will also still be affected by outliers as long as their test statistic is non-robust! The message here is that nonparametric/robust/"model free" approaches are not a silver bullet. Technically (as also mentioned in our paper which is cited as "this preprint" in the question) applying misspecification tests, and then running an ANOVA on the same data conditionally on not having rejected model assumptions will invalidate the standard ANOVA-tests as correctly written in a comment by @rep_ho. This is due to the "misspecification paradox": see https://stats.stackexchange.com/a/592495/247165 Advice by @Björn is good to test model assumptions on independent (hopefully equally distributed) data where possible. Note also that this problem does apply not only to formal misspecification testing, but also to looking at data visualisation (of the same data) and making decisions about whether to run the standard ANOVA dependent on these visualisations. However, given that model assumptions never hold anyway, violation of assumptions due to the misspecification paradox is usually preferable to leaving some bigger problems undetected because of not checking the model assumptions. There are even some situations in which one can show that misspecification testing will not affect the characteristics of the later ANOVA in case the assumed model held before misspecification testing, namely where the misspecification test is independent of the finally used statistic. This happens for example when running misspecification tests on only the residuals in the linear model, and then running a standard normality-based test only if normality is not rejected. Generally the formal impact of misspecification testing and looking at data will be small under the assumed model if fulfilled assumptions are rejected with low probability, i.e., testing at low level, or, when looking at the data, really only rejecting the model if violations are clear and strong. Now getting to recommendations what to do actually, I don't have a general recipe. When doing consultation, whatever I do or advise will depend on all available background information about the subject matter and aim of the study. This concerns for example the question whether the mean is an appropriate good statistic to summarise group-wise results in case of skewness or heteroscedasticity. It also concerns potential consequences of type I and type II errors (outliers will not normally cause type I errors, but can increase the probability of type II errors big time), and more generally how "strongly" results will be interpreted. The first thing to do is always, if possible before having seen the data, to think about potentially harmful model assumption violations that could occur in the given situation. Are potential sources for dependence known? These should then be modelled or people should think hard about methods for data gathering where these problems don't occur. Dependence can be harmful, even in cases where it is hard or impossible to detect from the data! See https://arxiv.org/abs/2108.09227. Also if I know in advance that outliers can be expected to occur for this kind of data, I'd use something robust or nonparametric. On the other hand, there are situations in which the occurrence of outliers can be ruled out because the value range of outcomes is limited, and it can also with good reasons be expected that there is enough variation that not almost all observations concentrate on one side of the scale (in which case stray observations on the other side could still be seen as outliers). I'm a curious person and just the fact that a certain test or check rejects the model assumption wouldn't stop me from running a method that uses this assumption if I'd have used it otherwise. For a number of checks (based on residuals) this is necessary anyway. If I don't have any indication before seeing the data against standard ANOVA (see above), I'd run it. (Obviously "legal" and procedural concerns such as pre-registration have to be taken into account.) I'd also look at visual model diagnostics. I don't necessarily use formal misspecification tests because given the earlier discussion I know what kind of deviations from the model I look for, and misspecification tests don't know that. However, somebody with less experience and knowledge about these things will often do better running a formal misspecification test than not doing anything at all; also regularly running misspecification tests and comparing them with the visual impression gives us experience about what kind of apparent deviations from the model can still be compatible with random variation. So I run misspecification tests for informing my intuition rather than for making formal decisions about how to proceed. Anyway, such diagnostics may or may not prompt me to run a nonparametric or robust alternative on top of the standard ANOVA rather than "instead". Most importantly, I will also look at the raw data and boxplots. The question that I ask here is not in the first place "are the model assumptions violated?" (That's anyway the case.) Rather I ask: "Do I get the impression that the message from looking at the data about group differences is in line with what my tests say?" If yes, I can interpret the test results with some confidence (also possibly confirmed by the observation that standard ANOVA and an alternative approach convey the same message). If not I try to understand exactly how the data led the tests astray (or how my intuition went wrong - this may happen, too), and I may then explain both what I see and why one or more test results are not in line with it. (This can also concern meaningless significant results because of a so large sample that a meaninglessly small effect came out significant; or on the other hand insignificance even if a too small sample visually suggests differences between groups. Obviously one should also look at effect sizes and confidence intervals.) Overall I'm probably closest to option 2 in the list in the question.
When to check model assumptions Some remarks: Model assumptions are never fulfilled in reality, and there is therefore no way to make sure or even check that they are fulfilled. The correct question is not whether model assumptions
15,558
When to check model assumptions
It's useful to distinguish different scenarios. In the first scenario, strict type I error control, as well as pre-specification (otherwise the first is hard to imagine), are required. E.g. think of a randomized Phase III trial for a new drug. In this scenario, you would check your assumptions before you even run your trial using data that is as relevant as possible. Because it is well known that switching analysis methods based on some pre-tests (e.g. for normality*) leads to some type I error inflation (and other issues), you would not do an analysis strategy where you only check assumptions and determine your analysis method based on that (even if you could pre-specify the conditions and how it influences the analysis). Of course, certain small deviations can be looked at and judged to be somewhat irrelevant (e.g. there's a reason why things like blood pressure are usually analyzed using linear regression with a baseline value in the model, even though we know the model cannot be precisely true since blood pressure cannot be negative) and ignored, because many models are very robust to mild deviations. On the other hand, for other situations some appropriate re-medial actions are needed (e.g. we know it's much better to log-transform urine albumin-creatine ratios than to analyze untransformed values). Many scientific investigations fall into this first category, even if they are not as tightly regulated as drug trials or overseen by regulatory bodies. However, very often we have a clear up-front plan and relevant similar data are available and allow us to check our assumptions to a sufficient degree that assumption checking on the actual data is usually more or less a waste of time. The second setting is when things are completely new, we are trying out new measurement methods, trying to understand something about a new system (or how a new drug behaves in the human body) and so on. In this setting, there may just not be anything similar we can base reliable assumptions on. Here, we may have to be quite flexible and explore a good bit. However, then we should also not sell this as a definite confirmatory experiment. That's why some larger definite experiments have pilot parts to be able to make assumptions. The third setting is the most difficult: When you don't know for sure whether you are in the first or the second setting, because there's some data/prior knowledge that may or may not be relevant and/or may be ambiguous and/or something might turn out to be very different (e.g. the first immuno-Oncology treatments with delayed treatment effects). However, it's very hard to say something general about these situations. * Based on the discussion under another post, here's an illustration of the pre-test for normality using only residuals causing type I error inflation. library(tidyverse) set.seed(1234) corrs <- map_dfr(1:1000000, function(x){ sim_data <- tibble(y=rnorm(n=50), x=rbernoulli(n=50, p=0.5)) lmfit <- lm(y~1+x, data=sim_data) wtres <- wilcox.test(sim_data$y[sim_data$x==0], sim_data$y[sim_data$x==1]) data.frame(test_statistic = summary(lmfit)$coeff["xTRUE", "t value"], lm_pval = summary(lmfit)$coeff["xTRUE", "Pr(>|t|)"], wt_pval = wtres$p.value, shapiro_wilk_pval = shapiro.test(lmfit$residuals)$p.value) }) corrs %>% mutate(conditional = ifelse(shapiro_wilk_pval<=0.1, wt_pval, lm_pval), signif1 = (lm_pval<=0.05), signif2 = (wt_pval<=0.05), signif3 = (conditional<=0.05)) %>% summarize(lm_lcl = qbeta(0.025, sum(signif1), 1+length(signif1)-sum(signif1)), lm_ucl = qbeta(0.975, 1+sum(signif1), length(signif1)-sum(signif1)), wilcox_lcl = qbeta(0.025, sum(signif2), 1+length(signif2)-sum(signif2)), wilcox_ucl = qbeta(0.975, 1+sum(signif2), length(signif2)-sum(signif2)), cond_lcl = qbeta(0.025, sum(signif3), 1+length(signif3)-sum(signif3)), cond_ucl = qbeta(0.975, 1+sum(signif3), length(signif3)-sum(signif3))) This gives this result for tests with a nominal level of 0.05 showing a type I error inflation when doing a pre-test for normality. Analysis method Clopper-Pearson confidence interval for type I error rate Linear model 0.0495 to 0.0503 two-sample Wilcoxon aka Mann-Whitney test 0.0482 to 0.0490 Conditional (switch to Wilcoxon if Shapiro-Wilk test of normality of residuals has p-value<=0.1 0.0512 to 0.0521
When to check model assumptions
It's useful to distinguish different scenarios. In the first scenario, strict type I error control, as well as pre-specification (otherwise the first is hard to imagine), are required. E.g. think of a
When to check model assumptions It's useful to distinguish different scenarios. In the first scenario, strict type I error control, as well as pre-specification (otherwise the first is hard to imagine), are required. E.g. think of a randomized Phase III trial for a new drug. In this scenario, you would check your assumptions before you even run your trial using data that is as relevant as possible. Because it is well known that switching analysis methods based on some pre-tests (e.g. for normality*) leads to some type I error inflation (and other issues), you would not do an analysis strategy where you only check assumptions and determine your analysis method based on that (even if you could pre-specify the conditions and how it influences the analysis). Of course, certain small deviations can be looked at and judged to be somewhat irrelevant (e.g. there's a reason why things like blood pressure are usually analyzed using linear regression with a baseline value in the model, even though we know the model cannot be precisely true since blood pressure cannot be negative) and ignored, because many models are very robust to mild deviations. On the other hand, for other situations some appropriate re-medial actions are needed (e.g. we know it's much better to log-transform urine albumin-creatine ratios than to analyze untransformed values). Many scientific investigations fall into this first category, even if they are not as tightly regulated as drug trials or overseen by regulatory bodies. However, very often we have a clear up-front plan and relevant similar data are available and allow us to check our assumptions to a sufficient degree that assumption checking on the actual data is usually more or less a waste of time. The second setting is when things are completely new, we are trying out new measurement methods, trying to understand something about a new system (or how a new drug behaves in the human body) and so on. In this setting, there may just not be anything similar we can base reliable assumptions on. Here, we may have to be quite flexible and explore a good bit. However, then we should also not sell this as a definite confirmatory experiment. That's why some larger definite experiments have pilot parts to be able to make assumptions. The third setting is the most difficult: When you don't know for sure whether you are in the first or the second setting, because there's some data/prior knowledge that may or may not be relevant and/or may be ambiguous and/or something might turn out to be very different (e.g. the first immuno-Oncology treatments with delayed treatment effects). However, it's very hard to say something general about these situations. * Based on the discussion under another post, here's an illustration of the pre-test for normality using only residuals causing type I error inflation. library(tidyverse) set.seed(1234) corrs <- map_dfr(1:1000000, function(x){ sim_data <- tibble(y=rnorm(n=50), x=rbernoulli(n=50, p=0.5)) lmfit <- lm(y~1+x, data=sim_data) wtres <- wilcox.test(sim_data$y[sim_data$x==0], sim_data$y[sim_data$x==1]) data.frame(test_statistic = summary(lmfit)$coeff["xTRUE", "t value"], lm_pval = summary(lmfit)$coeff["xTRUE", "Pr(>|t|)"], wt_pval = wtres$p.value, shapiro_wilk_pval = shapiro.test(lmfit$residuals)$p.value) }) corrs %>% mutate(conditional = ifelse(shapiro_wilk_pval<=0.1, wt_pval, lm_pval), signif1 = (lm_pval<=0.05), signif2 = (wt_pval<=0.05), signif3 = (conditional<=0.05)) %>% summarize(lm_lcl = qbeta(0.025, sum(signif1), 1+length(signif1)-sum(signif1)), lm_ucl = qbeta(0.975, 1+sum(signif1), length(signif1)-sum(signif1)), wilcox_lcl = qbeta(0.025, sum(signif2), 1+length(signif2)-sum(signif2)), wilcox_ucl = qbeta(0.975, 1+sum(signif2), length(signif2)-sum(signif2)), cond_lcl = qbeta(0.025, sum(signif3), 1+length(signif3)-sum(signif3)), cond_ucl = qbeta(0.975, 1+sum(signif3), length(signif3)-sum(signif3))) This gives this result for tests with a nominal level of 0.05 showing a type I error inflation when doing a pre-test for normality. Analysis method Clopper-Pearson confidence interval for type I error rate Linear model 0.0495 to 0.0503 two-sample Wilcoxon aka Mann-Whitney test 0.0482 to 0.0490 Conditional (switch to Wilcoxon if Shapiro-Wilk test of normality of residuals has p-value<=0.1 0.0512 to 0.0521
When to check model assumptions It's useful to distinguish different scenarios. In the first scenario, strict type I error control, as well as pre-specification (otherwise the first is hard to imagine), are required. E.g. think of a
15,559
Universal approximation theorem for convolutional networks
It seems this question has been answered in the affirmative in this recent article by Dmitry Yarotsky: Universal approximations of invariant maps by neural networks. The article shows that any translation equivariant function can be approximated arbitrarily well by a convolutional neural network given that it is sufficiently wide, in direct analogy to the classical universal approximation theorem.
Universal approximation theorem for convolutional networks
It seems this question has been answered in the affirmative in this recent article by Dmitry Yarotsky: Universal approximations of invariant maps by neural networks. The article shows that any transla
Universal approximation theorem for convolutional networks It seems this question has been answered in the affirmative in this recent article by Dmitry Yarotsky: Universal approximations of invariant maps by neural networks. The article shows that any translation equivariant function can be approximated arbitrarily well by a convolutional neural network given that it is sufficiently wide, in direct analogy to the classical universal approximation theorem.
Universal approximation theorem for convolutional networks It seems this question has been answered in the affirmative in this recent article by Dmitry Yarotsky: Universal approximations of invariant maps by neural networks. The article shows that any transla
15,560
Universal approximation theorem for convolutional networks
This is an interesting question, however, it does lack a proper clarification what is considered a convolutional neural network. Is the only requirement that the network has to include a convolution operation? Does it have to only include convolution operations? Are pooling operations admitted? Convolutional networks used in practice use a combination of operations, often including fully connected layers (as soon as you have a fully connected layers, you have theoretical universal approximation ability). To provide you with some answer, consider the following case: A fully connected layer with $D$ inputs and $K$ outputs is realized using a weight matrix $W \in \mathbb R ^{K\times D} $. You can simulate this operation using 2 convolution layers: The first one has $K\times D$ filters of shape $D$. Element $d$ of filter $k,d$ is equal to $W_{k,d}$, the rest are zeros. This layer transforms the input into $KD$-dimensional intermediate space where every dimension represents a product of a weight and its corresponding input. The second layer contains $K$ filters of shape $KD$. Elements $kD\ldots(k+1)D$ of filter $k$ are ones, the rest are zeros. This layer performs the summation of products from the previous layer. Such convolutional network simulates a fully connected network and thus has the same universal approximation capabilities. It is up to you to consider how useful such an example is in practice, but I hope it answers your question.
Universal approximation theorem for convolutional networks
This is an interesting question, however, it does lack a proper clarification what is considered a convolutional neural network. Is the only requirement that the network has to include a convolution o
Universal approximation theorem for convolutional networks This is an interesting question, however, it does lack a proper clarification what is considered a convolutional neural network. Is the only requirement that the network has to include a convolution operation? Does it have to only include convolution operations? Are pooling operations admitted? Convolutional networks used in practice use a combination of operations, often including fully connected layers (as soon as you have a fully connected layers, you have theoretical universal approximation ability). To provide you with some answer, consider the following case: A fully connected layer with $D$ inputs and $K$ outputs is realized using a weight matrix $W \in \mathbb R ^{K\times D} $. You can simulate this operation using 2 convolution layers: The first one has $K\times D$ filters of shape $D$. Element $d$ of filter $k,d$ is equal to $W_{k,d}$, the rest are zeros. This layer transforms the input into $KD$-dimensional intermediate space where every dimension represents a product of a weight and its corresponding input. The second layer contains $K$ filters of shape $KD$. Elements $kD\ldots(k+1)D$ of filter $k$ are ones, the rest are zeros. This layer performs the summation of products from the previous layer. Such convolutional network simulates a fully connected network and thus has the same universal approximation capabilities. It is up to you to consider how useful such an example is in practice, but I hope it answers your question.
Universal approximation theorem for convolutional networks This is an interesting question, however, it does lack a proper clarification what is considered a convolutional neural network. Is the only requirement that the network has to include a convolution o
15,561
Universal approximation theorem for convolutional networks
See the paper Universality of Deep Convolutional Neural Networks by Ding-Xuan Zhou, who shows that convolutional neural networks are universal, that is, they can approximate any continuous function to an arbitrary accuracy when the depth of the neural network is large enough.
Universal approximation theorem for convolutional networks
See the paper Universality of Deep Convolutional Neural Networks by Ding-Xuan Zhou, who shows that convolutional neural networks are universal, that is, they can approximate any continuous function to
Universal approximation theorem for convolutional networks See the paper Universality of Deep Convolutional Neural Networks by Ding-Xuan Zhou, who shows that convolutional neural networks are universal, that is, they can approximate any continuous function to an arbitrary accuracy when the depth of the neural network is large enough.
Universal approximation theorem for convolutional networks See the paper Universality of Deep Convolutional Neural Networks by Ding-Xuan Zhou, who shows that convolutional neural networks are universal, that is, they can approximate any continuous function to
15,562
Which multiple comparison method to use for a lmer model: lsmeans or glht?
Not a complete answer... The difference between glht(myfit, mcp(myfactor="Tukey")) and the two other methods is that this way uses a "z" statistic (normal distribution), whereas the other ones use a "t" statistic (Student distribution). The "z" statistic it the same as a "t" statistic with an infinite degree of freedom. This method is an asymptotic one and it provides smaller p-values and shorter confidence intervals than the other ones. The p-values can be too small and the confidence intervals can be too short if the dataset is small. When I run lsmeans(myfit, pairwise~myfactor) the following message appears: Loading required namespace: pbkrtest That means that lsmeans (for a lmer model) uses the pbkrtest package which implements the Kenward & Rogers method for the degrees of freedom of the "t" statistic. This method intends to provide better p-values and confidence intervals than the asymptotic one (there's no difference when the degree of freedom is large). Now, about the difference between lsmeans(myfit, pairwise~myfactor)$contrasts and glht(myfit, lsm(pairwise~factor), I have just done some tests and my observations are the following ones: lsm is an interface between the lsmeans package and the multcomp package (see ?lsm) for a balanced design there's no difference between the results for an unbalanced design, I observed small differences between the results (the standard errors and the t ratio) Unfortunately I do not know what is the cause of these differences. It looks like lsm calls lsmeans only to get the linear hypotheses matrix and the degrees of freedom, but lsmeans uses a different way to calculate the standard errors.
Which multiple comparison method to use for a lmer model: lsmeans or glht?
Not a complete answer... The difference between glht(myfit, mcp(myfactor="Tukey")) and the two other methods is that this way uses a "z" statistic (normal distribution), whereas the other ones use a "
Which multiple comparison method to use for a lmer model: lsmeans or glht? Not a complete answer... The difference between glht(myfit, mcp(myfactor="Tukey")) and the two other methods is that this way uses a "z" statistic (normal distribution), whereas the other ones use a "t" statistic (Student distribution). The "z" statistic it the same as a "t" statistic with an infinite degree of freedom. This method is an asymptotic one and it provides smaller p-values and shorter confidence intervals than the other ones. The p-values can be too small and the confidence intervals can be too short if the dataset is small. When I run lsmeans(myfit, pairwise~myfactor) the following message appears: Loading required namespace: pbkrtest That means that lsmeans (for a lmer model) uses the pbkrtest package which implements the Kenward & Rogers method for the degrees of freedom of the "t" statistic. This method intends to provide better p-values and confidence intervals than the asymptotic one (there's no difference when the degree of freedom is large). Now, about the difference between lsmeans(myfit, pairwise~myfactor)$contrasts and glht(myfit, lsm(pairwise~factor), I have just done some tests and my observations are the following ones: lsm is an interface between the lsmeans package and the multcomp package (see ?lsm) for a balanced design there's no difference between the results for an unbalanced design, I observed small differences between the results (the standard errors and the t ratio) Unfortunately I do not know what is the cause of these differences. It looks like lsm calls lsmeans only to get the linear hypotheses matrix and the degrees of freedom, but lsmeans uses a different way to calculate the standard errors.
Which multiple comparison method to use for a lmer model: lsmeans or glht? Not a complete answer... The difference between glht(myfit, mcp(myfactor="Tukey")) and the two other methods is that this way uses a "z" statistic (normal distribution), whereas the other ones use a "
15,563
Which multiple comparison method to use for a lmer model: lsmeans or glht?
(This answer highlights some information already present in one comment by @RussLenth above) In situations where the difference due to "z" vs. "t" statistic is negligible (i.e. in the limit of an infinite number of observations), calling lsmeans and multcomp with the default treatment of multiple comparisons would also give different results, because by default they use different methods (tukey vs. single-step). To remove this difference lsmeans and multcomp need to be called with the same multiple comparison method (e.g. none): lsmeans(exp.model,pairwise~condition, adjust='none') and summary(glht(exp.model,mcp(condition="Tukey")),test=adjusted(type="none"))
Which multiple comparison method to use for a lmer model: lsmeans or glht?
(This answer highlights some information already present in one comment by @RussLenth above) In situations where the difference due to "z" vs. "t" statistic is negligible (i.e. in the limit of an infi
Which multiple comparison method to use for a lmer model: lsmeans or glht? (This answer highlights some information already present in one comment by @RussLenth above) In situations where the difference due to "z" vs. "t" statistic is negligible (i.e. in the limit of an infinite number of observations), calling lsmeans and multcomp with the default treatment of multiple comparisons would also give different results, because by default they use different methods (tukey vs. single-step). To remove this difference lsmeans and multcomp need to be called with the same multiple comparison method (e.g. none): lsmeans(exp.model,pairwise~condition, adjust='none') and summary(glht(exp.model,mcp(condition="Tukey")),test=adjusted(type="none"))
Which multiple comparison method to use for a lmer model: lsmeans or glht? (This answer highlights some information already present in one comment by @RussLenth above) In situations where the difference due to "z" vs. "t" statistic is negligible (i.e. in the limit of an infi
15,564
How to deal with overdispersion in Poisson regression: quasi-likelihood, negative binomial GLM, or subject-level random effect?
Poisson regression is just a GLM: People often speak of the parametric rationale for applying Poisson regression. In fact, Poisson regression is just a GLM. That means Poisson regression is justified for any type of data (counts, ratings, exam scores, binary events, etc.) when two assumptions are met: 1) the log of the mean-outcome is a linear combination of the predictors and 2) the variance of the outcome is equal to the mean. These two conditions are respectively referred to as the mean-model and the mean-variance relationship. The mean-model assumption can be relaxed somewhat by using a complex set of adjustments for predictors. This is nice because the link function affects the interpretation of the parameters; the subtlety of interpretation makes the difference between answering a scientific question and completely eluding the consumers of your statistical analysis. In another SE post I discuss the usefulness of log-transforms for interpretation. It turns out, however, that the second assumption (mean-variance relationship) has strong implications on inference. When the mean-variance relationship is not true, the parameter estimates are not biased. However, the standard errors, confidence intervals, p-values, and predictions are all miscalibrated. That means you cannot control for Type I error and you may have suboptimal power. What if the mean-variance could be relaxed so that the variance is simply proportional to the mean? Negative binomial regression and Quasipoisson regression do this. Quasipoisson models Quasipoisson models are not likelihood based. They maximize a "quasilikelihood" which is a Poisson likelihood up to a proportional constant. That proportional constant happens to be the dispersion. The dispersion is considered a nuisance parameter. While the maximization routine comes up with an estimate of the nuisance parameter, that estimate is merely an artifact of the data rather than any value which generalizes to the population. The dispersion only serves to "shrink" or "widen" the SEs of the regression parameters according to whether the variance is proportionally smaller than or larger than the mean. Since the dispersion is treated as a nuisance parameter, quasipoisson models enjoy a host of robust properties: the data can in fact be heteroscedastic (not meeting the proportional mean-variance assumption) and even exhibit small sources of dependence, and the mean model need not be exactly correct, but the 95% CIs for the regression parameters are asymptotically correct. If your goal of the data analysis is to measure the association between a set of regression parameters and the outcome, quasipoisson models are usually the way to go. A limitation of these models is that they cannot yield prediction intervals, the Pearson residuals cannot tell you much about how accurate the mean model is, and information criteria like the AIC or BIC cannot effectively compare these models to other types of models. Negative binomial models It's most useful to understand negative binomial regression as a 2-parameter Poisson regression. The mean model is the same as in Poisson and Quasipoisson models where the log of the outcome is a linear combination of predictors. Furthermore, the "scale" parameter models a mean-variance relationship where the variance is merely proportional to the mean as before. However, unlike quasipoisson models, this type of model is an exact likelihood based procedure. In this case the dispersion is an actual parameter which has some extent of generalizability to the population. This introduces a few advantages over quasipoisson but, in my opinion, imposes more (untestable) assumptions. Unlike quasipoisson models: the data must be independent, the mean model must be correct, and the scale parameter must be homoscedastic across the range of fitted values to obtain correct inference. However, these can be assessed somewhat by inspecting Pearson residuals, and the model produces viable prediction and prediction intervals, and is amenable to comparison with information criteria. Negative binomial probability models arise from a Poisson-Gamma mixture. That is, there is an unknown fluctuating Gamma random variable "feeding into" the Poisson rate parameter. Since NB GLM fitting is likelihood based, it is usually helpful to state prior beliefs about the data generating mechanism and connect them to the probabilistic rationale for the model at hand. For instance, if I am testing number of racers retiring from 24-hour endurance racing, I might consider that the environmental conditions are all stressors that I did not measure and thus contribute to the risk of DNF, such as moisture or cold temperature affecting tire traction and thus the risk of a spin-out and wreck. Models for dependent data: GLMMs vs GEE Generalized linear mixed models (GLMMs) for Poisson data do not compare with the above approaches. GLMMs answer a different question and are used in different data structures. Here sources of dependence between data are measured explicitly. GLMMs make use of random intercepts and random slopes to account for individual level heterogeneity. This modifies what we estimate. The random effects modify the mean and the variance that is modeled rather than just the variance as was discussed above. There are two possible levels of association which can be measured in dependent data: population level (marginal) and individual level (conditional). GLMMs claim to measure individual level (conditional) associations: that is, given the whole host of individual level contributors to the outcome, what is the relative effect of a combination of predictors. As an example, exam prep courses may be of little effect to children who attend exemplary schools, whereas inner city children may benefit tremendously. The individual level effect is then substantially higher in this circumstance since advantaged children are too far above the curve in terms of positive exposures. If we naively applied quasipoisson or negative binomial models to dependent data, the NB models would be wrong, and the Quasipoisson models would be inefficient. The GEE, however, extends the quasipoisson model to explicitly model dependence structures like the GLMM, but the GEE measures an marginal (population level) trend and obtains the correct weights, standard errors, and inference. Data analysis example: This post is already too long :) There is a nice illustration of the first two models in this tutorial, along with references to more reading if you are interested. The data in question involve the nesting habits of horseshoe crabs: females sit in nests and males (satellites) attach to her. The investigators wanted to measures the number of males attached to a female as a function of the female's characteristics. I hope I've underscored why mixed models are noncomparable: if you have dependent data, you must use the correct model for the question those dependent data are trying to answer, either a GLM or a GEE. References: [1] Agresti, Categorical Data Analysis 2nd Edition [2] Diggle, Heagerty, Liang, Zeger, Analysis of Longitudinal Data 2nd ed.
How to deal with overdispersion in Poisson regression: quasi-likelihood, negative binomial GLM, or s
Poisson regression is just a GLM: People often speak of the parametric rationale for applying Poisson regression. In fact, Poisson regression is just a GLM. That means Poisson regression is justified
How to deal with overdispersion in Poisson regression: quasi-likelihood, negative binomial GLM, or subject-level random effect? Poisson regression is just a GLM: People often speak of the parametric rationale for applying Poisson regression. In fact, Poisson regression is just a GLM. That means Poisson regression is justified for any type of data (counts, ratings, exam scores, binary events, etc.) when two assumptions are met: 1) the log of the mean-outcome is a linear combination of the predictors and 2) the variance of the outcome is equal to the mean. These two conditions are respectively referred to as the mean-model and the mean-variance relationship. The mean-model assumption can be relaxed somewhat by using a complex set of adjustments for predictors. This is nice because the link function affects the interpretation of the parameters; the subtlety of interpretation makes the difference between answering a scientific question and completely eluding the consumers of your statistical analysis. In another SE post I discuss the usefulness of log-transforms for interpretation. It turns out, however, that the second assumption (mean-variance relationship) has strong implications on inference. When the mean-variance relationship is not true, the parameter estimates are not biased. However, the standard errors, confidence intervals, p-values, and predictions are all miscalibrated. That means you cannot control for Type I error and you may have suboptimal power. What if the mean-variance could be relaxed so that the variance is simply proportional to the mean? Negative binomial regression and Quasipoisson regression do this. Quasipoisson models Quasipoisson models are not likelihood based. They maximize a "quasilikelihood" which is a Poisson likelihood up to a proportional constant. That proportional constant happens to be the dispersion. The dispersion is considered a nuisance parameter. While the maximization routine comes up with an estimate of the nuisance parameter, that estimate is merely an artifact of the data rather than any value which generalizes to the population. The dispersion only serves to "shrink" or "widen" the SEs of the regression parameters according to whether the variance is proportionally smaller than or larger than the mean. Since the dispersion is treated as a nuisance parameter, quasipoisson models enjoy a host of robust properties: the data can in fact be heteroscedastic (not meeting the proportional mean-variance assumption) and even exhibit small sources of dependence, and the mean model need not be exactly correct, but the 95% CIs for the regression parameters are asymptotically correct. If your goal of the data analysis is to measure the association between a set of regression parameters and the outcome, quasipoisson models are usually the way to go. A limitation of these models is that they cannot yield prediction intervals, the Pearson residuals cannot tell you much about how accurate the mean model is, and information criteria like the AIC or BIC cannot effectively compare these models to other types of models. Negative binomial models It's most useful to understand negative binomial regression as a 2-parameter Poisson regression. The mean model is the same as in Poisson and Quasipoisson models where the log of the outcome is a linear combination of predictors. Furthermore, the "scale" parameter models a mean-variance relationship where the variance is merely proportional to the mean as before. However, unlike quasipoisson models, this type of model is an exact likelihood based procedure. In this case the dispersion is an actual parameter which has some extent of generalizability to the population. This introduces a few advantages over quasipoisson but, in my opinion, imposes more (untestable) assumptions. Unlike quasipoisson models: the data must be independent, the mean model must be correct, and the scale parameter must be homoscedastic across the range of fitted values to obtain correct inference. However, these can be assessed somewhat by inspecting Pearson residuals, and the model produces viable prediction and prediction intervals, and is amenable to comparison with information criteria. Negative binomial probability models arise from a Poisson-Gamma mixture. That is, there is an unknown fluctuating Gamma random variable "feeding into" the Poisson rate parameter. Since NB GLM fitting is likelihood based, it is usually helpful to state prior beliefs about the data generating mechanism and connect them to the probabilistic rationale for the model at hand. For instance, if I am testing number of racers retiring from 24-hour endurance racing, I might consider that the environmental conditions are all stressors that I did not measure and thus contribute to the risk of DNF, such as moisture or cold temperature affecting tire traction and thus the risk of a spin-out and wreck. Models for dependent data: GLMMs vs GEE Generalized linear mixed models (GLMMs) for Poisson data do not compare with the above approaches. GLMMs answer a different question and are used in different data structures. Here sources of dependence between data are measured explicitly. GLMMs make use of random intercepts and random slopes to account for individual level heterogeneity. This modifies what we estimate. The random effects modify the mean and the variance that is modeled rather than just the variance as was discussed above. There are two possible levels of association which can be measured in dependent data: population level (marginal) and individual level (conditional). GLMMs claim to measure individual level (conditional) associations: that is, given the whole host of individual level contributors to the outcome, what is the relative effect of a combination of predictors. As an example, exam prep courses may be of little effect to children who attend exemplary schools, whereas inner city children may benefit tremendously. The individual level effect is then substantially higher in this circumstance since advantaged children are too far above the curve in terms of positive exposures. If we naively applied quasipoisson or negative binomial models to dependent data, the NB models would be wrong, and the Quasipoisson models would be inefficient. The GEE, however, extends the quasipoisson model to explicitly model dependence structures like the GLMM, but the GEE measures an marginal (population level) trend and obtains the correct weights, standard errors, and inference. Data analysis example: This post is already too long :) There is a nice illustration of the first two models in this tutorial, along with references to more reading if you are interested. The data in question involve the nesting habits of horseshoe crabs: females sit in nests and males (satellites) attach to her. The investigators wanted to measures the number of males attached to a female as a function of the female's characteristics. I hope I've underscored why mixed models are noncomparable: if you have dependent data, you must use the correct model for the question those dependent data are trying to answer, either a GLM or a GEE. References: [1] Agresti, Categorical Data Analysis 2nd Edition [2] Diggle, Heagerty, Liang, Zeger, Analysis of Longitudinal Data 2nd ed.
How to deal with overdispersion in Poisson regression: quasi-likelihood, negative binomial GLM, or s Poisson regression is just a GLM: People often speak of the parametric rationale for applying Poisson regression. In fact, Poisson regression is just a GLM. That means Poisson regression is justified
15,565
centering and scaling dummy variables
When constructing dummy variables for use in regression analyses, each category in a categorical variable except for one should get a binary variable. So you should have e.g. A_level2, A_level3 etc. One of the categories should not have a binary variable, and this category will serve as the reference category. If you don't omit one of the categories, your regression analyses won't run properly. If you use SPSS or R, I don't think the scaling and centering of the entire data set will generally be a problem since those software packages often interprets variables with only two levels as factors, but it may depend on the specific statistical methods used. In any case, it makes no sense to scale and center binary (or categorical) variables so you should only center and scale continuous variables if you must do this.
centering and scaling dummy variables
When constructing dummy variables for use in regression analyses, each category in a categorical variable except for one should get a binary variable. So you should have e.g. A_level2, A_level3 etc. O
centering and scaling dummy variables When constructing dummy variables for use in regression analyses, each category in a categorical variable except for one should get a binary variable. So you should have e.g. A_level2, A_level3 etc. One of the categories should not have a binary variable, and this category will serve as the reference category. If you don't omit one of the categories, your regression analyses won't run properly. If you use SPSS or R, I don't think the scaling and centering of the entire data set will generally be a problem since those software packages often interprets variables with only two levels as factors, but it may depend on the specific statistical methods used. In any case, it makes no sense to scale and center binary (or categorical) variables so you should only center and scale continuous variables if you must do this.
centering and scaling dummy variables When constructing dummy variables for use in regression analyses, each category in a categorical variable except for one should get a binary variable. So you should have e.g. A_level2, A_level3 etc. O
15,566
centering and scaling dummy variables
If you are using R and scaling the dummy variables or variables having 0 or 1 to a scale between 0 and 1 only, then there won't be any change on the values of these variables, rest of the columns will be scaled. maxs <- apply(data, 2, max) mins <- apply(data, 2, min) data.scaled <- as.data.frame(scale(data, center = mins, scale = maxs - mins))
centering and scaling dummy variables
If you are using R and scaling the dummy variables or variables having 0 or 1 to a scale between 0 and 1 only, then there won't be any change on the values of these variables, rest of the columns will
centering and scaling dummy variables If you are using R and scaling the dummy variables or variables having 0 or 1 to a scale between 0 and 1 only, then there won't be any change on the values of these variables, rest of the columns will be scaled. maxs <- apply(data, 2, max) mins <- apply(data, 2, min) data.scaled <- as.data.frame(scale(data, center = mins, scale = maxs - mins))
centering and scaling dummy variables If you are using R and scaling the dummy variables or variables having 0 or 1 to a scale between 0 and 1 only, then there won't be any change on the values of these variables, rest of the columns will
15,567
centering and scaling dummy variables
The point of mean centering in regression is to make the intercept more interpretable. That is, id you mean center all the variables in your regression model, then the intercept (called Constant in SPSS output) equals the overall grand mean for your outcome variable. Which can be convenient when interpreting the final model. As to mean centering dummy variables, I just had a conversation with a professor of mine about mean centering dummy variables in a regression model (in my case a randomized block design multilevel model with 3 levels) and my take-away was that mean centering the dummy variables doesn't actually change the interpretation of the regression coefficients (except that the solution is completely standardized). Usually, it is not necessary in regression to interpret the actual unit level mean centered value - only the coefficients. And this essentially doesn't change - for the most part. She said it changes slightly because it's standardized which, for dummies, is not as intuitive to understand. Caveat: That was my understanding when I left my professor's office. I could, of course, have got it wrong.
centering and scaling dummy variables
The point of mean centering in regression is to make the intercept more interpretable. That is, id you mean center all the variables in your regression model, then the intercept (called Constant in SP
centering and scaling dummy variables The point of mean centering in regression is to make the intercept more interpretable. That is, id you mean center all the variables in your regression model, then the intercept (called Constant in SPSS output) equals the overall grand mean for your outcome variable. Which can be convenient when interpreting the final model. As to mean centering dummy variables, I just had a conversation with a professor of mine about mean centering dummy variables in a regression model (in my case a randomized block design multilevel model with 3 levels) and my take-away was that mean centering the dummy variables doesn't actually change the interpretation of the regression coefficients (except that the solution is completely standardized). Usually, it is not necessary in regression to interpret the actual unit level mean centered value - only the coefficients. And this essentially doesn't change - for the most part. She said it changes slightly because it's standardized which, for dummies, is not as intuitive to understand. Caveat: That was my understanding when I left my professor's office. I could, of course, have got it wrong.
centering and scaling dummy variables The point of mean centering in regression is to make the intercept more interpretable. That is, id you mean center all the variables in your regression model, then the intercept (called Constant in SP
15,568
Explanation for non-integer degrees of freedom in t test with unequal variances
The Welch-Satterthwaite d.f. can be shown to be a scaled weighted harmonic mean of the two degrees of freedom, with weights in proportion to the corresponding standard deviations. The original expression reads: $$\nu_{_W} = \frac{\left(\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}\right)^2}{\frac{s_1^4}{n_1^2\nu_1}+\frac{s_2^4}{n_2^2\nu_2}}$$ Note that $r_i=s_i^2/n_i$ is the estimated variance of the $i^\text{th}$ sample mean or the square of the $i$-th standard error of the mean. Let $r=r_1/r_2$ (the ratio of the estimated variances of the sample means), so \begin{align} \nu_{_W} &= \frac{\left(r_1+r_2\right)^2}{\frac{r_1^2}{\nu_1}+\frac{r_2^2}{\nu_2}} \newline \newline &=\frac{\left(r_1+r_2\right)^2}{r_1^2+r_2^2}\frac{r_1^2+r_2^2}{\frac{r_1^2}{\nu_1}+\frac{r_2^2}{\nu_2}} \newline \newline &=\frac{\left(r+1\right)^2}{r^2+1}\frac{r_1^2+r_2^2}{\frac{r_1^2}{\nu_1}+\frac{r_2^2}{\nu_2}} \end{align} The first factor is $1+\text{sech}(\log(r))$, which increases from $1$ at $r=0$ to $2$ at $r=1$ and then decreases to $1$ at $r=\infty$; it's symmetric in $\log r$. The second factor is a weighted harmonic mean: $$H(\underline{x})=\frac{\sum_{i=1}^n w_i }{ \sum_{i=1}^n \frac{w_i}{x_i}}\,.$$ of the d.f., where $w_i=r_i^2$ are the relative weights to the two d.f. Which is to say, when $r_1/r_2$ is very large, it converges to $\nu_1$. When $r_1/r_2$ is very close to $0$ it converges to $\nu_2$. When $r_1=r_2$ you get twice the harmonic mean of the d.f., and when $s_1^2=s_2^2$ you get the usual equal-variance t-test d.f., which is also the maximum possible value for $\nu_{_W}$ (given the sample sizes). -- With an equal-variance t-test, if the assumptions hold, the square of the denominator is a constant times a chi-square random variate. The square of the denominator of the Welch t-test isn't (a constant times) a chi-square; however, it's often not too bad an approximation. A relevant discussion can be found here. A more textbook-style derivation can be found here.
Explanation for non-integer degrees of freedom in t test with unequal variances
The Welch-Satterthwaite d.f. can be shown to be a scaled weighted harmonic mean of the two degrees of freedom, with weights in proportion to the corresponding standard deviations. The original express
Explanation for non-integer degrees of freedom in t test with unequal variances The Welch-Satterthwaite d.f. can be shown to be a scaled weighted harmonic mean of the two degrees of freedom, with weights in proportion to the corresponding standard deviations. The original expression reads: $$\nu_{_W} = \frac{\left(\frac{s_1^2}{n_1}+\frac{s_2^2}{n_2}\right)^2}{\frac{s_1^4}{n_1^2\nu_1}+\frac{s_2^4}{n_2^2\nu_2}}$$ Note that $r_i=s_i^2/n_i$ is the estimated variance of the $i^\text{th}$ sample mean or the square of the $i$-th standard error of the mean. Let $r=r_1/r_2$ (the ratio of the estimated variances of the sample means), so \begin{align} \nu_{_W} &= \frac{\left(r_1+r_2\right)^2}{\frac{r_1^2}{\nu_1}+\frac{r_2^2}{\nu_2}} \newline \newline &=\frac{\left(r_1+r_2\right)^2}{r_1^2+r_2^2}\frac{r_1^2+r_2^2}{\frac{r_1^2}{\nu_1}+\frac{r_2^2}{\nu_2}} \newline \newline &=\frac{\left(r+1\right)^2}{r^2+1}\frac{r_1^2+r_2^2}{\frac{r_1^2}{\nu_1}+\frac{r_2^2}{\nu_2}} \end{align} The first factor is $1+\text{sech}(\log(r))$, which increases from $1$ at $r=0$ to $2$ at $r=1$ and then decreases to $1$ at $r=\infty$; it's symmetric in $\log r$. The second factor is a weighted harmonic mean: $$H(\underline{x})=\frac{\sum_{i=1}^n w_i }{ \sum_{i=1}^n \frac{w_i}{x_i}}\,.$$ of the d.f., where $w_i=r_i^2$ are the relative weights to the two d.f. Which is to say, when $r_1/r_2$ is very large, it converges to $\nu_1$. When $r_1/r_2$ is very close to $0$ it converges to $\nu_2$. When $r_1=r_2$ you get twice the harmonic mean of the d.f., and when $s_1^2=s_2^2$ you get the usual equal-variance t-test d.f., which is also the maximum possible value for $\nu_{_W}$ (given the sample sizes). -- With an equal-variance t-test, if the assumptions hold, the square of the denominator is a constant times a chi-square random variate. The square of the denominator of the Welch t-test isn't (a constant times) a chi-square; however, it's often not too bad an approximation. A relevant discussion can be found here. A more textbook-style derivation can be found here.
Explanation for non-integer degrees of freedom in t test with unequal variances The Welch-Satterthwaite d.f. can be shown to be a scaled weighted harmonic mean of the two degrees of freedom, with weights in proportion to the corresponding standard deviations. The original express
15,569
Explanation for non-integer degrees of freedom in t test with unequal variances
What you are referring to is the Welch-Satterthwaite correction to the degrees of freedom. The $t$-test when the WS correction is applied is often called Welch's $t$-test. (Incidentally, this has nothing to do with SPSS, all statistical software will be able to conduct Welch's $t$-test, they just don't usually report both side by side by default, so you wouldn't necessarily be prompted to think about the issue.) The equation for the correction is very ugly, but can be seen on the Wikipedia page; unless you are very math savvy or a glutton for punishment, I don't recommend trying to work through it to understand the idea. From a loose conceptual standpoint however, the idea is relatively straightforward: the regular $t$-test assumes the variances are equal in the two groups. If they're not, then the test should not benefit from that assumption. Since the power of the $t$-test can be seen as a function of the residual degrees of freedom, one way to adjust for this is to 'shrink' the df somewhat. The appropriate df must be somewhere between the full df and the df of the smaller group. (As @Glen_b notes below, it depends on the relative sizes of $s^2_1/n_1$ vs $s_2^2/n_2$; if the larger n is associated with a sufficiently smaller variance, the combined df can be lower than the larger of the two df.) The WS correction finds the right proportion of way from the former to the latter to adjust the df. Then the test statistic is assessed against a $t$-distribution with that df.
Explanation for non-integer degrees of freedom in t test with unequal variances
What you are referring to is the Welch-Satterthwaite correction to the degrees of freedom. The $t$-test when the WS correction is applied is often called Welch's $t$-test. (Incidentally, this has no
Explanation for non-integer degrees of freedom in t test with unequal variances What you are referring to is the Welch-Satterthwaite correction to the degrees of freedom. The $t$-test when the WS correction is applied is often called Welch's $t$-test. (Incidentally, this has nothing to do with SPSS, all statistical software will be able to conduct Welch's $t$-test, they just don't usually report both side by side by default, so you wouldn't necessarily be prompted to think about the issue.) The equation for the correction is very ugly, but can be seen on the Wikipedia page; unless you are very math savvy or a glutton for punishment, I don't recommend trying to work through it to understand the idea. From a loose conceptual standpoint however, the idea is relatively straightforward: the regular $t$-test assumes the variances are equal in the two groups. If they're not, then the test should not benefit from that assumption. Since the power of the $t$-test can be seen as a function of the residual degrees of freedom, one way to adjust for this is to 'shrink' the df somewhat. The appropriate df must be somewhere between the full df and the df of the smaller group. (As @Glen_b notes below, it depends on the relative sizes of $s^2_1/n_1$ vs $s_2^2/n_2$; if the larger n is associated with a sufficiently smaller variance, the combined df can be lower than the larger of the two df.) The WS correction finds the right proportion of way from the former to the latter to adjust the df. Then the test statistic is assessed against a $t$-distribution with that df.
Explanation for non-integer degrees of freedom in t test with unequal variances What you are referring to is the Welch-Satterthwaite correction to the degrees of freedom. The $t$-test when the WS correction is applied is often called Welch's $t$-test. (Incidentally, this has no
15,570
Why does one have to use REML (instead of ML) for choosing among nested var-covar models?
A very short answer: the REML is a ML, so the test based on REML is correct anyway. As the estimation of the variance parameters with REML is better, it is natural to use it. Why is REML a ML? Consider e.g. a model $$Y = X\beta + Zu + e \def\R{\mathbb{R}}$$ with $X\in\R^{n\times p}$, $Z\in\R^{n\times q}$, and $\beta \in \R^p$ is the vector of the fixed effects, $u \sim \mathcal N(0, \tau I_q)$ is the vector of random effects, and $e \sim \mathcal N(0, \sigma^2 I_n)$. The Restricted Likelihood can be obtained by considering $n-p$ contrasts to "remove" the fixed effects. More precisely, let $C \in \R^{(n-p)\times n}$, such that $CX = 0$ and $CC' = I_{n-p}$ (that is, the columns of $C'$ are an orthonormal basis of the vector space orthognal to the space generated by the columns of $X$) ; then $$CY = CZ u + \epsilon$$ with $\epsilon \sim \mathcal N(0, \sigma^2 I_{n-p})$, and the likelihood for $\tau, \sigma^2$ given $CY$ is the Restricted Likelihood.
Why does one have to use REML (instead of ML) for choosing among nested var-covar models?
A very short answer: the REML is a ML, so the test based on REML is correct anyway. As the estimation of the variance parameters with REML is better, it is natural to use it. Why is REML a ML? Conside
Why does one have to use REML (instead of ML) for choosing among nested var-covar models? A very short answer: the REML is a ML, so the test based on REML is correct anyway. As the estimation of the variance parameters with REML is better, it is natural to use it. Why is REML a ML? Consider e.g. a model $$Y = X\beta + Zu + e \def\R{\mathbb{R}}$$ with $X\in\R^{n\times p}$, $Z\in\R^{n\times q}$, and $\beta \in \R^p$ is the vector of the fixed effects, $u \sim \mathcal N(0, \tau I_q)$ is the vector of random effects, and $e \sim \mathcal N(0, \sigma^2 I_n)$. The Restricted Likelihood can be obtained by considering $n-p$ contrasts to "remove" the fixed effects. More precisely, let $C \in \R^{(n-p)\times n}$, such that $CX = 0$ and $CC' = I_{n-p}$ (that is, the columns of $C'$ are an orthonormal basis of the vector space orthognal to the space generated by the columns of $X$) ; then $$CY = CZ u + \epsilon$$ with $\epsilon \sim \mathcal N(0, \sigma^2 I_{n-p})$, and the likelihood for $\tau, \sigma^2$ given $CY$ is the Restricted Likelihood.
Why does one have to use REML (instead of ML) for choosing among nested var-covar models? A very short answer: the REML is a ML, so the test based on REML is correct anyway. As the estimation of the variance parameters with REML is better, it is natural to use it. Why is REML a ML? Conside
15,571
Why does one have to use REML (instead of ML) for choosing among nested var-covar models?
Likelihood ratio tests are statistical hypothesis tests that are based on a ratio of two likelihoods. Their properties are linked to maximum likelihood estimation (MLE). (see e.g. Maximum Likelihood Estimation (MLE) in layman terms). In your case (see question) you want to ''choose'' among two nested var-covar models, let's say you want to choose between a model where the var-covar is $\Sigma_g$ and a model where the var-covar is $\Sigma_s$ where the second one (simple model) is a special case of the first one (the general one). The test is based on the likelihood ratio $LR=-2 (log(\mathcal{L}_s(\hat{\Sigma}_s)) - log(\mathcal{L}_g(\hat{\Sigma}_g) )$. Where $\hat{\Sigma}_s$ and $\hat{\Sigma}_g$ are the maximum likelihood estimators. The statistic $LR$ is , asymptotically (!) $\chi^2$. Maximum likelihood estimators are known to be consistent, however, in many cases they are biased . This is the case for the MLE estimators for the variance, $\hat{\Sigma}_s$ and $\hat{\Sigma}_g$, it can be show that they are biased. This is because they are computed using a mean that was derived from the data, such that the spread around this 'estimated average' is smaller than the spread around the true mean (see e.g. Intuitive explanation for dividing by $n-1$ when calculating standard deviation?) The statistic $LR$ above is $\chi^2$ in large samples, this is just because of the fact that, in large samples, $\hat{\Sigma}_s$ and $\hat{\Sigma}_g$ converge to their true values (MLE are consistent). (Note: in the above link, for very large samples, dividing by n or by (n-1), will make no difference) For smaller samples, the MLE estimates of $\hat{\Sigma}_s$ and $\hat{\Sigma}_g$ will be biased and therefore the distribution of $LR$ will deviate from $\chi^2$, while the REML estimates will give unbiased estimates for $\Sigma_s$ and $\Sigma_g$, so if you use, for the selection of the var-covar model, the REML estimates then the $LR$ will for smaller samples be better approximated by the $\chi^2$. Note that REML should only be used to choose among nested var-covar structures of models with the same mean, for models with different means, the REML is not appropriate, for models with different means one should use ML.
Why does one have to use REML (instead of ML) for choosing among nested var-covar models?
Likelihood ratio tests are statistical hypothesis tests that are based on a ratio of two likelihoods. Their properties are linked to maximum likelihood estimation (MLE). (see e.g. Maximum Likelihood
Why does one have to use REML (instead of ML) for choosing among nested var-covar models? Likelihood ratio tests are statistical hypothesis tests that are based on a ratio of two likelihoods. Their properties are linked to maximum likelihood estimation (MLE). (see e.g. Maximum Likelihood Estimation (MLE) in layman terms). In your case (see question) you want to ''choose'' among two nested var-covar models, let's say you want to choose between a model where the var-covar is $\Sigma_g$ and a model where the var-covar is $\Sigma_s$ where the second one (simple model) is a special case of the first one (the general one). The test is based on the likelihood ratio $LR=-2 (log(\mathcal{L}_s(\hat{\Sigma}_s)) - log(\mathcal{L}_g(\hat{\Sigma}_g) )$. Where $\hat{\Sigma}_s$ and $\hat{\Sigma}_g$ are the maximum likelihood estimators. The statistic $LR$ is , asymptotically (!) $\chi^2$. Maximum likelihood estimators are known to be consistent, however, in many cases they are biased . This is the case for the MLE estimators for the variance, $\hat{\Sigma}_s$ and $\hat{\Sigma}_g$, it can be show that they are biased. This is because they are computed using a mean that was derived from the data, such that the spread around this 'estimated average' is smaller than the spread around the true mean (see e.g. Intuitive explanation for dividing by $n-1$ when calculating standard deviation?) The statistic $LR$ above is $\chi^2$ in large samples, this is just because of the fact that, in large samples, $\hat{\Sigma}_s$ and $\hat{\Sigma}_g$ converge to their true values (MLE are consistent). (Note: in the above link, for very large samples, dividing by n or by (n-1), will make no difference) For smaller samples, the MLE estimates of $\hat{\Sigma}_s$ and $\hat{\Sigma}_g$ will be biased and therefore the distribution of $LR$ will deviate from $\chi^2$, while the REML estimates will give unbiased estimates for $\Sigma_s$ and $\Sigma_g$, so if you use, for the selection of the var-covar model, the REML estimates then the $LR$ will for smaller samples be better approximated by the $\chi^2$. Note that REML should only be used to choose among nested var-covar structures of models with the same mean, for models with different means, the REML is not appropriate, for models with different means one should use ML.
Why does one have to use REML (instead of ML) for choosing among nested var-covar models? Likelihood ratio tests are statistical hypothesis tests that are based on a ratio of two likelihoods. Their properties are linked to maximum likelihood estimation (MLE). (see e.g. Maximum Likelihood
15,572
Why does one have to use REML (instead of ML) for choosing among nested var-covar models?
I have an answer that has more to do with common sense than with Statistics. If you take a look at PROC MIXED in SAS, the estimation can be performed with six methods: http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_mixed_sect008.htm but REML is the default. Why? Apparently, the practical experience showed it has the best performance (e.g., the smallest chance of convergence problems). Therefore, if your goal is achievable with REML, then it makes sense to use REML as opposed to the other five methods.
Why does one have to use REML (instead of ML) for choosing among nested var-covar models?
I have an answer that has more to do with common sense than with Statistics. If you take a look at PROC MIXED in SAS, the estimation can be performed with six methods: http://support.sas.com/documenta
Why does one have to use REML (instead of ML) for choosing among nested var-covar models? I have an answer that has more to do with common sense than with Statistics. If you take a look at PROC MIXED in SAS, the estimation can be performed with six methods: http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_mixed_sect008.htm but REML is the default. Why? Apparently, the practical experience showed it has the best performance (e.g., the smallest chance of convergence problems). Therefore, if your goal is achievable with REML, then it makes sense to use REML as opposed to the other five methods.
Why does one have to use REML (instead of ML) for choosing among nested var-covar models? I have an answer that has more to do with common sense than with Statistics. If you take a look at PROC MIXED in SAS, the estimation can be performed with six methods: http://support.sas.com/documenta
15,573
Log-linked Gamma GLM vs log-linked Gaussian GLM vs log-transformed LM
Well, quite clearly the log-linear fit to the Gaussian is unsuitable; there's strong heteroskedasticity in the residuals. So let's take that out of consideration. What's left is lognormal vs gamma. Note that the histogram of $T$ is of no direct use, since the marginal distribution will be a mixture of variates (each conditioned on a different set of values for the predictors); even if one of the two models was correct, that plot may look nothing like the conditional distribution. Either model appears just about equally suitable in this case. They both have variance proportional to the square of the mean, so the pattern of spread in residuals against fit is similar. A low outlier will fit slightly better with a gamma than a lognormal (vice versa for a high outlier). At a given mean and variance, the lognormal is more skew and has a higher coefficient of variation. One thing to remember is that the expectation of the lognormal is not $\exp(\mu)$; if you're interested in the mean you can't just exponentiate the log scale fit. Indeed, if you are interested in the mean, the gamma avoids a number of issues with the lognormal (e.g. once you incorporate parameter uncertainty in $\sigma^2$ in the lognormal, you have prediction based on the log-t distribution, which doesn't have a mean. Prediction intervals still work fine, but that may be a problem for predicting the mean. See also here and here for some related discussions.
Log-linked Gamma GLM vs log-linked Gaussian GLM vs log-transformed LM
Well, quite clearly the log-linear fit to the Gaussian is unsuitable; there's strong heteroskedasticity in the residuals. So let's take that out of consideration. What's left is lognormal vs gamma. No
Log-linked Gamma GLM vs log-linked Gaussian GLM vs log-transformed LM Well, quite clearly the log-linear fit to the Gaussian is unsuitable; there's strong heteroskedasticity in the residuals. So let's take that out of consideration. What's left is lognormal vs gamma. Note that the histogram of $T$ is of no direct use, since the marginal distribution will be a mixture of variates (each conditioned on a different set of values for the predictors); even if one of the two models was correct, that plot may look nothing like the conditional distribution. Either model appears just about equally suitable in this case. They both have variance proportional to the square of the mean, so the pattern of spread in residuals against fit is similar. A low outlier will fit slightly better with a gamma than a lognormal (vice versa for a high outlier). At a given mean and variance, the lognormal is more skew and has a higher coefficient of variation. One thing to remember is that the expectation of the lognormal is not $\exp(\mu)$; if you're interested in the mean you can't just exponentiate the log scale fit. Indeed, if you are interested in the mean, the gamma avoids a number of issues with the lognormal (e.g. once you incorporate parameter uncertainty in $\sigma^2$ in the lognormal, you have prediction based on the log-t distribution, which doesn't have a mean. Prediction intervals still work fine, but that may be a problem for predicting the mean. See also here and here for some related discussions.
Log-linked Gamma GLM vs log-linked Gaussian GLM vs log-transformed LM Well, quite clearly the log-linear fit to the Gaussian is unsuitable; there's strong heteroskedasticity in the residuals. So let's take that out of consideration. What's left is lognormal vs gamma. No
15,574
Finding the fitted and predicted values for a statistical model
You have to be a bit careful with model objects in R. For example, whilst the fitted values and the predictions of the training data should be the same in the glm() model case, they are not the same when you use the correct extractor functions: R> fitted(md2) 1 2 3 4 5 6 0.4208590 0.4208590 0.4193888 0.7274819 0.4308001 0.5806112 R> predict(md2) 1 2 3 4 5 6 -0.3192480 -0.3192480 -0.3252830 0.9818840 -0.2785876 0.3252830 That is because the default for predict.glm() is to return predictions on the scale of the linear predictor. To get the fitted values we want to apply the inverse of the link function to those values. fitted() does that for us, and we can get the correct values using predict() as well: R> predict(md2, type = "response") 1 2 3 4 5 6 0.4208590 0.4208590 0.4193888 0.7274819 0.4308001 0.5806112 Likewise with residuals() (or resid()); the values stored in md2$residuals are the working residuals are are unlikely to be what you want. The resid() method allows you to specify the type of residual you want and has a useful default. For the glm() model, something like this will suffice: R> data.frame(Age = df$age, Won = df$won, Fitted = fitted(md2)) Age Won Fitted 1 18 0 0.4208590 2 18 0 0.4208590 3 23 1 0.4193888 4 50 1 0.7274819 5 19 1 0.4308001 6 39 0 0.5806112 Something similar can be done for the lm() model: R> data.frame(Age = df$age, Income = df$income, Fitted = fitted(md1)) Age Income Fitted 1 18 5 7.893273 2 18 3 7.893273 3 23 47 28.320749 4 50 8 -1.389725 5 19 6 7.603179 6 39 5 23.679251
Finding the fitted and predicted values for a statistical model
You have to be a bit careful with model objects in R. For example, whilst the fitted values and the predictions of the training data should be the same in the glm() model case, they are not the same w
Finding the fitted and predicted values for a statistical model You have to be a bit careful with model objects in R. For example, whilst the fitted values and the predictions of the training data should be the same in the glm() model case, they are not the same when you use the correct extractor functions: R> fitted(md2) 1 2 3 4 5 6 0.4208590 0.4208590 0.4193888 0.7274819 0.4308001 0.5806112 R> predict(md2) 1 2 3 4 5 6 -0.3192480 -0.3192480 -0.3252830 0.9818840 -0.2785876 0.3252830 That is because the default for predict.glm() is to return predictions on the scale of the linear predictor. To get the fitted values we want to apply the inverse of the link function to those values. fitted() does that for us, and we can get the correct values using predict() as well: R> predict(md2, type = "response") 1 2 3 4 5 6 0.4208590 0.4208590 0.4193888 0.7274819 0.4308001 0.5806112 Likewise with residuals() (or resid()); the values stored in md2$residuals are the working residuals are are unlikely to be what you want. The resid() method allows you to specify the type of residual you want and has a useful default. For the glm() model, something like this will suffice: R> data.frame(Age = df$age, Won = df$won, Fitted = fitted(md2)) Age Won Fitted 1 18 0 0.4208590 2 18 0 0.4208590 3 23 1 0.4193888 4 50 1 0.7274819 5 19 1 0.4308001 6 39 0 0.5806112 Something similar can be done for the lm() model: R> data.frame(Age = df$age, Income = df$income, Fitted = fitted(md1)) Age Income Fitted 1 18 5 7.893273 2 18 3 7.893273 3 23 47 28.320749 4 50 8 -1.389725 5 19 6 7.603179 6 39 5 23.679251
Finding the fitted and predicted values for a statistical model You have to be a bit careful with model objects in R. For example, whilst the fitted values and the predictions of the training data should be the same in the glm() model case, they are not the same w
15,575
What are good datasets to illustrate particular aspects of statistical analysis?
The low birth weight study This is one of the datasets in Hosmer and Lemeshow's textbook on Applied Logistic Regression (2000, Wiley, 2nd ed.). The goal of this prospective study was to identify risk factors associated with giving birth to a low birth weight baby (weighing less than 2,500 grams). Data were collected on 189 women, 59 of which had low birth weight babies and 130 of which had normal birth weight babies. Four variables which were thought to be of importance were age, weight of the subject at her last menstrual period, race, and the number of physician visits during the first trimester of pregnancy. It is available in R as data(birthwt, package="MASS") or in Stata with webuse lbw. A text version appears here: lowbwt.dat (description). Of note, there are several versions of this dataset because it was extended to a case-control study (1-1 or 1-3, matched on age), as illustrated by Hosmer and Lemeshow in ALR chapter 7. I used to teach introductory courses based on this dataset for the following reasons: It is interesting from an historical and epidemiological perspective (data were collected in 1986); no prior background in medicine or statistics is required to understand the main ideas and what questions can be asked from that study. Several variables of mixed types (continuous, ordinal, and nominal) are available which makes it easy to present basic association tests (t-test, ANOVA, $\chi^2$-test for two-way tables, odds-ratio, Cochrane and Armitage trend test, etc.). Morever, birth weight is available as a continuous measure as well as a binary indicator (above or below 2.5 kg): We can start building simple linear models, followed by multiple regression (with predictors of interest selected from prior exploratory analysis), and then switch to GLM (logistic regression), possibly discussing the choice of a cutoff. It allows to discuss different modeling perspectives (explanatory or predictive approaches), and the implication of the sampling scheme when developing models (stratification/matched cases). Other points that can be emphasized, depending on the audience and level of expertise with statistical software, or statistics in general. As for the dataset available in R, categorical predictors are scored as integers (e.g., for mother's ethnicity we have ‘1’ = white, ‘2’ = black, ‘3’ = other), notwithstanding the fact that natural ordering for some predictors (e.g., number of previous premature labors or number of physician visits) or the use of explicit labels (it is always a good idea to use 'yes'/'no' instead of 1/0 for binary variables, even if that doesn't change anything in the design matrix!) are simply absent. As such, it is easy to discuss what issues may be raised by ignoring levels or units of measurement in data analysis. Variables of mixed types are interesting when it comes to do some exploratory analysis and discuss what kind of graphical displays are appropriate for summarizing univariate, bivariate or trivariate relationships. Likewise, producing nice summary tables, and more generally reporting, is another interesting aspect of this dataset (but the Hmisc::summary.formula command makes it so easy under R). Hosmer and Lemeshow reported that actual data were modified to protect subject confidentiality (p. 25). It might be interesting to discuss data confidentiality issues, as was done in one of our earlier Journal Club, but see its transcript. (I must admit I never go into much details with that.) It is easy to introduce some missing values or erroneous values (which are common issues in real life of a statistician), which lead to discuss (a) their detection through codebook (Hmisc::describe or Stata's codebook) or exploratory graphics (always plot your data first!), and (b) possible remedial (data imputation, listwise deletion or pairwise measure of association, etc.).
What are good datasets to illustrate particular aspects of statistical analysis?
The low birth weight study This is one of the datasets in Hosmer and Lemeshow's textbook on Applied Logistic Regression (2000, Wiley, 2nd ed.). The goal of this prospective study was to identify risk
What are good datasets to illustrate particular aspects of statistical analysis? The low birth weight study This is one of the datasets in Hosmer and Lemeshow's textbook on Applied Logistic Regression (2000, Wiley, 2nd ed.). The goal of this prospective study was to identify risk factors associated with giving birth to a low birth weight baby (weighing less than 2,500 grams). Data were collected on 189 women, 59 of which had low birth weight babies and 130 of which had normal birth weight babies. Four variables which were thought to be of importance were age, weight of the subject at her last menstrual period, race, and the number of physician visits during the first trimester of pregnancy. It is available in R as data(birthwt, package="MASS") or in Stata with webuse lbw. A text version appears here: lowbwt.dat (description). Of note, there are several versions of this dataset because it was extended to a case-control study (1-1 or 1-3, matched on age), as illustrated by Hosmer and Lemeshow in ALR chapter 7. I used to teach introductory courses based on this dataset for the following reasons: It is interesting from an historical and epidemiological perspective (data were collected in 1986); no prior background in medicine or statistics is required to understand the main ideas and what questions can be asked from that study. Several variables of mixed types (continuous, ordinal, and nominal) are available which makes it easy to present basic association tests (t-test, ANOVA, $\chi^2$-test for two-way tables, odds-ratio, Cochrane and Armitage trend test, etc.). Morever, birth weight is available as a continuous measure as well as a binary indicator (above or below 2.5 kg): We can start building simple linear models, followed by multiple regression (with predictors of interest selected from prior exploratory analysis), and then switch to GLM (logistic regression), possibly discussing the choice of a cutoff. It allows to discuss different modeling perspectives (explanatory or predictive approaches), and the implication of the sampling scheme when developing models (stratification/matched cases). Other points that can be emphasized, depending on the audience and level of expertise with statistical software, or statistics in general. As for the dataset available in R, categorical predictors are scored as integers (e.g., for mother's ethnicity we have ‘1’ = white, ‘2’ = black, ‘3’ = other), notwithstanding the fact that natural ordering for some predictors (e.g., number of previous premature labors or number of physician visits) or the use of explicit labels (it is always a good idea to use 'yes'/'no' instead of 1/0 for binary variables, even if that doesn't change anything in the design matrix!) are simply absent. As such, it is easy to discuss what issues may be raised by ignoring levels or units of measurement in data analysis. Variables of mixed types are interesting when it comes to do some exploratory analysis and discuss what kind of graphical displays are appropriate for summarizing univariate, bivariate or trivariate relationships. Likewise, producing nice summary tables, and more generally reporting, is another interesting aspect of this dataset (but the Hmisc::summary.formula command makes it so easy under R). Hosmer and Lemeshow reported that actual data were modified to protect subject confidentiality (p. 25). It might be interesting to discuss data confidentiality issues, as was done in one of our earlier Journal Club, but see its transcript. (I must admit I never go into much details with that.) It is easy to introduce some missing values or erroneous values (which are common issues in real life of a statistician), which lead to discuss (a) their detection through codebook (Hmisc::describe or Stata's codebook) or exploratory graphics (always plot your data first!), and (b) possible remedial (data imputation, listwise deletion or pairwise measure of association, etc.).
What are good datasets to illustrate particular aspects of statistical analysis? The low birth weight study This is one of the datasets in Hosmer and Lemeshow's textbook on Applied Logistic Regression (2000, Wiley, 2nd ed.). The goal of this prospective study was to identify risk
15,576
What are good datasets to illustrate particular aspects of statistical analysis?
Of course, the Anscombe 4 datasets are very good for teaching - they look very different, yet have identical simple statistical properties. I also suggest KDD Cup datasets http://www.kdd.org/kddcup/ because they have been well studied and there are many solutions, so students can compare their results and see how they rank. In my data mining course I provided a Microarray dataset competition which can be used by professors http://www.kdnuggets.com/data_mining_course/
What are good datasets to illustrate particular aspects of statistical analysis?
Of course, the Anscombe 4 datasets are very good for teaching - they look very different, yet have identical simple statistical properties. I also suggest KDD Cup datasets http://www.kdd.org/kddcup/
What are good datasets to illustrate particular aspects of statistical analysis? Of course, the Anscombe 4 datasets are very good for teaching - they look very different, yet have identical simple statistical properties. I also suggest KDD Cup datasets http://www.kdd.org/kddcup/ because they have been well studied and there are many solutions, so students can compare their results and see how they rank. In my data mining course I provided a Microarray dataset competition which can be used by professors http://www.kdnuggets.com/data_mining_course/
What are good datasets to illustrate particular aspects of statistical analysis? Of course, the Anscombe 4 datasets are very good for teaching - they look very different, yet have identical simple statistical properties. I also suggest KDD Cup datasets http://www.kdd.org/kddcup/
15,577
What are good datasets to illustrate particular aspects of statistical analysis?
A lot of my Statistical Analysis courses at Cal Poly have used the "Iris" dataset which in already in R. It has categorical variables, and highly correlated variables.
What are good datasets to illustrate particular aspects of statistical analysis?
A lot of my Statistical Analysis courses at Cal Poly have used the "Iris" dataset which in already in R. It has categorical variables, and highly correlated variables.
What are good datasets to illustrate particular aspects of statistical analysis? A lot of my Statistical Analysis courses at Cal Poly have used the "Iris" dataset which in already in R. It has categorical variables, and highly correlated variables.
What are good datasets to illustrate particular aspects of statistical analysis? A lot of my Statistical Analysis courses at Cal Poly have used the "Iris" dataset which in already in R. It has categorical variables, and highly correlated variables.
15,578
What are good datasets to illustrate particular aspects of statistical analysis?
The Titanic dataset used by Harrell in "Regression Modeling Strategies". I use a simplified version of his analysis when explaining logistic regression, explaining survival using sex, class and age. The Loyn dataset discussed in "Experimental Design and Data Analysis for Biologists" by Gerry Quinn and Mick Keough contains nice problems requiring transformation for multiple linear regression.
What are good datasets to illustrate particular aspects of statistical analysis?
The Titanic dataset used by Harrell in "Regression Modeling Strategies". I use a simplified version of his analysis when explaining logistic regression, explaining survival using sex, class and age. T
What are good datasets to illustrate particular aspects of statistical analysis? The Titanic dataset used by Harrell in "Regression Modeling Strategies". I use a simplified version of his analysis when explaining logistic regression, explaining survival using sex, class and age. The Loyn dataset discussed in "Experimental Design and Data Analysis for Biologists" by Gerry Quinn and Mick Keough contains nice problems requiring transformation for multiple linear regression.
What are good datasets to illustrate particular aspects of statistical analysis? The Titanic dataset used by Harrell in "Regression Modeling Strategies". I use a simplified version of his analysis when explaining logistic regression, explaining survival using sex, class and age. T
15,579
Hidden Markov models with Baum-Welch algorithm using python
The scikit-learn has an HMM implementation. It was until recently considered as unmaintained and its usage was discouraged. However it has improved in the development version. I cannot vouch for its quality, though, as I know nothing of HMMs. Disclaimer: I am a scikit-learn developer. Edit: we have moved the HMMs outside of scikit-learn, to https://github.com/hmmlearn/hmmlearn
Hidden Markov models with Baum-Welch algorithm using python
The scikit-learn has an HMM implementation. It was until recently considered as unmaintained and its usage was discouraged. However it has improved in the development version. I cannot vouch for its q
Hidden Markov models with Baum-Welch algorithm using python The scikit-learn has an HMM implementation. It was until recently considered as unmaintained and its usage was discouraged. However it has improved in the development version. I cannot vouch for its quality, though, as I know nothing of HMMs. Disclaimer: I am a scikit-learn developer. Edit: we have moved the HMMs outside of scikit-learn, to https://github.com/hmmlearn/hmmlearn
Hidden Markov models with Baum-Welch algorithm using python The scikit-learn has an HMM implementation. It was until recently considered as unmaintained and its usage was discouraged. However it has improved in the development version. I cannot vouch for its q
15,580
Hidden Markov models with Baum-Welch algorithm using python
You can find Python implementations on: Hidden Markov Models in Python - CS440: Introduction to Artifical Intelligence - CSU Baum-Welch algorithm: Finding parameters for our HMM | Does this make sense? BTW: See Example of implementation of Baum-Welch on Stack Overflow - the answer turns out to be in Python.
Hidden Markov models with Baum-Welch algorithm using python
You can find Python implementations on: Hidden Markov Models in Python - CS440: Introduction to Artifical Intelligence - CSU Baum-Welch algorithm: Finding parameters for our HMM | Does this make sens
Hidden Markov models with Baum-Welch algorithm using python You can find Python implementations on: Hidden Markov Models in Python - CS440: Introduction to Artifical Intelligence - CSU Baum-Welch algorithm: Finding parameters for our HMM | Does this make sense? BTW: See Example of implementation of Baum-Welch on Stack Overflow - the answer turns out to be in Python.
Hidden Markov models with Baum-Welch algorithm using python You can find Python implementations on: Hidden Markov Models in Python - CS440: Introduction to Artifical Intelligence - CSU Baum-Welch algorithm: Finding parameters for our HMM | Does this make sens
15,581
Hidden Markov models with Baum-Welch algorithm using python
Have you seen NLTK? http://www.nltk.org/ It has some classes that are suitable for this sort of thing, but somewhat application dependent. http://www.nltk.org/api/nltk.tag.html#nltk.tag.hmm.HiddenMarkovModelTrainer If you are looking for something more 'education oriented', I wrote toy trainer a while ago: http://pastebin.com/aJG3Ukmn
Hidden Markov models with Baum-Welch algorithm using python
Have you seen NLTK? http://www.nltk.org/ It has some classes that are suitable for this sort of thing, but somewhat application dependent. http://www.nltk.org/api/nltk.tag.html#nltk.tag.hmm.HiddenMark
Hidden Markov models with Baum-Welch algorithm using python Have you seen NLTK? http://www.nltk.org/ It has some classes that are suitable for this sort of thing, but somewhat application dependent. http://www.nltk.org/api/nltk.tag.html#nltk.tag.hmm.HiddenMarkovModelTrainer If you are looking for something more 'education oriented', I wrote toy trainer a while ago: http://pastebin.com/aJG3Ukmn
Hidden Markov models with Baum-Welch algorithm using python Have you seen NLTK? http://www.nltk.org/ It has some classes that are suitable for this sort of thing, but somewhat application dependent. http://www.nltk.org/api/nltk.tag.html#nltk.tag.hmm.HiddenMark
15,582
Hidden Markov models with Baum-Welch algorithm using python
Some implementation of basic algorithms (including Baum-welch in python) are available here: http://ai.cs.umbc.edu/icgi2012/challenge/Pautomac/baseline.php
Hidden Markov models with Baum-Welch algorithm using python
Some implementation of basic algorithms (including Baum-welch in python) are available here: http://ai.cs.umbc.edu/icgi2012/challenge/Pautomac/baseline.php
Hidden Markov models with Baum-Welch algorithm using python Some implementation of basic algorithms (including Baum-welch in python) are available here: http://ai.cs.umbc.edu/icgi2012/challenge/Pautomac/baseline.php
Hidden Markov models with Baum-Welch algorithm using python Some implementation of basic algorithms (including Baum-welch in python) are available here: http://ai.cs.umbc.edu/icgi2012/challenge/Pautomac/baseline.php
15,583
Hidden Markov models with Baum-Welch algorithm using python
The General Hidden Markov Model library has python bindings and uses the Baum-Welch algorithm.
Hidden Markov models with Baum-Welch algorithm using python
The General Hidden Markov Model library has python bindings and uses the Baum-Welch algorithm.
Hidden Markov models with Baum-Welch algorithm using python The General Hidden Markov Model library has python bindings and uses the Baum-Welch algorithm.
Hidden Markov models with Baum-Welch algorithm using python The General Hidden Markov Model library has python bindings and uses the Baum-Welch algorithm.
15,584
Hidden Markov models with Baum-Welch algorithm using python
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. Following is a Pyhton implementation of Baum-Welch Algorithm: https://github.com/hamzarawal/HMM-Baum-Welch-Algorithm
Hidden Markov models with Baum-Welch algorithm using python
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
Hidden Markov models with Baum-Welch algorithm using python Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted. Following is a Pyhton implementation of Baum-Welch Algorithm: https://github.com/hamzarawal/HMM-Baum-Welch-Algorithm
Hidden Markov models with Baum-Welch algorithm using python Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
15,585
Correcting for outliers in a running average
If that example graph you have is typical, then any of the criteria you list will work. Most of those statistical methods are for riding the edge of errors right at the fuzzy level of "is this really an error?" But your problem looks wildly simple.. your errors are not just a couple standard deviations from the norm, they're 20+. This is good news for you. So, use the simplest heuristic. Always accept the first 5 points or so in order to prevent a startup spike from ruining your computation. Maintain mean and standard deviation. If your data point falls 5 standard deviations outside the norm, then discard it and repeat the previous data point as a filler. If you know your typical data behavior in advance you may not even need to compute mean and standard deviation, you can hardwire absolute "reject" limits. This is actually better in that an initial error won't blow up your detector.
Correcting for outliers in a running average
If that example graph you have is typical, then any of the criteria you list will work. Most of those statistical methods are for riding the edge of errors right at the fuzzy level of "is this really
Correcting for outliers in a running average If that example graph you have is typical, then any of the criteria you list will work. Most of those statistical methods are for riding the edge of errors right at the fuzzy level of "is this really an error?" But your problem looks wildly simple.. your errors are not just a couple standard deviations from the norm, they're 20+. This is good news for you. So, use the simplest heuristic. Always accept the first 5 points or so in order to prevent a startup spike from ruining your computation. Maintain mean and standard deviation. If your data point falls 5 standard deviations outside the norm, then discard it and repeat the previous data point as a filler. If you know your typical data behavior in advance you may not even need to compute mean and standard deviation, you can hardwire absolute "reject" limits. This is actually better in that an initial error won't blow up your detector.
Correcting for outliers in a running average If that example graph you have is typical, then any of the criteria you list will work. Most of those statistical methods are for riding the edge of errors right at the fuzzy level of "is this really
15,586
Correcting for outliers in a running average
The definition of what constitutes an abnormal value must scale to the data itself. The classic method of doing this is to calculate the z score of each of the data points and throwing out any values greater than 3 z scores from the average. The z score can be found by taking the difference between the data point and the average and dividing by the standard deviation.
Correcting for outliers in a running average
The definition of what constitutes an abnormal value must scale to the data itself. The classic method of doing this is to calculate the z score of each of the data points and throwing out any values
Correcting for outliers in a running average The definition of what constitutes an abnormal value must scale to the data itself. The classic method of doing this is to calculate the z score of each of the data points and throwing out any values greater than 3 z scores from the average. The z score can be found by taking the difference between the data point and the average and dividing by the standard deviation.
Correcting for outliers in a running average The definition of what constitutes an abnormal value must scale to the data itself. The classic method of doing this is to calculate the z score of each of the data points and throwing out any values
15,587
Correcting for outliers in a running average
I would compute a running median (robust alternative to mean) and a running mad (robust alternative to sd), remove everything that more than 5 mad's away from the median https://ec.europa.eu/eurostat/documents/1001617/4398385/S4P1-MIRROROUTLIERDETECTION-LIAPIS.pdf
Correcting for outliers in a running average
I would compute a running median (robust alternative to mean) and a running mad (robust alternative to sd), remove everything that more than 5 mad's away from the median https://ec.europa.eu/eurostat/
Correcting for outliers in a running average I would compute a running median (robust alternative to mean) and a running mad (robust alternative to sd), remove everything that more than 5 mad's away from the median https://ec.europa.eu/eurostat/documents/1001617/4398385/S4P1-MIRROROUTLIERDETECTION-LIAPIS.pdf
Correcting for outliers in a running average I would compute a running median (robust alternative to mean) and a running mad (robust alternative to sd), remove everything that more than 5 mad's away from the median https://ec.europa.eu/eurostat/
15,588
Correcting for outliers in a running average
Another solution is to use the harmonic mean. Your case is very similar to the example discussed in http://economistatlarge.com/finance/applied-finance/differences-arithmetic-geometric-harmonic-means
Correcting for outliers in a running average
Another solution is to use the harmonic mean. Your case is very similar to the example discussed in http://economistatlarge.com/finance/applied-finance/differences-arithmetic-geometric-harmonic-means
Correcting for outliers in a running average Another solution is to use the harmonic mean. Your case is very similar to the example discussed in http://economistatlarge.com/finance/applied-finance/differences-arithmetic-geometric-harmonic-means
Correcting for outliers in a running average Another solution is to use the harmonic mean. Your case is very similar to the example discussed in http://economistatlarge.com/finance/applied-finance/differences-arithmetic-geometric-harmonic-means
15,589
Correcting for outliers in a running average
You need to have some idea of expected variation or distribution, if you want to be able to exclude certain (higher) instances of variation as erroneous. For instance, if you can approximate the distribution of the "average times" result to a normal (Gaussian) distribution, then you can do what ojblass suggested and exclude those results that exhibit a variation that is greater than some multiple of the standard deviation (which can be calculated on the fly alongside your running average). If you wanted to exclude results that have a 99.75 (or so) percent chance of being erroneous, exclude those that vary more than 3 standard deviations from the mean. If you only want 95% certainty, exclude those that vary more than 2 standard deviations and so on. I'm sure a little bit of googling for "standard deviation" or "gaussian distribution" will help you. Of course, this assumes that you expect a normal distribution of results. You might not. In which case, the first step would be to guess at what distribution you expect.
Correcting for outliers in a running average
You need to have some idea of expected variation or distribution, if you want to be able to exclude certain (higher) instances of variation as erroneous. For instance, if you can approximate the distr
Correcting for outliers in a running average You need to have some idea of expected variation or distribution, if you want to be able to exclude certain (higher) instances of variation as erroneous. For instance, if you can approximate the distribution of the "average times" result to a normal (Gaussian) distribution, then you can do what ojblass suggested and exclude those results that exhibit a variation that is greater than some multiple of the standard deviation (which can be calculated on the fly alongside your running average). If you wanted to exclude results that have a 99.75 (or so) percent chance of being erroneous, exclude those that vary more than 3 standard deviations from the mean. If you only want 95% certainty, exclude those that vary more than 2 standard deviations and so on. I'm sure a little bit of googling for "standard deviation" or "gaussian distribution" will help you. Of course, this assumes that you expect a normal distribution of results. You might not. In which case, the first step would be to guess at what distribution you expect.
Correcting for outliers in a running average You need to have some idea of expected variation or distribution, if you want to be able to exclude certain (higher) instances of variation as erroneous. For instance, if you can approximate the distr
15,590
Correcting for outliers in a running average
Maybe a good method would be to ignore any results that are more than some defined value outside the current running average?
Correcting for outliers in a running average
Maybe a good method would be to ignore any results that are more than some defined value outside the current running average?
Correcting for outliers in a running average Maybe a good method would be to ignore any results that are more than some defined value outside the current running average?
Correcting for outliers in a running average Maybe a good method would be to ignore any results that are more than some defined value outside the current running average?
15,591
Correcting for outliers in a running average
The naive (and possibly best) answer to the bootstrapping question is "Accept the first N values without filtering." Choose N to be as large as possible while still allowing the setup time to be "short" in your application. In this case, you might consider using the window width (64 samples) for N. Then I would go with some kind of mean and sigma based filter.
Correcting for outliers in a running average
The naive (and possibly best) answer to the bootstrapping question is "Accept the first N values without filtering." Choose N to be as large as possible while still allowing the setup time to be "shor
Correcting for outliers in a running average The naive (and possibly best) answer to the bootstrapping question is "Accept the first N values without filtering." Choose N to be as large as possible while still allowing the setup time to be "short" in your application. In this case, you might consider using the window width (64 samples) for N. Then I would go with some kind of mean and sigma based filter.
Correcting for outliers in a running average The naive (and possibly best) answer to the bootstrapping question is "Accept the first N values without filtering." Choose N to be as large as possible while still allowing the setup time to be "shor
15,592
Finding most likely permutation
Provided the measurement errors are independent and identically Normally distributed for each instrument, the solution is to match the two sets of measurements in sorted order. Although this is intuitively obvious (comments posted shortly after the question was posted state this solution), it remains to prove it. To this end, let the first set of measurements in sorted order be $x_1\le x_2\le \cdots \le x_n$ and let the second set of measurements in sorted order be $y_1\le y_2\le \cdots \le y_n.$ Let the error distributions have zero means and variances $\sigma^2$ for the X instrument and $\tau^2$ for the Y instrument. (I find this notation a little more congenial than the subscripting in the question.) To find the most likely permutation, we solve the maximum likelihood problem. Its parameters are (a) the $n$ true weights $\theta_i$ corresponding to the objects measured by each $x_i$ and (b) the permutation $s$ that makes $y_{s(i)}$ the second measurement of object $i.$ Insofar as the likelihood depends on $(\theta)$ and $s,$ the likelihood of these observations is proportional to the exponential of $$\mathcal{L}(\theta,s) = -\frac{1}{2}\sum_{i=1}^n \left(\frac{x_i-\theta_i}{\sigma}\right)^2 + \left(\frac{y_{s(i)}-\theta_i}{\tau}\right)^2.$$ For any given $s,$ this expression (and therefore its exponential) is maximized term by term by taking $$\hat\theta_i = \frac{\tau^2 x_i + \sigma^2 y_{s(i)}}{\sigma^2 + \tau^2}.$$ For these optimal values of $\theta,$ the value of $-2\mathcal{L}$ (which we wish to minimize) is $$-2\mathcal{L}(\hat\theta,s) = \frac{1}{\sigma^2+\tau^2}\sum_{i=1}^n \left(x_i - y_{s(i)}\right)^2.$$ When each squared expression is expanded we obtain (a) a sum of the $x_i^2,$ (b) a sum of the $y_{s(i)}^2$ (which equals the sum of the $y_i^2$ because $s$ is a permutation), and (c) the cross terms, $$-2\sum_{i=1}^n x_i y_{s(i)}.$$ The Rearrangement Inequality states that such sums of products are maximized (thereby maximizing $\mathcal{L}(\hat\theta, s)$) when the $y_{s(i)}$ are in increasing order, QED. This analysis relies on the Normality assumption. Although it can be relaxed, some distributional assumption is needed, as @fblundun perceptively points out in a comment to the question.
Finding most likely permutation
Provided the measurement errors are independent and identically Normally distributed for each instrument, the solution is to match the two sets of measurements in sorted order. Although this is intui
Finding most likely permutation Provided the measurement errors are independent and identically Normally distributed for each instrument, the solution is to match the two sets of measurements in sorted order. Although this is intuitively obvious (comments posted shortly after the question was posted state this solution), it remains to prove it. To this end, let the first set of measurements in sorted order be $x_1\le x_2\le \cdots \le x_n$ and let the second set of measurements in sorted order be $y_1\le y_2\le \cdots \le y_n.$ Let the error distributions have zero means and variances $\sigma^2$ for the X instrument and $\tau^2$ for the Y instrument. (I find this notation a little more congenial than the subscripting in the question.) To find the most likely permutation, we solve the maximum likelihood problem. Its parameters are (a) the $n$ true weights $\theta_i$ corresponding to the objects measured by each $x_i$ and (b) the permutation $s$ that makes $y_{s(i)}$ the second measurement of object $i.$ Insofar as the likelihood depends on $(\theta)$ and $s,$ the likelihood of these observations is proportional to the exponential of $$\mathcal{L}(\theta,s) = -\frac{1}{2}\sum_{i=1}^n \left(\frac{x_i-\theta_i}{\sigma}\right)^2 + \left(\frac{y_{s(i)}-\theta_i}{\tau}\right)^2.$$ For any given $s,$ this expression (and therefore its exponential) is maximized term by term by taking $$\hat\theta_i = \frac{\tau^2 x_i + \sigma^2 y_{s(i)}}{\sigma^2 + \tau^2}.$$ For these optimal values of $\theta,$ the value of $-2\mathcal{L}$ (which we wish to minimize) is $$-2\mathcal{L}(\hat\theta,s) = \frac{1}{\sigma^2+\tau^2}\sum_{i=1}^n \left(x_i - y_{s(i)}\right)^2.$$ When each squared expression is expanded we obtain (a) a sum of the $x_i^2,$ (b) a sum of the $y_{s(i)}^2$ (which equals the sum of the $y_i^2$ because $s$ is a permutation), and (c) the cross terms, $$-2\sum_{i=1}^n x_i y_{s(i)}.$$ The Rearrangement Inequality states that such sums of products are maximized (thereby maximizing $\mathcal{L}(\hat\theta, s)$) when the $y_{s(i)}$ are in increasing order, QED. This analysis relies on the Normality assumption. Although it can be relaxed, some distributional assumption is needed, as @fblundun perceptively points out in a comment to the question.
Finding most likely permutation Provided the measurement errors are independent and identically Normally distributed for each instrument, the solution is to match the two sets of measurements in sorted order. Although this is intui
15,593
Finding most likely permutation
@whuber (+1) has answered the question in your title about finding the most likely permutation. My purpose here is to explore briefly by simulation whether you can expect that most likely permutation to be exactly correct. Roughly speaking, the order for the second weighing is most likely to be correct if the minimum difference in weights of the objects is larger than $3\sigma,$ where $\sigma$ is the standard deviation of the the balance used to do the weighing. Let's say there are $n = 6$ objects with true weights $\mu = 10, 20, 30, 40, 50, 60$ measured initially on a balance with $\sigma=1.$ Then weights might be as shown in the vector x below. [Sampling and computations in R.] set.seed(112) n = 6; mu = c(10,20,30,40,50,60) x = numeric(n) for(i in 1:n) { x[i] = rnorm(1, mu[i], 1) } x [1] 9.685768 22.403375 29.281736 38.239389 48.874719 59.280459 Because smallest differences (10) in true weights are considerably greater than $\sigma=1$ we can expect that a second weighing, will put them into the same order as in y. set.seed(113) n = 6; mu = c(10,20,30,40,50,60) y = numeric(n) for(i in 1:n) { y[i] = rnorm(1, mu[i], 1) } y [1] 10.13335 21.37522 30.74872 38.70615 49.44123 58.26755 Thus the ranks of all six objects in the two weighings agree: sum(rank(x)==rank(y)) [1] 6 However, if the differences among the true weights are not several $\sigma$s apart, then the ranks may be scrambled. (Below, again with gaps of 10, but $\sigma=4,$ specimens 2 and 3 are not consistent.) set.seed(112) n = 6; mu = c(10,20,30,40,50,60) x = numeric(n) for(i in 1:n) { x[i] = rnorm(1, mu[i], 4) } x [1] 8.743073 29.613500 27.126944 32.957556 45.498875 57.121838 set.seed(113) n = 6; mu = c(10,20,30,40,50,60) y = numeric(n) for(i in 1:n) { y[i] = rnorm(1, mu[i], 4) } y [1] 10.53342 25.50089 32.99486 34.82460 47.76492 53.07020 sum(rank(x)==rank(y)) [1] 4 So, in order to know how good the best permutation might be, you would need to take into account the diversity of the object weights and the precision of the balance.
Finding most likely permutation
@whuber (+1) has answered the question in your title about finding the most likely permutation. My purpose here is to explore briefly by simulation whether you can expect that most likely permutation
Finding most likely permutation @whuber (+1) has answered the question in your title about finding the most likely permutation. My purpose here is to explore briefly by simulation whether you can expect that most likely permutation to be exactly correct. Roughly speaking, the order for the second weighing is most likely to be correct if the minimum difference in weights of the objects is larger than $3\sigma,$ where $\sigma$ is the standard deviation of the the balance used to do the weighing. Let's say there are $n = 6$ objects with true weights $\mu = 10, 20, 30, 40, 50, 60$ measured initially on a balance with $\sigma=1.$ Then weights might be as shown in the vector x below. [Sampling and computations in R.] set.seed(112) n = 6; mu = c(10,20,30,40,50,60) x = numeric(n) for(i in 1:n) { x[i] = rnorm(1, mu[i], 1) } x [1] 9.685768 22.403375 29.281736 38.239389 48.874719 59.280459 Because smallest differences (10) in true weights are considerably greater than $\sigma=1$ we can expect that a second weighing, will put them into the same order as in y. set.seed(113) n = 6; mu = c(10,20,30,40,50,60) y = numeric(n) for(i in 1:n) { y[i] = rnorm(1, mu[i], 1) } y [1] 10.13335 21.37522 30.74872 38.70615 49.44123 58.26755 Thus the ranks of all six objects in the two weighings agree: sum(rank(x)==rank(y)) [1] 6 However, if the differences among the true weights are not several $\sigma$s apart, then the ranks may be scrambled. (Below, again with gaps of 10, but $\sigma=4,$ specimens 2 and 3 are not consistent.) set.seed(112) n = 6; mu = c(10,20,30,40,50,60) x = numeric(n) for(i in 1:n) { x[i] = rnorm(1, mu[i], 4) } x [1] 8.743073 29.613500 27.126944 32.957556 45.498875 57.121838 set.seed(113) n = 6; mu = c(10,20,30,40,50,60) y = numeric(n) for(i in 1:n) { y[i] = rnorm(1, mu[i], 4) } y [1] 10.53342 25.50089 32.99486 34.82460 47.76492 53.07020 sum(rank(x)==rank(y)) [1] 4 So, in order to know how good the best permutation might be, you would need to take into account the diversity of the object weights and the precision of the balance.
Finding most likely permutation @whuber (+1) has answered the question in your title about finding the most likely permutation. My purpose here is to explore briefly by simulation whether you can expect that most likely permutation
15,594
Finding most likely permutation
Inspired by BruceET's answer here is a simulation that computes the distribution of the difference in the rank. While Whuber's answer shows that identity is the most likely permutation, it is not the most likely difference in rank (there is only one permutation, the identity, with no change in rank, but there are many permutations with the same difference in rank and these add up together). The simulation uses some random distribution of the true weights (with the line mu <- c(1:n)*d they are evenly distributed) The histogram can be approximated with a Poisson-binomial distribution which itself can be approximated with a Gaussian distribution. The image below shows a comparison for the simulation (the histogram) and the approximation (the line with points). ### settings set.seed(1) n <- 200 d <- 2 sig <- 1 mu <- runif(n,0,d*n) mu <- mu[order(mu)] #mu <- c(1:n)*d ### simulation of drawing X and Y ### the output is the average difference in rank simulate <- function(n,d,sig,mu) { x <- rnorm(n,mu,sig) y <- rnorm(n,mu,sig) return(mean(abs(rank(x)-rank(y)))) } ### perform the simulation 10 000 times and plot historgram s <- replicate(10^4, simulate(n,d,sig,mu)) hist(s, breaks = seq(-1/n,max(s)+1/n,2/n), freq = 0, main = "average difference in rank", xlim = c(0.5,1)) ### compute probabilities that ranks get swapped 1 or 2 places ### the 2*p*(1-p) relates to the probability that ### the swap occurs in X but not in Y or vice versa p <- 1-pnorm(mu[-1]-mu[-n],0,sig*sqrt(2)) p <- 2*p*(1-p) p2 <- 1-pnorm(mu[-c(1:2)]-mu[-c(n-1,n)],0,sig*sqrt(2)) p2 <- 2*p2*(1-p2) ### normal approximation of the Poisson-binomial dvar <- sum(p*(1-p))+sum(p2*(1-p2)) dmu <- sum(p)+sum(p2) ### plotting ds <- 0:100 lines(ds*(2/n), dnorm(ds,dmu,sqrt(dvar))*(n/2)) points(ds*(2/n), dnorm(ds,dmu,sqrt(dvar))*(n/2), pch = 21 , col = 1, bg = 0, cex = 0.7)
Finding most likely permutation
Inspired by BruceET's answer here is a simulation that computes the distribution of the difference in the rank. While Whuber's answer shows that identity is the most likely permutation, it is not the
Finding most likely permutation Inspired by BruceET's answer here is a simulation that computes the distribution of the difference in the rank. While Whuber's answer shows that identity is the most likely permutation, it is not the most likely difference in rank (there is only one permutation, the identity, with no change in rank, but there are many permutations with the same difference in rank and these add up together). The simulation uses some random distribution of the true weights (with the line mu <- c(1:n)*d they are evenly distributed) The histogram can be approximated with a Poisson-binomial distribution which itself can be approximated with a Gaussian distribution. The image below shows a comparison for the simulation (the histogram) and the approximation (the line with points). ### settings set.seed(1) n <- 200 d <- 2 sig <- 1 mu <- runif(n,0,d*n) mu <- mu[order(mu)] #mu <- c(1:n)*d ### simulation of drawing X and Y ### the output is the average difference in rank simulate <- function(n,d,sig,mu) { x <- rnorm(n,mu,sig) y <- rnorm(n,mu,sig) return(mean(abs(rank(x)-rank(y)))) } ### perform the simulation 10 000 times and plot historgram s <- replicate(10^4, simulate(n,d,sig,mu)) hist(s, breaks = seq(-1/n,max(s)+1/n,2/n), freq = 0, main = "average difference in rank", xlim = c(0.5,1)) ### compute probabilities that ranks get swapped 1 or 2 places ### the 2*p*(1-p) relates to the probability that ### the swap occurs in X but not in Y or vice versa p <- 1-pnorm(mu[-1]-mu[-n],0,sig*sqrt(2)) p <- 2*p*(1-p) p2 <- 1-pnorm(mu[-c(1:2)]-mu[-c(n-1,n)],0,sig*sqrt(2)) p2 <- 2*p2*(1-p2) ### normal approximation of the Poisson-binomial dvar <- sum(p*(1-p))+sum(p2*(1-p2)) dmu <- sum(p)+sum(p2) ### plotting ds <- 0:100 lines(ds*(2/n), dnorm(ds,dmu,sqrt(dvar))*(n/2)) points(ds*(2/n), dnorm(ds,dmu,sqrt(dvar))*(n/2), pch = 21 , col = 1, bg = 0, cex = 0.7)
Finding most likely permutation Inspired by BruceET's answer here is a simulation that computes the distribution of the difference in the rank. While Whuber's answer shows that identity is the most likely permutation, it is not the
15,595
Fine Tuning vs. Transferlearning vs. Learning from scratch
Transfer learning is when a model developed for one task is reused to work on a second task. Fine-tuning is one approach to transfer learning where you change the model output to fit the new task and train only the output model. In Transfer Learning or Domain Adaptation, we train the model with a dataset. Then, we train the same model with another dataset that has a different distribution of classes, or even with other classes than in the first training dataset). In Fine-tuning, an approach of Transfer Learning, we have a dataset, and we use let's say 90% of it in training. Then, we train the same model with the remaining 10%. Usually, we change the learning rate to a smaller one, so it does not have a significant impact on the already adjusted weights. You can also have a base model working for a similar task and then freezing some of the layers to keep the old knowledge when performing the new training session with the new data. The output layer can also be different and have some of it frozen regarding the training. In my experience learning from scratch leads to better results, but it is much costly than the others especially regarding time and resources consumption. Using Transfer Learning you should freeze some layers, mainly the pre-trained ones and only train in the added ones, and decrease the learning rate to adjust the weights without mixing their meaning for the network. If you speed up the learning rate you normally face yourself with poor results due to the big steps in the gradient descent optimisation. This can lead to a state where the neural network cannot find the global minimum but only a local one. Using a pre-trained model in a similar task, usually have great results when we use Fine-tuning. However, if you do not have enough data in the new dataset or even your hyperparameters are not the best ones, you can get unsatisfactory results. Machine learning always depends on its dataset and network's parameters. And in that case, you should only use the "standard" Transfer Learning. So, we need to evaluate the trade-off between the resources and time consumption with the accuracy we desire, to choose the best approach.
Fine Tuning vs. Transferlearning vs. Learning from scratch
Transfer learning is when a model developed for one task is reused to work on a second task. Fine-tuning is one approach to transfer learning where you change the model output to fit the new task and
Fine Tuning vs. Transferlearning vs. Learning from scratch Transfer learning is when a model developed for one task is reused to work on a second task. Fine-tuning is one approach to transfer learning where you change the model output to fit the new task and train only the output model. In Transfer Learning or Domain Adaptation, we train the model with a dataset. Then, we train the same model with another dataset that has a different distribution of classes, or even with other classes than in the first training dataset). In Fine-tuning, an approach of Transfer Learning, we have a dataset, and we use let's say 90% of it in training. Then, we train the same model with the remaining 10%. Usually, we change the learning rate to a smaller one, so it does not have a significant impact on the already adjusted weights. You can also have a base model working for a similar task and then freezing some of the layers to keep the old knowledge when performing the new training session with the new data. The output layer can also be different and have some of it frozen regarding the training. In my experience learning from scratch leads to better results, but it is much costly than the others especially regarding time and resources consumption. Using Transfer Learning you should freeze some layers, mainly the pre-trained ones and only train in the added ones, and decrease the learning rate to adjust the weights without mixing their meaning for the network. If you speed up the learning rate you normally face yourself with poor results due to the big steps in the gradient descent optimisation. This can lead to a state where the neural network cannot find the global minimum but only a local one. Using a pre-trained model in a similar task, usually have great results when we use Fine-tuning. However, if you do not have enough data in the new dataset or even your hyperparameters are not the best ones, you can get unsatisfactory results. Machine learning always depends on its dataset and network's parameters. And in that case, you should only use the "standard" Transfer Learning. So, we need to evaluate the trade-off between the resources and time consumption with the accuracy we desire, to choose the best approach.
Fine Tuning vs. Transferlearning vs. Learning from scratch Transfer learning is when a model developed for one task is reused to work on a second task. Fine-tuning is one approach to transfer learning where you change the model output to fit the new task and
15,596
Fine Tuning vs. Transferlearning vs. Learning from scratch
Fine tuning, transfer learning, and learning from scratch are similar in that they are approaches to training a model on some data. But there are important differences. Both fine tuning and transfer learning build on knowledge (parameters) an existing model has learned from previous data, while training from scratch does not build on the knowledge a model has previously learned. Further, we can differentiate between fine tuning and transfer learning based on how exactly these two approaches build on existing knowledge. In transfer learning, you freeze the parameters taken from the existing model. In fine tuning, you further train the parameters taken from the existing model. Note that all three approaches can be combined during training. For example, you could create a new model by adding new layers to an existing model. Then, when training this new model, you could freeze only part of the existing model (the lower layers), fine tune the rest of the existing model (the upper layers), and train the new layers you added from scratch. Thus, transfer learning, fine tuning, and training from scratch can co-exist. Also note, transfer learning cannot be used all by itself when learning from new data because of frozen parameters. Transfer learning needs to be combined with either fine tuning or training from scratch when learning from new data.
Fine Tuning vs. Transferlearning vs. Learning from scratch
Fine tuning, transfer learning, and learning from scratch are similar in that they are approaches to training a model on some data. But there are important differences. Both fine tuning and transfer l
Fine Tuning vs. Transferlearning vs. Learning from scratch Fine tuning, transfer learning, and learning from scratch are similar in that they are approaches to training a model on some data. But there are important differences. Both fine tuning and transfer learning build on knowledge (parameters) an existing model has learned from previous data, while training from scratch does not build on the knowledge a model has previously learned. Further, we can differentiate between fine tuning and transfer learning based on how exactly these two approaches build on existing knowledge. In transfer learning, you freeze the parameters taken from the existing model. In fine tuning, you further train the parameters taken from the existing model. Note that all three approaches can be combined during training. For example, you could create a new model by adding new layers to an existing model. Then, when training this new model, you could freeze only part of the existing model (the lower layers), fine tune the rest of the existing model (the upper layers), and train the new layers you added from scratch. Thus, transfer learning, fine tuning, and training from scratch can co-exist. Also note, transfer learning cannot be used all by itself when learning from new data because of frozen parameters. Transfer learning needs to be combined with either fine tuning or training from scratch when learning from new data.
Fine Tuning vs. Transferlearning vs. Learning from scratch Fine tuning, transfer learning, and learning from scratch are similar in that they are approaches to training a model on some data. But there are important differences. Both fine tuning and transfer l
15,597
In what kind of real-life situations can we use a multi-arm bandit algorithm?
When you play the original Pokemon games (Red or Blue and Yellow) and you get to Celadon city, the Team rocket slot machines have different odds. Multi-Arm Bandit right there if you want to optimize getting that Porygon really fast. In all seriousness, people talk about the problem with choosing tuning variables in machine learning. Especially if you have a lot of of variables, exploration vs exploitation gets talked about. See like Spearmint or even the new paper in this topic that uses a super simple algorithm to choose tuning parameters (and way outperforms other tuning variable techniques)
In what kind of real-life situations can we use a multi-arm bandit algorithm?
When you play the original Pokemon games (Red or Blue and Yellow) and you get to Celadon city, the Team rocket slot machines have different odds. Multi-Arm Bandit right there if you want to optimize
In what kind of real-life situations can we use a multi-arm bandit algorithm? When you play the original Pokemon games (Red or Blue and Yellow) and you get to Celadon city, the Team rocket slot machines have different odds. Multi-Arm Bandit right there if you want to optimize getting that Porygon really fast. In all seriousness, people talk about the problem with choosing tuning variables in machine learning. Especially if you have a lot of of variables, exploration vs exploitation gets talked about. See like Spearmint or even the new paper in this topic that uses a super simple algorithm to choose tuning parameters (and way outperforms other tuning variable techniques)
In what kind of real-life situations can we use a multi-arm bandit algorithm? When you play the original Pokemon games (Red or Blue and Yellow) and you get to Celadon city, the Team rocket slot machines have different odds. Multi-Arm Bandit right there if you want to optimize
15,598
In what kind of real-life situations can we use a multi-arm bandit algorithm?
They can be used in a biomedical treatment / research design setting. For example, I believe q-learning algorithms are used in Sequential, Multiple Assignment, Randomized Trial (SMART trials). Loosely, the idea is that the treatment regime adapts optimally to the progress the patient is making. It is clear how this might be best for an individual patient, but it can also be more efficient in randomized clinical trials.
In what kind of real-life situations can we use a multi-arm bandit algorithm?
They can be used in a biomedical treatment / research design setting. For example, I believe q-learning algorithms are used in Sequential, Multiple Assignment, Randomized Trial (SMART trials). Loose
In what kind of real-life situations can we use a multi-arm bandit algorithm? They can be used in a biomedical treatment / research design setting. For example, I believe q-learning algorithms are used in Sequential, Multiple Assignment, Randomized Trial (SMART trials). Loosely, the idea is that the treatment regime adapts optimally to the progress the patient is making. It is clear how this might be best for an individual patient, but it can also be more efficient in randomized clinical trials.
In what kind of real-life situations can we use a multi-arm bandit algorithm? They can be used in a biomedical treatment / research design setting. For example, I believe q-learning algorithms are used in Sequential, Multiple Assignment, Randomized Trial (SMART trials). Loose
15,599
In what kind of real-life situations can we use a multi-arm bandit algorithm?
They are used in A/B testing of online advertising, where different ads are displayed to different users and based on the outcomes decisions are made about what ads to show in the future. This is described in nice paper by Google researcher Steven L. Scott (2010), there was also a page that is currently offline, but available through archive.org.
In what kind of real-life situations can we use a multi-arm bandit algorithm?
They are used in A/B testing of online advertising, where different ads are displayed to different users and based on the outcomes decisions are made about what ads to show in the future. This is desc
In what kind of real-life situations can we use a multi-arm bandit algorithm? They are used in A/B testing of online advertising, where different ads are displayed to different users and based on the outcomes decisions are made about what ads to show in the future. This is described in nice paper by Google researcher Steven L. Scott (2010), there was also a page that is currently offline, but available through archive.org.
In what kind of real-life situations can we use a multi-arm bandit algorithm? They are used in A/B testing of online advertising, where different ads are displayed to different users and based on the outcomes decisions are made about what ads to show in the future. This is desc
15,600
In what kind of real-life situations can we use a multi-arm bandit algorithm?
I asked the same question on Quora Here's the answer Allocation of funding for different departments of an organization Picking best performing athletes out of a group of students given limited time and an arbitrary selection threshold Maximizing website earnings while simultaneously testing new features (in lieu of A/B testing) You can use them anytime you need to optimize results when you don't have enough data to create a rigorous statistical model.
In what kind of real-life situations can we use a multi-arm bandit algorithm?
I asked the same question on Quora Here's the answer Allocation of funding for different departments of an organization Picking best performing athletes out of a group of students given limited tim
In what kind of real-life situations can we use a multi-arm bandit algorithm? I asked the same question on Quora Here's the answer Allocation of funding for different departments of an organization Picking best performing athletes out of a group of students given limited time and an arbitrary selection threshold Maximizing website earnings while simultaneously testing new features (in lieu of A/B testing) You can use them anytime you need to optimize results when you don't have enough data to create a rigorous statistical model.
In what kind of real-life situations can we use a multi-arm bandit algorithm? I asked the same question on Quora Here's the answer Allocation of funding for different departments of an organization Picking best performing athletes out of a group of students given limited tim