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
8,601
XGBoost vs Python Sklearn gradient boosted trees
Unlike the Sklearn's gradient boosting, Xgboost does regularization of the tree as well to avoid overfitting and it deals with the missing values efficiently as well. Following link might be helpful to learn xgboost precisely https://www.youtube.com/watch?v=Vly8xGnNiWs
XGBoost vs Python Sklearn gradient boosted trees
Unlike the Sklearn's gradient boosting, Xgboost does regularization of the tree as well to avoid overfitting and it deals with the missing values efficiently as well. Following link might be helpful t
XGBoost vs Python Sklearn gradient boosted trees Unlike the Sklearn's gradient boosting, Xgboost does regularization of the tree as well to avoid overfitting and it deals with the missing values efficiently as well. Following link might be helpful to learn xgboost precisely https://www.youtube.com/watch?v=Vly8xGnNiWs
XGBoost vs Python Sklearn gradient boosted trees Unlike the Sklearn's gradient boosting, Xgboost does regularization of the tree as well to avoid overfitting and it deals with the missing values efficiently as well. Following link might be helpful t
8,602
XGBoost vs Python Sklearn gradient boosted trees
XGboost is implementation of GBDT with randmization(It uses coloumn sampling and row sampling).Row sampling is possible by not using all of the training data for each base model of the GBDT. Instead of using all of the training data for each base-model, we sample a subset of rows and use only those rows of data to build each of the base models. This ensures that there is a lesser chance of overfitting which is a major issue with simple GBDT which XGBoost tries to address using this randomization.
XGBoost vs Python Sklearn gradient boosted trees
XGboost is implementation of GBDT with randmization(It uses coloumn sampling and row sampling).Row sampling is possible by not using all of the training data for each base model of the GBDT. Instead o
XGBoost vs Python Sklearn gradient boosted trees XGboost is implementation of GBDT with randmization(It uses coloumn sampling and row sampling).Row sampling is possible by not using all of the training data for each base model of the GBDT. Instead of using all of the training data for each base-model, we sample a subset of rows and use only those rows of data to build each of the base models. This ensures that there is a lesser chance of overfitting which is a major issue with simple GBDT which XGBoost tries to address using this randomization.
XGBoost vs Python Sklearn gradient boosted trees XGboost is implementation of GBDT with randmization(It uses coloumn sampling and row sampling).Row sampling is possible by not using all of the training data for each base model of the GBDT. Instead o
8,603
How to deal with multicollinearity when performing variable selection?
First off, a very good resource for this problem is T. Keith, Multiple Regression and Beyond. There is a lot of material in the book about path modeling and variables selection and I think you will find exhaustive answers to your questions there. One way to address multicollinearity is to center the predictors, that is substract the mean of one series from each value. Ridge regression can also be used when data is highly collinear. Finally sequential regression can help in understanding cause-effect relationships between the predictors, in conjunction with analyzing the time sequence of the predictor events. Do all 9 variables show collinearity? For diagnosis you can use Cohen 2003 variance inflation factor. A VIF value >= 10 indicates high collinearity and inflated standard errors. I understand you are more interested in the cause-effect relationship between predictors and outcomes. If not, multicollinearity is not considered a serious problem for prediction, as you can confirm by checking the MAE of out of sample data against models built adding your predictors one at the time. If your predictors have marginal prediction power, you will find that the MAE decreases even in the presence of model multicollinearity.
How to deal with multicollinearity when performing variable selection?
First off, a very good resource for this problem is T. Keith, Multiple Regression and Beyond. There is a lot of material in the book about path modeling and variables selection and I think you will fi
How to deal with multicollinearity when performing variable selection? First off, a very good resource for this problem is T. Keith, Multiple Regression and Beyond. There is a lot of material in the book about path modeling and variables selection and I think you will find exhaustive answers to your questions there. One way to address multicollinearity is to center the predictors, that is substract the mean of one series from each value. Ridge regression can also be used when data is highly collinear. Finally sequential regression can help in understanding cause-effect relationships between the predictors, in conjunction with analyzing the time sequence of the predictor events. Do all 9 variables show collinearity? For diagnosis you can use Cohen 2003 variance inflation factor. A VIF value >= 10 indicates high collinearity and inflated standard errors. I understand you are more interested in the cause-effect relationship between predictors and outcomes. If not, multicollinearity is not considered a serious problem for prediction, as you can confirm by checking the MAE of out of sample data against models built adding your predictors one at the time. If your predictors have marginal prediction power, you will find that the MAE decreases even in the presence of model multicollinearity.
How to deal with multicollinearity when performing variable selection? First off, a very good resource for this problem is T. Keith, Multiple Regression and Beyond. There is a lot of material in the book about path modeling and variables selection and I think you will fi
8,604
How to deal with multicollinearity when performing variable selection?
Because it is so hard to determine which variables to drop, it is often better not to drop variables. Two ways to proceed along this line are (1) use a data reduction method (e.g., variable clustering or principal components) and put summary scores into the model instead of individual variables and (2) put all variables in the model but do not test for the effect of one variable adjusted for the effects of competing variables. For (2), chunk tests of competing variables are powerful because collinear variables join forces in the overall multiple degree of freedom association test, instead of competing against each other as when you test variables individually.
How to deal with multicollinearity when performing variable selection?
Because it is so hard to determine which variables to drop, it is often better not to drop variables. Two ways to proceed along this line are (1) use a data reduction method (e.g., variable clusterin
How to deal with multicollinearity when performing variable selection? Because it is so hard to determine which variables to drop, it is often better not to drop variables. Two ways to proceed along this line are (1) use a data reduction method (e.g., variable clustering or principal components) and put summary scores into the model instead of individual variables and (2) put all variables in the model but do not test for the effect of one variable adjusted for the effects of competing variables. For (2), chunk tests of competing variables are powerful because collinear variables join forces in the overall multiple degree of freedom association test, instead of competing against each other as when you test variables individually.
How to deal with multicollinearity when performing variable selection? Because it is so hard to determine which variables to drop, it is often better not to drop variables. Two ways to proceed along this line are (1) use a data reduction method (e.g., variable clusterin
8,605
How to deal with multicollinearity when performing variable selection?
If you would like to carry out variable selection in the presence of high collinearity I can recommend the l0ara package, which fits L0 penalized GLMs using an iterative adaptive ridge procedure. As this method is ultimately based on ridge regularized regression, it can deal very well with collinearity, and in my simulations it produced much less false positives whilst still giving great prediction performance as well compared to e.g. LASSO, elastic net or adaptive LASSO. Alternatively, you could also try the L0Learn package with a combination of an L0 and L2 penalty. The L0 penalty then favours sparsity (ie small models) whilst the L2 penalty regularizes collinearity. Elastic net (which uses a combination of an L1 and L2 penalty) is also often suggested, but in my tests this produced way more false positives, plus the coefficients will be heavily biased. This bias you can get rid off if you use L0 penalized methods instead (aka best subset) - it's a so-called oracle estimator, that simultaneously obtains consistent and unbiased parameter coefficients. The regularization parameters in all of these methods need to be optimized via cross validation to give optimal out of sample prediction performance. If you would also like to obtain significance levels and confidence intervals on your parameters then you can also do this via nonparametric bootstrapping. The iterative adaptive ridge algorithm of l0ara (sometimes referred to as broken adaptive ridge), like elastic net, possesses a grouping effect, which will cause it to select highly correlated variables in groups as soon as they would enter your model. This makes sense - e.g. if you had two near-collinear variables in your model it would divide the effect equally over both. If you're analysing proportion data you are better off using a logistic regression model btw - the l0ara package allows you to do that in combination with an L0 penalty; for the L0Learn package this will be supported shortly.
How to deal with multicollinearity when performing variable selection?
If you would like to carry out variable selection in the presence of high collinearity I can recommend the l0ara package, which fits L0 penalized GLMs using an iterative adaptive ridge procedure. As t
How to deal with multicollinearity when performing variable selection? If you would like to carry out variable selection in the presence of high collinearity I can recommend the l0ara package, which fits L0 penalized GLMs using an iterative adaptive ridge procedure. As this method is ultimately based on ridge regularized regression, it can deal very well with collinearity, and in my simulations it produced much less false positives whilst still giving great prediction performance as well compared to e.g. LASSO, elastic net or adaptive LASSO. Alternatively, you could also try the L0Learn package with a combination of an L0 and L2 penalty. The L0 penalty then favours sparsity (ie small models) whilst the L2 penalty regularizes collinearity. Elastic net (which uses a combination of an L1 and L2 penalty) is also often suggested, but in my tests this produced way more false positives, plus the coefficients will be heavily biased. This bias you can get rid off if you use L0 penalized methods instead (aka best subset) - it's a so-called oracle estimator, that simultaneously obtains consistent and unbiased parameter coefficients. The regularization parameters in all of these methods need to be optimized via cross validation to give optimal out of sample prediction performance. If you would also like to obtain significance levels and confidence intervals on your parameters then you can also do this via nonparametric bootstrapping. The iterative adaptive ridge algorithm of l0ara (sometimes referred to as broken adaptive ridge), like elastic net, possesses a grouping effect, which will cause it to select highly correlated variables in groups as soon as they would enter your model. This makes sense - e.g. if you had two near-collinear variables in your model it would divide the effect equally over both. If you're analysing proportion data you are better off using a logistic regression model btw - the l0ara package allows you to do that in combination with an L0 penalty; for the L0Learn package this will be supported shortly.
How to deal with multicollinearity when performing variable selection? If you would like to carry out variable selection in the presence of high collinearity I can recommend the l0ara package, which fits L0 penalized GLMs using an iterative adaptive ridge procedure. As t
8,606
Is interaction possible between two continuous variables?
Yes, why not? The same consideration as for categorical variables would apply in this case: The effect of $X_1$ on the outcome $Y$ is not the same depending on the value of $X_2$. To help visualize it, you can think of the values taken by $X_1$ when $X_2$ takes high or low values. Contrary to categorical variables, here interaction is just represented by the product of $X_1$ and $X_2$. Of note, it's better to center your two variables first (so that the coefficient for say $X_1$ reads as the effect of $X_1$ when $X_2$ is at its sample mean). As kindly suggested by @whuber, an easy way to see how $X_1$ varies with $Y$ as a function of $X_2$ when an interaction term is included, is to write down the model $\mathbb{E}(Y|X)=\beta_0+\beta_1X_1+\beta_2X_2+\beta_3X_1X_2$. Then, it can be seen that the effect of a one-unit increase in $X_1$ when $X_2$ is held constant may be expressed as: $$ \begin{eqnarray*} \mathbb{E}(Y|X_1+1,X_2)-\mathbb{E}(Y|X_1,X_2)&=&\beta_0+\beta_1(X_1+1)+\beta_2X_2+\beta_3(X_1+1)X_2\\ &&-\big(\beta_0+\beta_1X_1+\beta_2X_2+\beta_3X_1X_2\big)\\ &=& \beta_1+\beta_3X_2 \end{eqnarray*} $$ Likewise, the effect when $X_2$ is increased by one unit while holding $X_1$ constant is $\beta_2+\beta_3X_1$. This demonstrates why it is difficult to interpret the effects of $X_1$ ($\beta_1$) and $X_2$ ($\beta_2$) in isolation. This will even be more complicated if both predictors are highly correlated. It is also important to keep in mind the linearity assumption that is being made in such a linear model. You can have a look at Multiple regression: testing and interpreting interactions, by Leona S. Aiken, Stephen G. West, and Raymond R. Reno (Sage Publications, 1996), for an overview of the different kind of interaction effects in multiple regression. (This is probably not the best book, but it's available through Google) Here is a toy example in R: library(mvtnorm) set.seed(101) n <- 300 # sample size S <- matrix(c(1,.2,.8,0,.2,1,.6,0,.8,.6,1,-.2,0,0,-.2,1), nr=4, byrow=TRUE) # cor matrix X <- as.data.frame(rmvnorm(n, mean=rep(0, 4), sigma=S)) colnames(X) <- c("x1","x2","y","x1x2") summary(lm(y~x1+x2+x1x2, data=X)) pairs(X) where the output actually reads: Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.01050 0.01860 -0.565 0.573 x1 0.71498 0.01999 35.758 <2e-16 *** x2 0.43706 0.01969 22.201 <2e-16 *** x1x2 -0.17626 0.01801 -9.789 <2e-16 *** --- Signif. codes: 0 β€˜***’ 0.001 β€˜**’ 0.01 β€˜*’ 0.05 β€˜.’ 0.1 β€˜ ’ 1 Residual standard error: 0.3206 on 296 degrees of freedom Multiple R-squared: 0.8828, Adjusted R-squared: 0.8816 F-statistic: 743.2 on 3 and 296 DF, p-value: < 2.2e-16 And here is how the simulated data looks like: To illustrate @whuber's second comment, you can always look at the variations of $Y$ as a function of $X_2$ at different values of $X_1$ (e.g., terciles or deciles); trellis displays are useful in this case. With the data above, we would proceed as follows: library(Hmisc) X$x1b <- cut2(X$x1, g=5) # consider 5 quantiles (60 obs. per group) coplot(y~x2|x1b, data=X, panel = panel.smooth)
Is interaction possible between two continuous variables?
Yes, why not? The same consideration as for categorical variables would apply in this case: The effect of $X_1$ on the outcome $Y$ is not the same depending on the value of $X_2$. To help visualize it
Is interaction possible between two continuous variables? Yes, why not? The same consideration as for categorical variables would apply in this case: The effect of $X_1$ on the outcome $Y$ is not the same depending on the value of $X_2$. To help visualize it, you can think of the values taken by $X_1$ when $X_2$ takes high or low values. Contrary to categorical variables, here interaction is just represented by the product of $X_1$ and $X_2$. Of note, it's better to center your two variables first (so that the coefficient for say $X_1$ reads as the effect of $X_1$ when $X_2$ is at its sample mean). As kindly suggested by @whuber, an easy way to see how $X_1$ varies with $Y$ as a function of $X_2$ when an interaction term is included, is to write down the model $\mathbb{E}(Y|X)=\beta_0+\beta_1X_1+\beta_2X_2+\beta_3X_1X_2$. Then, it can be seen that the effect of a one-unit increase in $X_1$ when $X_2$ is held constant may be expressed as: $$ \begin{eqnarray*} \mathbb{E}(Y|X_1+1,X_2)-\mathbb{E}(Y|X_1,X_2)&=&\beta_0+\beta_1(X_1+1)+\beta_2X_2+\beta_3(X_1+1)X_2\\ &&-\big(\beta_0+\beta_1X_1+\beta_2X_2+\beta_3X_1X_2\big)\\ &=& \beta_1+\beta_3X_2 \end{eqnarray*} $$ Likewise, the effect when $X_2$ is increased by one unit while holding $X_1$ constant is $\beta_2+\beta_3X_1$. This demonstrates why it is difficult to interpret the effects of $X_1$ ($\beta_1$) and $X_2$ ($\beta_2$) in isolation. This will even be more complicated if both predictors are highly correlated. It is also important to keep in mind the linearity assumption that is being made in such a linear model. You can have a look at Multiple regression: testing and interpreting interactions, by Leona S. Aiken, Stephen G. West, and Raymond R. Reno (Sage Publications, 1996), for an overview of the different kind of interaction effects in multiple regression. (This is probably not the best book, but it's available through Google) Here is a toy example in R: library(mvtnorm) set.seed(101) n <- 300 # sample size S <- matrix(c(1,.2,.8,0,.2,1,.6,0,.8,.6,1,-.2,0,0,-.2,1), nr=4, byrow=TRUE) # cor matrix X <- as.data.frame(rmvnorm(n, mean=rep(0, 4), sigma=S)) colnames(X) <- c("x1","x2","y","x1x2") summary(lm(y~x1+x2+x1x2, data=X)) pairs(X) where the output actually reads: Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.01050 0.01860 -0.565 0.573 x1 0.71498 0.01999 35.758 <2e-16 *** x2 0.43706 0.01969 22.201 <2e-16 *** x1x2 -0.17626 0.01801 -9.789 <2e-16 *** --- Signif. codes: 0 β€˜***’ 0.001 β€˜**’ 0.01 β€˜*’ 0.05 β€˜.’ 0.1 β€˜ ’ 1 Residual standard error: 0.3206 on 296 degrees of freedom Multiple R-squared: 0.8828, Adjusted R-squared: 0.8816 F-statistic: 743.2 on 3 and 296 DF, p-value: < 2.2e-16 And here is how the simulated data looks like: To illustrate @whuber's second comment, you can always look at the variations of $Y$ as a function of $X_2$ at different values of $X_1$ (e.g., terciles or deciles); trellis displays are useful in this case. With the data above, we would proceed as follows: library(Hmisc) X$x1b <- cut2(X$x1, g=5) # consider 5 quantiles (60 obs. per group) coplot(y~x2|x1b, data=X, panel = panel.smooth)
Is interaction possible between two continuous variables? Yes, why not? The same consideration as for categorical variables would apply in this case: The effect of $X_1$ on the outcome $Y$ is not the same depending on the value of $X_2$. To help visualize it
8,607
Is rejecting the hypothesis using p-value equivalent to hypothesis not belonging to the confidence interval?
Yes and no. First the "yes" What you've observed is that when a test and a confidence interval is based on the same statistic, there is an equivalence between them: we can interpret the $p$-value as the smallest value of $\alpha$ for which the null value of the parameter would be included in the $1-\alpha$ confidence interval. Let $\theta$ be an unknown parameter in the parameter space $\Theta\subseteq\mathbb{R}$, and let the sample $\mathbf{x}=(x_1,\ldots,x_n)\in\mathcal{X}^ n\subseteq\mathbb{R}^n$ be a realization of the random variable $\mathbf{X}=(X_1,\ldots,X_n)$. For simplicity, define a confidence interval $I_\alpha(\mathbf{X})$ as a random interval such that its coverage probability $$ P_\theta(\theta\in I_\alpha(\mathbf{X}))= 1-\alpha\qquad\mbox{for all }\alpha\in(0,1). $$ (You could similarly consider more general intervals, where the coverage probability either is bounded by or approximately equal to $1-\alpha$. The reasoning is analogous.) Consider a two-sided test of the point-null hypothesis $H_0(\theta_0): \theta=\theta_0$ against the alternative $H_1(\theta_0): \theta\neq \theta_0$. Let $\lambda(\theta_0,\mathbf{x})$ denote the p-value of the test. For any $\alpha\in(0,1)$, $H_0(\theta_0)$ is rejected at the level $\alpha$ if $\lambda(\theta_0,x)\leq\alpha$. The level $\alpha$ rejection region is the set of $\mathbf{x}$ which lead to the rejection of $H_0(\theta_0)$: $$ R_\alpha(\theta_0)=\{\mathbf{x}\in\mathbb{R}^n: \lambda(\theta_0,\mathbf{x})\leq\alpha\}.$$ Now, consider a family of two-sided tests with p-values $\lambda(\theta,\mathbf{x})$, for $\theta\in\Theta$. For such a family we can define an inverted rejection region $$ Q_\alpha(\mathbf{x})=\{\theta\in\Theta: \lambda(\theta,\mathbf{x})\leq\alpha\}.$$ For any fixed $\theta_0$, $H_0(\theta_0)$ is rejected if $\mathbf{x}\in R_\alpha(\theta_0)$, which happens if and only if $\theta_0\in Q_\alpha(\mathbf{x})$, that is, $$ \mathbf{x}\in R_\alpha(\theta_0) \Leftrightarrow \theta_0\in Q_\alpha(\mathbf{x}). $$ If the test is based on a test statistic with a completely specified absolutely continuous null distribution, then $\lambda(\theta_0,\mathbf{X})\sim \mbox{U}(0,1)$ under $H_0(\theta_0)$. Then $$ P_{\theta_0}(\mathbf{X}\in R_\alpha(\theta_0))=P_{\theta_0}(\lambda(\theta_0,\mathbf{X})\leq\alpha)=\alpha. $$ Since this equation holds for any $\theta_0\in\Theta$ and since the equation above it implies that $$P_{\theta_0}(\mathbf{X}\in R_\alpha(\theta_0))=P_{\theta_0}(\theta_0\in Q_\alpha(\mathbf{X})),$$ it follows that the random set $Q_\alpha(\mathbf{x})$ always covers the true parameter $\theta_0$ with probability $\alpha$. Consequently, letting $Q_\alpha^C(\mathbf{x})$ denote the complement of $Q_\alpha(\mathbf{x})$, for all $\theta_0\in\Theta$ we have $$P_{\theta_0}(\theta_0\in Q_\alpha^C(\mathbf{X}))=1-\alpha,$$ meaning that the complement of the inverted rejection region is a $1-\alpha$ confidence interval for $\theta$. An illustration is given below, showing rejection regions and confidence intervals corresponding to the the $z$-test for a normal mean, for different null means $\theta$ and different sample means $\bar{x}$, with $\sigma=1$. $H_0(\theta)$ is rejected if $(\bar{x},\theta)$ is in the shaded light grey region. Shown in dark grey is the rejection region $R_{0.05}(-0.9)=(-\infty,-1.52)\cup(-0.281,\infty)$ and the confidence interval $I_{0.05}(1/2)=Q_{0.05}^C(1/2)=(-0.120,1.120)$. (Much of this is taken from my PhD thesis.) Now for the "no" Above I described the standard way of constructing confidence intervals. In this approach, we use some statistic related to the unknown parameter $\theta$ to construct the interval. There are also intervals based on minimization algorithms, which seek to minimize the length of the interval condition on the value of $X$. Usually, such intervals do not correspond to a test. This phenomenon has to do with problems related to such intervals not being nested, meaning that the 94 % interval can be shorter than the 95 % interval. For more on this, see Section 2.5 of this recent paper of mine (to appear in Bernoulli). And a second "no" In some problems, the standard confidence interval is not based on the same statistic as the standard test (as discussed by Michael Fay in this paper). In those cases, confidence intervals and tests may not give the same results. For instance, $\theta_0=0$ may be rejected by the test even though 0 is included in the confidence interval. This does not contradict the "yes" above, as different statistics are used. And sometimes "yes" is not a good thing As pointed out by f coppens in a comment, sometimes intervals and tests have somewhat conflicting goals. We want short intervals and tests with high power, but the shortest interval does not always correspond to the test with the highest power. For some examples of this, see this paper (multivariate normal distribution), or this (exponential distribution), or Section 4 of my thesis. Bayesians can also say both yes and no Some years ago, I posted a question here about whether a test-interval-equivalence exists also in Bayesian statistics. The short answer is that using standard Bayesian hypothesis testing, the answer is "no". By reformulating the testing problem a little bit, the answer can however be "yes". (My attempts at answering my own question eventually turned into a paper!)
Is rejecting the hypothesis using p-value equivalent to hypothesis not belonging to the confidence i
Yes and no. First the "yes" What you've observed is that when a test and a confidence interval is based on the same statistic, there is an equivalence between them: we can interpret the $p$-value as t
Is rejecting the hypothesis using p-value equivalent to hypothesis not belonging to the confidence interval? Yes and no. First the "yes" What you've observed is that when a test and a confidence interval is based on the same statistic, there is an equivalence between them: we can interpret the $p$-value as the smallest value of $\alpha$ for which the null value of the parameter would be included in the $1-\alpha$ confidence interval. Let $\theta$ be an unknown parameter in the parameter space $\Theta\subseteq\mathbb{R}$, and let the sample $\mathbf{x}=(x_1,\ldots,x_n)\in\mathcal{X}^ n\subseteq\mathbb{R}^n$ be a realization of the random variable $\mathbf{X}=(X_1,\ldots,X_n)$. For simplicity, define a confidence interval $I_\alpha(\mathbf{X})$ as a random interval such that its coverage probability $$ P_\theta(\theta\in I_\alpha(\mathbf{X}))= 1-\alpha\qquad\mbox{for all }\alpha\in(0,1). $$ (You could similarly consider more general intervals, where the coverage probability either is bounded by or approximately equal to $1-\alpha$. The reasoning is analogous.) Consider a two-sided test of the point-null hypothesis $H_0(\theta_0): \theta=\theta_0$ against the alternative $H_1(\theta_0): \theta\neq \theta_0$. Let $\lambda(\theta_0,\mathbf{x})$ denote the p-value of the test. For any $\alpha\in(0,1)$, $H_0(\theta_0)$ is rejected at the level $\alpha$ if $\lambda(\theta_0,x)\leq\alpha$. The level $\alpha$ rejection region is the set of $\mathbf{x}$ which lead to the rejection of $H_0(\theta_0)$: $$ R_\alpha(\theta_0)=\{\mathbf{x}\in\mathbb{R}^n: \lambda(\theta_0,\mathbf{x})\leq\alpha\}.$$ Now, consider a family of two-sided tests with p-values $\lambda(\theta,\mathbf{x})$, for $\theta\in\Theta$. For such a family we can define an inverted rejection region $$ Q_\alpha(\mathbf{x})=\{\theta\in\Theta: \lambda(\theta,\mathbf{x})\leq\alpha\}.$$ For any fixed $\theta_0$, $H_0(\theta_0)$ is rejected if $\mathbf{x}\in R_\alpha(\theta_0)$, which happens if and only if $\theta_0\in Q_\alpha(\mathbf{x})$, that is, $$ \mathbf{x}\in R_\alpha(\theta_0) \Leftrightarrow \theta_0\in Q_\alpha(\mathbf{x}). $$ If the test is based on a test statistic with a completely specified absolutely continuous null distribution, then $\lambda(\theta_0,\mathbf{X})\sim \mbox{U}(0,1)$ under $H_0(\theta_0)$. Then $$ P_{\theta_0}(\mathbf{X}\in R_\alpha(\theta_0))=P_{\theta_0}(\lambda(\theta_0,\mathbf{X})\leq\alpha)=\alpha. $$ Since this equation holds for any $\theta_0\in\Theta$ and since the equation above it implies that $$P_{\theta_0}(\mathbf{X}\in R_\alpha(\theta_0))=P_{\theta_0}(\theta_0\in Q_\alpha(\mathbf{X})),$$ it follows that the random set $Q_\alpha(\mathbf{x})$ always covers the true parameter $\theta_0$ with probability $\alpha$. Consequently, letting $Q_\alpha^C(\mathbf{x})$ denote the complement of $Q_\alpha(\mathbf{x})$, for all $\theta_0\in\Theta$ we have $$P_{\theta_0}(\theta_0\in Q_\alpha^C(\mathbf{X}))=1-\alpha,$$ meaning that the complement of the inverted rejection region is a $1-\alpha$ confidence interval for $\theta$. An illustration is given below, showing rejection regions and confidence intervals corresponding to the the $z$-test for a normal mean, for different null means $\theta$ and different sample means $\bar{x}$, with $\sigma=1$. $H_0(\theta)$ is rejected if $(\bar{x},\theta)$ is in the shaded light grey region. Shown in dark grey is the rejection region $R_{0.05}(-0.9)=(-\infty,-1.52)\cup(-0.281,\infty)$ and the confidence interval $I_{0.05}(1/2)=Q_{0.05}^C(1/2)=(-0.120,1.120)$. (Much of this is taken from my PhD thesis.) Now for the "no" Above I described the standard way of constructing confidence intervals. In this approach, we use some statistic related to the unknown parameter $\theta$ to construct the interval. There are also intervals based on minimization algorithms, which seek to minimize the length of the interval condition on the value of $X$. Usually, such intervals do not correspond to a test. This phenomenon has to do with problems related to such intervals not being nested, meaning that the 94 % interval can be shorter than the 95 % interval. For more on this, see Section 2.5 of this recent paper of mine (to appear in Bernoulli). And a second "no" In some problems, the standard confidence interval is not based on the same statistic as the standard test (as discussed by Michael Fay in this paper). In those cases, confidence intervals and tests may not give the same results. For instance, $\theta_0=0$ may be rejected by the test even though 0 is included in the confidence interval. This does not contradict the "yes" above, as different statistics are used. And sometimes "yes" is not a good thing As pointed out by f coppens in a comment, sometimes intervals and tests have somewhat conflicting goals. We want short intervals and tests with high power, but the shortest interval does not always correspond to the test with the highest power. For some examples of this, see this paper (multivariate normal distribution), or this (exponential distribution), or Section 4 of my thesis. Bayesians can also say both yes and no Some years ago, I posted a question here about whether a test-interval-equivalence exists also in Bayesian statistics. The short answer is that using standard Bayesian hypothesis testing, the answer is "no". By reformulating the testing problem a little bit, the answer can however be "yes". (My attempts at answering my own question eventually turned into a paper!)
Is rejecting the hypothesis using p-value equivalent to hypothesis not belonging to the confidence i Yes and no. First the "yes" What you've observed is that when a test and a confidence interval is based on the same statistic, there is an equivalence between them: we can interpret the $p$-value as t
8,608
Is rejecting the hypothesis using p-value equivalent to hypothesis not belonging to the confidence interval?
When looking at a single parameter, it is possible that a test about the value of the parameter and the confidence interval "mismatch" depending on how they are constructed. In particular, a hypothesis test is a level $\alpha$-test, if it rejects the null hypothesis a proportion $\leq \alpha$ of the time when the null hypothesis is true. For that reason one can e.g. use estimates of model parameters (e.g. the variance) that are only valid under the null hypothesis. If one then tried to construct a CI by inverting this test, the coverage may be not quite right under the alternative hypothesis. For that reason one would usually construct a confidence interval differently so that the coverage is also right under the alternative, which can then lead to a (usually very small) mismatch.
Is rejecting the hypothesis using p-value equivalent to hypothesis not belonging to the confidence i
When looking at a single parameter, it is possible that a test about the value of the parameter and the confidence interval "mismatch" depending on how they are constructed. In particular, a hypothesi
Is rejecting the hypothesis using p-value equivalent to hypothesis not belonging to the confidence interval? When looking at a single parameter, it is possible that a test about the value of the parameter and the confidence interval "mismatch" depending on how they are constructed. In particular, a hypothesis test is a level $\alpha$-test, if it rejects the null hypothesis a proportion $\leq \alpha$ of the time when the null hypothesis is true. For that reason one can e.g. use estimates of model parameters (e.g. the variance) that are only valid under the null hypothesis. If one then tried to construct a CI by inverting this test, the coverage may be not quite right under the alternative hypothesis. For that reason one would usually construct a confidence interval differently so that the coverage is also right under the alternative, which can then lead to a (usually very small) mismatch.
Is rejecting the hypothesis using p-value equivalent to hypothesis not belonging to the confidence i When looking at a single parameter, it is possible that a test about the value of the parameter and the confidence interval "mismatch" depending on how they are constructed. In particular, a hypothesi
8,609
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients
In short, I wouldn't use both the partial $R^2$ and the standardized coefficients in the same analysis, as they are not independent. I would argue that it is usually probably more intuitive to compare relationships using the standardized coefficients because they relate readily to the model definition (i.e. $Y = \beta X$). The partial $R^2$, in turn, is essentially the proportion of unique shared variance between the predictor and dependent variable (dv) (so for the first predictor it is the square of the partial correlation $r_{x_1y.x_2...x_n}$). Furthermore, for a fit with a very small error all the coefficients' partial $R^2$ tend to 1, so they are not useful in identifying the relative importance of the predictors. The effect size definitions standardized coefficient, $\beta_{std}$ - the coefficients $\beta$ obtained from estimating a model on the standardized variables (mean = 0, standard deviation = 1). partial $R^2$- The proportion of residual variation explained by adding the predictor to the constrained model (the full model without the predictor). Same as: the square of the partial correlation between the predictor and the dependent variable, controlling for all the other predictors in the model. $R_{partial}^2 = r_{x_iy.X\setminus x_i}^2$. partial $\eta^2$ - the proportion of type III sums of squares from the predictor to the sum of squares attributed to the predictor and the error $\text{SS}_\text{effect}/(\text{SS}_\text{effect}+\text{SS}_\text{error})$ $\Delta R^2$ - The difference in $R^2$ between the constrained and full model. Equal to: squared semipartial correlation $r_{x_i(y.X\setminus x_i)}^2$ $\eta^2$ for type III sum of squares $\text{SS}_\text{effect}/\text{SS}_\text{total}$ - what you were calculating as partial $R^2$ in the question. All of these are closely related, but they differ as to how they handle the correlation structure between the variables. To understand this difference a bit better let us assume we have 3 standardized (mean = 0, sd = 1) variables $x,y,z$ whose correlations are $r_{xy}, r_{xz}, r_{yz}$. We will take $x$ as the dependent variable and $y$ and $z$ as the predictors. We will express all of the effect size coefficients in terms of the correlations so we can explicitly see how the correlation structure is handled by each. First we will list the coefficients in the regression model $x=\beta_{y}Y+\beta_{z}Z$ estimated using OLS. The formula for the coefficients: \begin{align}\beta_{y} = \frac{r_{xy}-r_{yz}r_{zx}}{1-r_{yz}^2}\\ \beta_{z}= \frac{r_{xz}-r_{yz}r_{yx}}{1-r_{yz}^2}, \end{align} The square root of the $R_\text{partial}^2$ for the predictors will be equal to: $$\sqrt{R^2_{xy.z}} = \frac{r_{xy}-r_{yz}r_{zx}}{\sqrt{(1-r_{xz}^2)(1-r_{yz}^2)}}\\ \sqrt{R^2_{xz.y}} = \frac{r_{xz}-r_{yz}r_{yx}}{\sqrt{(1-r_{xy}^2)(1-r_{yz}^2)}} $$ the $\sqrt{\Delta R^2}$ is given by: $$\sqrt{R^2_{xyz}-R^2_{xz}}= r_{y(x.z)} = \frac{r_{xy}-r_{yz}r_{zx}}{\sqrt{(1-r_{yz}^2)}}\\ \sqrt{R^2_{xzy}-R^2_{xy}}= r_{z(x.y)}= \frac{r_{xz}-r_{yz}r_{yx}}{\sqrt{(1-r_{yz}^2)}} $$ The difference between these is the denominator, which for the $\beta$ and $\sqrt{\Delta R^2}$ contains only the correlation between the predictors. Please note that in most contexts (for weakly correlated predictors) the size of these two will be very similar, so the decision will not impact your interpretation too much. Also, if the predictors that have a similar strength of correlation with the dependent variable and are not too strongly correlated the ratios of the $\sqrt{ R_\text{partial}^2}$ will be similar to the ratios of $\beta_{std}$. Getting back to your code. The anova function in R uses type I sum of squares by default, whereas the partial $R^2$ as described above should be calculated based on a type III sum of squares (which I believe is equivalent to a type II sum of squares if no interaction is present in your model). The difference is how the explained SS is partitioned among the predictors. In type I SS the first predictor is assigned all the explained SS, the second only the "left over SS" and the third only the left over SS from that, therefore the order in which you enter your variables in your lm call changes their respective SS. This is most probably not what you want when interpreting model coefficients. If you use a type II sum of squares in your Anova call from the car package in R, then the $F$ values for your anova will be equal to the $t$ values squared for your coefficients (since $F(1,n) = t^2(n)$). This indicates that indeed these quantities are closely tied, and should not be assessed independently. To invoke a type II sum of squares in your example replace anova(mod) with Anova(mod, type = 2). If you include an interaction term you will need to replace it with type III sum of squares for the coefficient and partial R tests to be the same (just remember to change contrasts to sum using options(contrasts = c("contr.sum","contr.poly")) before calling Anova(mod,type=3)). Partial $R^2$ is the variable SS divided by the variable SS plus the residual SS. This will yield the same values as you listed from the etasq() output. Now the tests and $p$-values for your anova results (partial $R^2$) and your regression coefficients are the same. Credit The formula for the partial correlation is given in ttnphns answer here: Multiple regression or partial correlation coefficient? And relations between the two The formula for semi partial correlation I found here: https://www3.nd.edu/~rwilliam/stats1/x92.pdf The observation that partial $R^2$ of all predictors will be 1 for a perfect fit, and thus not useful for comparing their relative importance was provided by amoeba in the comments to this question.
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients
In short, I wouldn't use both the partial $R^2$ and the standardized coefficients in the same analysis, as they are not independent. I would argue that it is usually probably more intuitive to compare
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients In short, I wouldn't use both the partial $R^2$ and the standardized coefficients in the same analysis, as they are not independent. I would argue that it is usually probably more intuitive to compare relationships using the standardized coefficients because they relate readily to the model definition (i.e. $Y = \beta X$). The partial $R^2$, in turn, is essentially the proportion of unique shared variance between the predictor and dependent variable (dv) (so for the first predictor it is the square of the partial correlation $r_{x_1y.x_2...x_n}$). Furthermore, for a fit with a very small error all the coefficients' partial $R^2$ tend to 1, so they are not useful in identifying the relative importance of the predictors. The effect size definitions standardized coefficient, $\beta_{std}$ - the coefficients $\beta$ obtained from estimating a model on the standardized variables (mean = 0, standard deviation = 1). partial $R^2$- The proportion of residual variation explained by adding the predictor to the constrained model (the full model without the predictor). Same as: the square of the partial correlation between the predictor and the dependent variable, controlling for all the other predictors in the model. $R_{partial}^2 = r_{x_iy.X\setminus x_i}^2$. partial $\eta^2$ - the proportion of type III sums of squares from the predictor to the sum of squares attributed to the predictor and the error $\text{SS}_\text{effect}/(\text{SS}_\text{effect}+\text{SS}_\text{error})$ $\Delta R^2$ - The difference in $R^2$ between the constrained and full model. Equal to: squared semipartial correlation $r_{x_i(y.X\setminus x_i)}^2$ $\eta^2$ for type III sum of squares $\text{SS}_\text{effect}/\text{SS}_\text{total}$ - what you were calculating as partial $R^2$ in the question. All of these are closely related, but they differ as to how they handle the correlation structure between the variables. To understand this difference a bit better let us assume we have 3 standardized (mean = 0, sd = 1) variables $x,y,z$ whose correlations are $r_{xy}, r_{xz}, r_{yz}$. We will take $x$ as the dependent variable and $y$ and $z$ as the predictors. We will express all of the effect size coefficients in terms of the correlations so we can explicitly see how the correlation structure is handled by each. First we will list the coefficients in the regression model $x=\beta_{y}Y+\beta_{z}Z$ estimated using OLS. The formula for the coefficients: \begin{align}\beta_{y} = \frac{r_{xy}-r_{yz}r_{zx}}{1-r_{yz}^2}\\ \beta_{z}= \frac{r_{xz}-r_{yz}r_{yx}}{1-r_{yz}^2}, \end{align} The square root of the $R_\text{partial}^2$ for the predictors will be equal to: $$\sqrt{R^2_{xy.z}} = \frac{r_{xy}-r_{yz}r_{zx}}{\sqrt{(1-r_{xz}^2)(1-r_{yz}^2)}}\\ \sqrt{R^2_{xz.y}} = \frac{r_{xz}-r_{yz}r_{yx}}{\sqrt{(1-r_{xy}^2)(1-r_{yz}^2)}} $$ the $\sqrt{\Delta R^2}$ is given by: $$\sqrt{R^2_{xyz}-R^2_{xz}}= r_{y(x.z)} = \frac{r_{xy}-r_{yz}r_{zx}}{\sqrt{(1-r_{yz}^2)}}\\ \sqrt{R^2_{xzy}-R^2_{xy}}= r_{z(x.y)}= \frac{r_{xz}-r_{yz}r_{yx}}{\sqrt{(1-r_{yz}^2)}} $$ The difference between these is the denominator, which for the $\beta$ and $\sqrt{\Delta R^2}$ contains only the correlation between the predictors. Please note that in most contexts (for weakly correlated predictors) the size of these two will be very similar, so the decision will not impact your interpretation too much. Also, if the predictors that have a similar strength of correlation with the dependent variable and are not too strongly correlated the ratios of the $\sqrt{ R_\text{partial}^2}$ will be similar to the ratios of $\beta_{std}$. Getting back to your code. The anova function in R uses type I sum of squares by default, whereas the partial $R^2$ as described above should be calculated based on a type III sum of squares (which I believe is equivalent to a type II sum of squares if no interaction is present in your model). The difference is how the explained SS is partitioned among the predictors. In type I SS the first predictor is assigned all the explained SS, the second only the "left over SS" and the third only the left over SS from that, therefore the order in which you enter your variables in your lm call changes their respective SS. This is most probably not what you want when interpreting model coefficients. If you use a type II sum of squares in your Anova call from the car package in R, then the $F$ values for your anova will be equal to the $t$ values squared for your coefficients (since $F(1,n) = t^2(n)$). This indicates that indeed these quantities are closely tied, and should not be assessed independently. To invoke a type II sum of squares in your example replace anova(mod) with Anova(mod, type = 2). If you include an interaction term you will need to replace it with type III sum of squares for the coefficient and partial R tests to be the same (just remember to change contrasts to sum using options(contrasts = c("contr.sum","contr.poly")) before calling Anova(mod,type=3)). Partial $R^2$ is the variable SS divided by the variable SS plus the residual SS. This will yield the same values as you listed from the etasq() output. Now the tests and $p$-values for your anova results (partial $R^2$) and your regression coefficients are the same. Credit The formula for the partial correlation is given in ttnphns answer here: Multiple regression or partial correlation coefficient? And relations between the two The formula for semi partial correlation I found here: https://www3.nd.edu/~rwilliam/stats1/x92.pdf The observation that partial $R^2$ of all predictors will be 1 for a perfect fit, and thus not useful for comparing their relative importance was provided by amoeba in the comments to this question.
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients In short, I wouldn't use both the partial $R^2$ and the standardized coefficients in the same analysis, as they are not independent. I would argue that it is usually probably more intuitive to compare
8,610
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients
As already explained in several other answers and in comments, this question was based on at least three confusions: Function anova() uses sequential (also called type I) sum of squares (SS) decomposition that depends on the order of predictors. A decomposition corresponding to the regression coefficients and $t$-tests for their significance, is type III SS, that you can obtain with Anova() function from car package. Even if you use type III SS decomposition, then partial $R^2$ for each predictor are not going to be equal to the squared standardized coefficients $\beta_\mathrm{std}$. The ratios of these values for two different predictors will also be different. Both values are measures of effect size (or importance), but they are different, non-equivalent, measures. They might qualitatively agree most of the times, but they do not have to. What you called partial R squared is not partial R squared. Partial $R^2$ is defined as $\text{SS}_\text{effect}/(\text{SS}_\text{effect}+\text{SS}_\text{error})$. In contrast, $\text{SS}_\text{effect}/\text{SS}_\text{total}$ can be called "eta squared" (borrowing a term from ANOVA), or squared semipartial correlation, or perhaps semipartial $R^2$ (in both formulas $\text{SS}_\text{effect}$ is understood in the type III way). This terminology is not very standard. It is yet another possible measure of importance. After these confusions are clarified, the question remains as to what are the most appropriate measures of predictor effect size, or importance. In R, there is a package relaimpo that provides several measures of relative importance. library(car) library(relaimpo) mod <- lm(education~income+young+urban, data=Anscombe) metrics <- calc.relimp(mod, type = c("lmg", "first", "last", "betasq", "pratt", "genizi", "car")) Using the same Anscombe dataset as in your question, this yields the following metrics: Relative importance metrics: lmg last first betasq pratt genizi car income 0.47702843 0.4968187 0.44565951 0.9453764 0.64908857 0.47690056 0.55375085 young 0.14069003 0.1727782 0.09702319 0.1777135 0.13131006 0.13751552 0.13572338 urban 0.07191039 0.0629027 0.06933945 0.1188235 -0.09076978 0.07521276 0.00015460 Some of these metrics have already been discussed: betasq are squared standardized coefficients, the same values as you obtained with lm(). first is squared correlation between each predictor and response. This is equal to $\text{SS}_\text{effect}/\text{SS}_\text{total}$ when $\text{SS}_\text{effect}$ is type I SS when this predictor is first in the model. The value for 'income' (0.446) matches your computation based on anova() output. Other values don't match. last is an increase in $R^2$ when this predictor is added last into the model. This is $\text{SS}_\text{effect}/\text{SS}_\text{total}$ when $\text{SS}_\text{effect}$ is type III SS; above I called it "semipartial $R^2$". The value for 'urban' (0.063) matches your computation based on anova() output. Other values don't match. Note that the package does not currently provide partial $R^2$ as such (but, according to the author, it might be added in the future [personal communication]). Anyway, it is not difficult to compute by other means. There are four further metrics in relaimpo -- and one more (fifth) is available if the package relaimpo is manually installed: CRAN version excludes this metric due to a potential conflict with its author who, crazy as it sounds, has a US patent on his method. I am running R online and don't have access to it, so if anybody can manually install relaimpo, please add this additional metric to my output above for completeness. Two metrics are pratt that can be negative (bad) and genizi that is pretty obscure. Two interesting approaches are lmg and car. The first is an average of $\text{SS}_\text{effect}/\text{SS}_\text{total}$ over all possible permutations of predictors (here $\text{SS}_\text{effect}$ is type I). It comes from a 1980 book by Lindeman & Merenda & Gold. The second is introduced in (Zuber & Strimmer, 2011) and has many appealing theoretical properties; it is squared standardized coefficients after predictors have been first standardized and then whitened with ZCA/Mahalanobis transformation (i.e. whitened while minimizing reconstruction error). Note that the ratio of the contribution of 'young' to 'urban' is around $2:1$ with lmg (this matches more or less what we see with standardized coefficients and semipartial correlations), but it's $878:1$ with car. The reason for this huge difference is not clear to me. Bibliography: References on relative importance on Ulrike GrΓΆmping's website -- she is the author of relaimpo. GrΓΆmping, U. (2006). Relative Importance for Linear Regression in R: The Package relaimpo. Journal of Statistical Software 17, Issue 1. GrΓΆmping, U. (2007). Estimators of Relative Importance in Linear Regression Based on Variance Decomposition. The American Statistician 61, 139-147. Zuber, V. and Strimmer, K. (2010). High-dimensional regression and variable selection using CAR scores. Statistical Applications in Genetics and Molecular Biology 10.1 (2011): 1-27. GrΓΆmping, U. (2015). Variable importance in regression models. Wiley Interdisciplinary Reviews: Computational Statistics, 7(2), 137-152. (behind pay wall)
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients
As already explained in several other answers and in comments, this question was based on at least three confusions: Function anova() uses sequential (also called type I) sum of squares (SS) decompos
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients As already explained in several other answers and in comments, this question was based on at least three confusions: Function anova() uses sequential (also called type I) sum of squares (SS) decomposition that depends on the order of predictors. A decomposition corresponding to the regression coefficients and $t$-tests for their significance, is type III SS, that you can obtain with Anova() function from car package. Even if you use type III SS decomposition, then partial $R^2$ for each predictor are not going to be equal to the squared standardized coefficients $\beta_\mathrm{std}$. The ratios of these values for two different predictors will also be different. Both values are measures of effect size (or importance), but they are different, non-equivalent, measures. They might qualitatively agree most of the times, but they do not have to. What you called partial R squared is not partial R squared. Partial $R^2$ is defined as $\text{SS}_\text{effect}/(\text{SS}_\text{effect}+\text{SS}_\text{error})$. In contrast, $\text{SS}_\text{effect}/\text{SS}_\text{total}$ can be called "eta squared" (borrowing a term from ANOVA), or squared semipartial correlation, or perhaps semipartial $R^2$ (in both formulas $\text{SS}_\text{effect}$ is understood in the type III way). This terminology is not very standard. It is yet another possible measure of importance. After these confusions are clarified, the question remains as to what are the most appropriate measures of predictor effect size, or importance. In R, there is a package relaimpo that provides several measures of relative importance. library(car) library(relaimpo) mod <- lm(education~income+young+urban, data=Anscombe) metrics <- calc.relimp(mod, type = c("lmg", "first", "last", "betasq", "pratt", "genizi", "car")) Using the same Anscombe dataset as in your question, this yields the following metrics: Relative importance metrics: lmg last first betasq pratt genizi car income 0.47702843 0.4968187 0.44565951 0.9453764 0.64908857 0.47690056 0.55375085 young 0.14069003 0.1727782 0.09702319 0.1777135 0.13131006 0.13751552 0.13572338 urban 0.07191039 0.0629027 0.06933945 0.1188235 -0.09076978 0.07521276 0.00015460 Some of these metrics have already been discussed: betasq are squared standardized coefficients, the same values as you obtained with lm(). first is squared correlation between each predictor and response. This is equal to $\text{SS}_\text{effect}/\text{SS}_\text{total}$ when $\text{SS}_\text{effect}$ is type I SS when this predictor is first in the model. The value for 'income' (0.446) matches your computation based on anova() output. Other values don't match. last is an increase in $R^2$ when this predictor is added last into the model. This is $\text{SS}_\text{effect}/\text{SS}_\text{total}$ when $\text{SS}_\text{effect}$ is type III SS; above I called it "semipartial $R^2$". The value for 'urban' (0.063) matches your computation based on anova() output. Other values don't match. Note that the package does not currently provide partial $R^2$ as such (but, according to the author, it might be added in the future [personal communication]). Anyway, it is not difficult to compute by other means. There are four further metrics in relaimpo -- and one more (fifth) is available if the package relaimpo is manually installed: CRAN version excludes this metric due to a potential conflict with its author who, crazy as it sounds, has a US patent on his method. I am running R online and don't have access to it, so if anybody can manually install relaimpo, please add this additional metric to my output above for completeness. Two metrics are pratt that can be negative (bad) and genizi that is pretty obscure. Two interesting approaches are lmg and car. The first is an average of $\text{SS}_\text{effect}/\text{SS}_\text{total}$ over all possible permutations of predictors (here $\text{SS}_\text{effect}$ is type I). It comes from a 1980 book by Lindeman & Merenda & Gold. The second is introduced in (Zuber & Strimmer, 2011) and has many appealing theoretical properties; it is squared standardized coefficients after predictors have been first standardized and then whitened with ZCA/Mahalanobis transformation (i.e. whitened while minimizing reconstruction error). Note that the ratio of the contribution of 'young' to 'urban' is around $2:1$ with lmg (this matches more or less what we see with standardized coefficients and semipartial correlations), but it's $878:1$ with car. The reason for this huge difference is not clear to me. Bibliography: References on relative importance on Ulrike GrΓΆmping's website -- she is the author of relaimpo. GrΓΆmping, U. (2006). Relative Importance for Linear Regression in R: The Package relaimpo. Journal of Statistical Software 17, Issue 1. GrΓΆmping, U. (2007). Estimators of Relative Importance in Linear Regression Based on Variance Decomposition. The American Statistician 61, 139-147. Zuber, V. and Strimmer, K. (2010). High-dimensional regression and variable selection using CAR scores. Statistical Applications in Genetics and Molecular Biology 10.1 (2011): 1-27. GrΓΆmping, U. (2015). Variable importance in regression models. Wiley Interdisciplinary Reviews: Computational Statistics, 7(2), 137-152. (behind pay wall)
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients As already explained in several other answers and in comments, this question was based on at least three confusions: Function anova() uses sequential (also called type I) sum of squares (SS) decompos
8,611
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients
You wrote: My question is: Should I use partial RΒ² or the coefficients to show how much influence each factor has on the outcome? It is important not to confuse two things here. First, there is the question of model specification. The lm algorithm assumes that the OLS-assumptions are met. Among other things this means that for unbiased estimates, NO signficant variable can be missing from the model (except for when it is uncorrelated to all other regressors, rare). So in finding a model, the additional influence on RΒ² or adjusted RΒ² is of course of interest. One might think it is proper to add regressors until the adjusted RΒ² stops improving, for example. There are interesting problems with stepwise regression procedures such as this, but this is not the topic. In any case I assume there was a reason you chose your model. HOWEVER: this additional influence on the RΒ² is not identical to the real or total influence of the regressor on the independent variable, precisely because of multicollinerity: If you take away the regressor, part of its influence will now be attributed to the other regressors which are correlated to it. So now the true influence is not correctly shown. And there is another problem: The estimates are only valid for the complete model with all other regressors present. Either this model is not yet correct and therefore discussion about influence is meaningless - or it is correct and then you can not eliminate a regressor and still use the OLS methods with success. So: is your model and the use of OLS appropriate? If it is, then the estimates answer your question - they are your literal best guess of the influence of the variables on the regressand / dependent variable. If not, then your first job is to find a correct model. For this the use of partial RΒ² may be a way. A search on model specification or stepwise regression will produce a lot of interesting approaches in this forum. What works will depend on your data.
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients
You wrote: My question is: Should I use partial RΒ² or the coefficients to show how much influence each factor has on the outcome? It is important not to confuse two things here. First, there is th
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients You wrote: My question is: Should I use partial RΒ² or the coefficients to show how much influence each factor has on the outcome? It is important not to confuse two things here. First, there is the question of model specification. The lm algorithm assumes that the OLS-assumptions are met. Among other things this means that for unbiased estimates, NO signficant variable can be missing from the model (except for when it is uncorrelated to all other regressors, rare). So in finding a model, the additional influence on RΒ² or adjusted RΒ² is of course of interest. One might think it is proper to add regressors until the adjusted RΒ² stops improving, for example. There are interesting problems with stepwise regression procedures such as this, but this is not the topic. In any case I assume there was a reason you chose your model. HOWEVER: this additional influence on the RΒ² is not identical to the real or total influence of the regressor on the independent variable, precisely because of multicollinerity: If you take away the regressor, part of its influence will now be attributed to the other regressors which are correlated to it. So now the true influence is not correctly shown. And there is another problem: The estimates are only valid for the complete model with all other regressors present. Either this model is not yet correct and therefore discussion about influence is meaningless - or it is correct and then you can not eliminate a regressor and still use the OLS methods with success. So: is your model and the use of OLS appropriate? If it is, then the estimates answer your question - they are your literal best guess of the influence of the variables on the regressand / dependent variable. If not, then your first job is to find a correct model. For this the use of partial RΒ² may be a way. A search on model specification or stepwise regression will produce a lot of interesting approaches in this forum. What works will depend on your data.
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients You wrote: My question is: Should I use partial RΒ² or the coefficients to show how much influence each factor has on the outcome? It is important not to confuse two things here. First, there is th
8,612
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients
Regarding the difference between the linear regression coefficient and the partial correlation you may read this, for example. However, the confusion expressed in the question seems to be of another nature. It appears to be about the default type of sums-of-squares used by this or that statistical package (topic, repeatedly discussed on our site). Linear regression uses what is called in ANOVA Type III SS reckoning. In many ANOVA programs that is the default option too. In R function anova, it appears to me (I'm not R user, so I just suppose it) the default reckoning is Type I SS (a "sequential SS" which is dependent on the order the predictors are specified in the model). So, the discrepancy that you observed and which did not dissapear when you standardized ("scaled") your variables is because you specified the ANOVA with the default Type I option. Below are results obtained in SPSS with your data: You may pick in these print-outs that parameters (regressional coefficients) are the same regardless type of SS calculation. You may notice also that partial Eta squared [which is SSeffect/(SSeffect+SSerror) and = partial R-squared in our case because the predictors are numeric covariates] is fully the same in the table of effects and of coefficients only when type SS is III. When type SS is I, only the last of the 3 predictors, "urban", retains the same value (.169); this is because in the sequence of input of the predictors it is the last. In case of type III SS the order of input does not matter, as in regression. By the way, the discrepancy is obseved in p-values as well. Although you don't see it in my tables because there is only 3 decimal digits in "Sig" column, the p-values are different between parameters and effects - except for the last predictor or except when type of SS is III. You might want to read more about different "SS types" in ANOVA / linear model. Conceptually, type III or "regression" type of SS is fundamental and primordial. Other types of SS (I, II, IV, there exist even more) are special devices to estimate the effects more comprehensively, less wastefully than regression parameters allow in the situation of correlated predictors. Generally, effects sizes and their p-values are more important to report than parameters and their p-values, unless the aim of the study is to create model for the future. Parameters are what allow you to predict, but "influence" or "effect" may be a wider concept than "strength of linear prediction". To report influence or importance other coefficients are possible besides the partial Eta squared. One being is the leave-one-out coefficient: the importance of a predictor is the residual sum of squares with the predictor removed from the model, normalized so that the importance values for all the predictors sum to 1.
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients
Regarding the difference between the linear regression coefficient and the partial correlation you may read this, for example. However, the confusion expressed in the question seems to be of another n
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients Regarding the difference between the linear regression coefficient and the partial correlation you may read this, for example. However, the confusion expressed in the question seems to be of another nature. It appears to be about the default type of sums-of-squares used by this or that statistical package (topic, repeatedly discussed on our site). Linear regression uses what is called in ANOVA Type III SS reckoning. In many ANOVA programs that is the default option too. In R function anova, it appears to me (I'm not R user, so I just suppose it) the default reckoning is Type I SS (a "sequential SS" which is dependent on the order the predictors are specified in the model). So, the discrepancy that you observed and which did not dissapear when you standardized ("scaled") your variables is because you specified the ANOVA with the default Type I option. Below are results obtained in SPSS with your data: You may pick in these print-outs that parameters (regressional coefficients) are the same regardless type of SS calculation. You may notice also that partial Eta squared [which is SSeffect/(SSeffect+SSerror) and = partial R-squared in our case because the predictors are numeric covariates] is fully the same in the table of effects and of coefficients only when type SS is III. When type SS is I, only the last of the 3 predictors, "urban", retains the same value (.169); this is because in the sequence of input of the predictors it is the last. In case of type III SS the order of input does not matter, as in regression. By the way, the discrepancy is obseved in p-values as well. Although you don't see it in my tables because there is only 3 decimal digits in "Sig" column, the p-values are different between parameters and effects - except for the last predictor or except when type of SS is III. You might want to read more about different "SS types" in ANOVA / linear model. Conceptually, type III or "regression" type of SS is fundamental and primordial. Other types of SS (I, II, IV, there exist even more) are special devices to estimate the effects more comprehensively, less wastefully than regression parameters allow in the situation of correlated predictors. Generally, effects sizes and their p-values are more important to report than parameters and their p-values, unless the aim of the study is to create model for the future. Parameters are what allow you to predict, but "influence" or "effect" may be a wider concept than "strength of linear prediction". To report influence or importance other coefficients are possible besides the partial Eta squared. One being is the leave-one-out coefficient: the importance of a predictor is the residual sum of squares with the predictor removed from the model, normalized so that the importance values for all the predictors sum to 1.
Importance of predictors in multiple regression: Partial $R^2$ vs. standardized coefficients Regarding the difference between the linear regression coefficient and the partial correlation you may read this, for example. However, the confusion expressed in the question seems to be of another n
8,613
Is unbiased maximum likelihood estimator always the best unbiased estimator?
But generally, if we have an unbiased MLE, would it also be the best unbiased estimator ? If there is a complete sufficient statistics, yes. Proof: Lehmann–ScheffΓ© theorem: Any unbiased estimator that is a function of a complete sufficient statistics is the best (UMVUE). MLE is a function of any sufficient statistics. See 4.2.3 here; Thus an unbiased MLE is necesserely the best as long as a complete sufficient statistics exists. But actually this result has almost no case of application since a complete sufficient statistics almost never exists. It is because complete sufficient statistics exist (essentially) only for exponential families where the MLE is most often biased (except location parameter of Gaussians). So the real answer is actually no. A general counter example can be given: any location family with likelihood $p_\theta(x)=p(x-\theta$) with $p$ symmetric around 0 ($\forall t\in\mathbb{R} \quad p(-t)=p(t)$). With sample size $n$, the following holds: the MLE is unbiased it is dominated by another unbiased estimator know as Pitman's equivariant estimator Most often the domination is strict thus the MLE is not even admissible. It was proven when $p$ is Cauchy but I guess it's a general fact. Thus MLE can't be UMVU. Actually, for these families it's known that, with mild conditions, there is never an UMVUE. The example was studied in this question with references and a few proofs.
Is unbiased maximum likelihood estimator always the best unbiased estimator?
But generally, if we have an unbiased MLE, would it also be the best unbiased estimator ? If there is a complete sufficient statistics, yes. Proof: Lehmann–ScheffΓ© theorem: Any unbiased estimator
Is unbiased maximum likelihood estimator always the best unbiased estimator? But generally, if we have an unbiased MLE, would it also be the best unbiased estimator ? If there is a complete sufficient statistics, yes. Proof: Lehmann–ScheffΓ© theorem: Any unbiased estimator that is a function of a complete sufficient statistics is the best (UMVUE). MLE is a function of any sufficient statistics. See 4.2.3 here; Thus an unbiased MLE is necesserely the best as long as a complete sufficient statistics exists. But actually this result has almost no case of application since a complete sufficient statistics almost never exists. It is because complete sufficient statistics exist (essentially) only for exponential families where the MLE is most often biased (except location parameter of Gaussians). So the real answer is actually no. A general counter example can be given: any location family with likelihood $p_\theta(x)=p(x-\theta$) with $p$ symmetric around 0 ($\forall t\in\mathbb{R} \quad p(-t)=p(t)$). With sample size $n$, the following holds: the MLE is unbiased it is dominated by another unbiased estimator know as Pitman's equivariant estimator Most often the domination is strict thus the MLE is not even admissible. It was proven when $p$ is Cauchy but I guess it's a general fact. Thus MLE can't be UMVU. Actually, for these families it's known that, with mild conditions, there is never an UMVUE. The example was studied in this question with references and a few proofs.
Is unbiased maximum likelihood estimator always the best unbiased estimator? But generally, if we have an unbiased MLE, would it also be the best unbiased estimator ? If there is a complete sufficient statistics, yes. Proof: Lehmann–ScheffΓ© theorem: Any unbiased estimator
8,614
Is unbiased maximum likelihood estimator always the best unbiased estimator?
In my opinion, the question is not truly coherent in that the maximisation of a likelihood and unbiasedness do not get along, if only because maximum likelihood estimators are equivariant, ie the transform of the estimator is the estimator of the transform of the parameter, while unbiasedness does not stand under non-linear transforms. Therefore, maximum likelihood estimators are almost never unbiased, if "almost" is considered over the range of all possible parametrisations. However, there is a more direct answer to the question: when considering the estimation of the Normal variance, $\sigma^2$, the UMVUE of $\sigma^2$ is $$\hat{\sigma}^2_n = \frac{1}{n-1} \sum_{i=1}^n \{x_i-\bar{x}_n\}^2$$ while the MLE of $\sigma^2$ is $$\check{\sigma}^2_n = \frac{1}{n} \sum_{i=1}^n \{x_i-\bar{x}_n\}^2$$ Ergo, they differ. This implies that if we have a best regular unbiased estimator, it must be the maximum likelihood estimator (MLE). does not hold in general. Note further that, even when there exist unbiased estimators of a parameter $\theta$, there is no necessarily a best unbiased minimum variance estimator (UNMVUE).
Is unbiased maximum likelihood estimator always the best unbiased estimator?
In my opinion, the question is not truly coherent in that the maximisation of a likelihood and unbiasedness do not get along, if only because maximum likelihood estimators are equivariant, ie the tran
Is unbiased maximum likelihood estimator always the best unbiased estimator? In my opinion, the question is not truly coherent in that the maximisation of a likelihood and unbiasedness do not get along, if only because maximum likelihood estimators are equivariant, ie the transform of the estimator is the estimator of the transform of the parameter, while unbiasedness does not stand under non-linear transforms. Therefore, maximum likelihood estimators are almost never unbiased, if "almost" is considered over the range of all possible parametrisations. However, there is a more direct answer to the question: when considering the estimation of the Normal variance, $\sigma^2$, the UMVUE of $\sigma^2$ is $$\hat{\sigma}^2_n = \frac{1}{n-1} \sum_{i=1}^n \{x_i-\bar{x}_n\}^2$$ while the MLE of $\sigma^2$ is $$\check{\sigma}^2_n = \frac{1}{n} \sum_{i=1}^n \{x_i-\bar{x}_n\}^2$$ Ergo, they differ. This implies that if we have a best regular unbiased estimator, it must be the maximum likelihood estimator (MLE). does not hold in general. Note further that, even when there exist unbiased estimators of a parameter $\theta$, there is no necessarily a best unbiased minimum variance estimator (UNMVUE).
Is unbiased maximum likelihood estimator always the best unbiased estimator? In my opinion, the question is not truly coherent in that the maximisation of a likelihood and unbiasedness do not get along, if only because maximum likelihood estimators are equivariant, ie the tran
8,615
Is unbiased maximum likelihood estimator always the best unbiased estimator?
MLE's asymptotic variance is UMVUE i.e attains cramer rao lower bound but finite variance may not be UMVUE to make sure that estimator is UMVUE it should be sufficient and complete statistics or any function of that statistics.
Is unbiased maximum likelihood estimator always the best unbiased estimator?
MLE's asymptotic variance is UMVUE i.e attains cramer rao lower bound but finite variance may not be UMVUE to make sure that estimator is UMVUE it should be sufficient and complete statistics or any f
Is unbiased maximum likelihood estimator always the best unbiased estimator? MLE's asymptotic variance is UMVUE i.e attains cramer rao lower bound but finite variance may not be UMVUE to make sure that estimator is UMVUE it should be sufficient and complete statistics or any function of that statistics.
Is unbiased maximum likelihood estimator always the best unbiased estimator? MLE's asymptotic variance is UMVUE i.e attains cramer rao lower bound but finite variance may not be UMVUE to make sure that estimator is UMVUE it should be sufficient and complete statistics or any f
8,616
Is unbiased maximum likelihood estimator always the best unbiased estimator?
In short, an estimator is UMVUE, if it is unbiased and the function of a complete and sufficient statistic. (See Rao-Blackwell and Scheffe)
Is unbiased maximum likelihood estimator always the best unbiased estimator?
In short, an estimator is UMVUE, if it is unbiased and the function of a complete and sufficient statistic. (See Rao-Blackwell and Scheffe)
Is unbiased maximum likelihood estimator always the best unbiased estimator? In short, an estimator is UMVUE, if it is unbiased and the function of a complete and sufficient statistic. (See Rao-Blackwell and Scheffe)
Is unbiased maximum likelihood estimator always the best unbiased estimator? In short, an estimator is UMVUE, if it is unbiased and the function of a complete and sufficient statistic. (See Rao-Blackwell and Scheffe)
8,617
R caret and NAs
To the train function in caret, you can pass the parameter na.action = na.pass, and no preprocessing (do not specify preProcess, leave it as its default value NULL). This will pass the NA values unmodified directly to the prediction function (this will cause prediction functions that do not support missing values to fail, for those you would need to specify preProcess to impute the missing values before calling the prediction function). For example: train(formula, dataset, method = "C5.0", na.action = na.pass) In this case, C5.0 will handle missing values by itself.
R caret and NAs
To the train function in caret, you can pass the parameter na.action = na.pass, and no preprocessing (do not specify preProcess, leave it as its default value NULL). This will pass the NA values unmod
R caret and NAs To the train function in caret, you can pass the parameter na.action = na.pass, and no preprocessing (do not specify preProcess, leave it as its default value NULL). This will pass the NA values unmodified directly to the prediction function (this will cause prediction functions that do not support missing values to fail, for those you would need to specify preProcess to impute the missing values before calling the prediction function). For example: train(formula, dataset, method = "C5.0", na.action = na.pass) In this case, C5.0 will handle missing values by itself.
R caret and NAs To the train function in caret, you can pass the parameter na.action = na.pass, and no preprocessing (do not specify preProcess, leave it as its default value NULL). This will pass the NA values unmod
8,618
R caret and NAs
Have you tried recoding the NAs? Something >3 standard deviations outside your data (e.g. -12345) should encourage C5.0 to predict them separately, like it does with NAs.
R caret and NAs
Have you tried recoding the NAs? Something >3 standard deviations outside your data (e.g. -12345) should encourage C5.0 to predict them separately, like it does with NAs.
R caret and NAs Have you tried recoding the NAs? Something >3 standard deviations outside your data (e.g. -12345) should encourage C5.0 to predict them separately, like it does with NAs.
R caret and NAs Have you tried recoding the NAs? Something >3 standard deviations outside your data (e.g. -12345) should encourage C5.0 to predict them separately, like it does with NAs.
8,619
R caret and NAs
I think your solution would be to impute the values while using the predict() function. See ?predict.train for more details. You can use na.omit to allow caret to impute values. For example: ## S3 method for class 'train': predict((object, newdata = NULL, type = "raw", na.action = na.omit, ...) from http://www.inside-r.org/packages/cran/caret/docs/predict.train Another solution would be to impute while preprocessing the data: ## S3 method for class 'default': preProcess(x, method = "knnImpute", # or *bagImpute* / *medianImpute* pcaComp = 10, na.remove = TRUE, k = 5, knnSummary = mean, outcome = NULL, fudge = .2, numUnique = 3, verbose = TRUE, ) from http://www.inside-r.org/node/86978
R caret and NAs
I think your solution would be to impute the values while using the predict() function. See ?predict.train for more details. You can use na.omit to allow caret to impute values. For example: ## S3
R caret and NAs I think your solution would be to impute the values while using the predict() function. See ?predict.train for more details. You can use na.omit to allow caret to impute values. For example: ## S3 method for class 'train': predict((object, newdata = NULL, type = "raw", na.action = na.omit, ...) from http://www.inside-r.org/packages/cran/caret/docs/predict.train Another solution would be to impute while preprocessing the data: ## S3 method for class 'default': preProcess(x, method = "knnImpute", # or *bagImpute* / *medianImpute* pcaComp = 10, na.remove = TRUE, k = 5, knnSummary = mean, outcome = NULL, fudge = .2, numUnique = 3, verbose = TRUE, ) from http://www.inside-r.org/node/86978
R caret and NAs I think your solution would be to impute the values while using the predict() function. See ?predict.train for more details. You can use na.omit to allow caret to impute values. For example: ## S3
8,620
Is the exact value of a 'p-value' meaningless?
The type 1 / false rejection error rate $\alpha=.05$ isn't completely arbitrary, but yes, it is close. It's somewhat preferable to $\alpha=.051$ because it's less cognitively complex (people like round numbers and multiples of five). It's a decent compromise between skepticism and practicality, though maybe a little outdated – modern methods and research resources may make higher standards (i.e., lower $p$ values) preferable, if standards there must be (Johnson, 2013). IMO, the greater problem than the choice of threshold is the often unexamined choice to use a threshold where it is not necessary or helpful. In situations where a practical choice has to be made, I can see the value, but much basic research does not necessitate the decision to dismiss one's evidence and give up on the prospect of rejecting the null just because a given sample's evidence against it falls short of almost any reasonable threshold. Yet much of this research's authors feel obligated to do so by convention, and resist it uncomfortably, inventing terms like "marginal" significance to beg for attention when they can feel it slipping away because their audiences often don't care about $p$s $\ge.05$. If you look around at other questions here on $p$ value interpretation, you'll see plenty of dissension about the interpretation of $p$ values by binary fail to/reject decisions regarding the null. Completely different – no. Meaningfully different – maybe. One reason to show a ridiculously small $p$ value is to imply information about effect size. Of course, just reporting effect size would be much better for several technical reasons, but authors often fail to consider this alternative, and audiences may be less familiar with it as well, unfortunately. In a null-hypothetical world where no one knows how to report effect sizes, one may be right most often in guessing that a smaller $p$ means a larger effect. To whatever extent this null-hypothetical world is closer to reality than the opposite, maybe there's some value in reporting exact $p$s for this reason. Please understand that this point is pure devil's advocacy... Another use for exact $p$s that I've learned by engaging in a very similar debate here is as indices of likelihood functions. See Michael Lew's comments on and article (Lew, 2013) linked in my answer to "Accommodating entrenched views of p-values". I don't think the Bonferroni correction is the same kind of arbitrary really. It corrects the threshold that I think we agree is at least close-to-completely arbitrary, so it doesn't lose any of that fundamental arbitrariness, but I don't think it adds anything arbitrary to the equation. The correction is defined in a logical, pragmatic way, and minor variations toward larger or smaller corrections would seem to require rather sophisticated arguments to justify them as more than arbitrary, whereas I think it would be easier to argue for an adjustment of $\alpha$ without having to overcome any deeply appealing yet simple logic in it. If anything, I think $p$ values should be more open to interpretation! I.e., whether the null is really more useful than the alternative ought to depend on more than just the evidence against it, including the cost of obtaining more information and the added incremental value of more precise knowledge thusly gained. This is essentially the Fisherian no-threshold idea that, AFAIK, is how it all began. See "Regarding p-values, why 1% and 5%? Why not 6% or 10%?" If fail to/reject crises aren't forced upon the null hypothesis from the outset, then the more continuous understanding of statistical significance certainly does admit the possibility of continuously increasing significance. In the dichotomized approach to statistical significance (I think this is sometimes referred to as the Neyman-Pearson framework; cf. Dienes, 2007), no, any significant result is as significant as the next – no more, no less. This question may help explain that principle: "Why are p-values uniformly distributed under the null hypothesis?" As for how many zeroes are meaningful and worth reporting, I recommend Glen_b's answer to this question: "How should tiny $p$-values be reported? (and why does R put a minimum on 2.22e-16?)" – it's much better than the answers to the version of that question you linked on Stack Overflow! References - Johnson, V. E. (2013). Revised standards for statistical evidence. Proceedings of the National Academy of Sciences, 110(48), 19313–19317. Retrieved from http://www.pnas.org/content/110/48/19313.full.pdf. - Lew, M. J. (2013). To P or not to P: On the evidential nature of P-values and their place in scientific inference. arXiv:1311.0081 [stat.ME]. Retrieved from http://arxiv.org/abs/1311.0081.
Is the exact value of a 'p-value' meaningless?
The type 1 / false rejection error rate $\alpha=.05$ isn't completely arbitrary, but yes, it is close. It's somewhat preferable to $\alpha=.051$ because it's less cognitively complex (people like roun
Is the exact value of a 'p-value' meaningless? The type 1 / false rejection error rate $\alpha=.05$ isn't completely arbitrary, but yes, it is close. It's somewhat preferable to $\alpha=.051$ because it's less cognitively complex (people like round numbers and multiples of five). It's a decent compromise between skepticism and practicality, though maybe a little outdated – modern methods and research resources may make higher standards (i.e., lower $p$ values) preferable, if standards there must be (Johnson, 2013). IMO, the greater problem than the choice of threshold is the often unexamined choice to use a threshold where it is not necessary or helpful. In situations where a practical choice has to be made, I can see the value, but much basic research does not necessitate the decision to dismiss one's evidence and give up on the prospect of rejecting the null just because a given sample's evidence against it falls short of almost any reasonable threshold. Yet much of this research's authors feel obligated to do so by convention, and resist it uncomfortably, inventing terms like "marginal" significance to beg for attention when they can feel it slipping away because their audiences often don't care about $p$s $\ge.05$. If you look around at other questions here on $p$ value interpretation, you'll see plenty of dissension about the interpretation of $p$ values by binary fail to/reject decisions regarding the null. Completely different – no. Meaningfully different – maybe. One reason to show a ridiculously small $p$ value is to imply information about effect size. Of course, just reporting effect size would be much better for several technical reasons, but authors often fail to consider this alternative, and audiences may be less familiar with it as well, unfortunately. In a null-hypothetical world where no one knows how to report effect sizes, one may be right most often in guessing that a smaller $p$ means a larger effect. To whatever extent this null-hypothetical world is closer to reality than the opposite, maybe there's some value in reporting exact $p$s for this reason. Please understand that this point is pure devil's advocacy... Another use for exact $p$s that I've learned by engaging in a very similar debate here is as indices of likelihood functions. See Michael Lew's comments on and article (Lew, 2013) linked in my answer to "Accommodating entrenched views of p-values". I don't think the Bonferroni correction is the same kind of arbitrary really. It corrects the threshold that I think we agree is at least close-to-completely arbitrary, so it doesn't lose any of that fundamental arbitrariness, but I don't think it adds anything arbitrary to the equation. The correction is defined in a logical, pragmatic way, and minor variations toward larger or smaller corrections would seem to require rather sophisticated arguments to justify them as more than arbitrary, whereas I think it would be easier to argue for an adjustment of $\alpha$ without having to overcome any deeply appealing yet simple logic in it. If anything, I think $p$ values should be more open to interpretation! I.e., whether the null is really more useful than the alternative ought to depend on more than just the evidence against it, including the cost of obtaining more information and the added incremental value of more precise knowledge thusly gained. This is essentially the Fisherian no-threshold idea that, AFAIK, is how it all began. See "Regarding p-values, why 1% and 5%? Why not 6% or 10%?" If fail to/reject crises aren't forced upon the null hypothesis from the outset, then the more continuous understanding of statistical significance certainly does admit the possibility of continuously increasing significance. In the dichotomized approach to statistical significance (I think this is sometimes referred to as the Neyman-Pearson framework; cf. Dienes, 2007), no, any significant result is as significant as the next – no more, no less. This question may help explain that principle: "Why are p-values uniformly distributed under the null hypothesis?" As for how many zeroes are meaningful and worth reporting, I recommend Glen_b's answer to this question: "How should tiny $p$-values be reported? (and why does R put a minimum on 2.22e-16?)" – it's much better than the answers to the version of that question you linked on Stack Overflow! References - Johnson, V. E. (2013). Revised standards for statistical evidence. Proceedings of the National Academy of Sciences, 110(48), 19313–19317. Retrieved from http://www.pnas.org/content/110/48/19313.full.pdf. - Lew, M. J. (2013). To P or not to P: On the evidential nature of P-values and their place in scientific inference. arXiv:1311.0081 [stat.ME]. Retrieved from http://arxiv.org/abs/1311.0081.
Is the exact value of a 'p-value' meaningless? The type 1 / false rejection error rate $\alpha=.05$ isn't completely arbitrary, but yes, it is close. It's somewhat preferable to $\alpha=.051$ because it's less cognitively complex (people like roun
8,621
Is the exact value of a 'p-value' meaningless?
It seems to me that, if a value is meaningful, its exact value is meaningful. The p value answers this question: If, in the population from which this sample was randomly drawn, the null hypothesis was true, what is the probability of getting a test statistic at least as extreme as the one we got in the sample? What about this definition makes an exact value meaningless? This is a different question from the ones about extreme values of p. The problem with statements that involve p with many 0's are about how well we can estimate p in the extremes. Since we can't do that very well, it makes no sense to use such precise estimates of p. This is the same reason we don't say that p = 0.0319281010012981 . We don't know those last digits with any confidence. Should our conclusions be different if p < 0.001 rather than p < 0.05? Or, to use precise numbers, should our conclusions be different if p = 0.00023 rather than p = 0.035? I think the problem is with how we typically conclude things about p. We say "significant" or "not significant" based on some arbitrary level. If we use these arbitrary levels, then, yes, our conclusions will be different. But this is not how we should be thinking about these things. We should be looking at the weight of evidence and statistical tests are only part of that evidence. I will (once again) plug Robert Abelson's "MAGIC criteria": Magnitude - how big is the effect? Articulation - how precisely is it stated? Are there lots of exceptions? Generality - to what group does it apply? Interestingness - will people care? Credibility - does it make sense? It is the combination of all of these that matters. Note that Abelson doesn't mention p values at all, although they do come in as a sort of hybrid of magnitude and articulation.
Is the exact value of a 'p-value' meaningless?
It seems to me that, if a value is meaningful, its exact value is meaningful. The p value answers this question: If, in the population from which this sample was randomly drawn, the null hypothesi
Is the exact value of a 'p-value' meaningless? It seems to me that, if a value is meaningful, its exact value is meaningful. The p value answers this question: If, in the population from which this sample was randomly drawn, the null hypothesis was true, what is the probability of getting a test statistic at least as extreme as the one we got in the sample? What about this definition makes an exact value meaningless? This is a different question from the ones about extreme values of p. The problem with statements that involve p with many 0's are about how well we can estimate p in the extremes. Since we can't do that very well, it makes no sense to use such precise estimates of p. This is the same reason we don't say that p = 0.0319281010012981 . We don't know those last digits with any confidence. Should our conclusions be different if p < 0.001 rather than p < 0.05? Or, to use precise numbers, should our conclusions be different if p = 0.00023 rather than p = 0.035? I think the problem is with how we typically conclude things about p. We say "significant" or "not significant" based on some arbitrary level. If we use these arbitrary levels, then, yes, our conclusions will be different. But this is not how we should be thinking about these things. We should be looking at the weight of evidence and statistical tests are only part of that evidence. I will (once again) plug Robert Abelson's "MAGIC criteria": Magnitude - how big is the effect? Articulation - how precisely is it stated? Are there lots of exceptions? Generality - to what group does it apply? Interestingness - will people care? Credibility - does it make sense? It is the combination of all of these that matters. Note that Abelson doesn't mention p values at all, although they do come in as a sort of hybrid of magnitude and articulation.
Is the exact value of a 'p-value' meaningless? It seems to me that, if a value is meaningful, its exact value is meaningful. The p value answers this question: If, in the population from which this sample was randomly drawn, the null hypothesi
8,622
Intuitive reasoning behind biased maximum likelihood estimators
the ML estimator results in the value for the parameter which is most likely to occur in the dataset. Given the assumptions, the ML estimator is the value of the parameter that has the best chance of producing the data set. I cannot intuitively understand a biased ML estimator in the sense that "How can the most likely value for the parameter predict the real value of the parameter with a bias towards a wrong value?" Bias is about expectations of sampling distributions. "Most likely to produce the data" isn't about expectations of sampling distributions. Why would they be expected to go together? What is the basis on which it is surprising they don't necessarily correspond? I'd suggest you consider some simple cases of MLE and ponder how the difference arises in those particular cases. As an example, consider observations on a uniform on $(0,\theta)$. The largest observation is (necessarily) no bigger than the parameter, so the parameter can only take values at least as large as the largest observation. When you consider the likelihood for $\theta$, it is (obviously) larger the closer $\theta$ is to the largest observation. So it's maximized at the largest observation; that's clearly the estimate for $\theta$ that maximizes the chance of obtaining the sample you got: But on the other hand it must be biased, since the largest observation is obviously (with probability 1) smaller than the true value of $\theta$; any other estimate of $\theta$ not already ruled out by the sample itself must be larger than it, and must (quite plainly in this case) be less likely to produce the sample. The expectation of the largest observation from a $U(0,\theta)$ is $\frac{n}{n+1}\theta$, so the usual way to unbias it is to take as the estimator of $\theta$: $\hat\theta=\frac{n+1}{n}X_{(n)}$, where $X_{(n)}$ is the largest observation. This lies to the right of the MLE, and so has lower likelihood.
Intuitive reasoning behind biased maximum likelihood estimators
the ML estimator results in the value for the parameter which is most likely to occur in the dataset. Given the assumptions, the ML estimator is the value of the parameter that has the best chance of
Intuitive reasoning behind biased maximum likelihood estimators the ML estimator results in the value for the parameter which is most likely to occur in the dataset. Given the assumptions, the ML estimator is the value of the parameter that has the best chance of producing the data set. I cannot intuitively understand a biased ML estimator in the sense that "How can the most likely value for the parameter predict the real value of the parameter with a bias towards a wrong value?" Bias is about expectations of sampling distributions. "Most likely to produce the data" isn't about expectations of sampling distributions. Why would they be expected to go together? What is the basis on which it is surprising they don't necessarily correspond? I'd suggest you consider some simple cases of MLE and ponder how the difference arises in those particular cases. As an example, consider observations on a uniform on $(0,\theta)$. The largest observation is (necessarily) no bigger than the parameter, so the parameter can only take values at least as large as the largest observation. When you consider the likelihood for $\theta$, it is (obviously) larger the closer $\theta$ is to the largest observation. So it's maximized at the largest observation; that's clearly the estimate for $\theta$ that maximizes the chance of obtaining the sample you got: But on the other hand it must be biased, since the largest observation is obviously (with probability 1) smaller than the true value of $\theta$; any other estimate of $\theta$ not already ruled out by the sample itself must be larger than it, and must (quite plainly in this case) be less likely to produce the sample. The expectation of the largest observation from a $U(0,\theta)$ is $\frac{n}{n+1}\theta$, so the usual way to unbias it is to take as the estimator of $\theta$: $\hat\theta=\frac{n+1}{n}X_{(n)}$, where $X_{(n)}$ is the largest observation. This lies to the right of the MLE, and so has lower likelihood.
Intuitive reasoning behind biased maximum likelihood estimators the ML estimator results in the value for the parameter which is most likely to occur in the dataset. Given the assumptions, the ML estimator is the value of the parameter that has the best chance of
8,623
Intuitive reasoning behind biased maximum likelihood estimators
$\beta^{MLE}$ is not the most probable value of $\beta$. The most probable value is $\beta $ itself. $\beta^{MLE}$ maximizes the probability of drawing the sample that we actually got. MLE is only asymptotically unbiased, and often you can adjust the estimator to behave better in finite samples. For example, the MLE of the variance of a random variable is one example, where multiplying by $\frac{N}{N-1}$ transforms it.
Intuitive reasoning behind biased maximum likelihood estimators
$\beta^{MLE}$ is not the most probable value of $\beta$. The most probable value is $\beta $ itself. $\beta^{MLE}$ maximizes the probability of drawing the sample that we actually got. MLE is only as
Intuitive reasoning behind biased maximum likelihood estimators $\beta^{MLE}$ is not the most probable value of $\beta$. The most probable value is $\beta $ itself. $\beta^{MLE}$ maximizes the probability of drawing the sample that we actually got. MLE is only asymptotically unbiased, and often you can adjust the estimator to behave better in finite samples. For example, the MLE of the variance of a random variable is one example, where multiplying by $\frac{N}{N-1}$ transforms it.
Intuitive reasoning behind biased maximum likelihood estimators $\beta^{MLE}$ is not the most probable value of $\beta$. The most probable value is $\beta $ itself. $\beta^{MLE}$ maximizes the probability of drawing the sample that we actually got. MLE is only as
8,624
Intuitive reasoning behind biased maximum likelihood estimators
Here's my intuition. Bias is a measure of accuracy, but there's also a notion of precision. In an ideal world, we'd get the estimate, which is both precise and accurate, i.e. always hits the bull's eye. Unfortunately, in our imperfect world, we have to balance accuracy and precision. Sometimes we may feel that we could give a bit of accuracy to gain more precision: we trade-off all the time. Hence, the fact that an estimator is biased doesn't mean that it's bad: it could be that it's more precise.
Intuitive reasoning behind biased maximum likelihood estimators
Here's my intuition. Bias is a measure of accuracy, but there's also a notion of precision. In an ideal world, we'd get the estimate, which is both precise and accurate, i.e. always hits the bull's
Intuitive reasoning behind biased maximum likelihood estimators Here's my intuition. Bias is a measure of accuracy, but there's also a notion of precision. In an ideal world, we'd get the estimate, which is both precise and accurate, i.e. always hits the bull's eye. Unfortunately, in our imperfect world, we have to balance accuracy and precision. Sometimes we may feel that we could give a bit of accuracy to gain more precision: we trade-off all the time. Hence, the fact that an estimator is biased doesn't mean that it's bad: it could be that it's more precise.
Intuitive reasoning behind biased maximum likelihood estimators Here's my intuition. Bias is a measure of accuracy, but there's also a notion of precision. In an ideal world, we'd get the estimate, which is both precise and accurate, i.e. always hits the bull's
8,625
Intuitive reasoning behind biased maximum likelihood estimators
The ordinary-language and technical meanings of biased are different. The answer by @Glen_b gives a good description of why maximum likelihood estimators can easily be biased in the technical sense. It is possible for the maximum likelihood estimator to be biased in something like the ordinary-language sense, but it's not usual. Something has to go wrong. The standard examples of an inconsistent MLE involve paired data. Suppose $X_{ij}\sim N(\mu_i,\sigma^2)$, for $j=0,1$, and $i=1,2,3,\dots,n$. The MLE of $\mu_i$ is $(X_{i0}+X_{i1})/2$. The MLE of $\hat\sigma^2$ is $$\hat\sigma^2= \frac{1}{2n}\sum_{i=1}^n\sum_{j=0}^1 (X_{ij}-\hat\mu_i)^2$$ As you get more data, $\hat\sigma^2$ converges not to $\sigma^2$ but to $\sigma^2/2$. With binary matched-pair data the generating model is $$\mathrm{logit}\,P[Y_{ij}=1]=\alpha_i+\beta X_{ij}$$ The MLE $\hat\beta$ converges to $2\beta$ rather than to $\beta$. In both cases, the problem is having the number of parameters grow with $n$, and the solution is a conditional likelihood that removes the $n$ intercept parameters before estimating the parameter you're interested in.
Intuitive reasoning behind biased maximum likelihood estimators
The ordinary-language and technical meanings of biased are different. The answer by @Glen_b gives a good description of why maximum likelihood estimators can easily be biased in the technical sense. I
Intuitive reasoning behind biased maximum likelihood estimators The ordinary-language and technical meanings of biased are different. The answer by @Glen_b gives a good description of why maximum likelihood estimators can easily be biased in the technical sense. It is possible for the maximum likelihood estimator to be biased in something like the ordinary-language sense, but it's not usual. Something has to go wrong. The standard examples of an inconsistent MLE involve paired data. Suppose $X_{ij}\sim N(\mu_i,\sigma^2)$, for $j=0,1$, and $i=1,2,3,\dots,n$. The MLE of $\mu_i$ is $(X_{i0}+X_{i1})/2$. The MLE of $\hat\sigma^2$ is $$\hat\sigma^2= \frac{1}{2n}\sum_{i=1}^n\sum_{j=0}^1 (X_{ij}-\hat\mu_i)^2$$ As you get more data, $\hat\sigma^2$ converges not to $\sigma^2$ but to $\sigma^2/2$. With binary matched-pair data the generating model is $$\mathrm{logit}\,P[Y_{ij}=1]=\alpha_i+\beta X_{ij}$$ The MLE $\hat\beta$ converges to $2\beta$ rather than to $\beta$. In both cases, the problem is having the number of parameters grow with $n$, and the solution is a conditional likelihood that removes the $n$ intercept parameters before estimating the parameter you're interested in.
Intuitive reasoning behind biased maximum likelihood estimators The ordinary-language and technical meanings of biased are different. The answer by @Glen_b gives a good description of why maximum likelihood estimators can easily be biased in the technical sense. I
8,626
Are 50% confidence intervals more robustly estimated than 95% confidence intervals?
This answer analyzes the meaning of the quotation and offers the results of a simulation study to illustrate it and help understand what it might be trying to say. The study can easily be extended by anybody (with rudimentary R skills) to explore other confidence interval procedures and other models. Two interesting issues emerged in this work. One concerns how to evaluate the accuracy of a confidence interval procedure. The impression one gets of robustness depends on that. I display two different accuracy measures so you can compare them. The other issue is that although a confidence interval procedure with low confidence may be robust, the corresponding confidence limits might not be robust at all. Intervals tend to work well because the errors they make at one end often counterbalance the errors they make at the other. As a practical matter, you can be pretty sure that around half of your $50\%$ confidence intervals are covering their parameters, but the actual parameter might consistently lie near one particular end of each interval, depending on how reality departs from your model assumptions. Robust has a standard meaning in statistics: Robustness generally implies insensitivity to departures from assumptions surrounding an underlying probabilistic model. (Hoaglin, Mosteller, and Tukey, Understanding Robust and Exploratory Data Analysis. J. Wiley (1983), p. 2.) This is consistent with the quotation in the question. To understand the quotation we still need to know the intended purpose of a confidence interval. To this end, let's review what Gelman wrote. I prefer 50% to 95% intervals for 3 reasons: Computational stability, More intuitive evaluation (half the 50% intervals should contain the true value), A sense that in applications it’s best to get a sense of where the parameters and predicted values will be, not to attempt an unrealistic near-certainty. Since getting a sense of predicted values is not what confidence intervals (CIs) are intended for, I will focus on getting a sense of parameter values, which is what CIs do. Let's call these the "target" values. Whence, by definition, a CI is intended to cover its target with a specified probability (its confidence level). Achieving intended coverage rates is the minimum criterion for evaluating the quality of any CI procedure. (Additionally, we might be interested in typical CI widths. To keep the post to a reasonable length, I will ignore this issue.) These considerations invite us to study how much a confidence interval calculation could mislead us concerning the target parameter value. The quotation could be read as suggesting that lower-confidence CIs might retain their coverage even when the data are generated by a process different than the model. That's something we can test. The procedure is: Adopt a probability model that includes at least one parameter. The classic one is sampling from a Normal distribution of unknown mean and variance. Select a CI procedure for one or more of the model's parameters. An excellent one constructs the CI from the sample mean and sample standard deviation, multiplying the latter by a factor given by a Student t distribution. Apply that procedure to various different models--departing not too much from the adopted one--to assess its coverage over a range of confidence levels. As an example, I have done just that. I have allowed the underlying distribution to vary across a wide range, from almost Bernoulli, to Uniform, to Normal, to Exponential, and all the way to Lognormal. These include symmetric distributions (the first three) and strongly skewed ones (the last two). For each distribution I generated 50,000 samples of size 12. For each sample I constructed two-sided CIs of confidence levels between $50\%$ and $99.8\%$, which covers most applications. An interesting issue now arises: How should we measure how well (or how badly) a CI procedure is performing? A common method simply evaluates the difference between the actual coverage and the confidence level. This can look suspiciously good for high confidence levels, though. For instance, if you are trying to achieve 99.9% confidence but you get only 99% coverage, the raw difference is a mere 0.9%. However, that means your procedure fails to cover the target ten times more often than it should! For this reason, a more informative way of comparing coverages ought to use something like odds ratios. I use differences of logits, which are the logarithms of odds ratios. Specifically, when the desired confidence level is $\alpha$ and the actual coverage is $p$, then $$\log\left(\frac{p}{1-p}\right) - \log\left(\frac{\alpha}{1-\alpha}\right)$$ nicely captures the difference. When it is zero, the coverage is exactly the value intended. When it is negative, the coverage is too low--which means the CI is too optimistic and underestimates the uncertainty. The question, then, is how do these error rates vary with confidence level as the underlying model is perturbed? We can answer it by plotting the simulation results. These plots quantify how "unrealistic" the "near-certainty" of a CI might be in this archetypal application. The graphics show the same results, but the one at the left displays the values on logit scales while the one at the right uses raw scales. The Beta distribution is a Beta$(1/30,1/30)$ (which is practically a Bernoulli distribution). The lognormal distribution is the exponential of the standard Normal distribution. The normal distribution is included to verify that this CI procedure really does attain its intended coverage and to reveal how much variation to expect from the finite simulation size. (Indeed, the graphs for the normal distribution are comfortably close to zero, showing no significant deviations.) It is clear that on the logit scale, the coverages grow more divergent as the confidence level increases. There are some interesting exceptions, though. If we are unconcerned with perturbations of the model that introduce skewness or long tails, then we can ignore the exponential and lognormal and focus on the rest. Their behavior is erratic until $\alpha$ exceeds $95\%$ or so (a logit of $3$), at which point the divergence has set in. This little study brings some concreteness to Gelman's claim and illustrates some of the phenomena he might have had in mind. In particular, when we are using a CI procedure with a low confidence level, such as $\alpha=50\%$, then even when the underlying model is strongly perturbed, it looks like the coverage will still be close to $50\%$: our feeling that such a CI will be correct about half the time and incorrect the other half is borne out. That is robust. If instead we are hoping to be right, say, $95\%$ of the time, which means we really want to be wrong only $5\%$ of the time, then we should be prepared for our error rate to be much greater in case the world doesn't work quite the way our model supposes. Incidentally, this property of $50\%$ CIs holds in large part because we are studying symmetric confidence intervals. For the skewed distributions, the individual confidence limits can be terrible (and not robust at all), but their errors often cancel out. Typically one tail is short and the other long, leading to over-coverage at one end and under-coverage at the other. I believe that $50\%$ confidence limits will not be anywhere near as robust as the corresponding intervals. This is the R code that produced the plots. It is readily modified to study other distributions, other ranges of confidence, and other CI procedures. # # Zero-mean distributions. # distributions <- list(Beta=function(n) rbeta(n, 1/30, 1/30) - 1/2, Uniform=function(n) runif(n, -1, 1), Normal=rnorm, #Mixture=function(n) rnorm(n, -2) + rnorm(n, 2), Exponential=function(n) rexp(n) - 1, Lognormal=function(n) exp(rnorm(n, -1/2)) - 1 ) n.sample <- 12 n.sim <- 5e4 alpha.logit <- seq(0, 6, length.out=21); alpha <- signif(1 / (1 + exp(-alpha.logit)), 3) # # Normal CI. # CI <- function(x, Z=outer(c(1,-1), qt((1-alpha)/2, n.sample-1))) mean(x) + Z * sd(x) / sqrt(length(x)) # # The simulation. # #set.seed(17) alpha.s <- paste0("alpha=", alpha) sim <- lapply(distributions, function(dist) { x <- matrix(dist(n.sim*n.sample), n.sample) x.ci <- array(apply(x, 2, CI), c(2, length(alpha), n.sim), dimnames=list(Endpoint=c("Lower", "Upper"), Alpha=alpha.s, NULL)) covers <- x.ci["Lower",,] * x.ci["Upper",,] <= 0 rowMeans(covers) }) (sim) # # The plots. # logit <- function(p) log(p/(1-p)) colors <- hsv((1:length(sim)-1)/length(sim), 0.8, 0.7) par(mfrow=c(1,2)) plot(range(alpha.logit), c(-2,1), type="n", main="Confidence Interval Accuracies (Logit Scales)", cex.main=0.8, xlab="Logit(alpha)", ylab="Logit(coverage) - Logit(alpha)") abline(h=0, col="Gray", lwd=2) legend("bottomleft", names(sim), col=colors, lwd=2, bty="n", cex=0.8) for(i in 1:length(sim)) { coverage <- sim[[i]] lines(alpha.logit, logit(coverage) - alpha.logit, col=colors[i], lwd=2) } plot(range(alpha), c(-0.2, 0.05), type="n", main="Raw Confidence Interval Accuracies", cex.main=0.8, xlab="alpha", ylab="coverage-alpha") abline(h=0, col="Gray", lwd=2) legend("bottomleft", names(sim), col=colors, lwd=2, bty="n", cex=0.8) for(i in 1:length(sim)) { coverage <- sim[[i]] lines(alpha, coverage - alpha, col=colors[i], lwd=2) }
Are 50% confidence intervals more robustly estimated than 95% confidence intervals?
This answer analyzes the meaning of the quotation and offers the results of a simulation study to illustrate it and help understand what it might be trying to say. The study can easily be extended by
Are 50% confidence intervals more robustly estimated than 95% confidence intervals? This answer analyzes the meaning of the quotation and offers the results of a simulation study to illustrate it and help understand what it might be trying to say. The study can easily be extended by anybody (with rudimentary R skills) to explore other confidence interval procedures and other models. Two interesting issues emerged in this work. One concerns how to evaluate the accuracy of a confidence interval procedure. The impression one gets of robustness depends on that. I display two different accuracy measures so you can compare them. The other issue is that although a confidence interval procedure with low confidence may be robust, the corresponding confidence limits might not be robust at all. Intervals tend to work well because the errors they make at one end often counterbalance the errors they make at the other. As a practical matter, you can be pretty sure that around half of your $50\%$ confidence intervals are covering their parameters, but the actual parameter might consistently lie near one particular end of each interval, depending on how reality departs from your model assumptions. Robust has a standard meaning in statistics: Robustness generally implies insensitivity to departures from assumptions surrounding an underlying probabilistic model. (Hoaglin, Mosteller, and Tukey, Understanding Robust and Exploratory Data Analysis. J. Wiley (1983), p. 2.) This is consistent with the quotation in the question. To understand the quotation we still need to know the intended purpose of a confidence interval. To this end, let's review what Gelman wrote. I prefer 50% to 95% intervals for 3 reasons: Computational stability, More intuitive evaluation (half the 50% intervals should contain the true value), A sense that in applications it’s best to get a sense of where the parameters and predicted values will be, not to attempt an unrealistic near-certainty. Since getting a sense of predicted values is not what confidence intervals (CIs) are intended for, I will focus on getting a sense of parameter values, which is what CIs do. Let's call these the "target" values. Whence, by definition, a CI is intended to cover its target with a specified probability (its confidence level). Achieving intended coverage rates is the minimum criterion for evaluating the quality of any CI procedure. (Additionally, we might be interested in typical CI widths. To keep the post to a reasonable length, I will ignore this issue.) These considerations invite us to study how much a confidence interval calculation could mislead us concerning the target parameter value. The quotation could be read as suggesting that lower-confidence CIs might retain their coverage even when the data are generated by a process different than the model. That's something we can test. The procedure is: Adopt a probability model that includes at least one parameter. The classic one is sampling from a Normal distribution of unknown mean and variance. Select a CI procedure for one or more of the model's parameters. An excellent one constructs the CI from the sample mean and sample standard deviation, multiplying the latter by a factor given by a Student t distribution. Apply that procedure to various different models--departing not too much from the adopted one--to assess its coverage over a range of confidence levels. As an example, I have done just that. I have allowed the underlying distribution to vary across a wide range, from almost Bernoulli, to Uniform, to Normal, to Exponential, and all the way to Lognormal. These include symmetric distributions (the first three) and strongly skewed ones (the last two). For each distribution I generated 50,000 samples of size 12. For each sample I constructed two-sided CIs of confidence levels between $50\%$ and $99.8\%$, which covers most applications. An interesting issue now arises: How should we measure how well (or how badly) a CI procedure is performing? A common method simply evaluates the difference between the actual coverage and the confidence level. This can look suspiciously good for high confidence levels, though. For instance, if you are trying to achieve 99.9% confidence but you get only 99% coverage, the raw difference is a mere 0.9%. However, that means your procedure fails to cover the target ten times more often than it should! For this reason, a more informative way of comparing coverages ought to use something like odds ratios. I use differences of logits, which are the logarithms of odds ratios. Specifically, when the desired confidence level is $\alpha$ and the actual coverage is $p$, then $$\log\left(\frac{p}{1-p}\right) - \log\left(\frac{\alpha}{1-\alpha}\right)$$ nicely captures the difference. When it is zero, the coverage is exactly the value intended. When it is negative, the coverage is too low--which means the CI is too optimistic and underestimates the uncertainty. The question, then, is how do these error rates vary with confidence level as the underlying model is perturbed? We can answer it by plotting the simulation results. These plots quantify how "unrealistic" the "near-certainty" of a CI might be in this archetypal application. The graphics show the same results, but the one at the left displays the values on logit scales while the one at the right uses raw scales. The Beta distribution is a Beta$(1/30,1/30)$ (which is practically a Bernoulli distribution). The lognormal distribution is the exponential of the standard Normal distribution. The normal distribution is included to verify that this CI procedure really does attain its intended coverage and to reveal how much variation to expect from the finite simulation size. (Indeed, the graphs for the normal distribution are comfortably close to zero, showing no significant deviations.) It is clear that on the logit scale, the coverages grow more divergent as the confidence level increases. There are some interesting exceptions, though. If we are unconcerned with perturbations of the model that introduce skewness or long tails, then we can ignore the exponential and lognormal and focus on the rest. Their behavior is erratic until $\alpha$ exceeds $95\%$ or so (a logit of $3$), at which point the divergence has set in. This little study brings some concreteness to Gelman's claim and illustrates some of the phenomena he might have had in mind. In particular, when we are using a CI procedure with a low confidence level, such as $\alpha=50\%$, then even when the underlying model is strongly perturbed, it looks like the coverage will still be close to $50\%$: our feeling that such a CI will be correct about half the time and incorrect the other half is borne out. That is robust. If instead we are hoping to be right, say, $95\%$ of the time, which means we really want to be wrong only $5\%$ of the time, then we should be prepared for our error rate to be much greater in case the world doesn't work quite the way our model supposes. Incidentally, this property of $50\%$ CIs holds in large part because we are studying symmetric confidence intervals. For the skewed distributions, the individual confidence limits can be terrible (and not robust at all), but their errors often cancel out. Typically one tail is short and the other long, leading to over-coverage at one end and under-coverage at the other. I believe that $50\%$ confidence limits will not be anywhere near as robust as the corresponding intervals. This is the R code that produced the plots. It is readily modified to study other distributions, other ranges of confidence, and other CI procedures. # # Zero-mean distributions. # distributions <- list(Beta=function(n) rbeta(n, 1/30, 1/30) - 1/2, Uniform=function(n) runif(n, -1, 1), Normal=rnorm, #Mixture=function(n) rnorm(n, -2) + rnorm(n, 2), Exponential=function(n) rexp(n) - 1, Lognormal=function(n) exp(rnorm(n, -1/2)) - 1 ) n.sample <- 12 n.sim <- 5e4 alpha.logit <- seq(0, 6, length.out=21); alpha <- signif(1 / (1 + exp(-alpha.logit)), 3) # # Normal CI. # CI <- function(x, Z=outer(c(1,-1), qt((1-alpha)/2, n.sample-1))) mean(x) + Z * sd(x) / sqrt(length(x)) # # The simulation. # #set.seed(17) alpha.s <- paste0("alpha=", alpha) sim <- lapply(distributions, function(dist) { x <- matrix(dist(n.sim*n.sample), n.sample) x.ci <- array(apply(x, 2, CI), c(2, length(alpha), n.sim), dimnames=list(Endpoint=c("Lower", "Upper"), Alpha=alpha.s, NULL)) covers <- x.ci["Lower",,] * x.ci["Upper",,] <= 0 rowMeans(covers) }) (sim) # # The plots. # logit <- function(p) log(p/(1-p)) colors <- hsv((1:length(sim)-1)/length(sim), 0.8, 0.7) par(mfrow=c(1,2)) plot(range(alpha.logit), c(-2,1), type="n", main="Confidence Interval Accuracies (Logit Scales)", cex.main=0.8, xlab="Logit(alpha)", ylab="Logit(coverage) - Logit(alpha)") abline(h=0, col="Gray", lwd=2) legend("bottomleft", names(sim), col=colors, lwd=2, bty="n", cex=0.8) for(i in 1:length(sim)) { coverage <- sim[[i]] lines(alpha.logit, logit(coverage) - alpha.logit, col=colors[i], lwd=2) } plot(range(alpha), c(-0.2, 0.05), type="n", main="Raw Confidence Interval Accuracies", cex.main=0.8, xlab="alpha", ylab="coverage-alpha") abline(h=0, col="Gray", lwd=2) legend("bottomleft", names(sim), col=colors, lwd=2, bty="n", cex=0.8) for(i in 1:length(sim)) { coverage <- sim[[i]] lines(alpha, coverage - alpha, col=colors[i], lwd=2) }
Are 50% confidence intervals more robustly estimated than 95% confidence intervals? This answer analyzes the meaning of the quotation and offers the results of a simulation study to illustrate it and help understand what it might be trying to say. The study can easily be extended by
8,627
Are 50% confidence intervals more robustly estimated than 95% confidence intervals?
This is an interesting idea, and I can see how it is intuitively compelling, but I think it is too vague to be true or false. Here are a couple of questions I would want the commenter to clear up: A confidence interval for what (a mean, a variance, something else)? How was the interval computed (using large sample theory, bootstrapping, etc.)? In what sense exactly would the 50% CI be "more robust" or "less sensitive", and to what assumptions? With different answers to those questions, I think we could make the statement clearly true or false. My guess is that the commenter is referring to: a confidence interval for the mean computed using large sample theory, where the data's distribution is not contaminated with outliers but does come from a distribution other than the normal that is similar to the normal in the middle, but not the tails, and the idea is that the true asymptotic coverage more closely approximates the nominal coverage. If those are what the commenter has in mind, depending on how the tails of the distribution trade off with its shoulders, the statement could be true. For example, consider a plot of the normal distribution's and several low-df $t$-distributions' CDFs (copied from Wikipedia). A confidence interval based on the normal from $\Phi^{-1}(.25)$ to $\Phi^{-1}(.75)$ would have nearly the appropriate coverage for the low-df $t$s, if those represented the true sampling distributions of the statistic at issue. In fact, it looks like a 20% confidence interval would have nearly perfect coverage, even in the case of a Cauchy ($t_{df = 1}$) distribution:
Are 50% confidence intervals more robustly estimated than 95% confidence intervals?
This is an interesting idea, and I can see how it is intuitively compelling, but I think it is too vague to be true or false. Here are a couple of questions I would want the commenter to clear up:
Are 50% confidence intervals more robustly estimated than 95% confidence intervals? This is an interesting idea, and I can see how it is intuitively compelling, but I think it is too vague to be true or false. Here are a couple of questions I would want the commenter to clear up: A confidence interval for what (a mean, a variance, something else)? How was the interval computed (using large sample theory, bootstrapping, etc.)? In what sense exactly would the 50% CI be "more robust" or "less sensitive", and to what assumptions? With different answers to those questions, I think we could make the statement clearly true or false. My guess is that the commenter is referring to: a confidence interval for the mean computed using large sample theory, where the data's distribution is not contaminated with outliers but does come from a distribution other than the normal that is similar to the normal in the middle, but not the tails, and the idea is that the true asymptotic coverage more closely approximates the nominal coverage. If those are what the commenter has in mind, depending on how the tails of the distribution trade off with its shoulders, the statement could be true. For example, consider a plot of the normal distribution's and several low-df $t$-distributions' CDFs (copied from Wikipedia). A confidence interval based on the normal from $\Phi^{-1}(.25)$ to $\Phi^{-1}(.75)$ would have nearly the appropriate coverage for the low-df $t$s, if those represented the true sampling distributions of the statistic at issue. In fact, it looks like a 20% confidence interval would have nearly perfect coverage, even in the case of a Cauchy ($t_{df = 1}$) distribution:
Are 50% confidence intervals more robustly estimated than 95% confidence intervals? This is an interesting idea, and I can see how it is intuitively compelling, but I think it is too vague to be true or false. Here are a couple of questions I would want the commenter to clear up:
8,628
How incorrect is a regression model when assumptions are not met?
What happens if the residuals are not homoscedastic? If the residuals show an increasing or decreasing pattern in Residuals vs. Fitted plot. If the error term is not homoscedastic (we use the residuals as a proxy for the unobservable error term), the OLS estimator is still consistent and unbiased but is no longer the most efficient in the class of linear estimators. It is the GLS estimator now that enjoys this property. What happens if the residuals are not normally distributed, and fail the Shapiro-Wilk test? Shapiro-Wilk test of normality is a very strict test, and sometimes even if the Normal-QQ plot looks somewhat reasonable, the data fails the test. Normality is not required by the Gauss-Markov theorem. The OLS estimator is still BLUE but without normality you will have difficulty doing inference, i.e. hypothesis testing and confidence intervals, at least for finite sample sizes. There is still the bootstrap, however. Asymptotically this is less of a problem since the OLS estimator has a limiting normal distribution under mild regularity conditions. What happens if one or more predictors are not normally distributed, do not look right on the Normal-QQ plot or if the data fails the Shapiro-Wilk test? As far as I know the predictors are either considered fixed or the regression is conditional on them. This limits the effect of non-normality. What does failing the normality means for a model that is a good fit according to the R-Squared value. Does it become less reliable, or completely useless? The R-squared is the proportion of the variance explained by the model. It does not require the normality assumption and it's a measure of goodness of fit regardless. If you want to use it for a partial F-test though, that is quite another story. To what extent, the deviation is acceptable, or is it acceptable at all? Deviation from normality you mean, right? It really depends on your purposes because as I said, inference becomes hard in the absence of normality but is not impossible (bootstrap!). When applying transformations on the data to meet the normality criteria, does the model gets better if the data is more normal (higher P-value on Shapiro-Wilk test, better looking on normal Q-Q plot), or it is useless (equally good or bad compared to the original) until the data passes normality test? In short, if you have all the Gauss-Markov assumptions plus normality then the OLS estimator is Best Unbiased (BUE), i.e. the most efficient in all classes of estimators - the Cramer-Rao Lower Bound is attained. This is desirable of course but it's not the end of world if it does not happen. The above remarks apply. Regarding transformations, bear in mind that while the distribution of the response might be brought closer to normality, interpretation might not be straightforward afterwards. These are just some short answers to your questions. You seem to be particularly concerned with the implications of non-normality. Overall, I would say that it is not as catastrophic as people (have been made to?) believe and there are workarounds. The two references I have included are a good starting point for further reading, the first one being of theoretical nature. References: Hayashi, Fumio. : "Econometrics.", Princeton University Press, 2000 Kutner, Michael H., et al. "Applied linear statistical models.", McGraw-Hill Irwin, 2005.
How incorrect is a regression model when assumptions are not met?
What happens if the residuals are not homoscedastic? If the residuals show an increasing or decreasing pattern in Residuals vs. Fitted plot. If the error term is not homoscedastic (we use the residua
How incorrect is a regression model when assumptions are not met? What happens if the residuals are not homoscedastic? If the residuals show an increasing or decreasing pattern in Residuals vs. Fitted plot. If the error term is not homoscedastic (we use the residuals as a proxy for the unobservable error term), the OLS estimator is still consistent and unbiased but is no longer the most efficient in the class of linear estimators. It is the GLS estimator now that enjoys this property. What happens if the residuals are not normally distributed, and fail the Shapiro-Wilk test? Shapiro-Wilk test of normality is a very strict test, and sometimes even if the Normal-QQ plot looks somewhat reasonable, the data fails the test. Normality is not required by the Gauss-Markov theorem. The OLS estimator is still BLUE but without normality you will have difficulty doing inference, i.e. hypothesis testing and confidence intervals, at least for finite sample sizes. There is still the bootstrap, however. Asymptotically this is less of a problem since the OLS estimator has a limiting normal distribution under mild regularity conditions. What happens if one or more predictors are not normally distributed, do not look right on the Normal-QQ plot or if the data fails the Shapiro-Wilk test? As far as I know the predictors are either considered fixed or the regression is conditional on them. This limits the effect of non-normality. What does failing the normality means for a model that is a good fit according to the R-Squared value. Does it become less reliable, or completely useless? The R-squared is the proportion of the variance explained by the model. It does not require the normality assumption and it's a measure of goodness of fit regardless. If you want to use it for a partial F-test though, that is quite another story. To what extent, the deviation is acceptable, or is it acceptable at all? Deviation from normality you mean, right? It really depends on your purposes because as I said, inference becomes hard in the absence of normality but is not impossible (bootstrap!). When applying transformations on the data to meet the normality criteria, does the model gets better if the data is more normal (higher P-value on Shapiro-Wilk test, better looking on normal Q-Q plot), or it is useless (equally good or bad compared to the original) until the data passes normality test? In short, if you have all the Gauss-Markov assumptions plus normality then the OLS estimator is Best Unbiased (BUE), i.e. the most efficient in all classes of estimators - the Cramer-Rao Lower Bound is attained. This is desirable of course but it's not the end of world if it does not happen. The above remarks apply. Regarding transformations, bear in mind that while the distribution of the response might be brought closer to normality, interpretation might not be straightforward afterwards. These are just some short answers to your questions. You seem to be particularly concerned with the implications of non-normality. Overall, I would say that it is not as catastrophic as people (have been made to?) believe and there are workarounds. The two references I have included are a good starting point for further reading, the first one being of theoretical nature. References: Hayashi, Fumio. : "Econometrics.", Princeton University Press, 2000 Kutner, Michael H., et al. "Applied linear statistical models.", McGraw-Hill Irwin, 2005.
How incorrect is a regression model when assumptions are not met? What happens if the residuals are not homoscedastic? If the residuals show an increasing or decreasing pattern in Residuals vs. Fitted plot. If the error term is not homoscedastic (we use the residua
8,629
PCA, LDA, CCA, and PLS
Tijl De Bie wrote an interesting chapter "Eigenproblems in Pattern Recognition" which talks about exactly these from a primal/dual perspective. The three tables at the end summarise really nicely from an optimisation perspective:
PCA, LDA, CCA, and PLS
Tijl De Bie wrote an interesting chapter "Eigenproblems in Pattern Recognition" which talks about exactly these from a primal/dual perspective. The three tables at the end summarise really nicely from
PCA, LDA, CCA, and PLS Tijl De Bie wrote an interesting chapter "Eigenproblems in Pattern Recognition" which talks about exactly these from a primal/dual perspective. The three tables at the end summarise really nicely from an optimisation perspective:
PCA, LDA, CCA, and PLS Tijl De Bie wrote an interesting chapter "Eigenproblems in Pattern Recognition" which talks about exactly these from a primal/dual perspective. The three tables at the end summarise really nicely from
8,630
Why do we need to dummy code categorical variables?
Suppose your four categories are eye colors (code): brown (1), blue (2), green (3), hazel (4)β€”ignoring heterochromia, violet, red, gray, etc. for the moment. In no way (that I can currently imagine) would we mean that green $ = 3\times $ brown, or that hazel $=2\times$ blue as our codes imply, even though $3=3\times1$ and $4 = 2 \times 2$. Therefore (unless we for some reason do want such meaning to slip into our analyses), we need to use some sort of coding. Dummy coding is one example, which eliminates such relationships from the statistical stories we want to tell about eye color. Effect coding and Heckman coding are other examples. Update: your example of two variables for four categories does not match my understanding use of the term "dummy code" which typically entails replacing $k$ categories (say 4) with $k-1$ dummy variables (sorting observations by category): id category dummy1 dummy2 dummy3 1 1 1 0 0 2 1 1 0 0 3 2 0 1 0 4 2 0 1 0 5 3 0 0 1 6 3 0 0 1 7 4 0 0 0 8 4 0 0 0 Here category 4 is the reference category, assuming that there is a constant in your model, such as: $$y = \beta_{0} + \beta_{1}d1 + \beta_{2}d2 + \beta_{3}d3 + \varepsilon$$ where $\beta_{0}$ is the mean value of $y$ when category = 4, and the $\beta$ terms associated with each dummy indicate by what amount $y$ changes from $\beta_{0}$ for that category. If you do not have a constant ($\beta_{0}$) term in the model, then you need one more "dummy" predictor (perhaps less often termed "indicator variables"), in effect the dummies then each behave as the model constant for each category: $$y = \beta_{1}d1 + \beta_{2}d2 + \beta_{3}d3 + \beta_{4}d4 + \varepsilon$$ So this would get one around the issue of creating nonsensical quantitative relationships between category codes I mention at first, but why not use user12331-coding as you suggest? user12331-coding candidate A: id category code1 code2 1 1 0 ? 2 1 0 ? 3 2 1 ? 4 2 1 ? 5 3 ? 0 6 3 ? 0 7 4 ? 1 8 4 ? 1 you are quite right to point out that one can represent 4 values using 2 binary variables (i.e. two-bits). Unfortunately, one approach to this (code1 for categories 1 and 2, and code2 for categories 3 and 4) leaves the ambiguity indicated by the question marks: what values would go there?! Well, what about a second approach, call it user12331-coding candidate B: id category code1 code2 1 1 0 0 2 1 0 0 3 2 0 1 4 2 0 1 5 3 1 0 6 3 1 0 7 4 1 1 8 4 1 1 There! No ambiguity, right? Right! Unfortunately, all this coding does is represent the numerical quantities 1–4 (or 0–3) in binary notation, which leaves intact the problem of giving those undesired quantitative relationships to the categories. Hence, the need for another coding scheme. I will close with the caveat that the various coding schemes are more or less a matter or style (i.e. what does one want a specific $\beta$ to mean) unless one also includes interaction terms with the categories in the model. Then dummy coding will induce an artificial heteroscedasticity and bias the standard errors, so you would want to stick with effect coding in such a case (there may be other coding systems that keep one safe in that circumstance, but I am unfamiliar with them).
Why do we need to dummy code categorical variables?
Suppose your four categories are eye colors (code): brown (1), blue (2), green (3), hazel (4)β€”ignoring heterochromia, violet, red, gray, etc. for the moment. In no way (that I can currently imagine)
Why do we need to dummy code categorical variables? Suppose your four categories are eye colors (code): brown (1), blue (2), green (3), hazel (4)β€”ignoring heterochromia, violet, red, gray, etc. for the moment. In no way (that I can currently imagine) would we mean that green $ = 3\times $ brown, or that hazel $=2\times$ blue as our codes imply, even though $3=3\times1$ and $4 = 2 \times 2$. Therefore (unless we for some reason do want such meaning to slip into our analyses), we need to use some sort of coding. Dummy coding is one example, which eliminates such relationships from the statistical stories we want to tell about eye color. Effect coding and Heckman coding are other examples. Update: your example of two variables for four categories does not match my understanding use of the term "dummy code" which typically entails replacing $k$ categories (say 4) with $k-1$ dummy variables (sorting observations by category): id category dummy1 dummy2 dummy3 1 1 1 0 0 2 1 1 0 0 3 2 0 1 0 4 2 0 1 0 5 3 0 0 1 6 3 0 0 1 7 4 0 0 0 8 4 0 0 0 Here category 4 is the reference category, assuming that there is a constant in your model, such as: $$y = \beta_{0} + \beta_{1}d1 + \beta_{2}d2 + \beta_{3}d3 + \varepsilon$$ where $\beta_{0}$ is the mean value of $y$ when category = 4, and the $\beta$ terms associated with each dummy indicate by what amount $y$ changes from $\beta_{0}$ for that category. If you do not have a constant ($\beta_{0}$) term in the model, then you need one more "dummy" predictor (perhaps less often termed "indicator variables"), in effect the dummies then each behave as the model constant for each category: $$y = \beta_{1}d1 + \beta_{2}d2 + \beta_{3}d3 + \beta_{4}d4 + \varepsilon$$ So this would get one around the issue of creating nonsensical quantitative relationships between category codes I mention at first, but why not use user12331-coding as you suggest? user12331-coding candidate A: id category code1 code2 1 1 0 ? 2 1 0 ? 3 2 1 ? 4 2 1 ? 5 3 ? 0 6 3 ? 0 7 4 ? 1 8 4 ? 1 you are quite right to point out that one can represent 4 values using 2 binary variables (i.e. two-bits). Unfortunately, one approach to this (code1 for categories 1 and 2, and code2 for categories 3 and 4) leaves the ambiguity indicated by the question marks: what values would go there?! Well, what about a second approach, call it user12331-coding candidate B: id category code1 code2 1 1 0 0 2 1 0 0 3 2 0 1 4 2 0 1 5 3 1 0 6 3 1 0 7 4 1 1 8 4 1 1 There! No ambiguity, right? Right! Unfortunately, all this coding does is represent the numerical quantities 1–4 (or 0–3) in binary notation, which leaves intact the problem of giving those undesired quantitative relationships to the categories. Hence, the need for another coding scheme. I will close with the caveat that the various coding schemes are more or less a matter or style (i.e. what does one want a specific $\beta$ to mean) unless one also includes interaction terms with the categories in the model. Then dummy coding will induce an artificial heteroscedasticity and bias the standard errors, so you would want to stick with effect coding in such a case (there may be other coding systems that keep one safe in that circumstance, but I am unfamiliar with them).
Why do we need to dummy code categorical variables? Suppose your four categories are eye colors (code): brown (1), blue (2), green (3), hazel (4)β€”ignoring heterochromia, violet, red, gray, etc. for the moment. In no way (that I can currently imagine)
8,631
Why do we need to dummy code categorical variables?
My take on this question is, that coding the four possible states with just two variables is less expressive with some machine learning algorithms than using 4 variables. For example, imagine that you want to do linear regression and your true mapping maps the values 0,1 and 2 to 0 and the value 3 to 1. You can quickly check that there is no way of learning this mapping with linear regression when coding your categorial variable with just two binary ones (just try to fit the corresponding plane in your head). On the other hand, when you use a 1-Of-K coding, this would not be a problem.
Why do we need to dummy code categorical variables?
My take on this question is, that coding the four possible states with just two variables is less expressive with some machine learning algorithms than using 4 variables. For example, imagine that yo
Why do we need to dummy code categorical variables? My take on this question is, that coding the four possible states with just two variables is less expressive with some machine learning algorithms than using 4 variables. For example, imagine that you want to do linear regression and your true mapping maps the values 0,1 and 2 to 0 and the value 3 to 1. You can quickly check that there is no way of learning this mapping with linear regression when coding your categorial variable with just two binary ones (just try to fit the corresponding plane in your head). On the other hand, when you use a 1-Of-K coding, this would not be a problem.
Why do we need to dummy code categorical variables? My take on this question is, that coding the four possible states with just two variables is less expressive with some machine learning algorithms than using 4 variables. For example, imagine that yo
8,632
Why do we need to dummy code categorical variables?
If you are to encode your example as: Colour Category Binary1 Binary2 Hazel 0 0 0 Blue 1 0 1 Green 2 1 0 Brown 3 1 1 If your question is why do we use Encoding, lets consider the above example if you have 4 categories of colour of eyes according to what @Alexis suggested, we need to convert these categories into numbers because computers work better with numbers. So essentially we transform these four colour categories into respective integers categories, as shown above. Now if you are to give these integers as it is to the computer then depending on the integer values the computer will take out a relation as thus: Brown colour has been given a value 3, so it must be greater than the hazel colour denoted by 0 in terms of importance to colour with respect to the label you have to predict. This is wrong because the aim to provide an integer to text was just to make the calculation and evaluation easy for the computer. So to prevent learning wrong relations between features and output we need encoding What encoding essentially means is to create new dummy features corresponding to each colour ie if we have 'm' labels we can have maybe 'm' feature columns or 'm-1' feature columns depending on the encoding algorithm used. So if we were to represent the above table in terms of encoded values it would be: Colour Category Hazel Blue Green Brown Hazel 0 1 0 0 0 Blue 1 0 1 0 0 Green 2 0 0 1 0 Brown 3 0 0 0 1 In the above table what we did was to represent the categories by new columns called dummy features and corresponding to the colour its respective dummy column recieved a value 1 and rest were set to 0. While training, we do not need the category and colour columns because we have encoded them as dummy features. Note: If you perform transformation and encoding on training set, then transformation and encoding must be performed on the test set also. Returning back to the question. If it were to be framed as, if we can represent the category of integers by their binary couterparts then the answer would be no because essentially what you are doing is replacing the integers by their binary numbers. This does not validate or show the relation between the respective categories and the output of training would be the same as that with the integer values or maybe even worse. Refer the link below for more info: Feature Engineering on Categorical data
Why do we need to dummy code categorical variables?
If you are to encode your example as: Colour Category Binary1 Binary2 Hazel 0 0 0 Blue 1 0 1 Green 2 1 0 Brown 3 1 1 If your question is why do we use Encoding, lets consider the abo
Why do we need to dummy code categorical variables? If you are to encode your example as: Colour Category Binary1 Binary2 Hazel 0 0 0 Blue 1 0 1 Green 2 1 0 Brown 3 1 1 If your question is why do we use Encoding, lets consider the above example if you have 4 categories of colour of eyes according to what @Alexis suggested, we need to convert these categories into numbers because computers work better with numbers. So essentially we transform these four colour categories into respective integers categories, as shown above. Now if you are to give these integers as it is to the computer then depending on the integer values the computer will take out a relation as thus: Brown colour has been given a value 3, so it must be greater than the hazel colour denoted by 0 in terms of importance to colour with respect to the label you have to predict. This is wrong because the aim to provide an integer to text was just to make the calculation and evaluation easy for the computer. So to prevent learning wrong relations between features and output we need encoding What encoding essentially means is to create new dummy features corresponding to each colour ie if we have 'm' labels we can have maybe 'm' feature columns or 'm-1' feature columns depending on the encoding algorithm used. So if we were to represent the above table in terms of encoded values it would be: Colour Category Hazel Blue Green Brown Hazel 0 1 0 0 0 Blue 1 0 1 0 0 Green 2 0 0 1 0 Brown 3 0 0 0 1 In the above table what we did was to represent the categories by new columns called dummy features and corresponding to the colour its respective dummy column recieved a value 1 and rest were set to 0. While training, we do not need the category and colour columns because we have encoded them as dummy features. Note: If you perform transformation and encoding on training set, then transformation and encoding must be performed on the test set also. Returning back to the question. If it were to be framed as, if we can represent the category of integers by their binary couterparts then the answer would be no because essentially what you are doing is replacing the integers by their binary numbers. This does not validate or show the relation between the respective categories and the output of training would be the same as that with the integer values or maybe even worse. Refer the link below for more info: Feature Engineering on Categorical data
Why do we need to dummy code categorical variables? If you are to encode your example as: Colour Category Binary1 Binary2 Hazel 0 0 0 Blue 1 0 1 Green 2 1 0 Brown 3 1 1 If your question is why do we use Encoding, lets consider the abo
8,633
Why do we need to dummy code categorical variables?
Your alternative is also a dummy code. You choose the dummy code that best expresses the relationship to your dependent variable. Eg colour could be expressed as 1 of n, or you could turn into numeric rgb components, or you could categorise: girly/muddy/...1 of n basically means each instance is learnt separately which is good if there is no relationship. .. but where there is a relationship you are wasting your data..you have to separately estimate the coefficient for each instance of the category...consider job as a categorical variable. You might re categorise as market sector and seniority.
Why do we need to dummy code categorical variables?
Your alternative is also a dummy code. You choose the dummy code that best expresses the relationship to your dependent variable. Eg colour could be expressed as 1 of n, or you could turn into numeric
Why do we need to dummy code categorical variables? Your alternative is also a dummy code. You choose the dummy code that best expresses the relationship to your dependent variable. Eg colour could be expressed as 1 of n, or you could turn into numeric rgb components, or you could categorise: girly/muddy/...1 of n basically means each instance is learnt separately which is good if there is no relationship. .. but where there is a relationship you are wasting your data..you have to separately estimate the coefficient for each instance of the category...consider job as a categorical variable. You might re categorise as market sector and seniority.
Why do we need to dummy code categorical variables? Your alternative is also a dummy code. You choose the dummy code that best expresses the relationship to your dependent variable. Eg colour could be expressed as 1 of n, or you could turn into numeric
8,634
Why don't Bayesian methods require multiple testing corrections?
One odd way to answer the question is to note that the Bayesian method provides no way to do this because Bayesian methods are consistent with accepted rules of evidence and frequentist methods are often at odds with them. Examples: With frequentist statistics, comparing treatment A to B must penalize for comparing treatments C and D because of family-wise type I error considerations; with Bayesian the A-B comparison stands on its own. For sequential frequentist testing, penalties are usually required for multiple looks at the data. In a group sequential setting, an early comparison for A vs B must be penalized for a later comparison that has not been made yet, and a later comparison must be penalized for an earlier comparison even if the earlier comparison did not alter the course of the study. The problem stems from the frequentist's reversal of the flow of time and information, making frequentists have to consider what could have happened instead of what did happen. In contrast, Bayesian assessments anchor all assessment to the prior distribution, which calibrates evidence. For example, the prior distribution for the A-B difference calibrates all future assessments of A-B and does not have to consider C-D. With sequential testing, there is great confusion about how to adjust point estimates when an experiment is terminated early using frequentist inference. In the Bayesian world, the prior "pulls back" on any point estimates, and the updated posterior distribution applies to inference at any time and requires no complex sample space considerations.
Why don't Bayesian methods require multiple testing corrections?
One odd way to answer the question is to note that the Bayesian method provides no way to do this because Bayesian methods are consistent with accepted rules of evidence and frequentist methods are of
Why don't Bayesian methods require multiple testing corrections? One odd way to answer the question is to note that the Bayesian method provides no way to do this because Bayesian methods are consistent with accepted rules of evidence and frequentist methods are often at odds with them. Examples: With frequentist statistics, comparing treatment A to B must penalize for comparing treatments C and D because of family-wise type I error considerations; with Bayesian the A-B comparison stands on its own. For sequential frequentist testing, penalties are usually required for multiple looks at the data. In a group sequential setting, an early comparison for A vs B must be penalized for a later comparison that has not been made yet, and a later comparison must be penalized for an earlier comparison even if the earlier comparison did not alter the course of the study. The problem stems from the frequentist's reversal of the flow of time and information, making frequentists have to consider what could have happened instead of what did happen. In contrast, Bayesian assessments anchor all assessment to the prior distribution, which calibrates evidence. For example, the prior distribution for the A-B difference calibrates all future assessments of A-B and does not have to consider C-D. With sequential testing, there is great confusion about how to adjust point estimates when an experiment is terminated early using frequentist inference. In the Bayesian world, the prior "pulls back" on any point estimates, and the updated posterior distribution applies to inference at any time and requires no complex sample space considerations.
Why don't Bayesian methods require multiple testing corrections? One odd way to answer the question is to note that the Bayesian method provides no way to do this because Bayesian methods are consistent with accepted rules of evidence and frequentist methods are of
8,635
Why don't Bayesian methods require multiple testing corrections?
This type of hierarchical model does shrink the estimates and reduces the number of false claims to a reasonable extent for a small to moderate number of hypotheses. Does it guarantee some specific type I error rate? No. This particular suggestion by Gelman (who acknowledges the issue with looking at too many different things and then too easily wrongly concluding that you see something for some of them - in fact one of his pet topics on his blog) is distinct from a the extreme alternative viewpoint that holds that Bayesian methods do not need to account for multiplicity, because all that matters are your likelihood (and your prior).
Why don't Bayesian methods require multiple testing corrections?
This type of hierarchical model does shrink the estimates and reduces the number of false claims to a reasonable extent for a small to moderate number of hypotheses. Does it guarantee some specific ty
Why don't Bayesian methods require multiple testing corrections? This type of hierarchical model does shrink the estimates and reduces the number of false claims to a reasonable extent for a small to moderate number of hypotheses. Does it guarantee some specific type I error rate? No. This particular suggestion by Gelman (who acknowledges the issue with looking at too many different things and then too easily wrongly concluding that you see something for some of them - in fact one of his pet topics on his blog) is distinct from a the extreme alternative viewpoint that holds that Bayesian methods do not need to account for multiplicity, because all that matters are your likelihood (and your prior).
Why don't Bayesian methods require multiple testing corrections? This type of hierarchical model does shrink the estimates and reduces the number of false claims to a reasonable extent for a small to moderate number of hypotheses. Does it guarantee some specific ty
8,636
Why don't Bayesian methods require multiple testing corrections?
Very interesting question, here's my take on it. It's all about encoding information, then turn the Bayesian crank. It seems too good to be true - but both of these are harder than they seem. I start with asking the question What information is being used when we worry about multiple comparisons? I can think of some - the first is "data dredging" - test "everything" until you get enough passes/fails (I would think almost every stats trained person would be exposed to this problem). You also have less sinister, but essentially the same "I have so many tests to run - surely all can't be correct". After thinking about this, one thing I notice is that you don't tend to hear much about specific hypothesis or specific comparisons. It's all about the "collection" - this triggers my thinking towards exchangeability - the hypothesis being compared are "similar" to each other in some way. And how do you encode exchangeability into bayesian analysis? - hyper-priors, mixed models, random effects, etc!!! But exchangeability only gets you part of the way there. Is everything exchangeable? Or do you have "sparsity" - such as only a few non-zero regression coefficients with a large pool of candidates. Mixed models and normally distributed random effects don't work here. They get "stuck" in between squashing noise and leaving signals untouched (e.g. in your example keep locationB and locationC "true" parameters equal, and set locationA "true" parameter arbitrarily large or small, and watch the standard linear mixed model fail.). But it can be fixed - e.g. with "spike and slab" priors or "horse shoe" priors. So it's really more about describing what sort of hypothesis you are talking about and getting as many known features reflected in the prior and likelihood. Andrew Gelman's approach is just a way to handle a broad class of multiple comparisons implicitly. Just like least squares and normal distributions tend to work well in most cases (but not all). In terms of how it does this, you could think of a person reasoning as follows - group A and group B might have the same mean - I looked at the data, and the means are "close" - Hence, to get a better estimate for both, I should pool the data, as my initial thought was they have the same mean. - If they are not the same, the data provides evidence that they are "close", so pooling "a little bit" won't hurt me too badly if my hypothesis was wrong (a la all models are wrong, some are useful) Note that all the above hinges on the initial premise "they might be the same". Take that away, and there is no justification for pooling. You can probably also see a "normalish distribution" way of thinking about the tests. "Zero is most likely", "if not zero, then close to zero is next most likely", "extreme values are unlikely". Consider this alternative: group A and group B means might be equal, but they could also be drastically different Then the argument about pooling "a little bit" is a very bad idea. You are better off choosing total pooling or zero pooling. Much more like a Cauchy, spike&slab, type of situation (lots of mass around zero, and lots of mass for extreme values) The whole multiple comparisons doesn't need to be dealt with, because the Bayesian approach is incorporating the information that leads us to worry into the prior and/or likelihood. In a sense it more a reminder to properly think about what information is available to you, and making sure you have included it in your analysis.
Why don't Bayesian methods require multiple testing corrections?
Very interesting question, here's my take on it. It's all about encoding information, then turn the Bayesian crank. It seems too good to be true - but both of these are harder than they seem. I start
Why don't Bayesian methods require multiple testing corrections? Very interesting question, here's my take on it. It's all about encoding information, then turn the Bayesian crank. It seems too good to be true - but both of these are harder than they seem. I start with asking the question What information is being used when we worry about multiple comparisons? I can think of some - the first is "data dredging" - test "everything" until you get enough passes/fails (I would think almost every stats trained person would be exposed to this problem). You also have less sinister, but essentially the same "I have so many tests to run - surely all can't be correct". After thinking about this, one thing I notice is that you don't tend to hear much about specific hypothesis or specific comparisons. It's all about the "collection" - this triggers my thinking towards exchangeability - the hypothesis being compared are "similar" to each other in some way. And how do you encode exchangeability into bayesian analysis? - hyper-priors, mixed models, random effects, etc!!! But exchangeability only gets you part of the way there. Is everything exchangeable? Or do you have "sparsity" - such as only a few non-zero regression coefficients with a large pool of candidates. Mixed models and normally distributed random effects don't work here. They get "stuck" in between squashing noise and leaving signals untouched (e.g. in your example keep locationB and locationC "true" parameters equal, and set locationA "true" parameter arbitrarily large or small, and watch the standard linear mixed model fail.). But it can be fixed - e.g. with "spike and slab" priors or "horse shoe" priors. So it's really more about describing what sort of hypothesis you are talking about and getting as many known features reflected in the prior and likelihood. Andrew Gelman's approach is just a way to handle a broad class of multiple comparisons implicitly. Just like least squares and normal distributions tend to work well in most cases (but not all). In terms of how it does this, you could think of a person reasoning as follows - group A and group B might have the same mean - I looked at the data, and the means are "close" - Hence, to get a better estimate for both, I should pool the data, as my initial thought was they have the same mean. - If they are not the same, the data provides evidence that they are "close", so pooling "a little bit" won't hurt me too badly if my hypothesis was wrong (a la all models are wrong, some are useful) Note that all the above hinges on the initial premise "they might be the same". Take that away, and there is no justification for pooling. You can probably also see a "normalish distribution" way of thinking about the tests. "Zero is most likely", "if not zero, then close to zero is next most likely", "extreme values are unlikely". Consider this alternative: group A and group B means might be equal, but they could also be drastically different Then the argument about pooling "a little bit" is a very bad idea. You are better off choosing total pooling or zero pooling. Much more like a Cauchy, spike&slab, type of situation (lots of mass around zero, and lots of mass for extreme values) The whole multiple comparisons doesn't need to be dealt with, because the Bayesian approach is incorporating the information that leads us to worry into the prior and/or likelihood. In a sense it more a reminder to properly think about what information is available to you, and making sure you have included it in your analysis.
Why don't Bayesian methods require multiple testing corrections? Very interesting question, here's my take on it. It's all about encoding information, then turn the Bayesian crank. It seems too good to be true - but both of these are harder than they seem. I start
8,637
Why don't Bayesian methods require multiple testing corrections?
First, as I understand the model you presented I think it is a bit different to Gelman proposal, that more looks like: A ~ Distribution(locationA) B ~ Distribution(locationB) C ~ Distribution(locationC) locationA ~ Normal(commonLocation) locationB ~ Normal(commonLocation) locationC ~ Normal(commonLocation) commonLocation ~ hyperPrior In practice, by adding this commonLocation parameter, the inferences over the parameters the 3 distributions (here locations 1, 2 and 3) are no longer independent from each other. Moreover, commonLocation tends to shrink expectational values of the parameters toward a central (generally estimated) one. In a certain sense, it works as a regularization over all the inferences making the need of correction for multiple correction not needed (as in practice we perform one single multivariate estimation accounting from the interaction between each of them through the use of model). As pointed out by the other answer, this correction does not offer any control on type I error but in most cases, Bayesian method does not offer any such control even at the single inference scale and correction for multiple comparison must be thought differently in the Bayesian setting.
Why don't Bayesian methods require multiple testing corrections?
First, as I understand the model you presented I think it is a bit different to Gelman proposal, that more looks like: A ~ Distribution(locationA) B ~ Distribution(locationB) C ~ Distribution(location
Why don't Bayesian methods require multiple testing corrections? First, as I understand the model you presented I think it is a bit different to Gelman proposal, that more looks like: A ~ Distribution(locationA) B ~ Distribution(locationB) C ~ Distribution(locationC) locationA ~ Normal(commonLocation) locationB ~ Normal(commonLocation) locationC ~ Normal(commonLocation) commonLocation ~ hyperPrior In practice, by adding this commonLocation parameter, the inferences over the parameters the 3 distributions (here locations 1, 2 and 3) are no longer independent from each other. Moreover, commonLocation tends to shrink expectational values of the parameters toward a central (generally estimated) one. In a certain sense, it works as a regularization over all the inferences making the need of correction for multiple correction not needed (as in practice we perform one single multivariate estimation accounting from the interaction between each of them through the use of model). As pointed out by the other answer, this correction does not offer any control on type I error but in most cases, Bayesian method does not offer any such control even at the single inference scale and correction for multiple comparison must be thought differently in the Bayesian setting.
Why don't Bayesian methods require multiple testing corrections? First, as I understand the model you presented I think it is a bit different to Gelman proposal, that more looks like: A ~ Distribution(locationA) B ~ Distribution(locationB) C ~ Distribution(location
8,638
t-test for partially paired and partially unpaired data
Guo and Yuan suggest an alternative method called the optimal pooled t-test stemming from Samawi and Vogel's pooled t-test. Link to reference: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.865.734&rep=rep1&type=pdf Great read with multiple options for this situation. New to commenting so please let me know if I need to add anything else.
t-test for partially paired and partially unpaired data
Guo and Yuan suggest an alternative method called the optimal pooled t-test stemming from Samawi and Vogel's pooled t-test. Link to reference: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.
t-test for partially paired and partially unpaired data Guo and Yuan suggest an alternative method called the optimal pooled t-test stemming from Samawi and Vogel's pooled t-test. Link to reference: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.865.734&rep=rep1&type=pdf Great read with multiple options for this situation. New to commenting so please let me know if I need to add anything else.
t-test for partially paired and partially unpaired data Guo and Yuan suggest an alternative method called the optimal pooled t-test stemming from Samawi and Vogel's pooled t-test. Link to reference: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.
8,639
t-test for partially paired and partially unpaired data
Well, if you knew the variances in the unpaired and in the paired (which would generally be a good deal smaller), the optimal weights for the two estimates of difference in groups means would be to have weights inversely proportional to the variance of the individual estimates of the difference in means. [Edit: turns out that when the variances are estimated, this is called the Graybill-Deal estimator. There's been quite a few papers on it. Here is one] The need to estimate variance causes some difficulty (the resulting ratio of variance estimates is F, and I think the resulting weights have a beta distribution, and a resulting statistic is kind of complicated), but since you're considering bootstrapping, this may be less of a concern. An alternative possibility which might be nicer in some sense (or at least a little more robust to non-normality, since we're playing with variance ratios) with very little loss in efficiency at the normal is to base a combined estimate of shift off paired and unpaired rank tests - in each case a kind of Hodges-Lehmann estimate, in the unpaired case based on medians of pairwise cross-sample differences and in the paired case off medians of pairwise-averages-of-pair-differences. Again, the minimum variance weighted linear combination of the two would be with weights proportional to inverses of variances. In that case I'd probably lean toward a permutation (/randomization) rather than a bootstrap - but depending on how you implement your bootstrap they can end up in the same place. In either case you might want to robustify your variances/shrink your variance ratio. Getting in the right ballpark for the weight is good, but you'll lose very little efficiency at the normal by making it slightly robust. --- Some additional thoughts I didn't have clearly enough sorted out in my head before: This problem has distinct similarities to the Behrens-Fisher problem, but is even harder. If we fixed the weights, we could just whack in a Welch-Satterthwaite type approximation; the structure of the problem is the same. Our issue is that we want to optimize the weights, which effectively means weighting is not fixed - and indeed, tends to maximize the statistic (at least approximately and more nearly in large samples, since any set of weights is a random quantity estimating the same numerator, and we're trying to minimize the denominator; the two aren't independent). This would, I expect, make the chi-square approximation worse, and would almost surely affect the d.f. of an approximation still further. [If this problem is doable, there also just might turn out be a good rule of thumb that would say 'you can do almost as well if you use only the paired data under these sets of circumstances, only the unpaired under these other sets of conditions and in the rest, this fixed weight-scheme is usually very close to optimal' -- but I won't hold my breath waiting on that chance. Such a decision rule would doubtless have some impact on true significance in each case, but if that effect wasn't so big, such a rule of thumb would give an easy way for people to use existing legacy software, so it could be desirable to try to identify a rule like that for users in such a situation.] --- Edit: Note to self - Need to come back and fill in details of work on 'overlapping samples' tests, especially overlapping samples t-tests --- It occurs to me that a randomization test should work okay - where the data are paired you randomly permute the group labels within pairs where data are unpaired but assumed to have common distribution (under the null), you permute the group assignments you can now base weights to the two shift estimates off the relative variance estimates ($w_1 = 1/(1+\frac{v_1}{v_2})$), compute each randomized sample's weighted estimate of shift and see where the sample fits into the randomization distribution. (Added much later) Possibly relevant paper: Derrick, B., Russ B., Toher, D., and White, P. (2017), "Test Statistics for the Comparison of Means for Two Samples That Include Both Paired and Independent Observations" Journal of Modern Applied Statistical Methods, May, Vol. 16, No. 1, 137-157. doi: 10.22237/jmasm/1493597280 http://digitalcommons.wayne.edu/cgi/viewcontent.cgi?article=2251&context=jmasm
t-test for partially paired and partially unpaired data
Well, if you knew the variances in the unpaired and in the paired (which would generally be a good deal smaller), the optimal weights for the two estimates of difference in groups means would be to ha
t-test for partially paired and partially unpaired data Well, if you knew the variances in the unpaired and in the paired (which would generally be a good deal smaller), the optimal weights for the two estimates of difference in groups means would be to have weights inversely proportional to the variance of the individual estimates of the difference in means. [Edit: turns out that when the variances are estimated, this is called the Graybill-Deal estimator. There's been quite a few papers on it. Here is one] The need to estimate variance causes some difficulty (the resulting ratio of variance estimates is F, and I think the resulting weights have a beta distribution, and a resulting statistic is kind of complicated), but since you're considering bootstrapping, this may be less of a concern. An alternative possibility which might be nicer in some sense (or at least a little more robust to non-normality, since we're playing with variance ratios) with very little loss in efficiency at the normal is to base a combined estimate of shift off paired and unpaired rank tests - in each case a kind of Hodges-Lehmann estimate, in the unpaired case based on medians of pairwise cross-sample differences and in the paired case off medians of pairwise-averages-of-pair-differences. Again, the minimum variance weighted linear combination of the two would be with weights proportional to inverses of variances. In that case I'd probably lean toward a permutation (/randomization) rather than a bootstrap - but depending on how you implement your bootstrap they can end up in the same place. In either case you might want to robustify your variances/shrink your variance ratio. Getting in the right ballpark for the weight is good, but you'll lose very little efficiency at the normal by making it slightly robust. --- Some additional thoughts I didn't have clearly enough sorted out in my head before: This problem has distinct similarities to the Behrens-Fisher problem, but is even harder. If we fixed the weights, we could just whack in a Welch-Satterthwaite type approximation; the structure of the problem is the same. Our issue is that we want to optimize the weights, which effectively means weighting is not fixed - and indeed, tends to maximize the statistic (at least approximately and more nearly in large samples, since any set of weights is a random quantity estimating the same numerator, and we're trying to minimize the denominator; the two aren't independent). This would, I expect, make the chi-square approximation worse, and would almost surely affect the d.f. of an approximation still further. [If this problem is doable, there also just might turn out be a good rule of thumb that would say 'you can do almost as well if you use only the paired data under these sets of circumstances, only the unpaired under these other sets of conditions and in the rest, this fixed weight-scheme is usually very close to optimal' -- but I won't hold my breath waiting on that chance. Such a decision rule would doubtless have some impact on true significance in each case, but if that effect wasn't so big, such a rule of thumb would give an easy way for people to use existing legacy software, so it could be desirable to try to identify a rule like that for users in such a situation.] --- Edit: Note to self - Need to come back and fill in details of work on 'overlapping samples' tests, especially overlapping samples t-tests --- It occurs to me that a randomization test should work okay - where the data are paired you randomly permute the group labels within pairs where data are unpaired but assumed to have common distribution (under the null), you permute the group assignments you can now base weights to the two shift estimates off the relative variance estimates ($w_1 = 1/(1+\frac{v_1}{v_2})$), compute each randomized sample's weighted estimate of shift and see where the sample fits into the randomization distribution. (Added much later) Possibly relevant paper: Derrick, B., Russ B., Toher, D., and White, P. (2017), "Test Statistics for the Comparison of Means for Two Samples That Include Both Paired and Independent Observations" Journal of Modern Applied Statistical Methods, May, Vol. 16, No. 1, 137-157. doi: 10.22237/jmasm/1493597280 http://digitalcommons.wayne.edu/cgi/viewcontent.cgi?article=2251&context=jmasm
t-test for partially paired and partially unpaired data Well, if you knew the variances in the unpaired and in the paired (which would generally be a good deal smaller), the optimal weights for the two estimates of difference in groups means would be to ha
8,640
t-test for partially paired and partially unpaired data
Here are some thoughts. I basically just arrive to Greg Snow conclusion that This problem has distinct similarities to the Behrens-Fisher problem. To avoid handwaving I first introduce some notations and formalize the hypotheses. we have $n$ paired observations $x_i^{pA}$ and $x_i^{pB}$ ($i = 1, \dots, n$); we have $n_A$ and $n_B$ unpaired observations $x_i^A$ ($i = 1, \dots, n_A$) and $x_i^B$ ($i = 1, \dots, n_B$); each observation is the sum of a patient effect and a treatment effect. The corresponding random variables are $X_i^{pA} = P_i + T_i^A$, $X_i^{pB} = P_i + T_i^B$, $X_i^A = Q_i + U_i^A$, $X_i^B = R_i + V_i^B$ with $P_i, Q_i, R_i \sim \mathcal N(0,\sigma_P^2)$, and $T_i^\tau, U_i^\tau, V_i^\tau \sim \mathcal N(\mu_\tau, \sigma^2)$ ($\tau = A, B$). under the null hypothesis, $\mu_A = \mu_B$. We form as usual a new variable $X_i = X_i^{pA} - X_i^{pB}$. We have $X_i \sim \mathcal N(\mu_A - \mu_B, 2\sigma^2)$. Now we have three groups of observations, the $X_i$ (size $n$), the $X_i^A$ (size $n_A$) and the $X_i^B$ (size $n_B$). The means are $X_\bullet\sim \mathcal N(\mu_A - \mu_B, {2\over n} \sigma^2)$ $X^A_\bullet\sim \mathcal N(\mu_A , {1\over n_A} (\sigma_P^2 + \sigma^2))$ $X^B_\bullet\sim \mathcal N(\mu_B , {1\over n_B} (\sigma_P^2 + \sigma^2))$ The next natural step is to consider $Y = X_\bullet + X^A_\bullet - X^B_\bullet \sim \mathcal N\left( 2(\mu_A-\mu_B), {2\over n} \sigma^2 + \left({1\over n_A}+ {1\over n_B}\right) (\sigma_P^2 + \sigma^2)\right)$ Now basically we are stuck. The three sums of squares give estimations of $\sigma^2$ with $n-1$ df, $\sigma_P^2 + \sigma^2$ with $n_A-1$ df and $n_B-1$ df respectively. The last two can be combined to give an estimation of $\left({1\over n_A}+ {1\over n_B}\right) (\sigma_P^2 + \sigma^2)$ with $n_A+n_B-2$ df. The variance of $Y$ is the sum of two terms, each of which can be estimated, but the recombination is not doable, just as in Behrens Fisher problem. At this point I think one may plug-in any solution proposed to Behrens Fisher problem to get a solution to your problem.
t-test for partially paired and partially unpaired data
Here are some thoughts. I basically just arrive to Greg Snow conclusion that This problem has distinct similarities to the Behrens-Fisher problem. To avoid handwaving I first introduce some notations
t-test for partially paired and partially unpaired data Here are some thoughts. I basically just arrive to Greg Snow conclusion that This problem has distinct similarities to the Behrens-Fisher problem. To avoid handwaving I first introduce some notations and formalize the hypotheses. we have $n$ paired observations $x_i^{pA}$ and $x_i^{pB}$ ($i = 1, \dots, n$); we have $n_A$ and $n_B$ unpaired observations $x_i^A$ ($i = 1, \dots, n_A$) and $x_i^B$ ($i = 1, \dots, n_B$); each observation is the sum of a patient effect and a treatment effect. The corresponding random variables are $X_i^{pA} = P_i + T_i^A$, $X_i^{pB} = P_i + T_i^B$, $X_i^A = Q_i + U_i^A$, $X_i^B = R_i + V_i^B$ with $P_i, Q_i, R_i \sim \mathcal N(0,\sigma_P^2)$, and $T_i^\tau, U_i^\tau, V_i^\tau \sim \mathcal N(\mu_\tau, \sigma^2)$ ($\tau = A, B$). under the null hypothesis, $\mu_A = \mu_B$. We form as usual a new variable $X_i = X_i^{pA} - X_i^{pB}$. We have $X_i \sim \mathcal N(\mu_A - \mu_B, 2\sigma^2)$. Now we have three groups of observations, the $X_i$ (size $n$), the $X_i^A$ (size $n_A$) and the $X_i^B$ (size $n_B$). The means are $X_\bullet\sim \mathcal N(\mu_A - \mu_B, {2\over n} \sigma^2)$ $X^A_\bullet\sim \mathcal N(\mu_A , {1\over n_A} (\sigma_P^2 + \sigma^2))$ $X^B_\bullet\sim \mathcal N(\mu_B , {1\over n_B} (\sigma_P^2 + \sigma^2))$ The next natural step is to consider $Y = X_\bullet + X^A_\bullet - X^B_\bullet \sim \mathcal N\left( 2(\mu_A-\mu_B), {2\over n} \sigma^2 + \left({1\over n_A}+ {1\over n_B}\right) (\sigma_P^2 + \sigma^2)\right)$ Now basically we are stuck. The three sums of squares give estimations of $\sigma^2$ with $n-1$ df, $\sigma_P^2 + \sigma^2$ with $n_A-1$ df and $n_B-1$ df respectively. The last two can be combined to give an estimation of $\left({1\over n_A}+ {1\over n_B}\right) (\sigma_P^2 + \sigma^2)$ with $n_A+n_B-2$ df. The variance of $Y$ is the sum of two terms, each of which can be estimated, but the recombination is not doable, just as in Behrens Fisher problem. At this point I think one may plug-in any solution proposed to Behrens Fisher problem to get a solution to your problem.
t-test for partially paired and partially unpaired data Here are some thoughts. I basically just arrive to Greg Snow conclusion that This problem has distinct similarities to the Behrens-Fisher problem. To avoid handwaving I first introduce some notations
8,641
t-test for partially paired and partially unpaired data
My first thought was a mixed effects model, but that has already been discussed so I won't say any more on that. My other thought is that if it were theoretically possible that you could have measured paired data on all subjects but due to cost, errors, or another reason you don't have all the pairs, then you could treat the unmeasured effect for the unpaired subjects as missing data and use tools like the EM algorithm or Multiple Imputation (missing at random seems reasonable unless the reason a subject was only measured under 1 treatment was related to what their outcome would be under the other treatment). It may be even simpler to just fit a bivariate normal to the data using maximum likelihood (with the likelihood factored based on the available data per subject), then do a likelihood ratio test comparing the distribution with the means equal vs. different means. It has been a long time since my theory classes, so I don't know how these compare on optimality.
t-test for partially paired and partially unpaired data
My first thought was a mixed effects model, but that has already been discussed so I won't say any more on that. My other thought is that if it were theoretically possible that you could have measured
t-test for partially paired and partially unpaired data My first thought was a mixed effects model, but that has already been discussed so I won't say any more on that. My other thought is that if it were theoretically possible that you could have measured paired data on all subjects but due to cost, errors, or another reason you don't have all the pairs, then you could treat the unmeasured effect for the unpaired subjects as missing data and use tools like the EM algorithm or Multiple Imputation (missing at random seems reasonable unless the reason a subject was only measured under 1 treatment was related to what their outcome would be under the other treatment). It may be even simpler to just fit a bivariate normal to the data using maximum likelihood (with the likelihood factored based on the available data per subject), then do a likelihood ratio test comparing the distribution with the means equal vs. different means. It has been a long time since my theory classes, so I don't know how these compare on optimality.
t-test for partially paired and partially unpaired data My first thought was a mixed effects model, but that has already been discussed so I won't say any more on that. My other thought is that if it were theoretically possible that you could have measured
8,642
t-test for partially paired and partially unpaired data
maybe mixed modelling with patient as random effect could be a way. With mixed modelling the correlation structure in the paired case and the partial missings in the unpaired case could be accounted for.
t-test for partially paired and partially unpaired data
maybe mixed modelling with patient as random effect could be a way. With mixed modelling the correlation structure in the paired case and the partial missings in the unpaired case could be accounted f
t-test for partially paired and partially unpaired data maybe mixed modelling with patient as random effect could be a way. With mixed modelling the correlation structure in the paired case and the partial missings in the unpaired case could be accounted for.
t-test for partially paired and partially unpaired data maybe mixed modelling with patient as random effect could be a way. With mixed modelling the correlation structure in the paired case and the partial missings in the unpaired case could be accounted f
8,643
t-test for partially paired and partially unpaired data
One of the methods proposed in Hani M. Samawi & Robert Vogel (Journal of Applied Statistics , 2013) consists of a weighted combination of T-scores from independent and dependent samples in such a way that the new T score is equal to $T_o = \sqrt\gamma ( \frac {\mu_Y - \mu_X} {S_x^2/n_X + S_y^2/n_Y}) + \sqrt {(1-\gamma)} \frac {\mu_D} {S_D^2/n_D}$ where $D$ represents the samples of paired differences taken from the correlated data. Basically the new T score is a weighted combination of the unpaired T-score with the new correction term. $\gamma$ represents the proportion of independent samples. When $\gamma$ is equal to 1 the test is equivalent to two sample t-test, whereas if equal to zero, it is a paired t-test.
t-test for partially paired and partially unpaired data
One of the methods proposed in Hani M. Samawi & Robert Vogel (Journal of Applied Statistics , 2013) consists of a weighted combination of T-scores from independent and dependent samples in such a way
t-test for partially paired and partially unpaired data One of the methods proposed in Hani M. Samawi & Robert Vogel (Journal of Applied Statistics , 2013) consists of a weighted combination of T-scores from independent and dependent samples in such a way that the new T score is equal to $T_o = \sqrt\gamma ( \frac {\mu_Y - \mu_X} {S_x^2/n_X + S_y^2/n_Y}) + \sqrt {(1-\gamma)} \frac {\mu_D} {S_D^2/n_D}$ where $D$ represents the samples of paired differences taken from the correlated data. Basically the new T score is a weighted combination of the unpaired T-score with the new correction term. $\gamma$ represents the proportion of independent samples. When $\gamma$ is equal to 1 the test is equivalent to two sample t-test, whereas if equal to zero, it is a paired t-test.
t-test for partially paired and partially unpaired data One of the methods proposed in Hani M. Samawi & Robert Vogel (Journal of Applied Statistics , 2013) consists of a weighted combination of T-scores from independent and dependent samples in such a way
8,644
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classification vs. clustering
Great question. Anything can be good or bad, useful or not, based on what your goals are (and perhaps on the nature of your situation). For the most part, these methods are designed to satisfy different goals. Statistical tests, like the $t$-test allow you to test scientific hypotheses. They are often used for other purposes (because people just aren't familiar with other tools), but generally shouldn't be. If you have an a-priori hypothesis that the two groups have different means on a normally distributed variable, then the $t$-test will let you test that hypothesis and control your long-run type I error rate (although you won't know whether you made a type I error rate in this particular case). Classifiers in machine learning, like a SVM, are designed to classify patterns as belonging to one of a known set of classes. The typical situation is that you have some known instances, and you want to train the classifier using them so that it can provide the most accurate classifications in the future when you will have other patterns whose true class is unknown. The emphasis here is on out of sample accuracy; you are not testing any hypothesis. Certainly you hope that the distribution of the predictor variables / features differ between the classes, because otherwise no future classification help will be possible, but you are not trying to assess your belief that the means of Y differ by X. You want to correctly guess X in the future when Y is known. Unsupervised learning algorithms, like clustering, are designed to detect or impose structure on a dataset. There are many possible reasons you might want to do this. Sometimes you might expect that there are true, latent groupings in a dataset and want to see if the results of clustering will seem sensible and usable for your purposes. In other cases, you might want to impose a structure on a dataset to enable data reduction. Either way, you are not trying to test a hypothesis about anything, nor are you hoping to be able to accurately predict anything in the future. With this in mind, lets address your questions: The three methods differ fundamentally in the goals they serve. b and c could be useful in scientific arguments, it depends on the nature of the arguments in question. By far the most common type of research in science is centered on testing hypotheses. However, forming predictive models or detecting latent patters are also possible, legitimate goals. You would not typically try to get 'significance' from methods b or c. Assuming the features are categorical in nature (which I gather is what you have in mind), you can still test hypotheses using a factorial ANOVA. In machine learning there is a subtopic for multi-label classification. There are also methods for multiple membership / overlapping clusters, but these are less common and constitute a much less tractable problem. For an overview of the topic, see Krumpleman, C.S. (2010) Overlapping clustering. Dissertation, UT Austin, Electrical and Computer Engineering (pdf). Generally speaking, all three types of methods have greater difficulty as the number of cases across the categories diverge.
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classifica
Great question. Anything can be good or bad, useful or not, based on what your goals are (and perhaps on the nature of your situation). For the most part, these methods are designed to satisfy diffe
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classification vs. clustering Great question. Anything can be good or bad, useful or not, based on what your goals are (and perhaps on the nature of your situation). For the most part, these methods are designed to satisfy different goals. Statistical tests, like the $t$-test allow you to test scientific hypotheses. They are often used for other purposes (because people just aren't familiar with other tools), but generally shouldn't be. If you have an a-priori hypothesis that the two groups have different means on a normally distributed variable, then the $t$-test will let you test that hypothesis and control your long-run type I error rate (although you won't know whether you made a type I error rate in this particular case). Classifiers in machine learning, like a SVM, are designed to classify patterns as belonging to one of a known set of classes. The typical situation is that you have some known instances, and you want to train the classifier using them so that it can provide the most accurate classifications in the future when you will have other patterns whose true class is unknown. The emphasis here is on out of sample accuracy; you are not testing any hypothesis. Certainly you hope that the distribution of the predictor variables / features differ between the classes, because otherwise no future classification help will be possible, but you are not trying to assess your belief that the means of Y differ by X. You want to correctly guess X in the future when Y is known. Unsupervised learning algorithms, like clustering, are designed to detect or impose structure on a dataset. There are many possible reasons you might want to do this. Sometimes you might expect that there are true, latent groupings in a dataset and want to see if the results of clustering will seem sensible and usable for your purposes. In other cases, you might want to impose a structure on a dataset to enable data reduction. Either way, you are not trying to test a hypothesis about anything, nor are you hoping to be able to accurately predict anything in the future. With this in mind, lets address your questions: The three methods differ fundamentally in the goals they serve. b and c could be useful in scientific arguments, it depends on the nature of the arguments in question. By far the most common type of research in science is centered on testing hypotheses. However, forming predictive models or detecting latent patters are also possible, legitimate goals. You would not typically try to get 'significance' from methods b or c. Assuming the features are categorical in nature (which I gather is what you have in mind), you can still test hypotheses using a factorial ANOVA. In machine learning there is a subtopic for multi-label classification. There are also methods for multiple membership / overlapping clusters, but these are less common and constitute a much less tractable problem. For an overview of the topic, see Krumpleman, C.S. (2010) Overlapping clustering. Dissertation, UT Austin, Electrical and Computer Engineering (pdf). Generally speaking, all three types of methods have greater difficulty as the number of cases across the categories diverge.
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classifica Great question. Anything can be good or bad, useful or not, based on what your goals are (and perhaps on the nature of your situation). For the most part, these methods are designed to satisfy diffe
8,645
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classification vs. clustering
Not going to address clustering because it's been addressed in other answers, but: In general, the problem of testing whether two samples are meaningfully different is known as two-sample testing. By doing a $t$-test, you severely limit the kinds of differences that you're looking for (differences in means between normal distributions). There are other tests which can check for more general types of distances: Wilcoxon-Mann-Whitney for stochastic ordering, Kolmogorov-Smirnov for general differences in one dimension, maximum mean discrepancy or the equivalent energy distance for generic differences on arbitrary input spaces, or lots of other choices. Each of these tests is better at detecting certain kinds of differences, and it's sometimes hard to reason about what kinds of differences they're good or bad at detecting, or to interpret the results beyond a $p$ value. It might be easier to think about some of these issues if you construct a two-sample test out of a classifier, e.g. as recently proposed by Lopez-Paz and Oquab (2017). The procedure is as follows: Split your observations $X$ and $Y$ into two parts each, $X_\text{train}$ and $X_\text{test}$, $Y_\text{train}$ and $Y_\text{test}$. Train a classifier to distinguish between $X_\text{train}$ and $Y_\text{train}$. Apply the output of the classifier to $X_\text{test}$ and $Y_\text{test}$. Count up the portion of times its prediction was correct to get $\hat p$. Apply a binomial test to distinguish the null $p = \tfrac12$ from $p \ne \tfrac12$. If $p \ne \tfrac12$, then the two distributions are different. By inspecting the learned classifier, you may also be able to interpret the differences between the distributions in a semi-meaningful way. By changing the family of classifiers you consider, you can also help guide the test to look for certain kinds of differences. Note that it's important to do the train-test split: otherwise a classifier that just memorized its inputs would always have perfect discriminability. Increasing the portion of points in the training set gives you more data to learn a good classifier, but less opportunity to be sure that the classification accuracy is really different from chance. This tradeoff is something that is going to vary by problem and classifier family and is not yet well-understood. Lopez-Paz and Oquab showed good empirical performance of this approach on a few problems. Ramdas et al. (2016) additionally showed that theoretically, a closely related approach is rate-optimal for one specific simple problem. The "right" thing to do in this setting is an area of active research, but this approach is at least reasonable in many settings if you want a little more flexibility and interpretability than just applying some off-the-shelf standard test.
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classifica
Not going to address clustering because it's been addressed in other answers, but: In general, the problem of testing whether two samples are meaningfully different is known as two-sample testing. By
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classification vs. clustering Not going to address clustering because it's been addressed in other answers, but: In general, the problem of testing whether two samples are meaningfully different is known as two-sample testing. By doing a $t$-test, you severely limit the kinds of differences that you're looking for (differences in means between normal distributions). There are other tests which can check for more general types of distances: Wilcoxon-Mann-Whitney for stochastic ordering, Kolmogorov-Smirnov for general differences in one dimension, maximum mean discrepancy or the equivalent energy distance for generic differences on arbitrary input spaces, or lots of other choices. Each of these tests is better at detecting certain kinds of differences, and it's sometimes hard to reason about what kinds of differences they're good or bad at detecting, or to interpret the results beyond a $p$ value. It might be easier to think about some of these issues if you construct a two-sample test out of a classifier, e.g. as recently proposed by Lopez-Paz and Oquab (2017). The procedure is as follows: Split your observations $X$ and $Y$ into two parts each, $X_\text{train}$ and $X_\text{test}$, $Y_\text{train}$ and $Y_\text{test}$. Train a classifier to distinguish between $X_\text{train}$ and $Y_\text{train}$. Apply the output of the classifier to $X_\text{test}$ and $Y_\text{test}$. Count up the portion of times its prediction was correct to get $\hat p$. Apply a binomial test to distinguish the null $p = \tfrac12$ from $p \ne \tfrac12$. If $p \ne \tfrac12$, then the two distributions are different. By inspecting the learned classifier, you may also be able to interpret the differences between the distributions in a semi-meaningful way. By changing the family of classifiers you consider, you can also help guide the test to look for certain kinds of differences. Note that it's important to do the train-test split: otherwise a classifier that just memorized its inputs would always have perfect discriminability. Increasing the portion of points in the training set gives you more data to learn a good classifier, but less opportunity to be sure that the classification accuracy is really different from chance. This tradeoff is something that is going to vary by problem and classifier family and is not yet well-understood. Lopez-Paz and Oquab showed good empirical performance of this approach on a few problems. Ramdas et al. (2016) additionally showed that theoretically, a closely related approach is rate-optimal for one specific simple problem. The "right" thing to do in this setting is an area of active research, but this approach is at least reasonable in many settings if you want a little more flexibility and interpretability than just applying some off-the-shelf standard test.
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classifica Not going to address clustering because it's been addressed in other answers, but: In general, the problem of testing whether two samples are meaningfully different is known as two-sample testing. By
8,646
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classification vs. clustering
Only approach (a) serves the purpose of testing hypothesis. In case of using supervised machine learning algorithms (b), they cannot neither prove or disprove hypothesis about distingness of groups. If machine learning algorithm does not classify the groups correctly it may happen because you used "wrong" algorithm for your problem, or you didn't tuned it enough etc. On another hand, you may "torture" the totally "random" data long enough to produce overfitting model that makes good predictions. Yet another problem is when and how would you know that the algorithm makes "good" predictions? Almost never you would aim at 100% classification accuracy, so when would you know that the classification results prove anything? Clustering algorithms (c) are not designed for supervised learning. They do not aim at recreating the labels, but to group your data in terms of similarities. Now, the results depend on what algorithm you use and what kind of similarities you are looking for. Your data may have different kinds of similarities, you may want to seek for differences between boys and girls, but the algorithm may instead find groups of poor and rich kids, or intelligent and less intelligent, right- and left-handed etc. Not finding the grouping that you intended does not prove that the grouping does not make sense, but only that it found other "meaningful" grouping. As in previous case, the results may depend on the algorithm used and the parameters. Would it suite you if one in ten algorithms/settings found "your" labels? What if it was one in one hundred? How long would you search before stopping? Notice that when using machine learning in vast majority of cases you won't stop after using one algorithm with default settings and the result may depend on the procedure that you used.
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classifica
Only approach (a) serves the purpose of testing hypothesis. In case of using supervised machine learning algorithms (b), they cannot neither prove or disprove hypothesis about distingness of groups. I
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classification vs. clustering Only approach (a) serves the purpose of testing hypothesis. In case of using supervised machine learning algorithms (b), they cannot neither prove or disprove hypothesis about distingness of groups. If machine learning algorithm does not classify the groups correctly it may happen because you used "wrong" algorithm for your problem, or you didn't tuned it enough etc. On another hand, you may "torture" the totally "random" data long enough to produce overfitting model that makes good predictions. Yet another problem is when and how would you know that the algorithm makes "good" predictions? Almost never you would aim at 100% classification accuracy, so when would you know that the classification results prove anything? Clustering algorithms (c) are not designed for supervised learning. They do not aim at recreating the labels, but to group your data in terms of similarities. Now, the results depend on what algorithm you use and what kind of similarities you are looking for. Your data may have different kinds of similarities, you may want to seek for differences between boys and girls, but the algorithm may instead find groups of poor and rich kids, or intelligent and less intelligent, right- and left-handed etc. Not finding the grouping that you intended does not prove that the grouping does not make sense, but only that it found other "meaningful" grouping. As in previous case, the results may depend on the algorithm used and the parameters. Would it suite you if one in ten algorithms/settings found "your" labels? What if it was one in one hundred? How long would you search before stopping? Notice that when using machine learning in vast majority of cases you won't stop after using one algorithm with default settings and the result may depend on the procedure that you used.
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classifica Only approach (a) serves the purpose of testing hypothesis. In case of using supervised machine learning algorithms (b), they cannot neither prove or disprove hypothesis about distingness of groups. I
8,647
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classification vs. clustering
a) only answers you the question whether the distribution is different, but not how to distinguish them. b) will also find the best value to differentiate between the two distributions. c) will work if the two distributions have some specific properties. For example it will work with normal distribution but not with some two modal distributions, because the method can differentiate two modes of the same group instead of two different groups. c) is not useful for scientific arguments because of two modal distributions. b) could be used for differentiating two distributions, because you can calculate the significance (see 3.) Though I never met it. By bootstrapping. You calculate the model based on random subsamples 1000 times. You get a score, for example the minimum sum of alpha and beta errors. You sort the score ascending. For 5% confidence you choose the 950th value. If this value is lower than 50% (for equal number of points for group A and B) then with 95% confidence you can disregard the null hypothesis that the distributions are the same. The problem is that if the distributions are both normal, have the same mean, but have a different variation then you won't be able to understand that they are different by ML techniques. On the other hand, you can find a test of variation that will be able to distinguish the two distributions. And it could be the other way around that ML will be stronger than a statistical test and will be able to distinguish the distributions. When you have only one feature in ML you need to find only one value to distinguish the distributions. With two features the border can be a sinus and in multi-dimensional space it could be really weird. So it will be much harder to find the right border. On the other hand, additional features bring additional information. So it will generally allow to distinguish the two distributions easier. If both variable are normally distributed then the border is a line. Smaller samples can behave non-normally because the Central Limit Theorem cannot be applied. Bigger sample start to behave more normally because the Central Limit Theorem starts working. For example the mean of both groups will be almost normally distributed if the sample is big enough. But it is usually not 100 vs 300 but 10 observations against 1000 observations. So according to this site the t-test for difference of mean will work irrespective of distribution if the number of observations is larger than 40 and without outliers.
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classifica
a) only answers you the question whether the distribution is different, but not how to distinguish them. b) will also find the best value to differentiate between the two distributions. c) will work i
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classification vs. clustering a) only answers you the question whether the distribution is different, but not how to distinguish them. b) will also find the best value to differentiate between the two distributions. c) will work if the two distributions have some specific properties. For example it will work with normal distribution but not with some two modal distributions, because the method can differentiate two modes of the same group instead of two different groups. c) is not useful for scientific arguments because of two modal distributions. b) could be used for differentiating two distributions, because you can calculate the significance (see 3.) Though I never met it. By bootstrapping. You calculate the model based on random subsamples 1000 times. You get a score, for example the minimum sum of alpha and beta errors. You sort the score ascending. For 5% confidence you choose the 950th value. If this value is lower than 50% (for equal number of points for group A and B) then with 95% confidence you can disregard the null hypothesis that the distributions are the same. The problem is that if the distributions are both normal, have the same mean, but have a different variation then you won't be able to understand that they are different by ML techniques. On the other hand, you can find a test of variation that will be able to distinguish the two distributions. And it could be the other way around that ML will be stronger than a statistical test and will be able to distinguish the distributions. When you have only one feature in ML you need to find only one value to distinguish the distributions. With two features the border can be a sinus and in multi-dimensional space it could be really weird. So it will be much harder to find the right border. On the other hand, additional features bring additional information. So it will generally allow to distinguish the two distributions easier. If both variable are normally distributed then the border is a line. Smaller samples can behave non-normally because the Central Limit Theorem cannot be applied. Bigger sample start to behave more normally because the Central Limit Theorem starts working. For example the mean of both groups will be almost normally distributed if the sample is big enough. But it is usually not 100 vs 300 but 10 observations against 1000 observations. So according to this site the t-test for difference of mean will work irrespective of distribution if the number of observations is larger than 40 and without outliers.
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classifica a) only answers you the question whether the distribution is different, but not how to distinguish them. b) will also find the best value to differentiate between the two distributions. c) will work i
8,648
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classification vs. clustering
Statistical testing is for making inference from data, it tells you how things are related. The result is something that has a real-world meaning. E.g. how smoking is associated with lung cancer, both in terms of direction and magnitude. It still does not tell you why things happened. To answer why things happened, we need to consider also the interrelationship with other variables and make appropriate adjustments (see Pearl, J. (2003) CAUSALITY: MODELS, REASONING, AND INFERENCE). Supervised learning is for making predictions, it tells you what will happen. E.g. Given the smoking status of a person, we can predict whether s/he will have lung cancer. In simple cases, it still tells you β€œhow”, for example by looking at the cutoff of smoking status that identified by the algorithm. But more complex models are harder or impossible to interpret (deep learning/boosting with a lot of features). Unsupervised learning is often used in facilitating the above two. For statistical testing, by discovering some unknown underlying subgroups of the data (clustering), we can infer the heterogeneity in the associations between variables. E.g. smoking increases the odds of having lung cancer for subgroup A but not subgroup B. For supervised learning, we can create new features to improve prediction accuracy and robustness. E.g. by identifying subgroups (clustering) or combination of features (dimension reduction) that are associated with odds of having lung cancer. When the number of features/variables gets larger, the difference between statistical testing and supervised learning become more substantial. Statistical testing may not necessarily benefit from this, it depends on for example whether you want to make causal inference by controlling for other factors or identifying heterogeneity in the associations as mentioned above. Supervised learning will perform better if the features are relevant and it will become more like a blackbox. When the number of sample gets larger, we can get more precise results for statistical testing, more accurate results for supervised learning and more robust results for unsupervised learning. But this depends on the quality of the data. Bad quality data may introduce bias or noise to the results. Sometimes we want to know β€œhow” and β€œwhy” to inform interventional actions, e.g. by identifying that smoking causes lung cancer, policy can be made to deal with that. Sometimes we want to know β€œwhat” to inform decision-making, e.g. finding out who is likely to have lung cancer and give them early treatments. There is a special issue published on Science about prediction and its limits (http://science.sciencemag.org/content/355/6324/468). β€œSuccess seems to be achieved most consistently when questions are tackled in multidisciplinary efforts that join human understanding of context with algorithmic capacity to handle terabytes of data.” In my opinion, for example, knowledge discovered using hypothesis testing can help supervised learning by informing us what data/features we should collect in the first place. On the other hand, supervised learning can help generating hypotheses by informing which variables
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classifica
Statistical testing is for making inference from data, it tells you how things are related. The result is something that has a real-world meaning. E.g. how smoking is associated with lung cancer, both
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classification vs. clustering Statistical testing is for making inference from data, it tells you how things are related. The result is something that has a real-world meaning. E.g. how smoking is associated with lung cancer, both in terms of direction and magnitude. It still does not tell you why things happened. To answer why things happened, we need to consider also the interrelationship with other variables and make appropriate adjustments (see Pearl, J. (2003) CAUSALITY: MODELS, REASONING, AND INFERENCE). Supervised learning is for making predictions, it tells you what will happen. E.g. Given the smoking status of a person, we can predict whether s/he will have lung cancer. In simple cases, it still tells you β€œhow”, for example by looking at the cutoff of smoking status that identified by the algorithm. But more complex models are harder or impossible to interpret (deep learning/boosting with a lot of features). Unsupervised learning is often used in facilitating the above two. For statistical testing, by discovering some unknown underlying subgroups of the data (clustering), we can infer the heterogeneity in the associations between variables. E.g. smoking increases the odds of having lung cancer for subgroup A but not subgroup B. For supervised learning, we can create new features to improve prediction accuracy and robustness. E.g. by identifying subgroups (clustering) or combination of features (dimension reduction) that are associated with odds of having lung cancer. When the number of features/variables gets larger, the difference between statistical testing and supervised learning become more substantial. Statistical testing may not necessarily benefit from this, it depends on for example whether you want to make causal inference by controlling for other factors or identifying heterogeneity in the associations as mentioned above. Supervised learning will perform better if the features are relevant and it will become more like a blackbox. When the number of sample gets larger, we can get more precise results for statistical testing, more accurate results for supervised learning and more robust results for unsupervised learning. But this depends on the quality of the data. Bad quality data may introduce bias or noise to the results. Sometimes we want to know β€œhow” and β€œwhy” to inform interventional actions, e.g. by identifying that smoking causes lung cancer, policy can be made to deal with that. Sometimes we want to know β€œwhat” to inform decision-making, e.g. finding out who is likely to have lung cancer and give them early treatments. There is a special issue published on Science about prediction and its limits (http://science.sciencemag.org/content/355/6324/468). β€œSuccess seems to be achieved most consistently when questions are tackled in multidisciplinary efforts that join human understanding of context with algorithmic capacity to handle terabytes of data.” In my opinion, for example, knowledge discovered using hypothesis testing can help supervised learning by informing us what data/features we should collect in the first place. On the other hand, supervised learning can help generating hypotheses by informing which variables
Distinguishing between two groups in statistics and machine learning: hypothesis test vs. classifica Statistical testing is for making inference from data, it tells you how things are related. The result is something that has a real-world meaning. E.g. how smoking is associated with lung cancer, both
8,649
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time?
This would obviously be an absolute nightmare to do in practice, but suppose it could be done: we appoint a Statistical Sultan and everyone running a hypothesis test reports their raw $p$-values to this despot. He performs some kind of global (literally) multiple comparisons correction and replies with the corrected versions. Would this usher in a golden age of science and reason? No, probably not. Let's start by considering one pair of hypotheses, as in a $t$-test. We measure some property of two groups and want to distinguish between two hypotheses about that property: $$\begin{align} H_0:& \textrm{ The groups have the same mean.} \\ H_A:& \textrm{ The groups have different means.} \end{align}$$ In a finite sample, the means are unlikely to be exactly equal even if $H_0$ really is true: measurement error and other sources of variability can push individual values around. However, the $H_0$ hypothesis is in some sense "boring", and researchers are typically concerned with avoiding a "false positive" situation wherein they claim to have found a difference between the groups where none really exists. Therefore, we only call results "significant" if they seem unlikely under the null hypothesis, and, by convention, that unlikeliness threshold is set at 5%. This applies to a single test. Now suppose you decide to run multiple tests and are willing to accept a 5% chance of mistakenly accepting $H_0$ for each one. With enough tests, you therefore almost certainly going to start making errors, and lots of them. The various multiple corrections approaches are intended to help you get back to a nominal error rate that you have already chosen to tolerate for individual tests. They do so in slightly different ways. Methods that control the Family-Wise Error Rate, like the Bonferroni, Sidak, and Holm procedures, say "You wanted a 5% chance of making an error on a single test, so we'll ensure that you there's no more than a 5% chance of making any errors across all of your tests." Methods that control the False Discovery Rate instead say "You are apparently okay with being wrong up to 5% of the time with a single test, so we'll ensure that no more than 5% of your 'calls' are wrong when doing multiple tests". (See the difference?) Now, suppose you attempted to control the family-wise error rate of all hypothesis tests ever run. You are essentially saying that you want a <5% chance of falsely rejecting any null hypothesis, ever. This sets up an impossibly stringent threshold and inference would be effectively useless but there's an even more pressing issue: your global correction means you are testing absolutely nonsensical "compound hypotheses" like $$\begin{align} H_1: &\textrm{Drug XYZ changes T-cell count } \wedge \\ &\textrm{Grapes grow better in some fields } \wedge&\\ &\ldots \wedge \ldots \wedge \ldots \wedge \ldots \wedge \\&\textrm{Men and women eat different amounts of ice cream} \end{align} $$ With False Discovery Rate corrections, the numerical issue isn't quite so severe, but it is still a mess philosophically. Instead, it makes sense to define a "family" of related tests, like a list of candidate genes during a genomics study, or a set of time-frequency bins during a spectral analysis. Tailoring your family to a specific question lets you actually interpret your Type I error bound in a direct way. For example, you could look at a FWER-corrected set of p-values from your own genomic data and say "There's a <5% chance that any of these genes are false positives." This is a lot better than a nebulous guarantee that covers inferences done by people you don't care about on topics you don't care about. The flip side of this is that he appropriate choice of "family" is debatable and a bit subjective (Are all genes one family or can I just consider the kinases?) but it should be informed by your problem and I don't believe anyone has seriously advocated defining families nearly so extensively. How about Bayes? Bayesian analysis offers coherent alternative to this problem--if you're willing to move a bit away from the Frequentist Type I/Type II error framework. We start with some non-committal prior over...well...everything. Every time we learn something, that information is combined with the prior to generate a posterior distribution, which in turn becomes the prior for the next time we learn something. This gives you a coherent update rule and you could compare different hypotheses about specific things by calculating the Bayes factor between two hypotheses. You could presumably factor out large chunks of the model, which wouldn't even make this particularly onerous. There is a persistent...meme that Bayesian methods don't require multiple comparisons corrections. Unfortunately, the posterior odds are just another test statistic for frequentists (i.e., people who care about Type I/II errors). They don't have any special properties that control these types of errors (Why would they?) Thus, you're back in intractable territory, but perhaps on slightly more principled ground. The Bayesian counter-argument is that we should focus on what we can know now and thus these error rates aren't as important. On Reproduciblity You seem to be suggesting that improper multiple comparisons-correction is the reason behind a lot of incorrect/unreproducible results. My sense is that other factors are more likely to be an issue. An obvious one is that pressure to publish leads people to avoid experiments that really stress their hypothesis (i.e., bad experimental design). For example, [in this experiment] (part of Amgen's (ir)reproduciblity initative 6, it turns out that the mice had mutations in genes other than the gene of interest. Andrew Gelman also likes to talk about the Garden of Forking Paths, wherein researchers choose a (reasonable) analysis plan based on the data, but might have done other analyses if the data looked different. This inflates $p$-values in a similar way to multiple comparisons, but is much harder to correct for afterward. Blatantly incorrect analysis may also play a role, but my feeling (and hope) is that that is gradually improving.
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time?
This would obviously be an absolute nightmare to do in practice, but suppose it could be done: we appoint a Statistical Sultan and everyone running a hypothesis test reports their raw $p$-values to th
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time? This would obviously be an absolute nightmare to do in practice, but suppose it could be done: we appoint a Statistical Sultan and everyone running a hypothesis test reports their raw $p$-values to this despot. He performs some kind of global (literally) multiple comparisons correction and replies with the corrected versions. Would this usher in a golden age of science and reason? No, probably not. Let's start by considering one pair of hypotheses, as in a $t$-test. We measure some property of two groups and want to distinguish between two hypotheses about that property: $$\begin{align} H_0:& \textrm{ The groups have the same mean.} \\ H_A:& \textrm{ The groups have different means.} \end{align}$$ In a finite sample, the means are unlikely to be exactly equal even if $H_0$ really is true: measurement error and other sources of variability can push individual values around. However, the $H_0$ hypothesis is in some sense "boring", and researchers are typically concerned with avoiding a "false positive" situation wherein they claim to have found a difference between the groups where none really exists. Therefore, we only call results "significant" if they seem unlikely under the null hypothesis, and, by convention, that unlikeliness threshold is set at 5%. This applies to a single test. Now suppose you decide to run multiple tests and are willing to accept a 5% chance of mistakenly accepting $H_0$ for each one. With enough tests, you therefore almost certainly going to start making errors, and lots of them. The various multiple corrections approaches are intended to help you get back to a nominal error rate that you have already chosen to tolerate for individual tests. They do so in slightly different ways. Methods that control the Family-Wise Error Rate, like the Bonferroni, Sidak, and Holm procedures, say "You wanted a 5% chance of making an error on a single test, so we'll ensure that you there's no more than a 5% chance of making any errors across all of your tests." Methods that control the False Discovery Rate instead say "You are apparently okay with being wrong up to 5% of the time with a single test, so we'll ensure that no more than 5% of your 'calls' are wrong when doing multiple tests". (See the difference?) Now, suppose you attempted to control the family-wise error rate of all hypothesis tests ever run. You are essentially saying that you want a <5% chance of falsely rejecting any null hypothesis, ever. This sets up an impossibly stringent threshold and inference would be effectively useless but there's an even more pressing issue: your global correction means you are testing absolutely nonsensical "compound hypotheses" like $$\begin{align} H_1: &\textrm{Drug XYZ changes T-cell count } \wedge \\ &\textrm{Grapes grow better in some fields } \wedge&\\ &\ldots \wedge \ldots \wedge \ldots \wedge \ldots \wedge \\&\textrm{Men and women eat different amounts of ice cream} \end{align} $$ With False Discovery Rate corrections, the numerical issue isn't quite so severe, but it is still a mess philosophically. Instead, it makes sense to define a "family" of related tests, like a list of candidate genes during a genomics study, or a set of time-frequency bins during a spectral analysis. Tailoring your family to a specific question lets you actually interpret your Type I error bound in a direct way. For example, you could look at a FWER-corrected set of p-values from your own genomic data and say "There's a <5% chance that any of these genes are false positives." This is a lot better than a nebulous guarantee that covers inferences done by people you don't care about on topics you don't care about. The flip side of this is that he appropriate choice of "family" is debatable and a bit subjective (Are all genes one family or can I just consider the kinases?) but it should be informed by your problem and I don't believe anyone has seriously advocated defining families nearly so extensively. How about Bayes? Bayesian analysis offers coherent alternative to this problem--if you're willing to move a bit away from the Frequentist Type I/Type II error framework. We start with some non-committal prior over...well...everything. Every time we learn something, that information is combined with the prior to generate a posterior distribution, which in turn becomes the prior for the next time we learn something. This gives you a coherent update rule and you could compare different hypotheses about specific things by calculating the Bayes factor between two hypotheses. You could presumably factor out large chunks of the model, which wouldn't even make this particularly onerous. There is a persistent...meme that Bayesian methods don't require multiple comparisons corrections. Unfortunately, the posterior odds are just another test statistic for frequentists (i.e., people who care about Type I/II errors). They don't have any special properties that control these types of errors (Why would they?) Thus, you're back in intractable territory, but perhaps on slightly more principled ground. The Bayesian counter-argument is that we should focus on what we can know now and thus these error rates aren't as important. On Reproduciblity You seem to be suggesting that improper multiple comparisons-correction is the reason behind a lot of incorrect/unreproducible results. My sense is that other factors are more likely to be an issue. An obvious one is that pressure to publish leads people to avoid experiments that really stress their hypothesis (i.e., bad experimental design). For example, [in this experiment] (part of Amgen's (ir)reproduciblity initative 6, it turns out that the mice had mutations in genes other than the gene of interest. Andrew Gelman also likes to talk about the Garden of Forking Paths, wherein researchers choose a (reasonable) analysis plan based on the data, but might have done other analyses if the data looked different. This inflates $p$-values in a similar way to multiple comparisons, but is much harder to correct for afterward. Blatantly incorrect analysis may also play a role, but my feeling (and hope) is that that is gradually improving.
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time? This would obviously be an absolute nightmare to do in practice, but suppose it could be done: we appoint a Statistical Sultan and everyone running a hypothesis test reports their raw $p$-values to th
8,650
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time?
I think that you deliberately paint a pessimistic view of science produced by statistics. Indeed, in my opinion, statistics is not just a set of tools providing p values. There is also a state of rigour, care and alertness about some possible effects involved in the procedure of scientific induction... and while to my mind, everything you state is roughly true, here are some of my opinions on why we have some guarantees about the knowledge we produce: First in general, a conclusion should not be reached only under the argument of a p value lower than a given threshold. Second, to my knowledge arguments of the kind of "over half of published scientific results are wrong" are relevant and interesting but are computed on the basis of p values approximately equal to 0.05 (see e.g. Confusion regarding p-values and false discovery rate). For lower p values the effect is much lower than the announced one and in practice, it is not rare to obtain p values much lower than 0.05. Moreover, many times a given hypothesis is confirmed by several sub-hypotheses which again reduces the announced effects. Third, the question of reproducibility is genuine but is also a problem that must be dealt by the statistician by identifying and dealing with confounding effects, group designs ... and this can be done very well if it is done with expertise and rigour. Finally, as I understand it, an archetypal statistical study must more or less stand on the following 5 successive steps: Formulate one or a few hypotheses Design the corresponding study Acquire the data Analyse the data Make conclusions about the above hypotheses (and only these ones) This general guideline prevents us from fishing expeditions as a tool to produce general conclusions. To conclude, I would say that your intent to protect us against bad scientific conclusions by over-thresholding p-values is a bit illusory. I would prefer protecting us against bad scientific conclusions by ensuring and encouraging warned and proper analyses (and I would like to think that this is a reason why so much qualified persons are here to help others on this site).
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time?
I think that you deliberately paint a pessimistic view of science produced by statistics. Indeed, in my opinion, statistics is not just a set of tools providing p values. There is also a state of rigo
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time? I think that you deliberately paint a pessimistic view of science produced by statistics. Indeed, in my opinion, statistics is not just a set of tools providing p values. There is also a state of rigour, care and alertness about some possible effects involved in the procedure of scientific induction... and while to my mind, everything you state is roughly true, here are some of my opinions on why we have some guarantees about the knowledge we produce: First in general, a conclusion should not be reached only under the argument of a p value lower than a given threshold. Second, to my knowledge arguments of the kind of "over half of published scientific results are wrong" are relevant and interesting but are computed on the basis of p values approximately equal to 0.05 (see e.g. Confusion regarding p-values and false discovery rate). For lower p values the effect is much lower than the announced one and in practice, it is not rare to obtain p values much lower than 0.05. Moreover, many times a given hypothesis is confirmed by several sub-hypotheses which again reduces the announced effects. Third, the question of reproducibility is genuine but is also a problem that must be dealt by the statistician by identifying and dealing with confounding effects, group designs ... and this can be done very well if it is done with expertise and rigour. Finally, as I understand it, an archetypal statistical study must more or less stand on the following 5 successive steps: Formulate one or a few hypotheses Design the corresponding study Acquire the data Analyse the data Make conclusions about the above hypotheses (and only these ones) This general guideline prevents us from fishing expeditions as a tool to produce general conclusions. To conclude, I would say that your intent to protect us against bad scientific conclusions by over-thresholding p-values is a bit illusory. I would prefer protecting us against bad scientific conclusions by ensuring and encouraging warned and proper analyses (and I would like to think that this is a reason why so much qualified persons are here to help others on this site).
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time? I think that you deliberately paint a pessimistic view of science produced by statistics. Indeed, in my opinion, statistics is not just a set of tools providing p values. There is also a state of rigo
8,651
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time?
Is it possible to control the false discovery rate without applying some such correction? Yes. This is what a threshold on p values does: it sets the rate of false discoveries to that threshold. In the long run, on all tests run on true null hypotheses, only $100\,a$ percent will have a p value below $a$. Remember that (frequentist) error rates do not concern at all any probabilities about a hypothesis tested by any individual test, but as methods for conducting tests with guaranteed long term failure rates. Correction for multiple comparisons is another method for guaranteeing long term failure rates: one for constructing compound methods which contain multiple tests so that some guaranteed long term failure rate for the compound holds. If you conduct a single experiment with 100 tests and report that 5 of them spoke against the null, thus claiming that you have observed some real result, nobody will be impressed, knowing that on average, amongst 100 tests of true nulls, 5% will reject; the method you have employed, "conduct 100 tests and report if any of them meets the 5% threshold", has a higher failure rate than 5%. Thus, you may chose to control for multiple comparisons and report that e.g. 2 out of 100 tests had p values lower than (5 / 100 == 0.05) %. Now you employ a method which has again a guaranteed failure rate (for the error of reporting at least one significant test even though no hypotheses are false) of 5%. That is, FWE/Family-wise error correction controls the global error rate; that if you do n tests, only $a$ times will you find a significant effect if all your tests are of true hypotheses. That is, if literally every single hypothesis anyone ever bothered to test was true, and everyone always did >1 tests per study, and everyone applied study-wise FWE control, 5% of studies would report significant results (and 5% of all individual tests would be significant under their original, uncorrected thresholds). In contrast, if everyone always tested 100 true hypotheses per study and did not apply FEW, the number of experiments reporting significant effects would exceed the guaranteed error rate of 5%. (Contrast with FDR/False Detection Rate, which is not a method that guarantees the rate of reporting any significant test in a study of multiple tests of true hypotheses.)
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time?
Is it possible to control the false discovery rate without applying some such correction? Yes. This is what a threshold on p values does: it sets the rate of false discoveries to that threshold. In t
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time? Is it possible to control the false discovery rate without applying some such correction? Yes. This is what a threshold on p values does: it sets the rate of false discoveries to that threshold. In the long run, on all tests run on true null hypotheses, only $100\,a$ percent will have a p value below $a$. Remember that (frequentist) error rates do not concern at all any probabilities about a hypothesis tested by any individual test, but as methods for conducting tests with guaranteed long term failure rates. Correction for multiple comparisons is another method for guaranteeing long term failure rates: one for constructing compound methods which contain multiple tests so that some guaranteed long term failure rate for the compound holds. If you conduct a single experiment with 100 tests and report that 5 of them spoke against the null, thus claiming that you have observed some real result, nobody will be impressed, knowing that on average, amongst 100 tests of true nulls, 5% will reject; the method you have employed, "conduct 100 tests and report if any of them meets the 5% threshold", has a higher failure rate than 5%. Thus, you may chose to control for multiple comparisons and report that e.g. 2 out of 100 tests had p values lower than (5 / 100 == 0.05) %. Now you employ a method which has again a guaranteed failure rate (for the error of reporting at least one significant test even though no hypotheses are false) of 5%. That is, FWE/Family-wise error correction controls the global error rate; that if you do n tests, only $a$ times will you find a significant effect if all your tests are of true hypotheses. That is, if literally every single hypothesis anyone ever bothered to test was true, and everyone always did >1 tests per study, and everyone applied study-wise FWE control, 5% of studies would report significant results (and 5% of all individual tests would be significant under their original, uncorrected thresholds). In contrast, if everyone always tested 100 true hypotheses per study and did not apply FEW, the number of experiments reporting significant effects would exceed the guaranteed error rate of 5%. (Contrast with FDR/False Detection Rate, which is not a method that guarantees the rate of reporting any significant test in a study of multiple tests of true hypotheses.)
Why aren't multiple hypothesis corrections applied to all experiments since the dawn of time? Is it possible to control the false discovery rate without applying some such correction? Yes. This is what a threshold on p values does: it sets the rate of false discoveries to that threshold. In t
8,652
What are variable importance rankings useful for?
I have argued that variable importance is a slippery concept, as this question posits. The tautological first type of response that you get to your question and the unrealistic hopes of those who would interpret variable-importance results in terms of causality, as noted by @DexGroves, need little elaboration. In fairness to those who would use backward selection, however, even Frank Harrell allows for it as part of a modeling strategy. From page 97 of his Regression Modeling Strategies, 2nd edition (a similar statement is on page 131 of the associated course notes): Do limited backwards step-down variable selection if parsimony is more important than accuracy. This limited potential use of backward selection, however, is step 13, the last step before the final model (step 14). It comes well after the crucial first steps: Assemble as much accurate pertinent data as possible, with wide distributions for predictor values... Formulate good hypotheses that lead to specification of relevant candidate predictors and possible interactions... In my experience people often want to bypass step 2, and let some automated procedure replace intelligent application of subject-matter knowledge. This may lead to some of the emphasis placed on variable importance. The full model of Harrell's step 14 is followed by 5 further steps of validation and adjustment, with a last step: Develop simplifications to the full model by approximating it to any desired degrees of accuracy. As other answers have noted, there are issues of actionability, cost, and simplicity that enter into the practical application of modeling results. For example, if I develop a new cancer biomarker that improves prognostication but costs $100,000 per test, it might be difficult to convince insurers or the government to pay for the test unless it is spectacularly useful. So it's not unreasonable for someone to want to focus on variables that are "most important," or to simplify an accurate model into one that is somewhat less accurate but is easier or less expensive to implement. But this variable selection and model simplification should be for a specific purpose, and I think that is where the difficulty arises. The issue is similar to assessing classification schemes solely on the basis of percent of cases correctly classified. Just as different classification errors can have different costs, different model simplification schemes can have different costs that balance against their hoped-for benefits. So I think that the issue to focus on as the analyst is the ability to estimate and illustrate these costs and benefits reliably with statistical modeling procedures, rather than worrying too much about an abstract concept of statistically validity per se. For example, pages 157-8 of Harrell's class notes linked above has an example of using the bootstrap to show the vagaries of ranking predictors in least squares; similar results can be found for variables sets selected by LASSO. If that type of variability in variable selection doesn't get in the way of a particular practical application of the model that's OK. The job is to estimate how much and what type of trouble that simplification will lead to.
What are variable importance rankings useful for?
I have argued that variable importance is a slippery concept, as this question posits. The tautological first type of response that you get to your question and the unrealistic hopes of those who woul
What are variable importance rankings useful for? I have argued that variable importance is a slippery concept, as this question posits. The tautological first type of response that you get to your question and the unrealistic hopes of those who would interpret variable-importance results in terms of causality, as noted by @DexGroves, need little elaboration. In fairness to those who would use backward selection, however, even Frank Harrell allows for it as part of a modeling strategy. From page 97 of his Regression Modeling Strategies, 2nd edition (a similar statement is on page 131 of the associated course notes): Do limited backwards step-down variable selection if parsimony is more important than accuracy. This limited potential use of backward selection, however, is step 13, the last step before the final model (step 14). It comes well after the crucial first steps: Assemble as much accurate pertinent data as possible, with wide distributions for predictor values... Formulate good hypotheses that lead to specification of relevant candidate predictors and possible interactions... In my experience people often want to bypass step 2, and let some automated procedure replace intelligent application of subject-matter knowledge. This may lead to some of the emphasis placed on variable importance. The full model of Harrell's step 14 is followed by 5 further steps of validation and adjustment, with a last step: Develop simplifications to the full model by approximating it to any desired degrees of accuracy. As other answers have noted, there are issues of actionability, cost, and simplicity that enter into the practical application of modeling results. For example, if I develop a new cancer biomarker that improves prognostication but costs $100,000 per test, it might be difficult to convince insurers or the government to pay for the test unless it is spectacularly useful. So it's not unreasonable for someone to want to focus on variables that are "most important," or to simplify an accurate model into one that is somewhat less accurate but is easier or less expensive to implement. But this variable selection and model simplification should be for a specific purpose, and I think that is where the difficulty arises. The issue is similar to assessing classification schemes solely on the basis of percent of cases correctly classified. Just as different classification errors can have different costs, different model simplification schemes can have different costs that balance against their hoped-for benefits. So I think that the issue to focus on as the analyst is the ability to estimate and illustrate these costs and benefits reliably with statistical modeling procedures, rather than worrying too much about an abstract concept of statistically validity per se. For example, pages 157-8 of Harrell's class notes linked above has an example of using the bootstrap to show the vagaries of ranking predictors in least squares; similar results can be found for variables sets selected by LASSO. If that type of variability in variable selection doesn't get in the way of a particular practical application of the model that's OK. The job is to estimate how much and what type of trouble that simplification will lead to.
What are variable importance rankings useful for? I have argued that variable importance is a slippery concept, as this question posits. The tautological first type of response that you get to your question and the unrealistic hopes of those who woul
8,653
What are variable importance rankings useful for?
This is completely anecdotal, but I've found variable importance useful in identifying mistakes or weaknesses in GBMs. Variable importance gives you a kind of huge cross-sectional overview of the model that would be hard to get otherwise. Variables higher in the list are seeing more activity (whether or not they are more 'important' is another question). Often a poorly behaving predictor (for instance something forward-looking, or a high-cardinality factor) will shoot to the top. If there's a big disagreement between intuition variable importance and GBM variable importance, there's usually some valuable knowledge to be gained or a mistake to be found. I would add a third answer to the "why are you asking me for this?" question, which is "because I want to understand what's causal to my response". Eep.
What are variable importance rankings useful for?
This is completely anecdotal, but I've found variable importance useful in identifying mistakes or weaknesses in GBMs. Variable importance gives you a kind of huge cross-sectional overview of the mod
What are variable importance rankings useful for? This is completely anecdotal, but I've found variable importance useful in identifying mistakes or weaknesses in GBMs. Variable importance gives you a kind of huge cross-sectional overview of the model that would be hard to get otherwise. Variables higher in the list are seeing more activity (whether or not they are more 'important' is another question). Often a poorly behaving predictor (for instance something forward-looking, or a high-cardinality factor) will shoot to the top. If there's a big disagreement between intuition variable importance and GBM variable importance, there's usually some valuable knowledge to be gained or a mistake to be found. I would add a third answer to the "why are you asking me for this?" question, which is "because I want to understand what's causal to my response". Eep.
What are variable importance rankings useful for? This is completely anecdotal, but I've found variable importance useful in identifying mistakes or weaknesses in GBMs. Variable importance gives you a kind of huge cross-sectional overview of the mod
8,654
What are variable importance rankings useful for?
Variable importance rankings have a definite role in the applied business world whenever there is a need to prioritize the potentially large number of inputs to a process, any process. This information provides direction in terms of a focused strategy for attacking a problem, working down from most to least important, e.g., process cost reduction, given that the variables are leveragable and not fixed or structural factors immune to manipulation. At the end of the day, this should result in an A/B test of some kind. To your point however, Matt, and as with any ordinal rankings, minor nuances or differences between variables can be ambiguous or obscured, vitiating their usefulness.
What are variable importance rankings useful for?
Variable importance rankings have a definite role in the applied business world whenever there is a need to prioritize the potentially large number of inputs to a process, any process. This informatio
What are variable importance rankings useful for? Variable importance rankings have a definite role in the applied business world whenever there is a need to prioritize the potentially large number of inputs to a process, any process. This information provides direction in terms of a focused strategy for attacking a problem, working down from most to least important, e.g., process cost reduction, given that the variables are leveragable and not fixed or structural factors immune to manipulation. At the end of the day, this should result in an A/B test of some kind. To your point however, Matt, and as with any ordinal rankings, minor nuances or differences between variables can be ambiguous or obscured, vitiating their usefulness.
What are variable importance rankings useful for? Variable importance rankings have a definite role in the applied business world whenever there is a need to prioritize the potentially large number of inputs to a process, any process. This informatio
8,655
What are variable importance rankings useful for?
I'm completely agree with you in the theoretical point of view. But in the practical point of view, variable importance is very useful. Let's take an example in which an insurance company wants to reduce the number of questions in a questionnaire quantifying the risk of their clients. The more complicated the questionnaire is, the less likely clients buy their products. For that reason, they want to reduce the less useful questions when maintaining the level of risk quantification. The solution is often to use variable importance to determine which questions be deleted from the questionnaire (and having "more or less" the same prediction about the risk profile of the prospect).
What are variable importance rankings useful for?
I'm completely agree with you in the theoretical point of view. But in the practical point of view, variable importance is very useful. Let's take an example in which an insurance company wants to red
What are variable importance rankings useful for? I'm completely agree with you in the theoretical point of view. But in the practical point of view, variable importance is very useful. Let's take an example in which an insurance company wants to reduce the number of questions in a questionnaire quantifying the risk of their clients. The more complicated the questionnaire is, the less likely clients buy their products. For that reason, they want to reduce the less useful questions when maintaining the level of risk quantification. The solution is often to use variable importance to determine which questions be deleted from the questionnaire (and having "more or less" the same prediction about the risk profile of the prospect).
What are variable importance rankings useful for? I'm completely agree with you in the theoretical point of view. But in the practical point of view, variable importance is very useful. Let's take an example in which an insurance company wants to red
8,656
How to compute SVD of a huge sparse matrix?
If it fits into memory, construct a sparse matrix in R using the Matrix package, and try irlba for the SVD. You can specify how many singular vectors you want in the result, which is another way to limit the computation. That's a pretty big matrix, but I've had very good results with this method in the past. irlba is pretty state-of-the-art. It uses the implicitly restarted Lanczos bi-diagonalization algorithm. It can chew through the netflix prize dataset (480,189 rows by 17,770 columns, 100,480,507 non-zero entries) in milliseconds. You dataset is ~ 200,000 times bigger than the Netflix dataset, so it take significantly longer than that. It might be reasonable to expect that it could do the computation in a couple of days.
How to compute SVD of a huge sparse matrix?
If it fits into memory, construct a sparse matrix in R using the Matrix package, and try irlba for the SVD. You can specify how many singular vectors you want in the result, which is another way to l
How to compute SVD of a huge sparse matrix? If it fits into memory, construct a sparse matrix in R using the Matrix package, and try irlba for the SVD. You can specify how many singular vectors you want in the result, which is another way to limit the computation. That's a pretty big matrix, but I've had very good results with this method in the past. irlba is pretty state-of-the-art. It uses the implicitly restarted Lanczos bi-diagonalization algorithm. It can chew through the netflix prize dataset (480,189 rows by 17,770 columns, 100,480,507 non-zero entries) in milliseconds. You dataset is ~ 200,000 times bigger than the Netflix dataset, so it take significantly longer than that. It might be reasonable to expect that it could do the computation in a couple of days.
How to compute SVD of a huge sparse matrix? If it fits into memory, construct a sparse matrix in R using the Matrix package, and try irlba for the SVD. You can specify how many singular vectors you want in the result, which is another way to l
8,657
How to compute SVD of a huge sparse matrix?
If you're willing to have a low-rank approximation (as you would with Lanczos-type algorithms and a limited number of singular vectors), an alternative is stochastic SVD. You get similar accuracy and computational effort to things like irlba, but a much, much simpler implementation -- which is relevant if none of the available implementations handle precisely your situation. If you start with an $N\times M$ matrix and you want a rank $k$ approximation, you need to be able to multiply your matrix by a dense matrix with, say, $M\times (k+10)$ entries and then do an ordinary SVD on the resulting $N\times (k+10)$ matrix. As with Lanczos-type algorithms, the computation only uses the matrix for multiplication (it's a "matrix-free" algorithm), so it will take advantage of sparsity and other structure. (My use case was in genetics and the matrix was the product of a sparse matrix and a projection orthogonal to a low-rank subspace)
How to compute SVD of a huge sparse matrix?
If you're willing to have a low-rank approximation (as you would with Lanczos-type algorithms and a limited number of singular vectors), an alternative is stochastic SVD. You get similar accuracy and
How to compute SVD of a huge sparse matrix? If you're willing to have a low-rank approximation (as you would with Lanczos-type algorithms and a limited number of singular vectors), an alternative is stochastic SVD. You get similar accuracy and computational effort to things like irlba, but a much, much simpler implementation -- which is relevant if none of the available implementations handle precisely your situation. If you start with an $N\times M$ matrix and you want a rank $k$ approximation, you need to be able to multiply your matrix by a dense matrix with, say, $M\times (k+10)$ entries and then do an ordinary SVD on the resulting $N\times (k+10)$ matrix. As with Lanczos-type algorithms, the computation only uses the matrix for multiplication (it's a "matrix-free" algorithm), so it will take advantage of sparsity and other structure. (My use case was in genetics and the matrix was the product of a sparse matrix and a projection orthogonal to a low-rank subspace)
How to compute SVD of a huge sparse matrix? If you're willing to have a low-rank approximation (as you would with Lanczos-type algorithms and a limited number of singular vectors), an alternative is stochastic SVD. You get similar accuracy and
8,658
How do you deal with "nested" variables in a regression model?
Meaningless values of nested variables must not affect your model: The crucial desideratum with this type of data analysis is that the nested variable must not impact the model if the original explanatory variable does not admit it as a meaningful variable. In other words, the model must be of a form that ignores meaningless values of the nested variable. This is a crucial requirement for a valid model with nested variables since it ensures that the model output is not affected by arbitrary coding choices. Modelling with nested variables: This requirement is achieved by creating an indicator variable that determines when your nested variable is meaningful, and putting the nested variable into the model only as an interaction with this indicator, without including it as a main effect. Note that this is an exception to the general rule that terms should not be included as interactions without a main effect term. Consider the general case where the nested variable is only meaningful when the explanatory variable is in some set of values A. In that case, you would use a model form like this: response ~ 1 + explanatory + (explanatory %in% A) + (explanatory %in% A):nested + ... This assumes that the explanatory variable is continuous; if it is already a factor variable then the (explanatory %in% A) term will be redundant and can be removed. In the common case where your explanatory variable is an indicator variable (with a value of one giving rise to a meaningful nested variable), this model form simplifies to this: response ~ 1 + explanatory + explanatory:nested + ... Observe that in these model statements there is no main effect term for the nested variable. This is by design --- the nested variable should not have a main effect term, since it is not a meaningful variable in the absence of a condition on the explanatory variable. With this type of model form you will get an estimate for the effect of the explanatory variable and another estimate for the effect of the nested variable. Coding nested variables in your data: When dealing with data-frames that list the variables for the regression, it is good practice for the values of the nested variable to be coded as NA in cases where it does not meaningfully arise from the explanatory variable. This tells the reader that there is no meaningful variable here. Some analysts code these variables with other values, like zero, but that is generally bad practice since it can be mistaken for a meaningful quantity. Mathematically, if you multiply any real number by zero, you get zero. However, if you are coding in R you have to be careful here because the program multiplies 0:NA to give NA instead of 0. This means that you may need to re-code the NA values to zero for the purposes of model-fitting, or construct the design-matrix for the model so that these values are set to zero. Cases where the base variable is a function of the nested variable: One situation that occasionally arises in regression analysis involving nested variables is the case where the nested variable has a sufficient amount of detail that it fully determines the initial explanatory variable that it arises from --- i.e., the original explanatory variable is a function of the nested variable. An example of this occurs in this question, where the analyst has an indicator variable DrugA for whether or not a drug has been taken, and a nested variable DrugA_Conc for the concentration of the drug. In this example, the latter variable allows a concentration value of zero, which is equivalent to the drug not being taken, and so DrugA is equivalent to DrugA_Conc != 0. In these types of cases, the interaction term between the explanatory variable and the nested variable is functionally equivalent to the nested variable, and so it is possible (and usually desirable) to remove the initial explanatory variable from the model altogether, and simply use the nested variable on its own. This is legitimate in this case, because the values in the nested variable determine the value of the initial explanatory variable. We have noted above that it is often appropriate to code nested variables as NA when the conditions for them are not applicable. If the condition arises from an explanatory variable that is an indicator, and the indicator corresponds to use of the nested variable, then the event nested != NA is equivalent to explanatory. In such cases, it is possible to recode the nested variable so that the initial explanatory variable is not required in the model at all. Note that care must be taken when looking at this situation. Even in the case where you are using an initial explanatory variable that is an indicator variable, it may be useful for interpretive purposes not to merge the explanatory variable and the nested variable. Moreover, in cases where the explanatory variable is not an indicator variable, it will usually contain information not contained in the nested variable, and so it cannot be removed. You should consider hierarchical or linear mixed models: The above method ensures that your nested variables do not contribute to the regression in cases where they are meaningless. However, the use of OLS estimation with a standard regression model still assumes that the "error terms" in the model are uncorrelated. In cases where you have nested variables, this may give rise to correlated errors that are best represented by a hierarchical model or a linear mixed model. Consequently, when you have nested variables in your regression, you should consider whether or not outcomes for data points in the same nested "group" will have outcomes that are correlated (conditional on the other regressors) or not. The present answer will not go into detail on hierarchical models and linear mixed models. They are both broad model classes with substantial statistical literature. Gelman and Hill (2007) gives a good overview of the subject, starting with standard linear regression and proceeding into multilevel hierarchical modelling. It also gives details on implementation in R.
How do you deal with "nested" variables in a regression model?
Meaningless values of nested variables must not affect your model: The crucial desideratum with this type of data analysis is that the nested variable must not impact the model if the original explana
How do you deal with "nested" variables in a regression model? Meaningless values of nested variables must not affect your model: The crucial desideratum with this type of data analysis is that the nested variable must not impact the model if the original explanatory variable does not admit it as a meaningful variable. In other words, the model must be of a form that ignores meaningless values of the nested variable. This is a crucial requirement for a valid model with nested variables since it ensures that the model output is not affected by arbitrary coding choices. Modelling with nested variables: This requirement is achieved by creating an indicator variable that determines when your nested variable is meaningful, and putting the nested variable into the model only as an interaction with this indicator, without including it as a main effect. Note that this is an exception to the general rule that terms should not be included as interactions without a main effect term. Consider the general case where the nested variable is only meaningful when the explanatory variable is in some set of values A. In that case, you would use a model form like this: response ~ 1 + explanatory + (explanatory %in% A) + (explanatory %in% A):nested + ... This assumes that the explanatory variable is continuous; if it is already a factor variable then the (explanatory %in% A) term will be redundant and can be removed. In the common case where your explanatory variable is an indicator variable (with a value of one giving rise to a meaningful nested variable), this model form simplifies to this: response ~ 1 + explanatory + explanatory:nested + ... Observe that in these model statements there is no main effect term for the nested variable. This is by design --- the nested variable should not have a main effect term, since it is not a meaningful variable in the absence of a condition on the explanatory variable. With this type of model form you will get an estimate for the effect of the explanatory variable and another estimate for the effect of the nested variable. Coding nested variables in your data: When dealing with data-frames that list the variables for the regression, it is good practice for the values of the nested variable to be coded as NA in cases where it does not meaningfully arise from the explanatory variable. This tells the reader that there is no meaningful variable here. Some analysts code these variables with other values, like zero, but that is generally bad practice since it can be mistaken for a meaningful quantity. Mathematically, if you multiply any real number by zero, you get zero. However, if you are coding in R you have to be careful here because the program multiplies 0:NA to give NA instead of 0. This means that you may need to re-code the NA values to zero for the purposes of model-fitting, or construct the design-matrix for the model so that these values are set to zero. Cases where the base variable is a function of the nested variable: One situation that occasionally arises in regression analysis involving nested variables is the case where the nested variable has a sufficient amount of detail that it fully determines the initial explanatory variable that it arises from --- i.e., the original explanatory variable is a function of the nested variable. An example of this occurs in this question, where the analyst has an indicator variable DrugA for whether or not a drug has been taken, and a nested variable DrugA_Conc for the concentration of the drug. In this example, the latter variable allows a concentration value of zero, which is equivalent to the drug not being taken, and so DrugA is equivalent to DrugA_Conc != 0. In these types of cases, the interaction term between the explanatory variable and the nested variable is functionally equivalent to the nested variable, and so it is possible (and usually desirable) to remove the initial explanatory variable from the model altogether, and simply use the nested variable on its own. This is legitimate in this case, because the values in the nested variable determine the value of the initial explanatory variable. We have noted above that it is often appropriate to code nested variables as NA when the conditions for them are not applicable. If the condition arises from an explanatory variable that is an indicator, and the indicator corresponds to use of the nested variable, then the event nested != NA is equivalent to explanatory. In such cases, it is possible to recode the nested variable so that the initial explanatory variable is not required in the model at all. Note that care must be taken when looking at this situation. Even in the case where you are using an initial explanatory variable that is an indicator variable, it may be useful for interpretive purposes not to merge the explanatory variable and the nested variable. Moreover, in cases where the explanatory variable is not an indicator variable, it will usually contain information not contained in the nested variable, and so it cannot be removed. You should consider hierarchical or linear mixed models: The above method ensures that your nested variables do not contribute to the regression in cases where they are meaningless. However, the use of OLS estimation with a standard regression model still assumes that the "error terms" in the model are uncorrelated. In cases where you have nested variables, this may give rise to correlated errors that are best represented by a hierarchical model or a linear mixed model. Consequently, when you have nested variables in your regression, you should consider whether or not outcomes for data points in the same nested "group" will have outcomes that are correlated (conditional on the other regressors) or not. The present answer will not go into detail on hierarchical models and linear mixed models. They are both broad model classes with substantial statistical literature. Gelman and Hill (2007) gives a good overview of the subject, starting with standard linear regression and proceeding into multilevel hierarchical modelling. It also gives details on implementation in R.
How do you deal with "nested" variables in a regression model? Meaningless values of nested variables must not affect your model: The crucial desideratum with this type of data analysis is that the nested variable must not impact the model if the original explana
8,659
libsvm data format [closed]
This link should help: http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html#/Q3:_Data_preparation It's mentioned that the data is stored in a sparse array/matrix form. Essentially, it means only the non-zero data are stored, and any missing data is taken as holding value zero. For your questions: a) Index merely serves as a way to distinguish between the features/parameters. In terms of a hyperspace, it's merely designating each component: Eg: 3-D ( 3 features) indices 1,2,3 would correspond to the x,y,z coordinates. b) The correspondence is merely mathematical, when constructing the hyper-plane, these serve as coordinates. c) If you skip one in between, it should be assigned a default value of zero. In short, +1 1:0.7 2:1 3:1 translates to: Assign to class +1, the point (0.7,1,1).
libsvm data format [closed]
This link should help: http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html#/Q3:_Data_preparation It's mentioned that the data is stored in a sparse array/matrix form. Essentially, it means only the non-
libsvm data format [closed] This link should help: http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html#/Q3:_Data_preparation It's mentioned that the data is stored in a sparse array/matrix form. Essentially, it means only the non-zero data are stored, and any missing data is taken as holding value zero. For your questions: a) Index merely serves as a way to distinguish between the features/parameters. In terms of a hyperspace, it's merely designating each component: Eg: 3-D ( 3 features) indices 1,2,3 would correspond to the x,y,z coordinates. b) The correspondence is merely mathematical, when constructing the hyper-plane, these serve as coordinates. c) If you skip one in between, it should be assigned a default value of zero. In short, +1 1:0.7 2:1 3:1 translates to: Assign to class +1, the point (0.7,1,1).
libsvm data format [closed] This link should help: http://www.csie.ntu.edu.tw/~cjlin/libsvm/faq.html#/Q3:_Data_preparation It's mentioned that the data is stored in a sparse array/matrix form. Essentially, it means only the non-
8,660
libsvm data format [closed]
Just small and fast guide: LibSVM format means that your document needs to be pre-processed already. You need to know how many classification classes will be used (most likely 2) and feature space. Classification class is something like true/false; 0,1,... Here you need to transform it into integers (e.g. 0,1). Feature space is a space for your multidimensional data. Each feauture (vector) should have its own ID (index) and its value. E.g. 1:23.2 means that feature/dimension 1 has value 23.2 <label> <index1>:<value1> <index2>:<value2> ... <indexN>:<valueN> ...
libsvm data format [closed]
Just small and fast guide: LibSVM format means that your document needs to be pre-processed already. You need to know how many classification classes will be used (most likely 2) and feature space. C
libsvm data format [closed] Just small and fast guide: LibSVM format means that your document needs to be pre-processed already. You need to know how many classification classes will be used (most likely 2) and feature space. Classification class is something like true/false; 0,1,... Here you need to transform it into integers (e.g. 0,1). Feature space is a space for your multidimensional data. Each feauture (vector) should have its own ID (index) and its value. E.g. 1:23.2 means that feature/dimension 1 has value 23.2 <label> <index1>:<value1> <index2>:<value2> ... <indexN>:<valueN> ...
libsvm data format [closed] Just small and fast guide: LibSVM format means that your document needs to be pre-processed already. You need to know how many classification classes will be used (most likely 2) and feature space. C
8,661
Why does the Kolmogorov-Smirnov test work?
Basically, the test is consistent as a direct result of the Glivenko Cantelli theorem, one of the most important results of empirical processes and maybe statistics. GC tells us that the Kolmogorov Smirnov test statistic goes to 0 as $n \rightarrow \infty$ under the null hypothesis. It may seem intuitive until you grapple with real analysis and limit theorems. This is a revelation because the process can be thought of as an uncountably infinite number of random processes, so the laws or probability would lead one to believe that there is always one point which could exceed any epsilon boundary but no, the supremum will converge in the long run. How long? Mmyyeeaa I don't know. The power of the test is kind of dubious. I'd never use it in reality. http://www.math.utah.edu/~davar/ps-pdf-files/Kolmogorov-Smirnov.pdf
Why does the Kolmogorov-Smirnov test work?
Basically, the test is consistent as a direct result of the Glivenko Cantelli theorem, one of the most important results of empirical processes and maybe statistics. GC tells us that the Kolmogorov Sm
Why does the Kolmogorov-Smirnov test work? Basically, the test is consistent as a direct result of the Glivenko Cantelli theorem, one of the most important results of empirical processes and maybe statistics. GC tells us that the Kolmogorov Smirnov test statistic goes to 0 as $n \rightarrow \infty$ under the null hypothesis. It may seem intuitive until you grapple with real analysis and limit theorems. This is a revelation because the process can be thought of as an uncountably infinite number of random processes, so the laws or probability would lead one to believe that there is always one point which could exceed any epsilon boundary but no, the supremum will converge in the long run. How long? Mmyyeeaa I don't know. The power of the test is kind of dubious. I'd never use it in reality. http://www.math.utah.edu/~davar/ps-pdf-files/Kolmogorov-Smirnov.pdf
Why does the Kolmogorov-Smirnov test work? Basically, the test is consistent as a direct result of the Glivenko Cantelli theorem, one of the most important results of empirical processes and maybe statistics. GC tells us that the Kolmogorov Sm
8,662
Why does the Kolmogorov-Smirnov test work?
We have two independent, univariate samples: \begin{align} X_1,\,X_2,\,...,\,X_N&\overset{iid}{\sim}F\\ Y_1,\,Y_2,\,...,\,Y_M&\overset{iid}{\sim}G, \end{align} where $G$ and $F$ are continuous cumulative distribution functions. The Kolmogorov-Smirnov test is testing \begin{align} H_0&:F(x) = G(x)\quad\text{for all } x\in\mathbb{R}\\ H_1&:F(x) \neq G(x)\quad\text{for some } x\in\mathbb{R}. \end{align} If the null hypothesis is true, then $\{X_i\}_{i=1}^N$ and $\{Y_j\}_{j=1}^M$ are samples from the same distribution. All it takes for the $X_i$ and the $Y_j$ to be draws from different distributions is for $F$ and $G$ to differ by any amount at at least one $x$ value. So the KS test is estimating $F$ and $G$ with the empirical CDFs of each sample, honing in on the largest pointwise difference between the two, and asking if that difference is "big enough" to conclude that $F(x)\neq G(x)$ at some $x\in\mathbb{R}$.
Why does the Kolmogorov-Smirnov test work?
We have two independent, univariate samples: \begin{align} X_1,\,X_2,\,...,\,X_N&\overset{iid}{\sim}F\\ Y_1,\,Y_2,\,...,\,Y_M&\overset{iid}{\sim}G, \end{align} where $G$ and $F$ are continuous cumulat
Why does the Kolmogorov-Smirnov test work? We have two independent, univariate samples: \begin{align} X_1,\,X_2,\,...,\,X_N&\overset{iid}{\sim}F\\ Y_1,\,Y_2,\,...,\,Y_M&\overset{iid}{\sim}G, \end{align} where $G$ and $F$ are continuous cumulative distribution functions. The Kolmogorov-Smirnov test is testing \begin{align} H_0&:F(x) = G(x)\quad\text{for all } x\in\mathbb{R}\\ H_1&:F(x) \neq G(x)\quad\text{for some } x\in\mathbb{R}. \end{align} If the null hypothesis is true, then $\{X_i\}_{i=1}^N$ and $\{Y_j\}_{j=1}^M$ are samples from the same distribution. All it takes for the $X_i$ and the $Y_j$ to be draws from different distributions is for $F$ and $G$ to differ by any amount at at least one $x$ value. So the KS test is estimating $F$ and $G$ with the empirical CDFs of each sample, honing in on the largest pointwise difference between the two, and asking if that difference is "big enough" to conclude that $F(x)\neq G(x)$ at some $x\in\mathbb{R}$.
Why does the Kolmogorov-Smirnov test work? We have two independent, univariate samples: \begin{align} X_1,\,X_2,\,...,\,X_N&\overset{iid}{\sim}F\\ Y_1,\,Y_2,\,...,\,Y_M&\overset{iid}{\sim}G, \end{align} where $G$ and $F$ are continuous cumulat
8,663
Why does the Kolmogorov-Smirnov test work?
An intuitive take: The Kolmogorov-Smirnov test relies pretty fundamentally on the ordering of observations by distribution. The logic is that if the two underlying distributions are the same, thenβ€”dependent on sample sizesβ€”the ordering should be pretty well shuffled between the two. If the sample ordering is "unshuffled" in an extreme enough fashion (e.g., all or most the observations in distribution $Y$ come before the observations in distribution $X$, which would make the $D$ statistic much larger), that is taken as evidence that the null hypothesis that the underlying distributions are not identical. If the two sample distributions are well shuffled, then $D$ won't have an opportunity to get very big because the ordered values of $X$ and $Y$ will tend to track along with one another, and you won't have enough evidence to reject the null.
Why does the Kolmogorov-Smirnov test work?
An intuitive take: The Kolmogorov-Smirnov test relies pretty fundamentally on the ordering of observations by distribution. The logic is that if the two underlying distributions are the same, thenβ€”de
Why does the Kolmogorov-Smirnov test work? An intuitive take: The Kolmogorov-Smirnov test relies pretty fundamentally on the ordering of observations by distribution. The logic is that if the two underlying distributions are the same, thenβ€”dependent on sample sizesβ€”the ordering should be pretty well shuffled between the two. If the sample ordering is "unshuffled" in an extreme enough fashion (e.g., all or most the observations in distribution $Y$ come before the observations in distribution $X$, which would make the $D$ statistic much larger), that is taken as evidence that the null hypothesis that the underlying distributions are not identical. If the two sample distributions are well shuffled, then $D$ won't have an opportunity to get very big because the ordered values of $X$ and $Y$ will tend to track along with one another, and you won't have enough evidence to reject the null.
Why does the Kolmogorov-Smirnov test work? An intuitive take: The Kolmogorov-Smirnov test relies pretty fundamentally on the ordering of observations by distribution. The logic is that if the two underlying distributions are the same, thenβ€”de
8,664
When if ever is a median statistic a sufficient statistic?
In the case when the support of the distribution does not depend on the unknown parameter $\theta, $ we can invoke the (FrΓ©chet-Darmois-)Pitman-Koopman theorem, namely that the density of the observations is necessarily of the exponential family form, $$ \exp\{ \theta T(x) - \psi(\theta) \}h(x) $$ to conclude that, since the natural sufficient statistic $$ S=\sum_{i=1}^n T(x_i) $$ is also minimal sufficient, then the median should be a function of $S$, and the other way as well, which is impossible: modifying an extreme in the observations $x_1,\ldots,x_n$, $n>2$, modifies $S$ but does not modify the median. Therefore, the median cannot be sufficient when $n>2$. In the alternative case when the support of the distribution does depend on the unknown parameter $ΞΈ$, I am less happy with the following proof: first, we can wlog consider the simple case when $$ f(x|\theta) = h(x) \mathbb{I}_{A_\theta}(x) \tau(\theta) $$ where the set $A_\theta$ indexed by $ΞΈ$ denotes the support of $f(\cdot|\theta)$. In that case, assuming the median is sufficient, the factorisation theorem implies that we have that $$ \prod_{i=1}^n \mathbb{I}_{A_\theta}(x_i) $$ is a binary ($0-1$) function of the sample median $$ \prod_{i=1}^n \mathbb{I}_{A_\theta}(x_i) = \mathbb{I}_{B^n_\theta}(\text{med}(x_{1:n})) $$ Indeed, there is no extra term in the factorisation since it should also be (i) a binary function of the data and (ii) independent from $\theta$. Adding a further observation $x_{n+1}$ which value is such that it does not modify the sample median then leads to a contradiction since it may be in or outside the support set, while $$ \mathbb{I}_{B^{n+1}_\theta}(\text{med}(x_{1:n+1}))=\mathbb{I}_{B^n_\theta}(\text{med}(x_{1:n}))\times \mathbb{I}_{A_\theta}(x_{n+1}). $$
When if ever is a median statistic a sufficient statistic?
In the case when the support of the distribution does not depend on the unknown parameter $\theta, $ we can invoke the (FrΓ©chet-Darmois-)Pitman-Koopman theorem, namely that the density of the observat
When if ever is a median statistic a sufficient statistic? In the case when the support of the distribution does not depend on the unknown parameter $\theta, $ we can invoke the (FrΓ©chet-Darmois-)Pitman-Koopman theorem, namely that the density of the observations is necessarily of the exponential family form, $$ \exp\{ \theta T(x) - \psi(\theta) \}h(x) $$ to conclude that, since the natural sufficient statistic $$ S=\sum_{i=1}^n T(x_i) $$ is also minimal sufficient, then the median should be a function of $S$, and the other way as well, which is impossible: modifying an extreme in the observations $x_1,\ldots,x_n$, $n>2$, modifies $S$ but does not modify the median. Therefore, the median cannot be sufficient when $n>2$. In the alternative case when the support of the distribution does depend on the unknown parameter $ΞΈ$, I am less happy with the following proof: first, we can wlog consider the simple case when $$ f(x|\theta) = h(x) \mathbb{I}_{A_\theta}(x) \tau(\theta) $$ where the set $A_\theta$ indexed by $ΞΈ$ denotes the support of $f(\cdot|\theta)$. In that case, assuming the median is sufficient, the factorisation theorem implies that we have that $$ \prod_{i=1}^n \mathbb{I}_{A_\theta}(x_i) $$ is a binary ($0-1$) function of the sample median $$ \prod_{i=1}^n \mathbb{I}_{A_\theta}(x_i) = \mathbb{I}_{B^n_\theta}(\text{med}(x_{1:n})) $$ Indeed, there is no extra term in the factorisation since it should also be (i) a binary function of the data and (ii) independent from $\theta$. Adding a further observation $x_{n+1}$ which value is such that it does not modify the sample median then leads to a contradiction since it may be in or outside the support set, while $$ \mathbb{I}_{B^{n+1}_\theta}(\text{med}(x_{1:n+1}))=\mathbb{I}_{B^n_\theta}(\text{med}(x_{1:n}))\times \mathbb{I}_{A_\theta}(x_{n+1}). $$
When if ever is a median statistic a sufficient statistic? In the case when the support of the distribution does not depend on the unknown parameter $\theta, $ we can invoke the (FrΓ©chet-Darmois-)Pitman-Koopman theorem, namely that the density of the observat
8,665
When if ever is a median statistic a sufficient statistic?
Xi'an's answer raises the question of what is happening with the Laplace (double exponential distribution), where the MLE is the median. As Xi'an says, the median is not sufficient in this model; it can't be, because among families with constant support only exponential families have finite-dimensional sufficient statistics. The log likelihood looks like this It's piecewise linear, increasing below the median and decreasing above the median. Note that it has a 'corner' at each observed $x$; you can see it doesn't factorise into a term that doesn't depend on parameter $\theta$ and a term that depends only on $\theta$ and the median. Now, why is this possible? The MLE is necessarily a function of any sufficient statistic, but it's not necessarily true that there's a sufficient statistic that's a function of the MLE. This seems to imply there's information in the data that doesn't make it into the MLE. Whether that's true or not depends on how you define 'information in the data', but this paper shows that the median fails to attain the Cramer-Rao bound for the Laplacian model by a factor of about $1+8/n$. What is true about the MLE is that it's asymptotically efficient. It's also asymptotically sufficient in some sense. For example, the Convolution theorem says that (under weak conditions) any estimator is equal to the asymptotically efficient estimator plus noise that doesn't depend on the parameter. Lin and Zeng's paper showing there's no asymptotic efficiency loss in meta-analysis using summary statistics is also relevant here
When if ever is a median statistic a sufficient statistic?
Xi'an's answer raises the question of what is happening with the Laplace (double exponential distribution), where the MLE is the median. As Xi'an says, the median is not sufficient in this model; it c
When if ever is a median statistic a sufficient statistic? Xi'an's answer raises the question of what is happening with the Laplace (double exponential distribution), where the MLE is the median. As Xi'an says, the median is not sufficient in this model; it can't be, because among families with constant support only exponential families have finite-dimensional sufficient statistics. The log likelihood looks like this It's piecewise linear, increasing below the median and decreasing above the median. Note that it has a 'corner' at each observed $x$; you can see it doesn't factorise into a term that doesn't depend on parameter $\theta$ and a term that depends only on $\theta$ and the median. Now, why is this possible? The MLE is necessarily a function of any sufficient statistic, but it's not necessarily true that there's a sufficient statistic that's a function of the MLE. This seems to imply there's information in the data that doesn't make it into the MLE. Whether that's true or not depends on how you define 'information in the data', but this paper shows that the median fails to attain the Cramer-Rao bound for the Laplacian model by a factor of about $1+8/n$. What is true about the MLE is that it's asymptotically efficient. It's also asymptotically sufficient in some sense. For example, the Convolution theorem says that (under weak conditions) any estimator is equal to the asymptotically efficient estimator plus noise that doesn't depend on the parameter. Lin and Zeng's paper showing there's no asymptotic efficiency loss in meta-analysis using summary statistics is also relevant here
When if ever is a median statistic a sufficient statistic? Xi'an's answer raises the question of what is happening with the Laplace (double exponential distribution), where the MLE is the median. As Xi'an says, the median is not sufficient in this model; it c
8,666
Bias correction in weighted variance
I went through the math and ended up with variant C: $$Var(X) = \frac{(\sum_i \omega_i)^2}{(\sum_i \omega_i)^2 - \sum_i \omega_i^2}\overline V$$ where $\overline V$ is the non corrected variance estimation. The formula agrees with the unweighted case when all $\omega_i$ are identical. I detail the proof below: Setting $\lambda_i = \frac{\omega_i}{\sum_i \omega_i}$, we have $$\overline V = \sum_i \lambda_i (x_i - \sum_j \lambda_j x_j)^2$$ Expanding the inner term gives: $$(x_i - \sum_j \lambda_j x_j)^2 = x_i^2 + \sum_{j, k} \lambda_j \lambda_k x_j x_k - 2 \sum_j \lambda_j x_i x_j $$ If we take the expectation, we have that $E[x_i x_j] = Var(X)1_{i = j} + E[X]^2$, the term $E[X]$ being present in each term, it cancels out and we get: $$E[\overline V] = Var(X) \sum_i \lambda_i (1 + \sum_j \lambda_j^2- 2 \lambda_i )$$ that is $$E[\overline V] = Var(X) (1 - \sum_j \lambda_j^2)$$ It remains to plug in the expression of $\lambda_i$ with respect to $\omega_i$ to get variant C.
Bias correction in weighted variance
I went through the math and ended up with variant C: $$Var(X) = \frac{(\sum_i \omega_i)^2}{(\sum_i \omega_i)^2 - \sum_i \omega_i^2}\overline V$$ where $\overline V$ is the non corrected variance estim
Bias correction in weighted variance I went through the math and ended up with variant C: $$Var(X) = \frac{(\sum_i \omega_i)^2}{(\sum_i \omega_i)^2 - \sum_i \omega_i^2}\overline V$$ where $\overline V$ is the non corrected variance estimation. The formula agrees with the unweighted case when all $\omega_i$ are identical. I detail the proof below: Setting $\lambda_i = \frac{\omega_i}{\sum_i \omega_i}$, we have $$\overline V = \sum_i \lambda_i (x_i - \sum_j \lambda_j x_j)^2$$ Expanding the inner term gives: $$(x_i - \sum_j \lambda_j x_j)^2 = x_i^2 + \sum_{j, k} \lambda_j \lambda_k x_j x_k - 2 \sum_j \lambda_j x_i x_j $$ If we take the expectation, we have that $E[x_i x_j] = Var(X)1_{i = j} + E[X]^2$, the term $E[X]$ being present in each term, it cancels out and we get: $$E[\overline V] = Var(X) \sum_i \lambda_i (1 + \sum_j \lambda_j^2- 2 \lambda_i )$$ that is $$E[\overline V] = Var(X) (1 - \sum_j \lambda_j^2)$$ It remains to plug in the expression of $\lambda_i$ with respect to $\omega_i$ to get variant C.
Bias correction in weighted variance I went through the math and ended up with variant C: $$Var(X) = \frac{(\sum_i \omega_i)^2}{(\sum_i \omega_i)^2 - \sum_i \omega_i^2}\overline V$$ where $\overline V$ is the non corrected variance estim
8,667
Bias correction in weighted variance
Both A and C are correct, but which one you will use depends on what kind of weights you use: A needs you to use "repeat"-type weights (integers counting the number of occurrences for each observation), and is unbiased. C needs you to use "reliability"-type weights (either normalized weights or either variances for each observation), and is biased. It can't be unbiased. The reason why C is necessarily biased is because if you don't use "repeat"-type weights, you lose the ability to count the total number of observations (sample size), and thus you can't use a correction factor. For more info, check the Wikipedia article that was updated recently: http://en.wikipedia.org/wiki/Weighted_arithmetic_mean#Weighted_sample_variance /EDIT: the Wikipedia page may not be up-to-date anymore. There is a strong dogma around this issue it seems, so despite sources clearly stating reliability-type weights cannot be unbiased, and any practical implementation comparing side-by-side the results of calculating reliability-type weighted variance vs repeat-type showing divergent results. If you want the original source and refs and technical details and even a practical implementation in Python, see my other posts here and here.
Bias correction in weighted variance
Both A and C are correct, but which one you will use depends on what kind of weights you use: A needs you to use "repeat"-type weights (integers counting the number of occurrences for each observatio
Bias correction in weighted variance Both A and C are correct, but which one you will use depends on what kind of weights you use: A needs you to use "repeat"-type weights (integers counting the number of occurrences for each observation), and is unbiased. C needs you to use "reliability"-type weights (either normalized weights or either variances for each observation), and is biased. It can't be unbiased. The reason why C is necessarily biased is because if you don't use "repeat"-type weights, you lose the ability to count the total number of observations (sample size), and thus you can't use a correction factor. For more info, check the Wikipedia article that was updated recently: http://en.wikipedia.org/wiki/Weighted_arithmetic_mean#Weighted_sample_variance /EDIT: the Wikipedia page may not be up-to-date anymore. There is a strong dogma around this issue it seems, so despite sources clearly stating reliability-type weights cannot be unbiased, and any practical implementation comparing side-by-side the results of calculating reliability-type weighted variance vs repeat-type showing divergent results. If you want the original source and refs and technical details and even a practical implementation in Python, see my other posts here and here.
Bias correction in weighted variance Both A and C are correct, but which one you will use depends on what kind of weights you use: A needs you to use "repeat"-type weights (integers counting the number of occurrences for each observatio
8,668
How to rigorously define the likelihood?
Your third item is the one I have seen the most often used as rigorous definition. The others are interesting too (+1). In particular the first is appealing, with the difficulty that the sample size not being (yet) defined, it is harder to define the "from" set. To me, the fundamental intuition of the likelihood is that it is a function of the model + its parameters, not a function of the random variables (also an important point for teaching purposes). So I would stick to the third definition. The source of the abuse of notation is that the "from" set of the likelihood is implicit, which is usually not the case for well defined functions. Here, the most rigorous approach is to realize that after the transformation, the likelihood relates to another model. It is equivalent to the first, but still another model. So the likelihood notation should show which model it refers to (by subscript or other). I never do it of course, but for teaching, I might. Finally, to be consistent with my previous answers, I say the "likelihood of $\theta$" in your last formula.
How to rigorously define the likelihood?
Your third item is the one I have seen the most often used as rigorous definition. The others are interesting too (+1). In particular the first is appealing, with the difficulty that the sample size
How to rigorously define the likelihood? Your third item is the one I have seen the most often used as rigorous definition. The others are interesting too (+1). In particular the first is appealing, with the difficulty that the sample size not being (yet) defined, it is harder to define the "from" set. To me, the fundamental intuition of the likelihood is that it is a function of the model + its parameters, not a function of the random variables (also an important point for teaching purposes). So I would stick to the third definition. The source of the abuse of notation is that the "from" set of the likelihood is implicit, which is usually not the case for well defined functions. Here, the most rigorous approach is to realize that after the transformation, the likelihood relates to another model. It is equivalent to the first, but still another model. So the likelihood notation should show which model it refers to (by subscript or other). I never do it of course, but for teaching, I might. Finally, to be consistent with my previous answers, I say the "likelihood of $\theta$" in your last formula.
How to rigorously define the likelihood? Your third item is the one I have seen the most often used as rigorous definition. The others are interesting too (+1). In particular the first is appealing, with the difficulty that the sample size
8,669
How to rigorously define the likelihood?
I think I would call it something different. Likelihood is the probability density for the observed x given the value of the parameter $θ$ expressed as a function of $θ$ for the given $x$. I don't share the view about the proportionality constant. I think that only comes into play because maximizing any monotonic function of the likelihood gives the same solution for $θ$. So you can maximize $cL(θ∣x)$ for $c>0$ or other monotonic functions such as $\log(L(θ∣x))$ which is commonly done.
How to rigorously define the likelihood?
I think I would call it something different. Likelihood is the probability density for the observed x given the value of the parameter $ΞΈ$ expressed as a function of $ΞΈ$ for the given $x$. I don't s
How to rigorously define the likelihood? I think I would call it something different. Likelihood is the probability density for the observed x given the value of the parameter $θ$ expressed as a function of $θ$ for the given $x$. I don't share the view about the proportionality constant. I think that only comes into play because maximizing any monotonic function of the likelihood gives the same solution for $θ$. So you can maximize $cL(θ∣x)$ for $c>0$ or other monotonic functions such as $\log(L(θ∣x))$ which is commonly done.
How to rigorously define the likelihood? I think I would call it something different. Likelihood is the probability density for the observed x given the value of the parameter $ΞΈ$ expressed as a function of $ΞΈ$ for the given $x$. I don't s
8,670
How to rigorously define the likelihood?
Here's an attempt at a rigorous mathematical definition: Let $X: \Omega \to \mathbb R^n$ be a random vector which admits a density $f(x | \theta_0)$ with respect to some measure $\nu$ on $\mathbb R^n$, where for $\theta \in \Theta$, $\{f(x|\theta): \theta \in \Theta\}$ is a family of densities on $\mathbb R^n$ with respect to $\nu$. Then, for any $x \in \mathbb R^n$ we define the likelihood function $L(\theta | x)$ to be $f(x | \theta)$; for clarity, for each $x$ we have $L_x : \Theta \to \mathbb R$. One can think of $x$ to be a particular potential $x_{obs}$ and $\theta_0$ to be the "true" value of $\theta$. A couple of observations about this definition: The definition is robust enough to handle discrete, continuous, and other sorts of families of distributions for $X$. We are defining the likelihood at the level of density functions instead of at the level of probability distributions/measures. The reason for this is that densities are not unique, and it turns out that this isn't a situation where one can pass to equivalence classes of densities and still be safe: different choices of densities lead to different MLE's in the continuous case. However, in most cases there is a natural choice of family of densities that are desirable theoretically. I like this definition because it incorporates the random variables we are working with into it and, by design since we have to assign them a distribution, we have also rigorously built in the notion of the "true but unknown" value of $\theta$, here denoted $\theta_0$. For me, as a student, the challenge of being rigorous about likelihood was always how to reconcile the real world concepts of a "true" $\theta$ and "observed" $x_{obs}$ with the mathematics; this was often not helped by instructors claiming that these concepts weren't formal but then turning around and using them formally when proving things! So we deal with them formally in this definition. EDIT: Of course, we are free to consider the usual random elements $L(\theta | X)$, $S(\theta | X)$ and $\mathcal I(\theta | X)$ and under this definition with no real problems with rigor as long as you are careful (or even if you aren't if that level of rigor is not important to you).
How to rigorously define the likelihood?
Here's an attempt at a rigorous mathematical definition: Let $X: \Omega \to \mathbb R^n$ be a random vector which admits a density $f(x | \theta_0)$ with respect to some measure $\nu$ on $\mathbb R^n$
How to rigorously define the likelihood? Here's an attempt at a rigorous mathematical definition: Let $X: \Omega \to \mathbb R^n$ be a random vector which admits a density $f(x | \theta_0)$ with respect to some measure $\nu$ on $\mathbb R^n$, where for $\theta \in \Theta$, $\{f(x|\theta): \theta \in \Theta\}$ is a family of densities on $\mathbb R^n$ with respect to $\nu$. Then, for any $x \in \mathbb R^n$ we define the likelihood function $L(\theta | x)$ to be $f(x | \theta)$; for clarity, for each $x$ we have $L_x : \Theta \to \mathbb R$. One can think of $x$ to be a particular potential $x_{obs}$ and $\theta_0$ to be the "true" value of $\theta$. A couple of observations about this definition: The definition is robust enough to handle discrete, continuous, and other sorts of families of distributions for $X$. We are defining the likelihood at the level of density functions instead of at the level of probability distributions/measures. The reason for this is that densities are not unique, and it turns out that this isn't a situation where one can pass to equivalence classes of densities and still be safe: different choices of densities lead to different MLE's in the continuous case. However, in most cases there is a natural choice of family of densities that are desirable theoretically. I like this definition because it incorporates the random variables we are working with into it and, by design since we have to assign them a distribution, we have also rigorously built in the notion of the "true but unknown" value of $\theta$, here denoted $\theta_0$. For me, as a student, the challenge of being rigorous about likelihood was always how to reconcile the real world concepts of a "true" $\theta$ and "observed" $x_{obs}$ with the mathematics; this was often not helped by instructors claiming that these concepts weren't formal but then turning around and using them formally when proving things! So we deal with them formally in this definition. EDIT: Of course, we are free to consider the usual random elements $L(\theta | X)$, $S(\theta | X)$ and $\mathcal I(\theta | X)$ and under this definition with no real problems with rigor as long as you are careful (or even if you aren't if that level of rigor is not important to you).
How to rigorously define the likelihood? Here's an attempt at a rigorous mathematical definition: Let $X: \Omega \to \mathbb R^n$ be a random vector which admits a density $f(x | \theta_0)$ with respect to some measure $\nu$ on $\mathbb R^n$
8,671
How to test and avoid multicollinearity in mixed linear model?
For VIF calculation usdm can also be package ( I need to install "usdm") library(usdm) df = # Data Frame vif(df) If VIF > 4.0 then I generally assume multicollinearity remove all those Predictor Variables before fitting them into my model
How to test and avoid multicollinearity in mixed linear model?
For VIF calculation usdm can also be package ( I need to install "usdm") library(usdm) df = # Data Frame vif(df) If VIF > 4.0 then I generally assume multicollinearity remove all those Predictor Var
How to test and avoid multicollinearity in mixed linear model? For VIF calculation usdm can also be package ( I need to install "usdm") library(usdm) df = # Data Frame vif(df) If VIF > 4.0 then I generally assume multicollinearity remove all those Predictor Variables before fitting them into my model
How to test and avoid multicollinearity in mixed linear model? For VIF calculation usdm can also be package ( I need to install "usdm") library(usdm) df = # Data Frame vif(df) If VIF > 4.0 then I generally assume multicollinearity remove all those Predictor Var
8,672
How to test and avoid multicollinearity in mixed linear model?
An update, since I found this question useful but can't add comments - The code from Zuur et al. (2009) is also available via the supplementary material to a subsequent (and very useful) publication of their's in the journal Methods in Ecology and Evolution. The paper - A protocol for data exploration to avoid common statistical problems - provides useful advice and a much needed reference for justifying VIF thresholds (they recommend a threshold of 3). The paper is here: http://onlinelibrary.wiley.com/doi/10.1111/j.2041-210X.2009.00001.x/full and the R code is in the supplementary materials tab (.zip download). A quick guide: to extract variance inflation factors (VIF) run their HighStatLib.r code and use the function corvif. The function requires a data frame with just the predictors (so, for example, df = data.frame(Dataset[,2:4]) if your data are stored in Dataset with the predictors in columns 2 to 4.
How to test and avoid multicollinearity in mixed linear model?
An update, since I found this question useful but can't add comments - The code from Zuur et al. (2009) is also available via the supplementary material to a subsequent (and very useful) publication
How to test and avoid multicollinearity in mixed linear model? An update, since I found this question useful but can't add comments - The code from Zuur et al. (2009) is also available via the supplementary material to a subsequent (and very useful) publication of their's in the journal Methods in Ecology and Evolution. The paper - A protocol for data exploration to avoid common statistical problems - provides useful advice and a much needed reference for justifying VIF thresholds (they recommend a threshold of 3). The paper is here: http://onlinelibrary.wiley.com/doi/10.1111/j.2041-210X.2009.00001.x/full and the R code is in the supplementary materials tab (.zip download). A quick guide: to extract variance inflation factors (VIF) run their HighStatLib.r code and use the function corvif. The function requires a data frame with just the predictors (so, for example, df = data.frame(Dataset[,2:4]) if your data are stored in Dataset with the predictors in columns 2 to 4.
How to test and avoid multicollinearity in mixed linear model? An update, since I found this question useful but can't add comments - The code from Zuur et al. (2009) is also available via the supplementary material to a subsequent (and very useful) publication
8,673
How to test and avoid multicollinearity in mixed linear model?
VIF (variance inflation factor) can be measured simply by: library(car) vif(yourmodel) #this should work for lme4::lmer mixed models.
How to test and avoid multicollinearity in mixed linear model?
VIF (variance inflation factor) can be measured simply by: library(car) vif(yourmodel) #this should work for lme4::lmer mixed models.
How to test and avoid multicollinearity in mixed linear model? VIF (variance inflation factor) can be measured simply by: library(car) vif(yourmodel) #this should work for lme4::lmer mixed models.
How to test and avoid multicollinearity in mixed linear model? VIF (variance inflation factor) can be measured simply by: library(car) vif(yourmodel) #this should work for lme4::lmer mixed models.
8,674
How to test and avoid multicollinearity in mixed linear model?
Maybe qr() function will work. If X is your data frame or matrix, you can use qr(X)$pivot. For example, qr(X)$pivot= c(1, 2, 4, 5, 7, 8, 3, 6), then column 3 and 6 is the multicollinear variable.
How to test and avoid multicollinearity in mixed linear model?
Maybe qr() function will work. If X is your data frame or matrix, you can use qr(X)$pivot. For example, qr(X)$pivot= c(1, 2, 4, 5, 7, 8, 3, 6), then column 3 and 6 is the multicollinear variable.
How to test and avoid multicollinearity in mixed linear model? Maybe qr() function will work. If X is your data frame or matrix, you can use qr(X)$pivot. For example, qr(X)$pivot= c(1, 2, 4, 5, 7, 8, 3, 6), then column 3 and 6 is the multicollinear variable.
How to test and avoid multicollinearity in mixed linear model? Maybe qr() function will work. If X is your data frame or matrix, you can use qr(X)$pivot. For example, qr(X)$pivot= c(1, 2, 4, 5, 7, 8, 3, 6), then column 3 and 6 is the multicollinear variable.
8,675
How to test and avoid multicollinearity in mixed linear model?
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. To assess multicollinearity between predictors when running the dredge function (MuMIn package), include the following max.r function as the "extra" argument: max.r <- function(x){ corm <- cov2cor(vcov(x)) corm <- as.matrix(corm) if (length(corm)==1){ corm <- 0 max(abs(corm)) } else if (length(corm)==4){ cormf <- corm[2:nrow(corm),2:ncol(corm)] cormf <- 0 max(abs(cormf)) } else { cormf <- corm[2:nrow(corm),2:ncol(corm)] diag(cormf) <- 0 max(abs(cormf)) } } then simply run dredge specifying the number of predictor variables and including the max.r function: options(na.action = na.fail) Allmodels <- dredge(Fullmodel, rank = "AIC", m.lim=c(0, 3), extra= max.r) Allmodels[Allmodels$max.r<=0.6, ] ##Subset models with max.r <=0.6 (not collinear) NCM <- get.models(Allmodels, subset = max.r<=0.6) ##Retrieve models with max.r <=0.6 (not collinear) model.sel(NCM) ##Final model selection table This works for lme4 models. For nlme models see: https://github.com/rojaff/dredge_mc
How to test and avoid multicollinearity in mixed linear model?
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.
How to test and avoid multicollinearity in mixed linear model? 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. To assess multicollinearity between predictors when running the dredge function (MuMIn package), include the following max.r function as the "extra" argument: max.r <- function(x){ corm <- cov2cor(vcov(x)) corm <- as.matrix(corm) if (length(corm)==1){ corm <- 0 max(abs(corm)) } else if (length(corm)==4){ cormf <- corm[2:nrow(corm),2:ncol(corm)] cormf <- 0 max(abs(cormf)) } else { cormf <- corm[2:nrow(corm),2:ncol(corm)] diag(cormf) <- 0 max(abs(cormf)) } } then simply run dredge specifying the number of predictor variables and including the max.r function: options(na.action = na.fail) Allmodels <- dredge(Fullmodel, rank = "AIC", m.lim=c(0, 3), extra= max.r) Allmodels[Allmodels$max.r<=0.6, ] ##Subset models with max.r <=0.6 (not collinear) NCM <- get.models(Allmodels, subset = max.r<=0.6) ##Retrieve models with max.r <=0.6 (not collinear) model.sel(NCM) ##Final model selection table This works for lme4 models. For nlme models see: https://github.com/rojaff/dredge_mc
How to test and avoid multicollinearity in mixed linear model? 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.
8,676
What is the reason that the Adam Optimizer is considered robust to the value of its hyper parameters?
In regards to the evidence in regards to the claim, I believe the only evidence supporting the claim can be found on figure 4 in their paper. They show the final results under a range of different values for $\beta_1$, $\beta_2$ and $\alpha$. Personally, I don't find their argument convincing, in particular because they do not present results across a variety of problems. With that said, I will note that I have used ADAM for a variety of problems, and my personal finding is that the default values of $\beta_1$ and $\beta_2$ do seem surprisingly reliable, although a good deal of fiddling with $\alpha$ is required.
What is the reason that the Adam Optimizer is considered robust to the value of its hyper parameters
In regards to the evidence in regards to the claim, I believe the only evidence supporting the claim can be found on figure 4 in their paper. They show the final results under a range of different val
What is the reason that the Adam Optimizer is considered robust to the value of its hyper parameters? In regards to the evidence in regards to the claim, I believe the only evidence supporting the claim can be found on figure 4 in their paper. They show the final results under a range of different values for $\beta_1$, $\beta_2$ and $\alpha$. Personally, I don't find their argument convincing, in particular because they do not present results across a variety of problems. With that said, I will note that I have used ADAM for a variety of problems, and my personal finding is that the default values of $\beta_1$ and $\beta_2$ do seem surprisingly reliable, although a good deal of fiddling with $\alpha$ is required.
What is the reason that the Adam Optimizer is considered robust to the value of its hyper parameters In regards to the evidence in regards to the claim, I believe the only evidence supporting the claim can be found on figure 4 in their paper. They show the final results under a range of different val
8,677
What is the reason that the Adam Optimizer is considered robust to the value of its hyper parameters?
Adam learns the learning rates itself, on a per-parameter basis. The parameters $\beta_1$ and $\beta_2$ don't directly define the learning rate, just the timescales over which the learned learning rates decay. If they decay really fast, then the learning rates will jump about all over the place. If they decay slowly, it will take ages for the learning rates to be learned. But note that in all cases, the learning rates are determined automatically, based on a moving estimate of the per-parameter gradient, and the per-parameter squared gradient. This is in huge contrast with stock vanilla Stochastic Gradient Descent, where: learning rates are not per-parameter, but there is a single, global learning rate, that is applied bluntly, across all parameters (by the way, this is one reason why data is often whitened, normalized, prior to being sent into nets, to try to keep the ideal per-parameter weights similar-ish) the learning rate provided is the exact learning rate used, and wont adapt over time Adam is not the only optimizer with adaptive learning rates. As the Adam paper states itself, it's highly related to Adagrad and Rmsprop, which are also extremely insensitive to hyperparameters. Especially, Rmsprop works quite nicely. But Adam is the best in general. With very few exceptions Adam will do what you want :) There are a few fairly pathological cases where Adam will not work, particularly for some very non-stationary distributions. In these cases, Rmsprop is an excellent standby option. But generally speaking, for most non-pathological cases, Adam works extremely well.
What is the reason that the Adam Optimizer is considered robust to the value of its hyper parameters
Adam learns the learning rates itself, on a per-parameter basis. The parameters $\beta_1$ and $\beta_2$ don't directly define the learning rate, just the timescales over which the learned learning rat
What is the reason that the Adam Optimizer is considered robust to the value of its hyper parameters? Adam learns the learning rates itself, on a per-parameter basis. The parameters $\beta_1$ and $\beta_2$ don't directly define the learning rate, just the timescales over which the learned learning rates decay. If they decay really fast, then the learning rates will jump about all over the place. If they decay slowly, it will take ages for the learning rates to be learned. But note that in all cases, the learning rates are determined automatically, based on a moving estimate of the per-parameter gradient, and the per-parameter squared gradient. This is in huge contrast with stock vanilla Stochastic Gradient Descent, where: learning rates are not per-parameter, but there is a single, global learning rate, that is applied bluntly, across all parameters (by the way, this is one reason why data is often whitened, normalized, prior to being sent into nets, to try to keep the ideal per-parameter weights similar-ish) the learning rate provided is the exact learning rate used, and wont adapt over time Adam is not the only optimizer with adaptive learning rates. As the Adam paper states itself, it's highly related to Adagrad and Rmsprop, which are also extremely insensitive to hyperparameters. Especially, Rmsprop works quite nicely. But Adam is the best in general. With very few exceptions Adam will do what you want :) There are a few fairly pathological cases where Adam will not work, particularly for some very non-stationary distributions. In these cases, Rmsprop is an excellent standby option. But generally speaking, for most non-pathological cases, Adam works extremely well.
What is the reason that the Adam Optimizer is considered robust to the value of its hyper parameters Adam learns the learning rates itself, on a per-parameter basis. The parameters $\beta_1$ and $\beta_2$ don't directly define the learning rate, just the timescales over which the learned learning rat
8,678
How should an individual researcher think about the false discovery rate?
In order to aggregate the results of multiple studies you should rather think of making your results accessible for meta analyses. A meta analysis considers the data of the study, or at least its estimates, models study effects and comes to a systematical conclusion by forming some kind of large virtual study out of many small single studies. The individual $p$-values, ficticious priors and planned power are not important input for meta analyses. Instead, it is important to have all studies accessible, disregarding power levels or significant results. In fact, the bad habit of publishing only significant and concealing non-significant results leads to publication bias and corrupts the overall record of scientific results. So the individual researcher should conduct a study in a reproducible way, keep all the records and log all experimental procedures even if such details are not asked by the publishing journals. He should not worry too much about low power. Even a noninformative result (= null hypothesis not rejected) would add more estimators for further studies, as long as one can afford sufficient quality of the data themselves. If you would try to aggregate findings only by $p$-values and some FDR-considerations, you are picking the wrong way because of course a study with larger sample sizes, smaller variances, better controlled confounders is more reliable than other studies. Yet they all produce $p$-values and the best FDR procedure for the $p$-values can never make up for quality disparities.
How should an individual researcher think about the false discovery rate?
In order to aggregate the results of multiple studies you should rather think of making your results accessible for meta analyses. A meta analysis considers the data of the study, or at least its esti
How should an individual researcher think about the false discovery rate? In order to aggregate the results of multiple studies you should rather think of making your results accessible for meta analyses. A meta analysis considers the data of the study, or at least its estimates, models study effects and comes to a systematical conclusion by forming some kind of large virtual study out of many small single studies. The individual $p$-values, ficticious priors and planned power are not important input for meta analyses. Instead, it is important to have all studies accessible, disregarding power levels or significant results. In fact, the bad habit of publishing only significant and concealing non-significant results leads to publication bias and corrupts the overall record of scientific results. So the individual researcher should conduct a study in a reproducible way, keep all the records and log all experimental procedures even if such details are not asked by the publishing journals. He should not worry too much about low power. Even a noninformative result (= null hypothesis not rejected) would add more estimators for further studies, as long as one can afford sufficient quality of the data themselves. If you would try to aggregate findings only by $p$-values and some FDR-considerations, you are picking the wrong way because of course a study with larger sample sizes, smaller variances, better controlled confounders is more reliable than other studies. Yet they all produce $p$-values and the best FDR procedure for the $p$-values can never make up for quality disparities.
How should an individual researcher think about the false discovery rate? In order to aggregate the results of multiple studies you should rather think of making your results accessible for meta analyses. A meta analysis considers the data of the study, or at least its esti
8,679
How should an individual researcher think about the false discovery rate?
If I [individual researcher] have a guess of what the size of the effect I'm studying should be [...], should I adjust my $\alpha$ level until the FDR = .05? Should I publish results at the $\alpha=.05$ level even if my studies are underpowered and leave consideration of the FDR to consumers of the literature? I would definitely not try to adjust the $\alpha$ level to reach a certain FDR, because it is very difficult: not only do you need to have a good estimate of power, but also a good estimate of the prevalence of nulls in some vaguely defined (!) population of studies that you imagine your own study to be part of. This is hardly possible. On the other hand, even though I engaged in a long discussion with @DavidColquhoun about some specific claims in his paper, I do on some level agree with his practical recommendations in that $p<0.05$ does not strike me as a particularly strong evidence. Personally, I have learned to consider it as relatively weak, and am not convinced at all by many published results that hinge on a single $p\approx 0.05$. Truly convincing scientific results usually have either a tiny $p$-value $p\ll 0.05$, or are based on several experiments with supporting conclusions (such that a "combined" $p$-value would again be tiny). So instead of adjusting your $\alpha$ in some specific automatic way, I would rather suggest to remain generally very skeptical about your own findings. Especially more so, if you know that your study is underpowered. Get more data. Think of a supporting analysis. Run another experiment. Etc.
How should an individual researcher think about the false discovery rate?
If I [individual researcher] have a guess of what the size of the effect I'm studying should be [...], should I adjust my $\alpha$ level until the FDR = .05? Should I publish results at the $\alpha=.0
How should an individual researcher think about the false discovery rate? If I [individual researcher] have a guess of what the size of the effect I'm studying should be [...], should I adjust my $\alpha$ level until the FDR = .05? Should I publish results at the $\alpha=.05$ level even if my studies are underpowered and leave consideration of the FDR to consumers of the literature? I would definitely not try to adjust the $\alpha$ level to reach a certain FDR, because it is very difficult: not only do you need to have a good estimate of power, but also a good estimate of the prevalence of nulls in some vaguely defined (!) population of studies that you imagine your own study to be part of. This is hardly possible. On the other hand, even though I engaged in a long discussion with @DavidColquhoun about some specific claims in his paper, I do on some level agree with his practical recommendations in that $p<0.05$ does not strike me as a particularly strong evidence. Personally, I have learned to consider it as relatively weak, and am not convinced at all by many published results that hinge on a single $p\approx 0.05$. Truly convincing scientific results usually have either a tiny $p$-value $p\ll 0.05$, or are based on several experiments with supporting conclusions (such that a "combined" $p$-value would again be tiny). So instead of adjusting your $\alpha$ in some specific automatic way, I would rather suggest to remain generally very skeptical about your own findings. Especially more so, if you know that your study is underpowered. Get more data. Think of a supporting analysis. Run another experiment. Etc.
How should an individual researcher think about the false discovery rate? If I [individual researcher] have a guess of what the size of the effect I'm studying should be [...], should I adjust my $\alpha$ level until the FDR = .05? Should I publish results at the $\alpha=.0
8,680
How should an individual researcher think about the false discovery rate?
This is actually a deep philosophical question. I'm a researcher myself and I've thought a while about this. But before an answer, let's review exactly what the false discovery rate is. FDR versus P P is simply a measure of the probability of saying that there is a difference, when there is no difference at all and doesn't take the power into account. The FDR, on the other hand, takes the power into account. However, in order to calculate the FDR, we have to make an assumption: what is the probability that we receive a true positive result? That's something that we will never have access to, except under highly contrived circumstances. I actually spoke about this recently during a seminar I gave. You can find the slides here. Here is a figure from David Colquhoun's paper on the topic: The false discover rate is computed by dividing the number of false positives by the sum of the true positives and the false positives (in the example, 495/(80+495) x 100% = 86%! A little bit more on P Take a close look at the slides from my lecture. I discussed the fact that P values are drawn from a distribution. Which means that there will always be a chance that you will find a false positive. So statistical significance shouldn't be thought of as absolute truth. I argue that something that is statistically significant should be interpreted as, "Hey, there might be something interesting here, I'm not sure, someone go double check!" Hence, the fundamental notion of reproducibility in research! So... what do we do? Well, an interesting point about the figure above and my analysis of P and FDRs is that the only way we can ever achieve a clear understanding is through 1) reproducibility and 2) publishing all results. That includes negative results (even though negative results are difficult to interpret). However, the conclusions that we draw from our results must be appropriate. Unfortunately, many readers and researchers do not fully understand the notions of P and FDR. I believe it is the responsibility of the readers to appropriately analyze results... which means that the burden is ultimately on the shoulders of educators. After all, a P value of 0.000000001 is meaningless if the "prevalence" (see figure above) is 0 (in that case, the false discovery rate would be 100%). As a publishing researcher, just be careful to fully understand your results and make claims only as strong as you are willing. If it turns out that the FDR for your particular study is 86% (like the example above), then you should be very careful about your interpretations. On the other hand, if the FDR is small enough for your comfort.... still be careful about your interpretations. I hope everything here was clear. It's a very important concept and I'm glad that you brought up the discussion. Let me know if you have any questions/concerns/etc.
How should an individual researcher think about the false discovery rate?
This is actually a deep philosophical question. I'm a researcher myself and I've thought a while about this. But before an answer, let's review exactly what the false discovery rate is. FDR versus P P
How should an individual researcher think about the false discovery rate? This is actually a deep philosophical question. I'm a researcher myself and I've thought a while about this. But before an answer, let's review exactly what the false discovery rate is. FDR versus P P is simply a measure of the probability of saying that there is a difference, when there is no difference at all and doesn't take the power into account. The FDR, on the other hand, takes the power into account. However, in order to calculate the FDR, we have to make an assumption: what is the probability that we receive a true positive result? That's something that we will never have access to, except under highly contrived circumstances. I actually spoke about this recently during a seminar I gave. You can find the slides here. Here is a figure from David Colquhoun's paper on the topic: The false discover rate is computed by dividing the number of false positives by the sum of the true positives and the false positives (in the example, 495/(80+495) x 100% = 86%! A little bit more on P Take a close look at the slides from my lecture. I discussed the fact that P values are drawn from a distribution. Which means that there will always be a chance that you will find a false positive. So statistical significance shouldn't be thought of as absolute truth. I argue that something that is statistically significant should be interpreted as, "Hey, there might be something interesting here, I'm not sure, someone go double check!" Hence, the fundamental notion of reproducibility in research! So... what do we do? Well, an interesting point about the figure above and my analysis of P and FDRs is that the only way we can ever achieve a clear understanding is through 1) reproducibility and 2) publishing all results. That includes negative results (even though negative results are difficult to interpret). However, the conclusions that we draw from our results must be appropriate. Unfortunately, many readers and researchers do not fully understand the notions of P and FDR. I believe it is the responsibility of the readers to appropriately analyze results... which means that the burden is ultimately on the shoulders of educators. After all, a P value of 0.000000001 is meaningless if the "prevalence" (see figure above) is 0 (in that case, the false discovery rate would be 100%). As a publishing researcher, just be careful to fully understand your results and make claims only as strong as you are willing. If it turns out that the FDR for your particular study is 86% (like the example above), then you should be very careful about your interpretations. On the other hand, if the FDR is small enough for your comfort.... still be careful about your interpretations. I hope everything here was clear. It's a very important concept and I'm glad that you brought up the discussion. Let me know if you have any questions/concerns/etc.
How should an individual researcher think about the false discovery rate? This is actually a deep philosophical question. I'm a researcher myself and I've thought a while about this. But before an answer, let's review exactly what the false discovery rate is. FDR versus P P
8,681
How should an individual researcher think about the false discovery rate?
To help understand the relationships, I created this graph of FDR as a function of prior probability for various powers (with alpha=0.05). Note this graph, and the equation of @Buckminster computes the FDR for all results with P less than alpha. The graph would look different if you only considered P values very close to the P value you happened to observe in one study.
How should an individual researcher think about the false discovery rate?
To help understand the relationships, I created this graph of FDR as a function of prior probability for various powers (with alpha=0.05). Note this graph, and the equation of @Buckminster computes th
How should an individual researcher think about the false discovery rate? To help understand the relationships, I created this graph of FDR as a function of prior probability for various powers (with alpha=0.05). Note this graph, and the equation of @Buckminster computes the FDR for all results with P less than alpha. The graph would look different if you only considered P values very close to the P value you happened to observe in one study.
How should an individual researcher think about the false discovery rate? To help understand the relationships, I created this graph of FDR as a function of prior probability for various powers (with alpha=0.05). Note this graph, and the equation of @Buckminster computes th
8,682
How should an individual researcher think about the false discovery rate?
To suggest publication is a decision. I think that it is worthwhile to study what are benefits and costs associated with this decision. 1) Academic environment universally pushes researchers to publish more, thought various rankings of publications will affect also this record. We can presume that more prestigious journals might have more robust quality checking (I hope so). 2) There might be social costs associated with the too large production of publications. These resources might be better used somewhere else, like in applied research without publications of results. There was recently a publication that many publications are not important as sources since sheer amount of new publications is so large... :) http://arxiv.org/pdf/1503.01881v1.pdf For the individual researcher number one forces to publish more and I think there should be institutionalized quality checks which are not dependent on individual peoples to keep quality at accepted level. In any case your parameter values are not facts, these must be given values by the consideration of various costs and benefits associated with number of results published when results are truly and/or falsely significant.
How should an individual researcher think about the false discovery rate?
To suggest publication is a decision. I think that it is worthwhile to study what are benefits and costs associated with this decision. 1) Academic environment universally pushes researchers to publ
How should an individual researcher think about the false discovery rate? To suggest publication is a decision. I think that it is worthwhile to study what are benefits and costs associated with this decision. 1) Academic environment universally pushes researchers to publish more, thought various rankings of publications will affect also this record. We can presume that more prestigious journals might have more robust quality checking (I hope so). 2) There might be social costs associated with the too large production of publications. These resources might be better used somewhere else, like in applied research without publications of results. There was recently a publication that many publications are not important as sources since sheer amount of new publications is so large... :) http://arxiv.org/pdf/1503.01881v1.pdf For the individual researcher number one forces to publish more and I think there should be institutionalized quality checks which are not dependent on individual peoples to keep quality at accepted level. In any case your parameter values are not facts, these must be given values by the consideration of various costs and benefits associated with number of results published when results are truly and/or falsely significant.
How should an individual researcher think about the false discovery rate? To suggest publication is a decision. I think that it is worthwhile to study what are benefits and costs associated with this decision. 1) Academic environment universally pushes researchers to publ
8,683
How to define the termination condition for gradient descent?
Nice question. I've seen lots of stopping rules in the literature, and there are advantages and disadvantages to each, depending on context. The optim function in R, for example, has at least three different stopping rules: maxit, i.e. a predetermined maximum number of iterations. Another similar alternative I've seen in the literature is a maximum number of seconds before timing out. If all you need is an approximate solution, this can be a very reasonable. In fact, there are classes of models (especially linear models) for which early stopping is similar to putting a Gaussian prior on your parameter values. A frequentist would say you have an "L2 norm" rather than a prior, but they would also think of it as a reasonable thing to do. I've only skimmed this paper, but it talks about the relationship between early stopping and regularization and might help point you toward more information. But the short version is, yes, early stopping can be a perfectly respectable thing to do, depending on what you're interested in. abstol, i.e., stop when the function gets "close enough" to zero. This may not be relevant for you (it doesn't sound like you're expecting a zero), so I'll skip it. reltol, which is like your second suggestion--stop when the improvement drops below a threshold. I don't actually know how much theory there is on this, but you'll probably tend to get lower minima this way than with a small maximum number of iterations. If that's important to you, then it might be worth running the code for more iterations. Another family of stopping rules has to do with optimizing a cost function on a validation data set (or with cross-validation) rather than on the training data. Depending on what you want to use your model for, you might want to stop well before you get to the local minimum on your training data, since that could involve overfitting. I'm pretty sure Trevor Hastie has written about good ways of doing this, but I can't remember the citation. Other possible options for finding lower minima in a reasonable amount of time could include: Stochastic gradient descent, which only requires estimating the gradients for a small portion of your data at a time (e.g. one data point for "pure" SGD, or small mini-batches). More advanced optimization functions (e.g. Newton-type methods or Conjugate Gradient), which use information about the curvature of your objective function to help you point in better directions and take better step sizes as you move downhill. A "momentum" term in your update rule, so that your optimizer does a better job of rolling downhill rather than bounding off canyon walls in your objective function. These approaches are all discussed in these lecture notes I found online. Hope this helps! Edit oh, and you can also try to get better starting values (e.g. by solving a simpler version of the problem) so that it takes fewer iterations to get close to the optimum from your "warm start".
How to define the termination condition for gradient descent?
Nice question. I've seen lots of stopping rules in the literature, and there are advantages and disadvantages to each, depending on context. The optim function in R, for example, has at least three d
How to define the termination condition for gradient descent? Nice question. I've seen lots of stopping rules in the literature, and there are advantages and disadvantages to each, depending on context. The optim function in R, for example, has at least three different stopping rules: maxit, i.e. a predetermined maximum number of iterations. Another similar alternative I've seen in the literature is a maximum number of seconds before timing out. If all you need is an approximate solution, this can be a very reasonable. In fact, there are classes of models (especially linear models) for which early stopping is similar to putting a Gaussian prior on your parameter values. A frequentist would say you have an "L2 norm" rather than a prior, but they would also think of it as a reasonable thing to do. I've only skimmed this paper, but it talks about the relationship between early stopping and regularization and might help point you toward more information. But the short version is, yes, early stopping can be a perfectly respectable thing to do, depending on what you're interested in. abstol, i.e., stop when the function gets "close enough" to zero. This may not be relevant for you (it doesn't sound like you're expecting a zero), so I'll skip it. reltol, which is like your second suggestion--stop when the improvement drops below a threshold. I don't actually know how much theory there is on this, but you'll probably tend to get lower minima this way than with a small maximum number of iterations. If that's important to you, then it might be worth running the code for more iterations. Another family of stopping rules has to do with optimizing a cost function on a validation data set (or with cross-validation) rather than on the training data. Depending on what you want to use your model for, you might want to stop well before you get to the local minimum on your training data, since that could involve overfitting. I'm pretty sure Trevor Hastie has written about good ways of doing this, but I can't remember the citation. Other possible options for finding lower minima in a reasonable amount of time could include: Stochastic gradient descent, which only requires estimating the gradients for a small portion of your data at a time (e.g. one data point for "pure" SGD, or small mini-batches). More advanced optimization functions (e.g. Newton-type methods or Conjugate Gradient), which use information about the curvature of your objective function to help you point in better directions and take better step sizes as you move downhill. A "momentum" term in your update rule, so that your optimizer does a better job of rolling downhill rather than bounding off canyon walls in your objective function. These approaches are all discussed in these lecture notes I found online. Hope this helps! Edit oh, and you can also try to get better starting values (e.g. by solving a simpler version of the problem) so that it takes fewer iterations to get close to the optimum from your "warm start".
How to define the termination condition for gradient descent? Nice question. I've seen lots of stopping rules in the literature, and there are advantages and disadvantages to each, depending on context. The optim function in R, for example, has at least three d
8,684
0-1 Loss Function explanation
You have correctly summarized the 0-1 loss function as effectively looking at accuracy. Your 1's become indicators for misclassified items, regardless of how they were misclassified. Since you have three 1's out of 10 items, your classification accuracy is 70%. If you change the weighting on the loss function, this interpretation doesn't apply anymore. For example, in disease classification, it might be more costly to miss a positive case of disease (false negative) than to falsely diagnose disease (false positive). In this case, your loss function would weight false negative misclassification more heavily. The sum of your losses would no longer represent accuracy in this case, but rather the total "cost" of misclassification. The 0-1 loss function is unique in its equivalence to accuracy, since all you care about is whether you got it right or not, and not how the errors are made.
0-1 Loss Function explanation
You have correctly summarized the 0-1 loss function as effectively looking at accuracy. Your 1's become indicators for misclassified items, regardless of how they were misclassified. Since you have th
0-1 Loss Function explanation You have correctly summarized the 0-1 loss function as effectively looking at accuracy. Your 1's become indicators for misclassified items, regardless of how they were misclassified. Since you have three 1's out of 10 items, your classification accuracy is 70%. If you change the weighting on the loss function, this interpretation doesn't apply anymore. For example, in disease classification, it might be more costly to miss a positive case of disease (false negative) than to falsely diagnose disease (false positive). In this case, your loss function would weight false negative misclassification more heavily. The sum of your losses would no longer represent accuracy in this case, but rather the total "cost" of misclassification. The 0-1 loss function is unique in its equivalence to accuracy, since all you care about is whether you got it right or not, and not how the errors are made.
0-1 Loss Function explanation You have correctly summarized the 0-1 loss function as effectively looking at accuracy. Your 1's become indicators for misclassified items, regardless of how they were misclassified. Since you have th
8,685
0-1 Loss Function explanation
Yes, this is basically it: you count the number of misclassified items. There is nothing more behind it, it is a very basic loss function. What follows, 0-1 loss leads to estimating mode of the target distribution (as compared to $L_1$ loss for estimating median and $L_2$ loss for estimating mean).
0-1 Loss Function explanation
Yes, this is basically it: you count the number of misclassified items. There is nothing more behind it, it is a very basic loss function. What follows, 0-1 loss leads to estimating mode of the target
0-1 Loss Function explanation Yes, this is basically it: you count the number of misclassified items. There is nothing more behind it, it is a very basic loss function. What follows, 0-1 loss leads to estimating mode of the target distribution (as compared to $L_1$ loss for estimating median and $L_2$ loss for estimating mean).
0-1 Loss Function explanation Yes, this is basically it: you count the number of misclassified items. There is nothing more behind it, it is a very basic loss function. What follows, 0-1 loss leads to estimating mode of the target
8,686
0-1 Loss Function explanation
I think your confusion is not differentiating the loss for one data point vs. the loss for the whole data set. Specifically, your $L(y,\hat y)$ is the loss for one data point (I am changing the notation little bit). And the loss for the whole data set, i.e., classification accuracy, needs to summing all data points. $$ \sum_i L(y_i,\hat y_i) $$
0-1 Loss Function explanation
I think your confusion is not differentiating the loss for one data point vs. the loss for the whole data set. Specifically, your $L(y,\hat y)$ is the loss for one data point (I am changing the notati
0-1 Loss Function explanation I think your confusion is not differentiating the loss for one data point vs. the loss for the whole data set. Specifically, your $L(y,\hat y)$ is the loss for one data point (I am changing the notation little bit). And the loss for the whole data set, i.e., classification accuracy, needs to summing all data points. $$ \sum_i L(y_i,\hat y_i) $$
0-1 Loss Function explanation I think your confusion is not differentiating the loss for one data point vs. the loss for the whole data set. Specifically, your $L(y,\hat y)$ is the loss for one data point (I am changing the notati
8,687
If the Epanechnikov kernel is theoretically optimal when doing Kernel Density Estimation, why isn't it more commonly used?
The reason why the Epanechnikov kernel isn't universally used for its theoretical optimality may very well be that the Epanechnikov kernel isn't actually theoretically optimal. Tsybakov explicitly criticizes the argument that the Epanechnikov kernel is "theoretically optimal" in pp. 16-19 of Introduction to Nonparametric Estimation (section 1.2.4). Trying to summarize, under some assumptions on the kernel $K$ and a fixed density $p$ one has that the mean integrated square error is, of the form $$\frac{1}{nh} \int K^2 (u) du + \frac{h^4}{4}S_K^2 \int (p''(x))^2 dx \,. \tag{1} $$ The main criticism of Tsybakov seems to be minimizing over non-negative kernels, since it's often possible to get better performing estimators, which are even non-negative, without restricting to non-negative kernels. The first step of the argument for the Epanechnikov kernel begins by minimizing $(1)$ over $h$ and all non-negative kernels (rather than all kernels of a wider class) to get an "optimal" bandwidth for $K$ $$ h^{MISE}(K) = \left( \frac{\int K^2}{nS_K^2 \int (p'')^2} \right)^{1/5}$$ and the "optimal" kernel (Epanechnikov) $$K^*(u) = \frac{3}{4}(1-u^2)_+ $$ whose mean integrated square error is: $$h^{MISE}(K^*) = \left( \frac{15}{n \int (p'')^2} \right)^{1/5} \,. $$ These however aren't feasible choices, since they depend on knowledge (via $p''$) of the unknown density $p$ -- therefore they are "oracle" quantities. A proposition given by Tsybakov implies that the asymptotic MISE for the Epanechnikov oracle is: $$\lim_{n \to \infty} n^{4/5} \mathbb{E}_p \int (p_n^E (x) - p(x))^2 dx = \frac{3^{4/5}}{5^{1/5}4} \left( \int (p''(x))^2 dx \right)^{1/5} \,. \tag{2} $$ Tsybakov says (2) is often claimed to be the best achievable MISE, but then shows that one can use kernels of order 2 (for which $S_K =0$) to construct kernel estimators, for every $\varepsilon >0$, such that $$ \limsup_{n \to \infty} n^{4/5} \mathbb{E}_p \int (\hat{p}_n (x) - p(x))^2 dx \le \varepsilon \,. $$ Even though $\hat{p}_n$ isn't necessarily non-negative, one still has the same result for the positive part estimator, $p_n^+ := \max(0, \hat{p}_n)$ (which is guaranteed to be non-negative even if $K$ isn't): $$ \limsup_{n \to \infty} n^{4/5} \mathbb{E}_p \int (p_n^+ (x) - p(x))^2 dx \le \varepsilon \,. $$ Therefore, for $\varepsilon$ small enough, there exist true estimators which have smaller asymptotic MISE than the Epanechnikov oracle, even using the same assumptions on the unknown density $p$. In particular, one has as a result that the infimum of the asymptotic MISE for a fixed $p$ over all kernel estimators (or positive parts of kernel estimators) is $0$. So the Epanechnikov oracle is not even close to being optimal, even when compared to true estimators. The reason why people advanced the argument for the Epanechnikov oracle in the first place is that one often argues that the kernel itself should be non-negative because the density itself is non-negative. But as Tsybakov points out, one doesn't have to assume that the kernel is non-negative in order to get non-negative density estimators, and by allowing other kernels one can non-negative density estimators which (1) aren't oracles and (2) perform arbitrarily better than the Epanechnikov oracle for a fixed $p$. Tsybakov uses this discrepancy to argue that it doesn't make sense to argue for optimality in terms of a fixed $p$, but only for optimality properties which are uniform over a class of densities. He also points out that the argument still works when using the MSE instead of MISE. EDIT: See also Corollary 1.1. on p.25, where the Epanechnikov kernel is shown to be inadmissible based on another criterion. Tsybakov really seems not to like the Epanechnikov kernel.
If the Epanechnikov kernel is theoretically optimal when doing Kernel Density Estimation, why isn't
The reason why the Epanechnikov kernel isn't universally used for its theoretical optimality may very well be that the Epanechnikov kernel isn't actually theoretically optimal. Tsybakov explicitly cri
If the Epanechnikov kernel is theoretically optimal when doing Kernel Density Estimation, why isn't it more commonly used? The reason why the Epanechnikov kernel isn't universally used for its theoretical optimality may very well be that the Epanechnikov kernel isn't actually theoretically optimal. Tsybakov explicitly criticizes the argument that the Epanechnikov kernel is "theoretically optimal" in pp. 16-19 of Introduction to Nonparametric Estimation (section 1.2.4). Trying to summarize, under some assumptions on the kernel $K$ and a fixed density $p$ one has that the mean integrated square error is, of the form $$\frac{1}{nh} \int K^2 (u) du + \frac{h^4}{4}S_K^2 \int (p''(x))^2 dx \,. \tag{1} $$ The main criticism of Tsybakov seems to be minimizing over non-negative kernels, since it's often possible to get better performing estimators, which are even non-negative, without restricting to non-negative kernels. The first step of the argument for the Epanechnikov kernel begins by minimizing $(1)$ over $h$ and all non-negative kernels (rather than all kernels of a wider class) to get an "optimal" bandwidth for $K$ $$ h^{MISE}(K) = \left( \frac{\int K^2}{nS_K^2 \int (p'')^2} \right)^{1/5}$$ and the "optimal" kernel (Epanechnikov) $$K^*(u) = \frac{3}{4}(1-u^2)_+ $$ whose mean integrated square error is: $$h^{MISE}(K^*) = \left( \frac{15}{n \int (p'')^2} \right)^{1/5} \,. $$ These however aren't feasible choices, since they depend on knowledge (via $p''$) of the unknown density $p$ -- therefore they are "oracle" quantities. A proposition given by Tsybakov implies that the asymptotic MISE for the Epanechnikov oracle is: $$\lim_{n \to \infty} n^{4/5} \mathbb{E}_p \int (p_n^E (x) - p(x))^2 dx = \frac{3^{4/5}}{5^{1/5}4} \left( \int (p''(x))^2 dx \right)^{1/5} \,. \tag{2} $$ Tsybakov says (2) is often claimed to be the best achievable MISE, but then shows that one can use kernels of order 2 (for which $S_K =0$) to construct kernel estimators, for every $\varepsilon >0$, such that $$ \limsup_{n \to \infty} n^{4/5} \mathbb{E}_p \int (\hat{p}_n (x) - p(x))^2 dx \le \varepsilon \,. $$ Even though $\hat{p}_n$ isn't necessarily non-negative, one still has the same result for the positive part estimator, $p_n^+ := \max(0, \hat{p}_n)$ (which is guaranteed to be non-negative even if $K$ isn't): $$ \limsup_{n \to \infty} n^{4/5} \mathbb{E}_p \int (p_n^+ (x) - p(x))^2 dx \le \varepsilon \,. $$ Therefore, for $\varepsilon$ small enough, there exist true estimators which have smaller asymptotic MISE than the Epanechnikov oracle, even using the same assumptions on the unknown density $p$. In particular, one has as a result that the infimum of the asymptotic MISE for a fixed $p$ over all kernel estimators (or positive parts of kernel estimators) is $0$. So the Epanechnikov oracle is not even close to being optimal, even when compared to true estimators. The reason why people advanced the argument for the Epanechnikov oracle in the first place is that one often argues that the kernel itself should be non-negative because the density itself is non-negative. But as Tsybakov points out, one doesn't have to assume that the kernel is non-negative in order to get non-negative density estimators, and by allowing other kernels one can non-negative density estimators which (1) aren't oracles and (2) perform arbitrarily better than the Epanechnikov oracle for a fixed $p$. Tsybakov uses this discrepancy to argue that it doesn't make sense to argue for optimality in terms of a fixed $p$, but only for optimality properties which are uniform over a class of densities. He also points out that the argument still works when using the MSE instead of MISE. EDIT: See also Corollary 1.1. on p.25, where the Epanechnikov kernel is shown to be inadmissible based on another criterion. Tsybakov really seems not to like the Epanechnikov kernel.
If the Epanechnikov kernel is theoretically optimal when doing Kernel Density Estimation, why isn't The reason why the Epanechnikov kernel isn't universally used for its theoretical optimality may very well be that the Epanechnikov kernel isn't actually theoretically optimal. Tsybakov explicitly cri
8,688
If the Epanechnikov kernel is theoretically optimal when doing Kernel Density Estimation, why isn't it more commonly used?
The Gaussian kernel is used for example in density estimation through derivatives: $$\frac{d^if}{dx^i}(x)\approx \frac{1}{bandwidth}\sum_{j=1}^N \frac{d^ik}{dx^i}(X_j,x)$$ This is because the Epanechnikov kernel has 3 derivatives before it's identically zero, unlike the Gaussian which has infinitely many (nonzero) derivatives. See section 2.10 in your link for more examples.
If the Epanechnikov kernel is theoretically optimal when doing Kernel Density Estimation, why isn't
The Gaussian kernel is used for example in density estimation through derivatives: $$\frac{d^if}{dx^i}(x)\approx \frac{1}{bandwidth}\sum_{j=1}^N \frac{d^ik}{dx^i}(X_j,x)$$ This is because the Epanechn
If the Epanechnikov kernel is theoretically optimal when doing Kernel Density Estimation, why isn't it more commonly used? The Gaussian kernel is used for example in density estimation through derivatives: $$\frac{d^if}{dx^i}(x)\approx \frac{1}{bandwidth}\sum_{j=1}^N \frac{d^ik}{dx^i}(X_j,x)$$ This is because the Epanechnikov kernel has 3 derivatives before it's identically zero, unlike the Gaussian which has infinitely many (nonzero) derivatives. See section 2.10 in your link for more examples.
If the Epanechnikov kernel is theoretically optimal when doing Kernel Density Estimation, why isn't The Gaussian kernel is used for example in density estimation through derivatives: $$\frac{d^if}{dx^i}(x)\approx \frac{1}{bandwidth}\sum_{j=1}^N \frac{d^ik}{dx^i}(X_j,x)$$ This is because the Epanechn
8,689
What does "independent observations" mean?
In probability theory, statistical independence (which is not the same as causal independence) is defined as your property (3), but (1) follows as a consequence$\dagger$. The events $\mathcal{A}$ and $\mathcal{B}$ are said to be statistically independent if and only if: $$\mathbb{P}(\mathcal{A} \cap \mathcal{B}) = \mathbb{P}(\mathcal{A}) \cdot \mathbb{P}(\mathcal{B}) .$$ If $\mathbb{P}(\mathcal{B}) > 0$ then if follows that: $$\mathbb{P}(\mathcal{A} |\mathcal{B}) = \frac{\mathbb{P}(\mathcal{A} \cap \mathcal{B})}{\mathbb{P}(\mathcal{B})} = \frac{\mathbb{P}(\mathcal{A}) \cdot \mathbb{P}(\mathcal{B})}{\mathbb{P}(\mathcal{B})} = \mathbb{P}(\mathcal{A}) .$$ This means that statistical independence implies that the occurrence of one event does not affect the probability of the other. Another way of saying this is that the occurrence of one event should not change your beliefs about the other. The concept of statistical independence is generally extended from events to random variables in a way that allows analogous statements to be made for random variables, including continuous random variables (which have zero probability of any particular outcome). Treatment of independence for random variables basically involves the same definitions applied to distribution functions. It is crucial to understand that independence is a very strong property - if events are statistically independent then (by definition) we cannot learn about one from observing the other. For this reason, statistical models generally involve assumptions of conditional independence, given some underlying distribution or parameters. The exact conceptual framework depends on whether one is using Bayesian methods or classical methods. The former involves explicit dependence between observable values, while the latter involves a (complicated and subtle) implicit form of dependence. Understanding this issue properly requires a bit of understanding of classical versus Bayesian statistics. Statistical models will often say they use an assumption that sequences of random variables are "independent and identically distributed (IID)". For example, you might have an observable sequence $X_1, X_2, X_3, ... \sim \text{IID N} (\mu, \sigma^2)$, which means that each observable random variable $X_i$ is normally distributed with mean $\mu$ and standard deviation $\sigma$. Each of the random variables in the sequence is "independent" of the others in the sense that its outcome does not change the stated distribution of the other values. In this kind of model we use the observed values of the sequence to estimate the parameters in the model, and we can then in turn predict unobserved values of the sequence. This necessarily involves using some observed values to learn about others. Bayesian statistics: Everything is conceptually simple. Assume that $X_1, X_2, X_3, ... $ are conditionally IID given the parameters $\mu$ and $\sigma$, and treat those unknown parameters as random variables. Given any non-degenerate prior distribution for these parameters, the values in the observable sequence are (unconditionally) dependent, generally with positive correlation. Hence, it makes perfect sense that we use observed outcomes to predict later unobserved outcomes - they are conditionally independent, but unconditionally dependent. Classical statistics: This is quite complicated and subtle. Assume that $X_1, X_2, X_3, ... $ are IID given the parameters $\mu$ and $\sigma$, but treat those parameters as "unknown constants". Since the parameters are treated as constants, there is no clear difference between conditional and unconditional independence in this case. Nevertheless, we still use the observed values to estimate the parameters and make predictions of the unobserved values. Hence, we use the observed outcomes to predict later unobserved outcomes even though they are notionally "independent" of each other. This apparent incongruity is discussed in detail in O'Neill, B. (2009) Exchangeability, Correlation and Bayes' Effect. International Statistical Review 77(2), pp. 241 - 250. Applying this to your student grades data, you would probably model something like this by assuming that grade is conditionally independent given teacher_id. You would use the data to make inferences about the grading distribution for each teacher (which would not be assumed to be the same) and this would allow you to make predictions about the unknown grade of another student. Because the grade variable is used in the inference, it will affect your predictions of any unknown grade variable for another student. Replacing teacher_id with gender does not change this; in either case you have a variable that you might use as a predictor of grade. If you use Bayesian method you will have an explicit assumption of conditional independence and a prior distribution for the teachers' grade distributions, and this leads to unconditional (predictive) dependence of grades, allowing you to rationally use one grade in your prediction of another. If you are using classical statistics you will have an assumption of independence (based on parameters that are "unknown constants") and you will use classical statistical prediction methods that allow you to use one grade to predict another. $\dagger$ There are some foundational presentations of probability theory that define independence via the conditional probability statement and then give the joint probability statement as a consequence. This is less common.
What does "independent observations" mean?
In probability theory, statistical independence (which is not the same as causal independence) is defined as your property (3), but (1) follows as a consequence$\dagger$. The events $\mathcal{A}$ and
What does "independent observations" mean? In probability theory, statistical independence (which is not the same as causal independence) is defined as your property (3), but (1) follows as a consequence$\dagger$. The events $\mathcal{A}$ and $\mathcal{B}$ are said to be statistically independent if and only if: $$\mathbb{P}(\mathcal{A} \cap \mathcal{B}) = \mathbb{P}(\mathcal{A}) \cdot \mathbb{P}(\mathcal{B}) .$$ If $\mathbb{P}(\mathcal{B}) > 0$ then if follows that: $$\mathbb{P}(\mathcal{A} |\mathcal{B}) = \frac{\mathbb{P}(\mathcal{A} \cap \mathcal{B})}{\mathbb{P}(\mathcal{B})} = \frac{\mathbb{P}(\mathcal{A}) \cdot \mathbb{P}(\mathcal{B})}{\mathbb{P}(\mathcal{B})} = \mathbb{P}(\mathcal{A}) .$$ This means that statistical independence implies that the occurrence of one event does not affect the probability of the other. Another way of saying this is that the occurrence of one event should not change your beliefs about the other. The concept of statistical independence is generally extended from events to random variables in a way that allows analogous statements to be made for random variables, including continuous random variables (which have zero probability of any particular outcome). Treatment of independence for random variables basically involves the same definitions applied to distribution functions. It is crucial to understand that independence is a very strong property - if events are statistically independent then (by definition) we cannot learn about one from observing the other. For this reason, statistical models generally involve assumptions of conditional independence, given some underlying distribution or parameters. The exact conceptual framework depends on whether one is using Bayesian methods or classical methods. The former involves explicit dependence between observable values, while the latter involves a (complicated and subtle) implicit form of dependence. Understanding this issue properly requires a bit of understanding of classical versus Bayesian statistics. Statistical models will often say they use an assumption that sequences of random variables are "independent and identically distributed (IID)". For example, you might have an observable sequence $X_1, X_2, X_3, ... \sim \text{IID N} (\mu, \sigma^2)$, which means that each observable random variable $X_i$ is normally distributed with mean $\mu$ and standard deviation $\sigma$. Each of the random variables in the sequence is "independent" of the others in the sense that its outcome does not change the stated distribution of the other values. In this kind of model we use the observed values of the sequence to estimate the parameters in the model, and we can then in turn predict unobserved values of the sequence. This necessarily involves using some observed values to learn about others. Bayesian statistics: Everything is conceptually simple. Assume that $X_1, X_2, X_3, ... $ are conditionally IID given the parameters $\mu$ and $\sigma$, and treat those unknown parameters as random variables. Given any non-degenerate prior distribution for these parameters, the values in the observable sequence are (unconditionally) dependent, generally with positive correlation. Hence, it makes perfect sense that we use observed outcomes to predict later unobserved outcomes - they are conditionally independent, but unconditionally dependent. Classical statistics: This is quite complicated and subtle. Assume that $X_1, X_2, X_3, ... $ are IID given the parameters $\mu$ and $\sigma$, but treat those parameters as "unknown constants". Since the parameters are treated as constants, there is no clear difference between conditional and unconditional independence in this case. Nevertheless, we still use the observed values to estimate the parameters and make predictions of the unobserved values. Hence, we use the observed outcomes to predict later unobserved outcomes even though they are notionally "independent" of each other. This apparent incongruity is discussed in detail in O'Neill, B. (2009) Exchangeability, Correlation and Bayes' Effect. International Statistical Review 77(2), pp. 241 - 250. Applying this to your student grades data, you would probably model something like this by assuming that grade is conditionally independent given teacher_id. You would use the data to make inferences about the grading distribution for each teacher (which would not be assumed to be the same) and this would allow you to make predictions about the unknown grade of another student. Because the grade variable is used in the inference, it will affect your predictions of any unknown grade variable for another student. Replacing teacher_id with gender does not change this; in either case you have a variable that you might use as a predictor of grade. If you use Bayesian method you will have an explicit assumption of conditional independence and a prior distribution for the teachers' grade distributions, and this leads to unconditional (predictive) dependence of grades, allowing you to rationally use one grade in your prediction of another. If you are using classical statistics you will have an assumption of independence (based on parameters that are "unknown constants") and you will use classical statistical prediction methods that allow you to use one grade to predict another. $\dagger$ There are some foundational presentations of probability theory that define independence via the conditional probability statement and then give the joint probability statement as a consequence. This is less common.
What does "independent observations" mean? In probability theory, statistical independence (which is not the same as causal independence) is defined as your property (3), but (1) follows as a consequence$\dagger$. The events $\mathcal{A}$ and
8,690
What does "independent observations" mean?
The definitions of statistical independence that you give in your post are all essentially correct, but they don't get to the heart of the independence assumption in a statistical model. To understand what we mean by the assumption of independent observations in a statistical model, it will be helpful to revisit what a statistical model is on a conceptual level. Statistical models as approximations to "nature's dice" Let's use a familiar example: we collect a random sample of adult humans (from a well-defined population--say, all adult humans on earth) and we measure their heights. We wish to estimate the population mean height of adult humans. To do this, we construct a simple statistical model by assuming that people's heights arise from a normal distribution. Our model will be a good one if a normal distribution provides a good approximation to how nature "picks" heights for people. That is, if we simulate data under our normal model, does the resulting dataset closely resemble (in a statistical sense) what we observe in nature? In the context of our model, does our random-number generator provide a good simulation of the complicated stochastic process that nature uses to determine the heights of randomly selected human adults ("nature's dice")? The independence assumption in a simple modeling context When we assumed that we could approximate "nature's dice" by drawing random numbers from a normal distribution, we didn't mean that we would draw a single number from the normal distribution, and then assign that height to everybody. We meant that we would independently draw numbers for everybody from the same normal distribution. This is our independence assumption. Imagine now that our sample of adults wasn't a random sample, but instead came from a handful of families. Tallness runs in some families, and shortness runs in others. We've already said that we're willing to assume that the heights of all adults come from one normal distribution. But sampling from the normal distribution wouldn't provide a dataset that looks much like our sample (our sample would show "clumps" of points, some short, others tall--each clump is a family). The heights of people in our sample are not independent draws from the overall normal distribution. The independence assumption in a more complicated modeling context But not all is lost! We might be able to write down a better model for our sample--one that preserves the independence of the heights. For example, we could write down a linear model where heights arise from a normal distribution with a mean that depends on what family the subject belongs to. In this context, the normal distribution describes the residual variation, AFTER we account for the influence of family. And independent samples from a normal distribution might be a good model for this residual variation. Overall here, what we have done is to write down a more sophisticated model of how we expect nature's dice to behave in the context of our study. By writing down a good model, we might still be justified in assuming that that the random part of the model (i.e. the random variation around the family means) is independently sampled for each member of the population. The (conditional) independence assumption in a general modeling context In general, statistical models work by assuming that data arises from some probability distribution. The parameters of that distribution (like the mean of the normal distribution in the example above) might depend on covariates (like family in the example above). But of course endless variations are possible. The distribution might not be normal, the parameter that depends on covariates might not be the mean, the form of the dependence might not be linear, etc. ALL of these models rely on the assumption that they provide a reasonably good approximation to how nature's dice behave (again, that data simulated under the model will look statistically similar to actual data obtained by nature). When we simulate data under the model, the final step will always be to draw a random number according to some modeled probability distribution. These are the draws that we assume to be independent of one another. The actual data that we get out might not look independent, because covariates or other features of the model might tell us to use different probability distributions for different draws (or sets of draws). But all of this information must be built into the model itself. We are not allowed to let the random final number draw depend on what values we drew for other data points. Thus, the events that need to be independent are the rolls of "nature's dice" in the context of our model. It is useful to refer to this situation as conditional independence, which means that the data points are independent of one another given (i.e. conditioned on) the covariates. In our height example, we assume my height and my brother's height conditioned on my family are independent of one another, and are also independent of your height and your sister's height conditioned on your family. Once we know somebody's family, we know what normal distribution to draw from to simulate their height, and the draws for different individuals are independent regardless of their family (even though our choice of what normal distribution to draw from depends on family). It's also possible that even after dealing with the family structure of our data, we still don't achieve good conditional independence (maybe it's also important to model gender, for example). Ultimately, whether it makes sense to assume conditional independence of observations is a decision that must be undertaken in the context of a particular model. This is why, for example, in linear regression, we don't check that the data come from a normal distribution, but we do check that the RESIDUALS come from a normal distribution (and from the SAME normal distribution across the full range of the data). The linear regression assumes that, after accounting for the influence of covariates (the regression line), the data are independently sampled from a normal distribution, according to the strict definition of independence in the original post. In the context of your example "Teacher" in your data might be like "family" in the height example. A final spin on it Lots of familiar models assume that the residuals arise from a normal distribution. Imagine I gave you some data that very clearly were NOT normal. Maybe the're strongly skewed, or maybe they're bimodal. And I told you "these data come from a normal distribution." "No way," you say, "It's obvious that those aren' normal!" "Who said anything about the data being normal?" I say. "I only said that they come from a normal distribution." "One in the same!" you say. "We know that a histogram of reasonably large sample from a normal distribution will tend to look approximately normal!" "But," I say, "I never said the data were independently sampled from the normal distribution. The DO come from a normal distribution, but they aren't independent draws." The assumption of (conditional) independence in statistical modeling is there to prevent smart-alecks like me from ignoring the distribution of the residuals and mis-applying the model. Two final notes 1) The term "nature's dice" is not mine originally, but despite consulting a couple of references I can't figure out where I got it in this context. 2) Some statistical models (e.g. autoregressive models) do not require independence of observations in quite this way. In particular, they allow the sampling distribution for a given observation to depend not only fixed covariates, but also on the data that came before it.
What does "independent observations" mean?
The definitions of statistical independence that you give in your post are all essentially correct, but they don't get to the heart of the independence assumption in a statistical model. To understan
What does "independent observations" mean? The definitions of statistical independence that you give in your post are all essentially correct, but they don't get to the heart of the independence assumption in a statistical model. To understand what we mean by the assumption of independent observations in a statistical model, it will be helpful to revisit what a statistical model is on a conceptual level. Statistical models as approximations to "nature's dice" Let's use a familiar example: we collect a random sample of adult humans (from a well-defined population--say, all adult humans on earth) and we measure their heights. We wish to estimate the population mean height of adult humans. To do this, we construct a simple statistical model by assuming that people's heights arise from a normal distribution. Our model will be a good one if a normal distribution provides a good approximation to how nature "picks" heights for people. That is, if we simulate data under our normal model, does the resulting dataset closely resemble (in a statistical sense) what we observe in nature? In the context of our model, does our random-number generator provide a good simulation of the complicated stochastic process that nature uses to determine the heights of randomly selected human adults ("nature's dice")? The independence assumption in a simple modeling context When we assumed that we could approximate "nature's dice" by drawing random numbers from a normal distribution, we didn't mean that we would draw a single number from the normal distribution, and then assign that height to everybody. We meant that we would independently draw numbers for everybody from the same normal distribution. This is our independence assumption. Imagine now that our sample of adults wasn't a random sample, but instead came from a handful of families. Tallness runs in some families, and shortness runs in others. We've already said that we're willing to assume that the heights of all adults come from one normal distribution. But sampling from the normal distribution wouldn't provide a dataset that looks much like our sample (our sample would show "clumps" of points, some short, others tall--each clump is a family). The heights of people in our sample are not independent draws from the overall normal distribution. The independence assumption in a more complicated modeling context But not all is lost! We might be able to write down a better model for our sample--one that preserves the independence of the heights. For example, we could write down a linear model where heights arise from a normal distribution with a mean that depends on what family the subject belongs to. In this context, the normal distribution describes the residual variation, AFTER we account for the influence of family. And independent samples from a normal distribution might be a good model for this residual variation. Overall here, what we have done is to write down a more sophisticated model of how we expect nature's dice to behave in the context of our study. By writing down a good model, we might still be justified in assuming that that the random part of the model (i.e. the random variation around the family means) is independently sampled for each member of the population. The (conditional) independence assumption in a general modeling context In general, statistical models work by assuming that data arises from some probability distribution. The parameters of that distribution (like the mean of the normal distribution in the example above) might depend on covariates (like family in the example above). But of course endless variations are possible. The distribution might not be normal, the parameter that depends on covariates might not be the mean, the form of the dependence might not be linear, etc. ALL of these models rely on the assumption that they provide a reasonably good approximation to how nature's dice behave (again, that data simulated under the model will look statistically similar to actual data obtained by nature). When we simulate data under the model, the final step will always be to draw a random number according to some modeled probability distribution. These are the draws that we assume to be independent of one another. The actual data that we get out might not look independent, because covariates or other features of the model might tell us to use different probability distributions for different draws (or sets of draws). But all of this information must be built into the model itself. We are not allowed to let the random final number draw depend on what values we drew for other data points. Thus, the events that need to be independent are the rolls of "nature's dice" in the context of our model. It is useful to refer to this situation as conditional independence, which means that the data points are independent of one another given (i.e. conditioned on) the covariates. In our height example, we assume my height and my brother's height conditioned on my family are independent of one another, and are also independent of your height and your sister's height conditioned on your family. Once we know somebody's family, we know what normal distribution to draw from to simulate their height, and the draws for different individuals are independent regardless of their family (even though our choice of what normal distribution to draw from depends on family). It's also possible that even after dealing with the family structure of our data, we still don't achieve good conditional independence (maybe it's also important to model gender, for example). Ultimately, whether it makes sense to assume conditional independence of observations is a decision that must be undertaken in the context of a particular model. This is why, for example, in linear regression, we don't check that the data come from a normal distribution, but we do check that the RESIDUALS come from a normal distribution (and from the SAME normal distribution across the full range of the data). The linear regression assumes that, after accounting for the influence of covariates (the regression line), the data are independently sampled from a normal distribution, according to the strict definition of independence in the original post. In the context of your example "Teacher" in your data might be like "family" in the height example. A final spin on it Lots of familiar models assume that the residuals arise from a normal distribution. Imagine I gave you some data that very clearly were NOT normal. Maybe the're strongly skewed, or maybe they're bimodal. And I told you "these data come from a normal distribution." "No way," you say, "It's obvious that those aren' normal!" "Who said anything about the data being normal?" I say. "I only said that they come from a normal distribution." "One in the same!" you say. "We know that a histogram of reasonably large sample from a normal distribution will tend to look approximately normal!" "But," I say, "I never said the data were independently sampled from the normal distribution. The DO come from a normal distribution, but they aren't independent draws." The assumption of (conditional) independence in statistical modeling is there to prevent smart-alecks like me from ignoring the distribution of the residuals and mis-applying the model. Two final notes 1) The term "nature's dice" is not mine originally, but despite consulting a couple of references I can't figure out where I got it in this context. 2) Some statistical models (e.g. autoregressive models) do not require independence of observations in quite this way. In particular, they allow the sampling distribution for a given observation to depend not only fixed covariates, but also on the data that came before it.
What does "independent observations" mean? The definitions of statistical independence that you give in your post are all essentially correct, but they don't get to the heart of the independence assumption in a statistical model. To understan
8,691
What does "independent observations" mean?
Let $\mathbb x=(X_1,...,X_j,...,X_k)$ by a $k-$dimensional random vector, i.e. a fixed-position collection of random variables (measurable real functions). Consider many such vectors, say $n$, and index these vectors by $i=1,...,n$, so, say $$\mathbb x_i=(X_{1i},...,X_{ji},...,X_{ki})$$ and regard them as a collection called "the sample", $S=(\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n)$. Then we call each $k-$ dimensional vector an "observation" (although it really becomes one only once we measure and record the realizations of the random variables involved ). Let's first treat the case where either a probability mass function (PMF) or a probability density function (PDF) exists, and also, joint such functions. Denote by $f_i(\mathbb x_i),\;i=1,...,n$ the joint PMF or joint PDF of each random vector, and $f(\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n)$ the joint PMF or joint PDF of all these vectors together. Then, the sample $S$ is called an "independent sample", if the following mathematical equality holds: $$f(\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n) = \prod_{i=1}^{n}f_i(\mathbb x_i),\;\;\; \forall (\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n) \in D_S$$ where $D_S$ is the joint domain created by the $n$ random vectors/observations. This means that the "observations" are "jointly independent", (in the statistical sense, or "independent in probability" as was the old saying that is still seen today sometimes). The habit is to simply call them "independent observations". Note that the statistical independence property here is over the index $i$, i.e. between observations. It is unrelated to what are the probabilistic/statistical relations between the random variables in each observation (in the general case we treat here where each observation is multidimensional). Note also that in cases where we have continuous random variables with no densities, the above can be expressed in terms of the distribution functions. This is what "independent observations" means. It is a precisely defined property expressed in mathematical terms. Let's see some of what it implies. SOME CONSEQUENCES OF HAVING INDEPENDENT OBSERVATIONS A. If two observations are part of a group of jointly independent observations, then they are also "pair-wise independent" (statistically), $$f(\mathbb x_i,\mathbb x_m) = f_i(\mathbb x_i)f_m(\mathbb x_m)\;\;\; \forall i\neq m, \;\;\; i,m =1,...,n$$ This in turn implies that conditional PMF's/PDFs equal the "marginal" ones $$f(\mathbb x_i \mid \mathbb x_m) = f_i(\mathbb x_i)\;\;\; \forall i\neq m, \;\;\; i,m =1,...,n$$ This generalizes to many arguments, conditioned or conditioning, say $$f(\mathbb x_i , \mathbb x_{\ell}\mid \mathbb x_m) = f(\mathbb x_i , \mathbb x_{\ell}),\;\;\;\; f(\mathbb x_i \mid \mathbb x_m, \mathbb x_{\ell}) = f_i(\mathbb x_i)$$ etc, as long as the indexes to the left are different to the indexes on the right of the vertical line. This implies that if we actually observe one observation, the probabilities characterizing any other observation of the sample do not change. So as regards prediction, an independent sample is not our best friend. We would prefer to have dependence so that each observation could help us say something more about any other observation. B. On the other hand, an independent sample has maximum informational content. Every observation, being independent, carries information that cannot be inferred, wholly or partly, by any other observation in the sample. So the sum total is maximum, compared to any comparable sample where there exists some statistical dependence between some of the observations. But of what use is this information, if it cannot help us improve our predictions? Well, this is indirect information about the probabilities that characterize the random variables in the sample. The more these observations have common characteristics (common probability distribution in our case), the more we are in a better position to uncover them, if our sample is independent. In other words if the sample is independent and "identically distributed", meaning $$f_i(\mathbb x_i) = f_m(\mathbb x_m) = f(\mathbb x),\;\;\; i\neq m$$ it is the best possible sample in order to obtain information about not only the common joint probability distribution $f(\mathbb x)$, but also for the marginal distributions of the random variables that comprise each observation, say $f_j(x_{ji})$. So even though $f(\mathbb x_i \mid \mathbb x_m) = f_i(\mathbb x_i)$, so zero additional predictive power as regards the actual realization of $\mathbb x_i$, with an independent and identically distributed sample, we are in the best position to uncover the functions $f_i$ (or some of its properties), i.e. the marginal distributions. Therefore, as regards estimation (which is sometimes used as a catch-all term, but here it should be kept distinct from the concept of prediction), an independent sample is our "best friend", if it is combined with the "identically distributed" property. C. It also follows that an independent sample of observations where each is characterized by a totally different probability distribution, with no common characteristics whatsoever, is as worthless a collection of information as one can get (of course every piece of information on its own is worthy, the issue here is that taken together these cannot be combined to offer anything useful). Imagine a sample containing three observations: one containing (quantitative characteristics of) fruits from South America, another containing mountains of Europe, and a third containing clothes from Asia. Pretty interesting information pieces all three of them -but together as a sample cannot do anything statistically useful for us. Put in another way, a necessary and sufficient condition for an independent sample to be useful, is that the observations have some statistical characteristics in common. This is why, in Statistics, the word "sample" is not synonymous to "collection of information" in general, but to "collection of information on entities that have some common characteristics". APPLICATION TO THE OP'S DATA EXAMPLE Responding to a request from user @gung, let's examine the OP's example in light of the above. We reasonably assume that we are in a school with more than two teachers and more than six pupils. So a) we are sampling both pupilss and teachers, and b) we include in our data set the grade that corresponds to each teacher-pupil combination. Namely, the grades are not "sampled", they are a consequence of the sampling we did on teachers and pupils. Therefore it is reasonable to treat the random variable $G$ (=grade) as the "dependent variable", while pupils ($P$) and teachers $T$ are "explanatory variables" (not all possible explanatory variables, just some). Our sample consists of six observations which we write explicitly, $S = (\mathbb s_1, ..., \mathbb s_6)$ as \begin{align} \mathbb s_1 =(T_1, P_1, G_1) \\ \mathbb s_2 =(T_1, P_2, G_2) \\ \mathbb s_3 =(T_1, P_3, G_3) \\ \mathbb s_3 =(T_2, P_4, G_4) \\ \mathbb s_4 =(T_2, P_5, G_5) \\ \mathbb s_5 =(T_2, P_6, G_6) \\ \end{align} Under the stated assumption "pupils do not influence each other", we can consider the $P_i$ variables as independently distributed. Under a non-stated assumption that "all other factors" that may influence the Grade are independent of each other, we can also consider the $G_i$ variables to be independent of each other. Finally under a non-stated assumption that teachers do not influence each other, we can consider the variables $T_1, T_2$ as statistically independent between them. But irrespective of what causal/structural assumption we will make regarding the relation between teachers and pupils, the fact remains that observations $\mathbb s_1, \mathbb s_2, \mathbb s_3$ contain the same random variable ($T_1$), while observations $\mathbb s_4, \mathbb s_5, \mathbb s_6$ also contains the same random variable ($T_2$). Note carefully the distinction between "the same random variable" and "two distinct random variables that have identical distributions". So even if we assume that "teachers do NOT influence pupils", then still, our sample as defined above is not an independent sample, because $\mathbb s_1, \mathbb s_2, \mathbb s_3$ are statistically dependent through $T_1$, while $\mathbb s_4, \mathbb s_5, \mathbb s_6$ are statistically dependent through $T_2$. Assume now that we exclude the random variable "teacher" from our sample. Is the (Pupil, Grade) sample of six observations, an independent sample? Here, the assumptions we will make regarding what is the structural relationship between teachers, pupils, and grades does matter. First, do teachers directly affect the random variable "Grade", through perhaps, different "grading attitudes/styles"? For example $T_1$ may be a "tough grader" while $T_2$ may be not. In such a case "not seeing" the variable "Teacher" does not make the sample independent, because it is now the $G_1, G_2, G_3$ that are dependent, due to a common source of influence, $T_1$ (and analogously for the other three). But say that teachers are identical in that respect. Then under the stated assumption "teachers influence students" we have again that the first three observations are dependent with each other, because teachers influence pupils who influence grades, and we arrive at the same result, albeit indirectly in this case (and likewise for the other three). So again, the sample is not independent. THE CASE OF GENDER Now, let's make the (Pupil, Grade) six-observation sample "conditionally independent with respect to teacher" (see other answers) by assuming that all six pupils have in reality the same teacher. But in addition let's include in the sample the random variable "$Ge$=Gender" that traditionally takes two values ($M,F$), while recently has started to take more. Our once again three-dimensional six-observation sample is now \begin{align} \mathbb s_1 =(Ge_1, P_1, G_1) \\ \mathbb s_2 =(Ge_2, P_2, G_2) \\ \mathbb s_3 =(Ge_3, P_3, G_3) \\ \mathbb s_3 =(Ge_4, P_4, G_4) \\ \mathbb s_4 =(Ge_5, P_5, G_5) \\ \mathbb s_5 =(Ge_6, P_6, G_6) \\ \end{align} Note carefully that what we included in the description of the sample as regards Gender, is not the actual value that it takes for each pupil, but the random variable "Gender". Look back at the beginning of this very long answer: the Sample is not defined as a collection of numbers (or fixed numerical or not values in general), but as a collection of random variables (i.e. of functions). Now, does the gender of one pupil influences (structurally or statistically) the gender of the another pupil? We could reasonably argue that it doesn't. So from that respect, the $Ge_i$ variables are independent. Does the gender of pupil $1$, $Ge_1$, affects in some other way directly some other pupil ($P_2, P_3,...$)? Hmm, there are battling educational theories if I recall on the matter. So if we assume that it does not, then off it goes another possible source of dependence between observations. Finally, does the gender of a pupil influence directly the grades of another pupil? if we argue that it doesn't, we obtain an independent sample (conditional on all pupils having the same teacher).
What does "independent observations" mean?
Let $\mathbb x=(X_1,...,X_j,...,X_k)$ by a $k-$dimensional random vector, i.e. a fixed-position collection of random variables (measurable real functions). Consider many such vectors, say $n$, and in
What does "independent observations" mean? Let $\mathbb x=(X_1,...,X_j,...,X_k)$ by a $k-$dimensional random vector, i.e. a fixed-position collection of random variables (measurable real functions). Consider many such vectors, say $n$, and index these vectors by $i=1,...,n$, so, say $$\mathbb x_i=(X_{1i},...,X_{ji},...,X_{ki})$$ and regard them as a collection called "the sample", $S=(\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n)$. Then we call each $k-$ dimensional vector an "observation" (although it really becomes one only once we measure and record the realizations of the random variables involved ). Let's first treat the case where either a probability mass function (PMF) or a probability density function (PDF) exists, and also, joint such functions. Denote by $f_i(\mathbb x_i),\;i=1,...,n$ the joint PMF or joint PDF of each random vector, and $f(\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n)$ the joint PMF or joint PDF of all these vectors together. Then, the sample $S$ is called an "independent sample", if the following mathematical equality holds: $$f(\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n) = \prod_{i=1}^{n}f_i(\mathbb x_i),\;\;\; \forall (\mathbb x_1,...,\mathbb x_i,...,\mathbb x_n) \in D_S$$ where $D_S$ is the joint domain created by the $n$ random vectors/observations. This means that the "observations" are "jointly independent", (in the statistical sense, or "independent in probability" as was the old saying that is still seen today sometimes). The habit is to simply call them "independent observations". Note that the statistical independence property here is over the index $i$, i.e. between observations. It is unrelated to what are the probabilistic/statistical relations between the random variables in each observation (in the general case we treat here where each observation is multidimensional). Note also that in cases where we have continuous random variables with no densities, the above can be expressed in terms of the distribution functions. This is what "independent observations" means. It is a precisely defined property expressed in mathematical terms. Let's see some of what it implies. SOME CONSEQUENCES OF HAVING INDEPENDENT OBSERVATIONS A. If two observations are part of a group of jointly independent observations, then they are also "pair-wise independent" (statistically), $$f(\mathbb x_i,\mathbb x_m) = f_i(\mathbb x_i)f_m(\mathbb x_m)\;\;\; \forall i\neq m, \;\;\; i,m =1,...,n$$ This in turn implies that conditional PMF's/PDFs equal the "marginal" ones $$f(\mathbb x_i \mid \mathbb x_m) = f_i(\mathbb x_i)\;\;\; \forall i\neq m, \;\;\; i,m =1,...,n$$ This generalizes to many arguments, conditioned or conditioning, say $$f(\mathbb x_i , \mathbb x_{\ell}\mid \mathbb x_m) = f(\mathbb x_i , \mathbb x_{\ell}),\;\;\;\; f(\mathbb x_i \mid \mathbb x_m, \mathbb x_{\ell}) = f_i(\mathbb x_i)$$ etc, as long as the indexes to the left are different to the indexes on the right of the vertical line. This implies that if we actually observe one observation, the probabilities characterizing any other observation of the sample do not change. So as regards prediction, an independent sample is not our best friend. We would prefer to have dependence so that each observation could help us say something more about any other observation. B. On the other hand, an independent sample has maximum informational content. Every observation, being independent, carries information that cannot be inferred, wholly or partly, by any other observation in the sample. So the sum total is maximum, compared to any comparable sample where there exists some statistical dependence between some of the observations. But of what use is this information, if it cannot help us improve our predictions? Well, this is indirect information about the probabilities that characterize the random variables in the sample. The more these observations have common characteristics (common probability distribution in our case), the more we are in a better position to uncover them, if our sample is independent. In other words if the sample is independent and "identically distributed", meaning $$f_i(\mathbb x_i) = f_m(\mathbb x_m) = f(\mathbb x),\;\;\; i\neq m$$ it is the best possible sample in order to obtain information about not only the common joint probability distribution $f(\mathbb x)$, but also for the marginal distributions of the random variables that comprise each observation, say $f_j(x_{ji})$. So even though $f(\mathbb x_i \mid \mathbb x_m) = f_i(\mathbb x_i)$, so zero additional predictive power as regards the actual realization of $\mathbb x_i$, with an independent and identically distributed sample, we are in the best position to uncover the functions $f_i$ (or some of its properties), i.e. the marginal distributions. Therefore, as regards estimation (which is sometimes used as a catch-all term, but here it should be kept distinct from the concept of prediction), an independent sample is our "best friend", if it is combined with the "identically distributed" property. C. It also follows that an independent sample of observations where each is characterized by a totally different probability distribution, with no common characteristics whatsoever, is as worthless a collection of information as one can get (of course every piece of information on its own is worthy, the issue here is that taken together these cannot be combined to offer anything useful). Imagine a sample containing three observations: one containing (quantitative characteristics of) fruits from South America, another containing mountains of Europe, and a third containing clothes from Asia. Pretty interesting information pieces all three of them -but together as a sample cannot do anything statistically useful for us. Put in another way, a necessary and sufficient condition for an independent sample to be useful, is that the observations have some statistical characteristics in common. This is why, in Statistics, the word "sample" is not synonymous to "collection of information" in general, but to "collection of information on entities that have some common characteristics". APPLICATION TO THE OP'S DATA EXAMPLE Responding to a request from user @gung, let's examine the OP's example in light of the above. We reasonably assume that we are in a school with more than two teachers and more than six pupils. So a) we are sampling both pupilss and teachers, and b) we include in our data set the grade that corresponds to each teacher-pupil combination. Namely, the grades are not "sampled", they are a consequence of the sampling we did on teachers and pupils. Therefore it is reasonable to treat the random variable $G$ (=grade) as the "dependent variable", while pupils ($P$) and teachers $T$ are "explanatory variables" (not all possible explanatory variables, just some). Our sample consists of six observations which we write explicitly, $S = (\mathbb s_1, ..., \mathbb s_6)$ as \begin{align} \mathbb s_1 =(T_1, P_1, G_1) \\ \mathbb s_2 =(T_1, P_2, G_2) \\ \mathbb s_3 =(T_1, P_3, G_3) \\ \mathbb s_3 =(T_2, P_4, G_4) \\ \mathbb s_4 =(T_2, P_5, G_5) \\ \mathbb s_5 =(T_2, P_6, G_6) \\ \end{align} Under the stated assumption "pupils do not influence each other", we can consider the $P_i$ variables as independently distributed. Under a non-stated assumption that "all other factors" that may influence the Grade are independent of each other, we can also consider the $G_i$ variables to be independent of each other. Finally under a non-stated assumption that teachers do not influence each other, we can consider the variables $T_1, T_2$ as statistically independent between them. But irrespective of what causal/structural assumption we will make regarding the relation between teachers and pupils, the fact remains that observations $\mathbb s_1, \mathbb s_2, \mathbb s_3$ contain the same random variable ($T_1$), while observations $\mathbb s_4, \mathbb s_5, \mathbb s_6$ also contains the same random variable ($T_2$). Note carefully the distinction between "the same random variable" and "two distinct random variables that have identical distributions". So even if we assume that "teachers do NOT influence pupils", then still, our sample as defined above is not an independent sample, because $\mathbb s_1, \mathbb s_2, \mathbb s_3$ are statistically dependent through $T_1$, while $\mathbb s_4, \mathbb s_5, \mathbb s_6$ are statistically dependent through $T_2$. Assume now that we exclude the random variable "teacher" from our sample. Is the (Pupil, Grade) sample of six observations, an independent sample? Here, the assumptions we will make regarding what is the structural relationship between teachers, pupils, and grades does matter. First, do teachers directly affect the random variable "Grade", through perhaps, different "grading attitudes/styles"? For example $T_1$ may be a "tough grader" while $T_2$ may be not. In such a case "not seeing" the variable "Teacher" does not make the sample independent, because it is now the $G_1, G_2, G_3$ that are dependent, due to a common source of influence, $T_1$ (and analogously for the other three). But say that teachers are identical in that respect. Then under the stated assumption "teachers influence students" we have again that the first three observations are dependent with each other, because teachers influence pupils who influence grades, and we arrive at the same result, albeit indirectly in this case (and likewise for the other three). So again, the sample is not independent. THE CASE OF GENDER Now, let's make the (Pupil, Grade) six-observation sample "conditionally independent with respect to teacher" (see other answers) by assuming that all six pupils have in reality the same teacher. But in addition let's include in the sample the random variable "$Ge$=Gender" that traditionally takes two values ($M,F$), while recently has started to take more. Our once again three-dimensional six-observation sample is now \begin{align} \mathbb s_1 =(Ge_1, P_1, G_1) \\ \mathbb s_2 =(Ge_2, P_2, G_2) \\ \mathbb s_3 =(Ge_3, P_3, G_3) \\ \mathbb s_3 =(Ge_4, P_4, G_4) \\ \mathbb s_4 =(Ge_5, P_5, G_5) \\ \mathbb s_5 =(Ge_6, P_6, G_6) \\ \end{align} Note carefully that what we included in the description of the sample as regards Gender, is not the actual value that it takes for each pupil, but the random variable "Gender". Look back at the beginning of this very long answer: the Sample is not defined as a collection of numbers (or fixed numerical or not values in general), but as a collection of random variables (i.e. of functions). Now, does the gender of one pupil influences (structurally or statistically) the gender of the another pupil? We could reasonably argue that it doesn't. So from that respect, the $Ge_i$ variables are independent. Does the gender of pupil $1$, $Ge_1$, affects in some other way directly some other pupil ($P_2, P_3,...$)? Hmm, there are battling educational theories if I recall on the matter. So if we assume that it does not, then off it goes another possible source of dependence between observations. Finally, does the gender of a pupil influence directly the grades of another pupil? if we argue that it doesn't, we obtain an independent sample (conditional on all pupils having the same teacher).
What does "independent observations" mean? Let $\mathbb x=(X_1,...,X_j,...,X_k)$ by a $k-$dimensional random vector, i.e. a fixed-position collection of random variables (measurable real functions). Consider many such vectors, say $n$, and in
8,692
Generate two variables with precise pre-specified correlation [duplicate]
For R you can use the mvrnorm function in the MASS package and set empirical=TRUE. Or this post shows the steps in R for creating new variables with specific correlations to an existing variable.
Generate two variables with precise pre-specified correlation [duplicate]
For R you can use the mvrnorm function in the MASS package and set empirical=TRUE. Or this post shows the steps in R for creating new variables with specific correlations to an existing variable.
Generate two variables with precise pre-specified correlation [duplicate] For R you can use the mvrnorm function in the MASS package and set empirical=TRUE. Or this post shows the steps in R for creating new variables with specific correlations to an existing variable.
Generate two variables with precise pre-specified correlation [duplicate] For R you can use the mvrnorm function in the MASS package and set empirical=TRUE. Or this post shows the steps in R for creating new variables with specific correlations to an existing variable.
8,693
Who invented k-fold cross-validation?
One paper that might be worth consulting is Stone M. Cross-validatory choice and assessment of statistical predictions. J. Royal Stat. Soc., 36(2), 111–147, 1974. I have seen references to Mosteller F. and Tukey J.W. Data analysis, including statistics. In Handbook of Social Psychology. Addison-Wesley, Reading, MA, 1968. as an early clear description of $k$-fold cross-validation, but I don't have this manuscript. The 1931 paper Larson S. The shrinkage of the coefficient of multiple correlation. J. Educat. Psychol., 22:45–55,1931. is mentioned, e.g. by Stone, as an early example where a randomly selected validation set is put aside for later assessment of the model.
Who invented k-fold cross-validation?
One paper that might be worth consulting is Stone M. Cross-validatory choice and assessment of statistical predictions. J. Royal Stat. Soc., 36(2), 111–147, 1974. I have seen references to Mosteller
Who invented k-fold cross-validation? One paper that might be worth consulting is Stone M. Cross-validatory choice and assessment of statistical predictions. J. Royal Stat. Soc., 36(2), 111–147, 1974. I have seen references to Mosteller F. and Tukey J.W. Data analysis, including statistics. In Handbook of Social Psychology. Addison-Wesley, Reading, MA, 1968. as an early clear description of $k$-fold cross-validation, but I don't have this manuscript. The 1931 paper Larson S. The shrinkage of the coefficient of multiple correlation. J. Educat. Psychol., 22:45–55,1931. is mentioned, e.g. by Stone, as an early example where a randomly selected validation set is put aside for later assessment of the model.
Who invented k-fold cross-validation? One paper that might be worth consulting is Stone M. Cross-validatory choice and assessment of statistical predictions. J. Royal Stat. Soc., 36(2), 111–147, 1974. I have seen references to Mosteller
8,694
Clustering procedure where each cluster has an equal number of points?
I suggest a two-step approach: get a good initial estimates of the cluster centers, e.g. using hard or fuzzy K-means. Use Global Nearest Neighbor assignment to associate points with cluster centers: Calculate a distance matrix between each point and each cluster center (you can make the problem a bit smaller by only calculating reasonable distances), replicate each cluster center X times, and solve the linear assignment problem. You'll get, for each cluster center, exactly X matches to data points, so that, globally, the distance between data points and cluster centers is minimized. Note that you can update cluster centers after step 2 and repeat step 2 to basically run K-means with fixed number of points per cluster. Still, it will be a good idea to get a good initial guess first.
Clustering procedure where each cluster has an equal number of points?
I suggest a two-step approach: get a good initial estimates of the cluster centers, e.g. using hard or fuzzy K-means. Use Global Nearest Neighbor assignment to associate points with cluster centers
Clustering procedure where each cluster has an equal number of points? I suggest a two-step approach: get a good initial estimates of the cluster centers, e.g. using hard or fuzzy K-means. Use Global Nearest Neighbor assignment to associate points with cluster centers: Calculate a distance matrix between each point and each cluster center (you can make the problem a bit smaller by only calculating reasonable distances), replicate each cluster center X times, and solve the linear assignment problem. You'll get, for each cluster center, exactly X matches to data points, so that, globally, the distance between data points and cluster centers is minimized. Note that you can update cluster centers after step 2 and repeat step 2 to basically run K-means with fixed number of points per cluster. Still, it will be a good idea to get a good initial guess first.
Clustering procedure where each cluster has an equal number of points? I suggest a two-step approach: get a good initial estimates of the cluster centers, e.g. using hard or fuzzy K-means. Use Global Nearest Neighbor assignment to associate points with cluster centers
8,695
Clustering procedure where each cluster has an equal number of points?
Try this k-means variation: Initialization: choose k centers from the dataset at random, or even better using kmeans++ strategy for each point, compute the distance to its nearest cluster center, and build a heap for this draw points from the heap, and assign them to the nearest cluster, unless the cluster is already overfull. If so, compute the next nearest cluster center and reinsert into the heap In the end, you should have a paritioning that satisfies your requirements of the +-1 same number of objects per cluster (make sure the last few clusters also have the right number. The first m clusters should have ceil objects, the remainder exactly floor objects.) Iteration step: Requisites: a list for each cluster with "swap proposals" (objects that would prefer to be in a different cluster). E step: compute the updated cluster centers as in regular k-means M step: Iterating through all points (either just one, or all in one batch) Compute nearest cluster center to object / all cluster centers that are closer than the current clusters. If it is a different cluster: If the other cluster is smaller than the current cluster, just move it to the new cluster If there is a swap proposal from the other cluster (or any cluster with a lower distance), swap the two element cluster assignments (if there is more than one offer, choose the one with the largest improvement) otherwise, indicate a swap proposal for the other cluster The cluster sizes remain invariant (+- the ceil/floor difference), an objects are only moved from one cluster to another as long as it results in an improvement of the estimation. It should therefore converge at some point like k-means. It might be a bit slower (i.e. more iterations) though. I do not know if this has been published or implemented before. It's just what I would try (if I would try k-means. there are much better clustering algorithms.) A good place to start might be with the k-means implementation in ELKI, which already seems to support three different initializations (including k-means++), and the authors said they also want to have different iteration strategys, to cover all the various common variants in a modular fashion (e.g. Lloyd, MacQueen, ...).
Clustering procedure where each cluster has an equal number of points?
Try this k-means variation: Initialization: choose k centers from the dataset at random, or even better using kmeans++ strategy for each point, compute the distance to its nearest cluster center, and
Clustering procedure where each cluster has an equal number of points? Try this k-means variation: Initialization: choose k centers from the dataset at random, or even better using kmeans++ strategy for each point, compute the distance to its nearest cluster center, and build a heap for this draw points from the heap, and assign them to the nearest cluster, unless the cluster is already overfull. If so, compute the next nearest cluster center and reinsert into the heap In the end, you should have a paritioning that satisfies your requirements of the +-1 same number of objects per cluster (make sure the last few clusters also have the right number. The first m clusters should have ceil objects, the remainder exactly floor objects.) Iteration step: Requisites: a list for each cluster with "swap proposals" (objects that would prefer to be in a different cluster). E step: compute the updated cluster centers as in regular k-means M step: Iterating through all points (either just one, or all in one batch) Compute nearest cluster center to object / all cluster centers that are closer than the current clusters. If it is a different cluster: If the other cluster is smaller than the current cluster, just move it to the new cluster If there is a swap proposal from the other cluster (or any cluster with a lower distance), swap the two element cluster assignments (if there is more than one offer, choose the one with the largest improvement) otherwise, indicate a swap proposal for the other cluster The cluster sizes remain invariant (+- the ceil/floor difference), an objects are only moved from one cluster to another as long as it results in an improvement of the estimation. It should therefore converge at some point like k-means. It might be a bit slower (i.e. more iterations) though. I do not know if this has been published or implemented before. It's just what I would try (if I would try k-means. there are much better clustering algorithms.) A good place to start might be with the k-means implementation in ELKI, which already seems to support three different initializations (including k-means++), and the authors said they also want to have different iteration strategys, to cover all the various common variants in a modular fashion (e.g. Lloyd, MacQueen, ...).
Clustering procedure where each cluster has an equal number of points? Try this k-means variation: Initialization: choose k centers from the dataset at random, or even better using kmeans++ strategy for each point, compute the distance to its nearest cluster center, and
8,696
Clustering procedure where each cluster has an equal number of points?
Recently I needed this myself for a not very large dataset. My answer, although it has a relatively long running time, is guaranteed to converge to a local optimum. def eqsc(X, K=None, G=None): "equal-size clustering based on data exchanges between pairs of clusters" from scipy.spatial.distance import pdist, squareform from matplotlib import pyplot as plt from matplotlib import animation as ani from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection def error(K, m, D): """return average distances between data in one cluster, averaged over all clusters""" E = 0 for k in range(K): i = numpy.where(m == k)[0] # indeces of datapoints belonging to class k E += numpy.mean(D[numpy.meshgrid(i,i)]) return E / K numpy.random.seed(0) # repeatability N, n = X.shape if G is None and K is not None: G = N // K # group size elif K is None and G is not None: K = N // G # number of clusters else: raise Exception('must specify either K or G') D = squareform(pdist(X)) # distance matrix m = numpy.random.permutation(N) % K # initial membership E = error(K, m, D) # visualization #FFMpegWriter = ani.writers['ffmpeg'] #writer = FFMpegWriter(fps=15) #fig = plt.figure() #with writer.saving(fig, "ec.mp4", 100): t = 1 while True: E_p = E for a in range(N): # systematically for b in range(a): m[a], m[b] = m[b], m[a] # exchange membership E_t = error(K, m, D) if E_t < E: E = E_t print("{}: {}<->{} E={}".format(t, a, b, E)) #plt.clf() #for i in range(N): #plt.text(X[i,0], X[i,1], m[i]) #writer.grab_frame() else: m[a], m[b] = m[b], m[a] # put them back if E_p == E: break t += 1 fig, ax = plt.subplots() patches = [] for k in range(K): i = numpy.where(m == k)[0] # indeces of datapoints belonging to class k x = X[i] patches.append(Polygon(x[:,:2], True)) # how to draw this clock-wise? u = numpy.mean(x, 0) plt.text(u[0], u[1], k) p = PatchCollection(patches, alpha=0.5) ax.add_collection(p) plt.show() if __name__ == "__main__": N, n = 100, 2 X = numpy.random.rand(N, n) eqsc(X, G=3)
Clustering procedure where each cluster has an equal number of points?
Recently I needed this myself for a not very large dataset. My answer, although it has a relatively long running time, is guaranteed to converge to a local optimum. def eqsc(X, K=None, G=None): "e
Clustering procedure where each cluster has an equal number of points? Recently I needed this myself for a not very large dataset. My answer, although it has a relatively long running time, is guaranteed to converge to a local optimum. def eqsc(X, K=None, G=None): "equal-size clustering based on data exchanges between pairs of clusters" from scipy.spatial.distance import pdist, squareform from matplotlib import pyplot as plt from matplotlib import animation as ani from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection def error(K, m, D): """return average distances between data in one cluster, averaged over all clusters""" E = 0 for k in range(K): i = numpy.where(m == k)[0] # indeces of datapoints belonging to class k E += numpy.mean(D[numpy.meshgrid(i,i)]) return E / K numpy.random.seed(0) # repeatability N, n = X.shape if G is None and K is not None: G = N // K # group size elif K is None and G is not None: K = N // G # number of clusters else: raise Exception('must specify either K or G') D = squareform(pdist(X)) # distance matrix m = numpy.random.permutation(N) % K # initial membership E = error(K, m, D) # visualization #FFMpegWriter = ani.writers['ffmpeg'] #writer = FFMpegWriter(fps=15) #fig = plt.figure() #with writer.saving(fig, "ec.mp4", 100): t = 1 while True: E_p = E for a in range(N): # systematically for b in range(a): m[a], m[b] = m[b], m[a] # exchange membership E_t = error(K, m, D) if E_t < E: E = E_t print("{}: {}<->{} E={}".format(t, a, b, E)) #plt.clf() #for i in range(N): #plt.text(X[i,0], X[i,1], m[i]) #writer.grab_frame() else: m[a], m[b] = m[b], m[a] # put them back if E_p == E: break t += 1 fig, ax = plt.subplots() patches = [] for k in range(K): i = numpy.where(m == k)[0] # indeces of datapoints belonging to class k x = X[i] patches.append(Polygon(x[:,:2], True)) # how to draw this clock-wise? u = numpy.mean(x, 0) plt.text(u[0], u[1], k) p = PatchCollection(patches, alpha=0.5) ax.add_collection(p) plt.show() if __name__ == "__main__": N, n = 100, 2 X = numpy.random.rand(N, n) eqsc(X, G=3)
Clustering procedure where each cluster has an equal number of points? Recently I needed this myself for a not very large dataset. My answer, although it has a relatively long running time, is guaranteed to converge to a local optimum. def eqsc(X, K=None, G=None): "e
8,697
Clustering procedure where each cluster has an equal number of points?
This is an optimisation problem. We have an open source java library which solves this problem (clustering where quantity per cluster must be between set ranges). You'd need your total number of points to be maximum of a few thousand though - no more than 5000 or maybe 10000. The library is here: https://github.com/PGWelch/territorium/tree/master/territorium.core The library itself is setup for geographic / GIS type problems - so you will see references to X and Ys, latitudes and longitudes, customers, distance and time, etc. You can just ignore the 'geographic' elements though and use it as a pure clusterer. You provide a set of initially empty input clusters each with a min and max target quantity. The clusterer will assign points to your input clusters, using a heuristic-based optimisation algorithm (swaps, moves etc). In the optimisation it firstly prioritises keeping each cluster within its min and max quantity range and then secondly minimises the distances between all points in the cluster and the cluster's central point, so a cluster is spatially cohesive. You give the solver a metric function (i.e. distance function) between points using this interface: https://github.com/PGWelch/territorium/blob/master/territorium.core/src/main/java/com/opendoorlogistics/territorium/problem/TravelMatrix.java The metric is actually structured to return both a distance and 'time', because its designed for travel-based geographic problems, but for arbitrary clustering problems just set 'time' to be zero and distance to be your actual metric you're using between points. You'd setup your problem in this class: https://github.com/PGWelch/territorium/blob/master/territorium.core/src/main/java/com/opendoorlogistics/territorium/problem/Problem.java Your points would be the 'Customers' and their quantity would be 1. In the customer class ensure you set costPerUnitTime = 0 and costPerUnitDistance=1 assuming you're returning your metric distance in the 'distance' field returned by the TravelMatrix. https://github.com/PGWelch/territorium/blob/master/territorium.core/src/main/java/com/opendoorlogistics/territorium/problem/Customer.java See here for an example of running the solver: https://github.com/PGWelch/territorium/blob/master/territorium.core/src/test/java/com/opendoorlogistics/territorium/TestSolver.java
Clustering procedure where each cluster has an equal number of points?
This is an optimisation problem. We have an open source java library which solves this problem (clustering where quantity per cluster must be between set ranges). You'd need your total number of point
Clustering procedure where each cluster has an equal number of points? This is an optimisation problem. We have an open source java library which solves this problem (clustering where quantity per cluster must be between set ranges). You'd need your total number of points to be maximum of a few thousand though - no more than 5000 or maybe 10000. The library is here: https://github.com/PGWelch/territorium/tree/master/territorium.core The library itself is setup for geographic / GIS type problems - so you will see references to X and Ys, latitudes and longitudes, customers, distance and time, etc. You can just ignore the 'geographic' elements though and use it as a pure clusterer. You provide a set of initially empty input clusters each with a min and max target quantity. The clusterer will assign points to your input clusters, using a heuristic-based optimisation algorithm (swaps, moves etc). In the optimisation it firstly prioritises keeping each cluster within its min and max quantity range and then secondly minimises the distances between all points in the cluster and the cluster's central point, so a cluster is spatially cohesive. You give the solver a metric function (i.e. distance function) between points using this interface: https://github.com/PGWelch/territorium/blob/master/territorium.core/src/main/java/com/opendoorlogistics/territorium/problem/TravelMatrix.java The metric is actually structured to return both a distance and 'time', because its designed for travel-based geographic problems, but for arbitrary clustering problems just set 'time' to be zero and distance to be your actual metric you're using between points. You'd setup your problem in this class: https://github.com/PGWelch/territorium/blob/master/territorium.core/src/main/java/com/opendoorlogistics/territorium/problem/Problem.java Your points would be the 'Customers' and their quantity would be 1. In the customer class ensure you set costPerUnitTime = 0 and costPerUnitDistance=1 assuming you're returning your metric distance in the 'distance' field returned by the TravelMatrix. https://github.com/PGWelch/territorium/blob/master/territorium.core/src/main/java/com/opendoorlogistics/territorium/problem/Customer.java See here for an example of running the solver: https://github.com/PGWelch/territorium/blob/master/territorium.core/src/test/java/com/opendoorlogistics/territorium/TestSolver.java
Clustering procedure where each cluster has an equal number of points? This is an optimisation problem. We have an open source java library which solves this problem (clustering where quantity per cluster must be between set ranges). You'd need your total number of point
8,698
Clustering procedure where each cluster has an equal number of points?
I suggest the recent paper Discriminative Clustering by Regularized Information Maximization (and references therein). Specifically, Section 2 talks about class balance and cluster assumption.
Clustering procedure where each cluster has an equal number of points?
I suggest the recent paper Discriminative Clustering by Regularized Information Maximization (and references therein). Specifically, Section 2 talks about class balance and cluster assumption.
Clustering procedure where each cluster has an equal number of points? I suggest the recent paper Discriminative Clustering by Regularized Information Maximization (and references therein). Specifically, Section 2 talks about class balance and cluster assumption.
Clustering procedure where each cluster has an equal number of points? I suggest the recent paper Discriminative Clustering by Regularized Information Maximization (and references therein). Specifically, Section 2 talks about class balance and cluster assumption.
8,699
StackExchange fires a moderator, and now in response hundreds of moderators resign: is the increase in resignations statistically significant?
This is an interesting investigation because of the flash-pan nature of the event. It's not the same as, say, installing a fence and trying to see if the number of trespassers was reduced. In that case, after the fence was installed, we would expect to see a permanent impact (if there was any) on the rate of trespassers. In this case, a bunch of mods will resign/be fired/be suspended over the issue over a course of a few days, and then the rate of these will die down. There are only so many moderators willing to/forced to do these things, and once they do them it's done. We would expect the rate of leavings to die down eventually. Graphically, you could represent this with a line chart. If you take the number of moderators leaving per day and plot it, you'd expect to see relatively consistent leavings up until the firing (lets call it $D_0$) after which you expect to see an increase, and a fall back to the original rate. Numerically, if you wanted to show that this spike is not within the normal variation of the process, I'd try to treat this almost as if it were quality control. Take some data from before $D_0$. Calculate an estimate of the mean leavings per day, an estimate of the variance, and then construct a confidence interval for that mean at your preferred level of significance. If $D_0$ (and other days in the aftermath) are outside this interval, then you can conclude that these points represent a shift in the average leavings per day. Anyway, that's my approach. I'm sure there are others.
StackExchange fires a moderator, and now in response hundreds of moderators resign: is the increase
This is an interesting investigation because of the flash-pan nature of the event. It's not the same as, say, installing a fence and trying to see if the number of trespassers was reduced. In that cas
StackExchange fires a moderator, and now in response hundreds of moderators resign: is the increase in resignations statistically significant? This is an interesting investigation because of the flash-pan nature of the event. It's not the same as, say, installing a fence and trying to see if the number of trespassers was reduced. In that case, after the fence was installed, we would expect to see a permanent impact (if there was any) on the rate of trespassers. In this case, a bunch of mods will resign/be fired/be suspended over the issue over a course of a few days, and then the rate of these will die down. There are only so many moderators willing to/forced to do these things, and once they do them it's done. We would expect the rate of leavings to die down eventually. Graphically, you could represent this with a line chart. If you take the number of moderators leaving per day and plot it, you'd expect to see relatively consistent leavings up until the firing (lets call it $D_0$) after which you expect to see an increase, and a fall back to the original rate. Numerically, if you wanted to show that this spike is not within the normal variation of the process, I'd try to treat this almost as if it were quality control. Take some data from before $D_0$. Calculate an estimate of the mean leavings per day, an estimate of the variance, and then construct a confidence interval for that mean at your preferred level of significance. If $D_0$ (and other days in the aftermath) are outside this interval, then you can conclude that these points represent a shift in the average leavings per day. Anyway, that's my approach. I'm sure there are others.
StackExchange fires a moderator, and now in response hundreds of moderators resign: is the increase This is an interesting investigation because of the flash-pan nature of the event. It's not the same as, say, installing a fence and trying to see if the number of trespassers was reduced. In that cas
8,700
StackExchange fires a moderator, and now in response hundreds of moderators resign: is the increase in resignations statistically significant?
The analysis you are proposing sounds interesting, but the data collection process will be quite complicated. There are a few main issues you are going to have to deal with: Determine the scope of events of interest: Ideally you should determine the scope of events of interest to you (even in just a broad way) before you begin collecting the data. This could be a broad stipulation of all events involving an intentional diminution in activity. Determine sampling frame and sampling method: You will need to determine your "sampling frame" to ensure you have a proper sampling method. The simplest way would be to stipulate some user criteria at a particular point in time (e.g., all moderators, all users with 5000+ rep, etc.). You will then need to decide how you will sample --- e.g., simple random sampling, or weighted sampling (e.g., by user reputation). Find a baseline for comparison: Obviously the other important element will be to get baseline data on how users were behaving before the issue arose. I would recommend that you examine each of your sampled users and get some metrics of their activities prior to the scandal (e.g., activity over previous year). May I offer a suggestion for a simpler analysis you could do with a lot less effort at data collection. Right now, a large number of users have converted their pictures to the "Reinstate Monica" picture, and many have also changed their user names. It should not be too onerous to go through the leader-boards of each site, and make a list of all users above some level (e.g., top 10, 20, 50) and list whether the user has converted their name and badge, and get a measure of the user's level of activity since the initial scandal. You could then do a "survival analysis" estimation of the rate of conversion on the different sites. Of course, this would only show that there is some symbolic solidarity on display, but it would be a simpler analysis than your proposal.
StackExchange fires a moderator, and now in response hundreds of moderators resign: is the increase
The analysis you are proposing sounds interesting, but the data collection process will be quite complicated. There are a few main issues you are going to have to deal with: Determine the scope of e
StackExchange fires a moderator, and now in response hundreds of moderators resign: is the increase in resignations statistically significant? The analysis you are proposing sounds interesting, but the data collection process will be quite complicated. There are a few main issues you are going to have to deal with: Determine the scope of events of interest: Ideally you should determine the scope of events of interest to you (even in just a broad way) before you begin collecting the data. This could be a broad stipulation of all events involving an intentional diminution in activity. Determine sampling frame and sampling method: You will need to determine your "sampling frame" to ensure you have a proper sampling method. The simplest way would be to stipulate some user criteria at a particular point in time (e.g., all moderators, all users with 5000+ rep, etc.). You will then need to decide how you will sample --- e.g., simple random sampling, or weighted sampling (e.g., by user reputation). Find a baseline for comparison: Obviously the other important element will be to get baseline data on how users were behaving before the issue arose. I would recommend that you examine each of your sampled users and get some metrics of their activities prior to the scandal (e.g., activity over previous year). May I offer a suggestion for a simpler analysis you could do with a lot less effort at data collection. Right now, a large number of users have converted their pictures to the "Reinstate Monica" picture, and many have also changed their user names. It should not be too onerous to go through the leader-boards of each site, and make a list of all users above some level (e.g., top 10, 20, 50) and list whether the user has converted their name and badge, and get a measure of the user's level of activity since the initial scandal. You could then do a "survival analysis" estimation of the rate of conversion on the different sites. Of course, this would only show that there is some symbolic solidarity on display, but it would be a simpler analysis than your proposal.
StackExchange fires a moderator, and now in response hundreds of moderators resign: is the increase The analysis you are proposing sounds interesting, but the data collection process will be quite complicated. There are a few main issues you are going to have to deal with: Determine the scope of e