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 |
|---|---|---|---|---|---|---|
24,601 | How can missing data be dealt with when using splines or fractional polynomials? | Multiple imputation can be used with fractional polynomials and splines. Let's say that $f(x)$ represents your functional form (e.g., $f(x) = x + x^.5$). Let $f_m()$ be the function estimated in each of $M$ synthetic samples, then your function is $\frac{1}{M}\sum^M_m f_m(x)$.
Assuming the software you are using for can provide a standard error estimate for every unique value of x, you can use Rubin's (Multiple imputation for nonresponse in surveys; 1987) formula for computing the standard errors. There are small and large sample formulas for the degrees of freedom with multiple imputation. The large sample formula (also in Rubin) just takes same inputs as the standard error, so can also be used. The small sample case takes the degrees of freedom of the model as an input; it is not obvious to me if this formula can be applied here. | How can missing data be dealt with when using splines or fractional polynomials? | Multiple imputation can be used with fractional polynomials and splines. Let's say that $f(x)$ represents your functional form (e.g., $f(x) = x + x^.5$). Let $f_m()$ be the function estimated in each | How can missing data be dealt with when using splines or fractional polynomials?
Multiple imputation can be used with fractional polynomials and splines. Let's say that $f(x)$ represents your functional form (e.g., $f(x) = x + x^.5$). Let $f_m()$ be the function estimated in each of $M$ synthetic samples, then your function is $\frac{1}{M}\sum^M_m f_m(x)$.
Assuming the software you are using for can provide a standard error estimate for every unique value of x, you can use Rubin's (Multiple imputation for nonresponse in surveys; 1987) formula for computing the standard errors. There are small and large sample formulas for the degrees of freedom with multiple imputation. The large sample formula (also in Rubin) just takes same inputs as the standard error, so can also be used. The small sample case takes the degrees of freedom of the model as an input; it is not obvious to me if this formula can be applied here. | How can missing data be dealt with when using splines or fractional polynomials?
Multiple imputation can be used with fractional polynomials and splines. Let's say that $f(x)$ represents your functional form (e.g., $f(x) = x + x^.5$). Let $f_m()$ be the function estimated in each |
24,602 | Use $\bar{X}^2$ for hypothesis test that $\mu=0$ because faster convergence rate? | Both of the tests you describe are equivalent.
If I have two hypotheses:
$$H_0: \mu=0$$
$$H_1: \mu\neq0$$
then they are equivalent to
$$H_0: \mu^2=0$$
$$H_1: \mu^2\gt 0.$$
If the data are known to be normal, then the sample mean $\bar{X}$ will also be Normal with mean $\mu$ and variance $\sigma^2/n$ (which might be known or unknown).
If the data aren't known to be Normal then you can use the central limit theorem and the above will be true asymptotically. You claim that $\bar{X}^2$ will converge to a chi-squared variable "faster" than $\bar{X}$ will converge to a normal one. This is true in the sense that as $n$ tends to infinity,
$$P(|\bar{X} - \mu| > |\bar{X}^2 - \mu^2|) \rightarrow 1$$
but that is not the whole story. We are performing a likelihood ratio test, or at least an approximate one. the ratio will come out the same whether we perform a chi-squared or a normal test. (Recall that the square of a normal random variable follows a chi-squared distribution.) If the sample mean $\bar{X}$ comes out at the 95th percentile of the relevant normal or t-distribution, then the sum-of-squares will be equal to the 95th percentile of the $\chi^2$ distribution (which is not the same number, but that doesn't matter). | Use $\bar{X}^2$ for hypothesis test that $\mu=0$ because faster convergence rate? | Both of the tests you describe are equivalent.
If I have two hypotheses:
$$H_0: \mu=0$$
$$H_1: \mu\neq0$$
then they are equivalent to
$$H_0: \mu^2=0$$
$$H_1: \mu^2\gt 0.$$
If the data are known to be | Use $\bar{X}^2$ for hypothesis test that $\mu=0$ because faster convergence rate?
Both of the tests you describe are equivalent.
If I have two hypotheses:
$$H_0: \mu=0$$
$$H_1: \mu\neq0$$
then they are equivalent to
$$H_0: \mu^2=0$$
$$H_1: \mu^2\gt 0.$$
If the data are known to be normal, then the sample mean $\bar{X}$ will also be Normal with mean $\mu$ and variance $\sigma^2/n$ (which might be known or unknown).
If the data aren't known to be Normal then you can use the central limit theorem and the above will be true asymptotically. You claim that $\bar{X}^2$ will converge to a chi-squared variable "faster" than $\bar{X}$ will converge to a normal one. This is true in the sense that as $n$ tends to infinity,
$$P(|\bar{X} - \mu| > |\bar{X}^2 - \mu^2|) \rightarrow 1$$
but that is not the whole story. We are performing a likelihood ratio test, or at least an approximate one. the ratio will come out the same whether we perform a chi-squared or a normal test. (Recall that the square of a normal random variable follows a chi-squared distribution.) If the sample mean $\bar{X}$ comes out at the 95th percentile of the relevant normal or t-distribution, then the sum-of-squares will be equal to the 95th percentile of the $\chi^2$ distribution (which is not the same number, but that doesn't matter). | Use $\bar{X}^2$ for hypothesis test that $\mu=0$ because faster convergence rate?
Both of the tests you describe are equivalent.
If I have two hypotheses:
$$H_0: \mu=0$$
$$H_1: \mu\neq0$$
then they are equivalent to
$$H_0: \mu^2=0$$
$$H_1: \mu^2\gt 0.$$
If the data are known to be |
24,603 | Cross validation after LASSO in complex survey data | I don't have a detailed answer, just some pointers to work I've been meaning to read:
You could take a look at McConville (2011) on complex-survey LASSO, to be sure your use of LASSO is appropriate for your data. But maybe it's not a big deal if you're doing LASSO only for variable selection, then fitting something else to the remaining variables.
For cross-validation with complex survey data (though not LASSO), McConville also cites Opsomer & Miller (2005) and You (2009). But their methods seems to use leave-one-out CV, not K-fold.
Leave-one-out should be simpler to implement with complex surveys---there's less concern about how to partition the data appropriately. (On the other hand, it can take longer to run than K-fold. And if your goal is model selection, it's known that leave-one-out can be worse than K-fold for large samples.) | Cross validation after LASSO in complex survey data | I don't have a detailed answer, just some pointers to work I've been meaning to read:
You could take a look at McConville (2011) on complex-survey LASSO, to be sure your use of LASSO is appropriate f | Cross validation after LASSO in complex survey data
I don't have a detailed answer, just some pointers to work I've been meaning to read:
You could take a look at McConville (2011) on complex-survey LASSO, to be sure your use of LASSO is appropriate for your data. But maybe it's not a big deal if you're doing LASSO only for variable selection, then fitting something else to the remaining variables.
For cross-validation with complex survey data (though not LASSO), McConville also cites Opsomer & Miller (2005) and You (2009). But their methods seems to use leave-one-out CV, not K-fold.
Leave-one-out should be simpler to implement with complex surveys---there's less concern about how to partition the data appropriately. (On the other hand, it can take longer to run than K-fold. And if your goal is model selection, it's known that leave-one-out can be worse than K-fold for large samples.) | Cross validation after LASSO in complex survey data
I don't have a detailed answer, just some pointers to work I've been meaning to read:
You could take a look at McConville (2011) on complex-survey LASSO, to be sure your use of LASSO is appropriate f |
24,604 | Cross validation after LASSO in complex survey data | A recent paper demonstrates how K-fold cross-validation can be applied to complex designs (featuring clustering, stratification, and unequal selection probabilities). The paper is open-access, fairly short, and quite readable, so check it out!
Wieczorek, Guerin, and McMahon 2022. "K-fold cross-validation for complex sample surveys."
https://doi.org/10.1002/sta4.454
The following excerpt provides a quick summary of their recommendations:
Nonetheless, Wolter's advice for taking subsamples also applies to forming CV folds:
For SRS sampling, partition the observations in the dataset completely at random into K equal-sized folds, as usual.
For cluster sampling, partition the data at the level of the PSUs. All elements from a given PSU should be placed in the same fold, so that the folds are a random partition of PSUs rather than of elementary sampling units. (Note: with multistage sampling, after a first-stage cluster sample there is further subsampling in the selected clusters. Since there is no straightforward way for CV to mimic this subsampling, we simply form folds at the PSU level even in multistage samples.)
For stratified sampling, make each fold a stratified sample of units from each stratum. Create SRS CV folds separately within each stratum, then combine them across strata.
For unequal probability samples, such as probability proportional to size (PPS), make each fold an SRS of the data. However, see below for advice on using sampling weights to estimate $\hat{𝐸𝑟𝑟}_{𝐶𝑉}(𝑓)$ as a weighted mean and to fit each $\hat{𝑓}_{𝑡𝑟𝑎𝑖𝑛_𝑗}$ .
For more complex sample designs that combine several of the design features above, combine these rules as needed.
The authors of that paper created an R package, named 'surveyCV', which implements the K-fold cross-validation method they proposed. That R package is available on CRAN.
https://github.com/ColbyStatSvyRsch/surveyCV | Cross validation after LASSO in complex survey data | A recent paper demonstrates how K-fold cross-validation can be applied to complex designs (featuring clustering, stratification, and unequal selection probabilities). The paper is open-access, fairly | Cross validation after LASSO in complex survey data
A recent paper demonstrates how K-fold cross-validation can be applied to complex designs (featuring clustering, stratification, and unequal selection probabilities). The paper is open-access, fairly short, and quite readable, so check it out!
Wieczorek, Guerin, and McMahon 2022. "K-fold cross-validation for complex sample surveys."
https://doi.org/10.1002/sta4.454
The following excerpt provides a quick summary of their recommendations:
Nonetheless, Wolter's advice for taking subsamples also applies to forming CV folds:
For SRS sampling, partition the observations in the dataset completely at random into K equal-sized folds, as usual.
For cluster sampling, partition the data at the level of the PSUs. All elements from a given PSU should be placed in the same fold, so that the folds are a random partition of PSUs rather than of elementary sampling units. (Note: with multistage sampling, after a first-stage cluster sample there is further subsampling in the selected clusters. Since there is no straightforward way for CV to mimic this subsampling, we simply form folds at the PSU level even in multistage samples.)
For stratified sampling, make each fold a stratified sample of units from each stratum. Create SRS CV folds separately within each stratum, then combine them across strata.
For unequal probability samples, such as probability proportional to size (PPS), make each fold an SRS of the data. However, see below for advice on using sampling weights to estimate $\hat{𝐸𝑟𝑟}_{𝐶𝑉}(𝑓)$ as a weighted mean and to fit each $\hat{𝑓}_{𝑡𝑟𝑎𝑖𝑛_𝑗}$ .
For more complex sample designs that combine several of the design features above, combine these rules as needed.
The authors of that paper created an R package, named 'surveyCV', which implements the K-fold cross-validation method they proposed. That R package is available on CRAN.
https://github.com/ColbyStatSvyRsch/surveyCV | Cross validation after LASSO in complex survey data
A recent paper demonstrates how K-fold cross-validation can be applied to complex designs (featuring clustering, stratification, and unequal selection probabilities). The paper is open-access, fairly |
24,605 | Cross validation after LASSO in complex survey data | EDIT by OP: Not applicable to complex survey data.
The cv.glmet function could help you to perform the cross validation required. The lambda.min value is the value of λ where the CV error is minimal. The lambda.1se represents the value of λ in the search that was simpler than the best model (lambda.min), but which has error within 1 standard error of the best model.
Choose a grid of values you could choose from for both alpha and
lambda
grid <- expand.grid(.alpha = (1:10) * 0.1,
.lambda = (1:10) * 0.1)
Setup the control parameters of your model. The below train control does repeatedcv for 10 iterations. Go over the methods available and pick the one that would fit your current scenario.
cv.glmmod
<-cv.glmnet(xTrain,y=yTrain,alpha=grid$.alpha,
> = T,lambda = grid$.lambda)
The lambda.min value could be accessed from the model itself as shown below.
cv.glmmod$lambda.min | Cross validation after LASSO in complex survey data | EDIT by OP: Not applicable to complex survey data.
The cv.glmet function could help you to perform the cross validation required. The lambda.min value is the value of λ where the CV error is minimal. | Cross validation after LASSO in complex survey data
EDIT by OP: Not applicable to complex survey data.
The cv.glmet function could help you to perform the cross validation required. The lambda.min value is the value of λ where the CV error is minimal. The lambda.1se represents the value of λ in the search that was simpler than the best model (lambda.min), but which has error within 1 standard error of the best model.
Choose a grid of values you could choose from for both alpha and
lambda
grid <- expand.grid(.alpha = (1:10) * 0.1,
.lambda = (1:10) * 0.1)
Setup the control parameters of your model. The below train control does repeatedcv for 10 iterations. Go over the methods available and pick the one that would fit your current scenario.
cv.glmmod
<-cv.glmnet(xTrain,y=yTrain,alpha=grid$.alpha,
> = T,lambda = grid$.lambda)
The lambda.min value could be accessed from the model itself as shown below.
cv.glmmod$lambda.min | Cross validation after LASSO in complex survey data
EDIT by OP: Not applicable to complex survey data.
The cv.glmet function could help you to perform the cross validation required. The lambda.min value is the value of λ where the CV error is minimal. |
24,606 | Which is the best method for network meta-analysis? | I think, the modeling approaches and estimation techniques should be viewed seperately.
From modeling point of view, Lumley model only works for two-arm trials only. So it is not preferable. To my understanding, node-splitting approach, which you listed as Dias et al, is very intuitive. Also, I think you should add the design-by-treatment interaction approach (http://www.ncbi.nlm.nih.gov/pubmed/24777711).
From estimation point of view, I dont know much about frequentist techniques, but one can use MCMC for almost all models for NMA.
Lastly, there is a different technique (which is not widely known unfortunately) called INLA. You can use INLA from within R and fit NMA models, it is faster and no need to check convergence diagnostics. Here is the paper http://www.ncbi.nlm.nih.gov/pubmed/26360927.
So, at the end I would prefer node-splitting and the design-by-treatment interaction approach using INLA. | Which is the best method for network meta-analysis? | I think, the modeling approaches and estimation techniques should be viewed seperately.
From modeling point of view, Lumley model only works for two-arm trials only. So it is not preferable. To my un | Which is the best method for network meta-analysis?
I think, the modeling approaches and estimation techniques should be viewed seperately.
From modeling point of view, Lumley model only works for two-arm trials only. So it is not preferable. To my understanding, node-splitting approach, which you listed as Dias et al, is very intuitive. Also, I think you should add the design-by-treatment interaction approach (http://www.ncbi.nlm.nih.gov/pubmed/24777711).
From estimation point of view, I dont know much about frequentist techniques, but one can use MCMC for almost all models for NMA.
Lastly, there is a different technique (which is not widely known unfortunately) called INLA. You can use INLA from within R and fit NMA models, it is faster and no need to check convergence diagnostics. Here is the paper http://www.ncbi.nlm.nih.gov/pubmed/26360927.
So, at the end I would prefer node-splitting and the design-by-treatment interaction approach using INLA. | Which is the best method for network meta-analysis?
I think, the modeling approaches and estimation techniques should be viewed seperately.
From modeling point of view, Lumley model only works for two-arm trials only. So it is not preferable. To my un |
24,607 | How to test if a cross-covariance matrix is non-zero? | We sample $X_{t+i}$ from $P(X_{t+i}|Y_{t+i})$. Since $Y_{t+i}$ is changing, I think $X_{t+i}$ and $X_{t+i+1}$ are not from the same distribution [...]
You are confusing conditional and unconditional distributions here, see also my next remark. Conditional on $Y_{t+i} = y_1$ and $Y_{t+i+1} = y_2$, $P(X_{t+i}|Y_{t+i} = y_1) \neq P(X_{t+i+1}|Y_{t+i+1} = y_2)$. But the entire point of constructing your Gibbs sampler is to sample from the stationary distributions of $X$ and $Y$. Very roughly speaking, if you have run your chain for long enough and so that $\{Y_t\}$ follows the stationary distribution, you can then say
\begin{align}
P(X_t) = \int_{\mathcal{Y}}P(X_t|Y_t)dP(Y_t),
\end{align}
meaning that the unconditional distribution of $X_t$ is also invariant. In other words, as $t \to \infty$ and we converge to the stationary distributions, $P(X_{t+i}|Y_{t+i}) = P(X_{t+i+1}|Y_{t+i+1})$, since $Y_{t+i}$ and $Y_{t+i+1}$ will asymptotically be drawn from (the same!) stationary distribution $P(Y_t)$. On the other hand and as before, once we condition on $Y_{t+i} = y_1$ and $Y_{t+i+1} = y_2$, this won't hold anymore, regardless how large $t$ is.
[...] so $\operatorname{Cov}[X_{t+i},X_{t+j}]$ is not the same as $\operatorname{Cov}[X_{t+i},X_{t+i}]$. Is this statement correct?
Yes, this is correct - even though $X_{t+1} \sim X_{t}$, i.e. $X_t$ and $X_{t+1}$ have the same stationary distribution. I know this may be confusing, but bear with me. Define $Y_t = 0.8\cdot Y_{t-1} + \varepsilon_t$ with $\varepsilon_t \overset{iid}{\sim} N(0,1)$. By iterated substitution, one can show that $Y_t = \sum_{i=0}^t0.8^i \varepsilon_{t-i}$, and since (infinite) sums of normals are still normal, it holds that $\text{Var}(Y_t) = \sum_{i=0}^t0.8^{2i} = \dfrac{1}{1-0.8^2}$ and so that $Y_t \overset{iid}{\sim} N(0, \dfrac{1}{1-0.8^2})$. Clearly, $Y_t$ and $Y_{t+1}$ will still be correlated, but they will also come from the same distribution ($Y_{t+1} \sim Y_{t}$). A similar situation holds for your $X_t$.
Suppose I have enough data to estimate $\operatorname{Cov}[X_{t+i},X_{t+i+1}]$ (neighboring samples in the sequence), is there any way to test if the covariance matrix is significantly a non-zero matrix? Broadly speaking, I am interested in an indicator which guides me to some meaningful cross-covariance matrices that should be included in my final variance estimation.
Well, if you had infinitely many observations, they will all be significant eventually. Clearly, you cannot do this in practice, but there are ways of 'chopping off' the expansion after some terms, see the accepted excellent answer here. Basically, you define a kernel $k(\cdot)$ which decays to $0$ and assigns weights to the first $l_T$ covariance matrices that you could compute. If you want to choose $l_T$ in a principled way, you will have to dig a bit into the literature, but the post I linked gives you some good references to do exactly that. | How to test if a cross-covariance matrix is non-zero? | We sample $X_{t+i}$ from $P(X_{t+i}|Y_{t+i})$. Since $Y_{t+i}$ is changing, I think $X_{t+i}$ and $X_{t+i+1}$ are not from the same distribution [...]
You are confusing conditional and unconditional | How to test if a cross-covariance matrix is non-zero?
We sample $X_{t+i}$ from $P(X_{t+i}|Y_{t+i})$. Since $Y_{t+i}$ is changing, I think $X_{t+i}$ and $X_{t+i+1}$ are not from the same distribution [...]
You are confusing conditional and unconditional distributions here, see also my next remark. Conditional on $Y_{t+i} = y_1$ and $Y_{t+i+1} = y_2$, $P(X_{t+i}|Y_{t+i} = y_1) \neq P(X_{t+i+1}|Y_{t+i+1} = y_2)$. But the entire point of constructing your Gibbs sampler is to sample from the stationary distributions of $X$ and $Y$. Very roughly speaking, if you have run your chain for long enough and so that $\{Y_t\}$ follows the stationary distribution, you can then say
\begin{align}
P(X_t) = \int_{\mathcal{Y}}P(X_t|Y_t)dP(Y_t),
\end{align}
meaning that the unconditional distribution of $X_t$ is also invariant. In other words, as $t \to \infty$ and we converge to the stationary distributions, $P(X_{t+i}|Y_{t+i}) = P(X_{t+i+1}|Y_{t+i+1})$, since $Y_{t+i}$ and $Y_{t+i+1}$ will asymptotically be drawn from (the same!) stationary distribution $P(Y_t)$. On the other hand and as before, once we condition on $Y_{t+i} = y_1$ and $Y_{t+i+1} = y_2$, this won't hold anymore, regardless how large $t$ is.
[...] so $\operatorname{Cov}[X_{t+i},X_{t+j}]$ is not the same as $\operatorname{Cov}[X_{t+i},X_{t+i}]$. Is this statement correct?
Yes, this is correct - even though $X_{t+1} \sim X_{t}$, i.e. $X_t$ and $X_{t+1}$ have the same stationary distribution. I know this may be confusing, but bear with me. Define $Y_t = 0.8\cdot Y_{t-1} + \varepsilon_t$ with $\varepsilon_t \overset{iid}{\sim} N(0,1)$. By iterated substitution, one can show that $Y_t = \sum_{i=0}^t0.8^i \varepsilon_{t-i}$, and since (infinite) sums of normals are still normal, it holds that $\text{Var}(Y_t) = \sum_{i=0}^t0.8^{2i} = \dfrac{1}{1-0.8^2}$ and so that $Y_t \overset{iid}{\sim} N(0, \dfrac{1}{1-0.8^2})$. Clearly, $Y_t$ and $Y_{t+1}$ will still be correlated, but they will also come from the same distribution ($Y_{t+1} \sim Y_{t}$). A similar situation holds for your $X_t$.
Suppose I have enough data to estimate $\operatorname{Cov}[X_{t+i},X_{t+i+1}]$ (neighboring samples in the sequence), is there any way to test if the covariance matrix is significantly a non-zero matrix? Broadly speaking, I am interested in an indicator which guides me to some meaningful cross-covariance matrices that should be included in my final variance estimation.
Well, if you had infinitely many observations, they will all be significant eventually. Clearly, you cannot do this in practice, but there are ways of 'chopping off' the expansion after some terms, see the accepted excellent answer here. Basically, you define a kernel $k(\cdot)$ which decays to $0$ and assigns weights to the first $l_T$ covariance matrices that you could compute. If you want to choose $l_T$ in a principled way, you will have to dig a bit into the literature, but the post I linked gives you some good references to do exactly that. | How to test if a cross-covariance matrix is non-zero?
We sample $X_{t+i}$ from $P(X_{t+i}|Y_{t+i})$. Since $Y_{t+i}$ is changing, I think $X_{t+i}$ and $X_{t+i+1}$ are not from the same distribution [...]
You are confusing conditional and unconditional |
24,608 | Is the ratio distribution of two normally distributed variables ever normal? | It is not normal, but it can be approximated with a normal distribution if the coefficient of variation of $Y$ is sufficiently small (<0.1). See
On the existence of a normal approximation to the distribution of the ratio of two independent normal random variables. | Is the ratio distribution of two normally distributed variables ever normal? | It is not normal, but it can be approximated with a normal distribution if the coefficient of variation of $Y$ is sufficiently small (<0.1). See
On the existence of a normal approximation to the dist | Is the ratio distribution of two normally distributed variables ever normal?
It is not normal, but it can be approximated with a normal distribution if the coefficient of variation of $Y$ is sufficiently small (<0.1). See
On the existence of a normal approximation to the distribution of the ratio of two independent normal random variables. | Is the ratio distribution of two normally distributed variables ever normal?
It is not normal, but it can be approximated with a normal distribution if the coefficient of variation of $Y$ is sufficiently small (<0.1). See
On the existence of a normal approximation to the dist |
24,609 | Out-of-bag error estimate for boosting? | Answering only partially (and adding a new question to your question).
The gbm implementation in R http://www.rdocumentation.org/packages/gbm/functions/gbm
has two parameters to adjust some out-of-bagness.
a) train.fraction will define a proportion of the data that is used to train all trees and thus 1-train.fraction will be true OOB (out-of-bag) data.
b) bag.fraction will define the proportion of training data to be used in the creation of the next tree in the boost. Thus there may be some data that is never used for the creation of any tree and they can be truly used as OOB data.(but it is unlikely, see the question below)
Which brings me to the question. Your analysis of 37% of data as being OOB is true for only ONE tree. But the chance there will be any data that is not used in ANY tree is much smaller - $0.37^{ntrees}$ (it has to be in the OOB for all $ntree$ trees - my understanding is that each tree does its own bootstrap). So in RandomForests it should be very unlikely to be any OOB to test the forest. And yet the randomForest implementation in R (based on Breiman's original code) talks a lot about OOB (for example the result data err.rate and confusion see http://www.rdocumentation.org/packages/randomForest/functions/randomForest)
I dont know how to answer that (and I thank you (+1) for asking the question and making me realize I don't understand this aspect of randomForests). The possible solution is that there is only one bootstrap - and all trees are constructed from it - but as far as I know , it is not the case. | Out-of-bag error estimate for boosting? | Answering only partially (and adding a new question to your question).
The gbm implementation in R http://www.rdocumentation.org/packages/gbm/functions/gbm
has two parameters to adjust some out-of-bag | Out-of-bag error estimate for boosting?
Answering only partially (and adding a new question to your question).
The gbm implementation in R http://www.rdocumentation.org/packages/gbm/functions/gbm
has two parameters to adjust some out-of-bagness.
a) train.fraction will define a proportion of the data that is used to train all trees and thus 1-train.fraction will be true OOB (out-of-bag) data.
b) bag.fraction will define the proportion of training data to be used in the creation of the next tree in the boost. Thus there may be some data that is never used for the creation of any tree and they can be truly used as OOB data.(but it is unlikely, see the question below)
Which brings me to the question. Your analysis of 37% of data as being OOB is true for only ONE tree. But the chance there will be any data that is not used in ANY tree is much smaller - $0.37^{ntrees}$ (it has to be in the OOB for all $ntree$ trees - my understanding is that each tree does its own bootstrap). So in RandomForests it should be very unlikely to be any OOB to test the forest. And yet the randomForest implementation in R (based on Breiman's original code) talks a lot about OOB (for example the result data err.rate and confusion see http://www.rdocumentation.org/packages/randomForest/functions/randomForest)
I dont know how to answer that (and I thank you (+1) for asking the question and making me realize I don't understand this aspect of randomForests). The possible solution is that there is only one bootstrap - and all trees are constructed from it - but as far as I know , it is not the case. | Out-of-bag error estimate for boosting?
Answering only partially (and adding a new question to your question).
The gbm implementation in R http://www.rdocumentation.org/packages/gbm/functions/gbm
has two parameters to adjust some out-of-bag |
24,610 | Out-of-bag error estimate for boosting? | I believe that the OOB stuff works differently on Random Forrests and Gradient Boosting.
On Random Forrests, you can train a tree on a portion of the data (train data) and thus any predictions on the OOB data are clean-room predictions. So, the implementation would keep two separate arrays in order to implement OOB predictions. Each of these two array has the same length as the data passed in to the fit() method. The first array (y_hat_oob) would keep a sum of the OOB y_hats for each OOB data point, and the second array (oob_count) would keep a count of how many predictions (trees) contributed to each OOB prediction (for each data point). So, let's say you have 10 data points (0..9) and your first bag uses points (0..4) for training and (5..9) for OOB. You fit() a tree on points (0..4) and use that tree to predict() on points (5..9). You add the predictions to the y_hat_oob array for points (5..9) and you add 1 to the oob_count array in points (5..9). Now, let's say your bag 2 uses points (5..9) for training and thus points (0..4) for oob. You do the same, store the oob predictions in the y_hat_oob array points (0..4) and increment the corresponding counts. Now you have two trees in your model, but since you use only 0.5 of your data for oob, then your oob contains predictions from only (number of trees) * (proportion of oob data) trees (2 * 0.5 = 1). To get the actual y_hat_oob at the end of training, you'd need to divide y_hat_oob by count_oob -- this does the same as averaging all the predictions from all the tree models. Ok, so that's Random Forrests, and this was the easy one.
For Gradient Boosting, I believe there is a problem. Because each tree depends on the predictions from prior trees, you can't take the same approach as with Random Forrests. What you CAN do is calculate the OOB "improvement" in "performance" due to the latest iteration/model. You'd calculate the error/performance on the iteration OOB data using the models of the prior iteration. Now, once the new iteration model is fit(), then you can recalculate the error/performance on the same OOB data and calculate the difference. That will give you and estimate of the OOB "improvement" in performance due to the latest iteration. At least this is how I understand things.
Hope that helps. | Out-of-bag error estimate for boosting? | I believe that the OOB stuff works differently on Random Forrests and Gradient Boosting.
On Random Forrests, you can train a tree on a portion of the data (train data) and thus any predictions on the | Out-of-bag error estimate for boosting?
I believe that the OOB stuff works differently on Random Forrests and Gradient Boosting.
On Random Forrests, you can train a tree on a portion of the data (train data) and thus any predictions on the OOB data are clean-room predictions. So, the implementation would keep two separate arrays in order to implement OOB predictions. Each of these two array has the same length as the data passed in to the fit() method. The first array (y_hat_oob) would keep a sum of the OOB y_hats for each OOB data point, and the second array (oob_count) would keep a count of how many predictions (trees) contributed to each OOB prediction (for each data point). So, let's say you have 10 data points (0..9) and your first bag uses points (0..4) for training and (5..9) for OOB. You fit() a tree on points (0..4) and use that tree to predict() on points (5..9). You add the predictions to the y_hat_oob array for points (5..9) and you add 1 to the oob_count array in points (5..9). Now, let's say your bag 2 uses points (5..9) for training and thus points (0..4) for oob. You do the same, store the oob predictions in the y_hat_oob array points (0..4) and increment the corresponding counts. Now you have two trees in your model, but since you use only 0.5 of your data for oob, then your oob contains predictions from only (number of trees) * (proportion of oob data) trees (2 * 0.5 = 1). To get the actual y_hat_oob at the end of training, you'd need to divide y_hat_oob by count_oob -- this does the same as averaging all the predictions from all the tree models. Ok, so that's Random Forrests, and this was the easy one.
For Gradient Boosting, I believe there is a problem. Because each tree depends on the predictions from prior trees, you can't take the same approach as with Random Forrests. What you CAN do is calculate the OOB "improvement" in "performance" due to the latest iteration/model. You'd calculate the error/performance on the iteration OOB data using the models of the prior iteration. Now, once the new iteration model is fit(), then you can recalculate the error/performance on the same OOB data and calculate the difference. That will give you and estimate of the OOB "improvement" in performance due to the latest iteration. At least this is how I understand things.
Hope that helps. | Out-of-bag error estimate for boosting?
I believe that the OOB stuff works differently on Random Forrests and Gradient Boosting.
On Random Forrests, you can train a tree on a portion of the data (train data) and thus any predictions on the |
24,611 | Out-of-bag error estimate for boosting? | I believe they do out of bag estimation on each step. Since results of all steps are added (with coefficients), OOB errors can be also added with same coefficients. | Out-of-bag error estimate for boosting? | I believe they do out of bag estimation on each step. Since results of all steps are added (with coefficients), OOB errors can be also added with same coefficients. | Out-of-bag error estimate for boosting?
I believe they do out of bag estimation on each step. Since results of all steps are added (with coefficients), OOB errors can be also added with same coefficients. | Out-of-bag error estimate for boosting?
I believe they do out of bag estimation on each step. Since results of all steps are added (with coefficients), OOB errors can be also added with same coefficients. |
24,612 | ANOVA: testing assumption of normality for many groups with few samples per group | Working on this answer, not completely done. I have some insight on this but it takes a while to explain. For this, let us consider that standard deviation is biased for small numbers. The reason for this is that if we take any two numbers $a<b$, we arbitrarily assign the sample mean to be $\frac{a+b}2{}$, where the population mean, $\sigma$, could very well be anywhere on the interval between $(a,b)$ or it could be that $\sigma<a$ or $\sigma>b$. This means that on the average $\text{SD}<\sigma$. Thus, It is only when $n>100$ that this bias becomes small. For a long series of SD's for small numbers of samples each, the SD calculation becomes more precise, and more obviously inaccurate.
Now, rather than throw our hands up in frustration, we can apply the small number correction for our SD's under normal conditions. (Ha! There is a solution to our misery.)
$\frac{SD(n)}{\mu(n)}\,=\,\sqrt{\frac{2}{n-1}}\,\,\,\frac{\Gamma\left(\frac{n}{2}\right)}{\Gamma\left(\frac{n-1}{2}\right)}
\, = \, 1 - \frac{1}{4n} - \frac{7}{32n^2} - \frac{19}{128n^3} + O(n^{-4})$ see $E[\mu]$
For $n=3$, this is $\Gamma(\frac{3}{2})=\frac{\sqrt{\pi }}{2}\approx0.8862269255$. Which means that we have to divide our SD by that much to estimate $\sigma$.
Now in the case you present you have several other things going on as well. As it happens, the best measure of location of a uniform distribution is not the mean. Although both the sample mean and the sample median are unbiased estimators of the midpoint, neither is as efficient as the sample mid-range, i.e., the arithmetic mean of the sample maximum and the sample minimum, which is the minimum-variance unbiased estimator UMVU estimator of the midpoint (and also the maximum likelihood estimate).
Now to the meat of the matter. If you use the average of the extreme values, the variance of the measure of location will be smaller, provided that your data is truly uniform distributed. It may be normally distributed because a single extreme value tail might well be normal. With only 3-samples, however, the standard deviation will need correction. | ANOVA: testing assumption of normality for many groups with few samples per group | Working on this answer, not completely done. I have some insight on this but it takes a while to explain. For this, let us consider that standard deviation is biased for small numbers. The reason for | ANOVA: testing assumption of normality for many groups with few samples per group
Working on this answer, not completely done. I have some insight on this but it takes a while to explain. For this, let us consider that standard deviation is biased for small numbers. The reason for this is that if we take any two numbers $a<b$, we arbitrarily assign the sample mean to be $\frac{a+b}2{}$, where the population mean, $\sigma$, could very well be anywhere on the interval between $(a,b)$ or it could be that $\sigma<a$ or $\sigma>b$. This means that on the average $\text{SD}<\sigma$. Thus, It is only when $n>100$ that this bias becomes small. For a long series of SD's for small numbers of samples each, the SD calculation becomes more precise, and more obviously inaccurate.
Now, rather than throw our hands up in frustration, we can apply the small number correction for our SD's under normal conditions. (Ha! There is a solution to our misery.)
$\frac{SD(n)}{\mu(n)}\,=\,\sqrt{\frac{2}{n-1}}\,\,\,\frac{\Gamma\left(\frac{n}{2}\right)}{\Gamma\left(\frac{n-1}{2}\right)}
\, = \, 1 - \frac{1}{4n} - \frac{7}{32n^2} - \frac{19}{128n^3} + O(n^{-4})$ see $E[\mu]$
For $n=3$, this is $\Gamma(\frac{3}{2})=\frac{\sqrt{\pi }}{2}\approx0.8862269255$. Which means that we have to divide our SD by that much to estimate $\sigma$.
Now in the case you present you have several other things going on as well. As it happens, the best measure of location of a uniform distribution is not the mean. Although both the sample mean and the sample median are unbiased estimators of the midpoint, neither is as efficient as the sample mid-range, i.e., the arithmetic mean of the sample maximum and the sample minimum, which is the minimum-variance unbiased estimator UMVU estimator of the midpoint (and also the maximum likelihood estimate).
Now to the meat of the matter. If you use the average of the extreme values, the variance of the measure of location will be smaller, provided that your data is truly uniform distributed. It may be normally distributed because a single extreme value tail might well be normal. With only 3-samples, however, the standard deviation will need correction. | ANOVA: testing assumption of normality for many groups with few samples per group
Working on this answer, not completely done. I have some insight on this but it takes a while to explain. For this, let us consider that standard deviation is biased for small numbers. The reason for |
24,613 | Overdispersion and modeling alternatives in Poisson random effect models with offsets | There is a maximum possible number of counted answers, related to the number of questions asked. Although one can model this as a Poisson process of the counting type, another interpretation is that a Poisson process has no theoretical limit for the number of counted answers, that is, it is on $[0,\infty)$. Another distribution, i.e., a discrete one that has finite support, e.g., the beta binomial, might be more appropriate as it has a more mutable shape. However, that is just a guess, and, in practice, I would search for an answer to a more general question using brute force...
Rather than check for overdispersion, which has no guarantee of leading to a useful answer, and, although one can examine indices of dispersion to quantify dispersion, I would more usefully suggest searching for a best distribution using a discrete distribution option of a fit quality search program, e.g., Mathematica's FindDistribution routine. That type of a search does a fairly exhaustive job of guessing what known distribution(s) work(s) best not only to mitigate overdispersion, but also to more usefully model many of other data characteristics, e.g., goodness of fit as measured a dozen different ways.
To further examine my candidate distributions, I would post hoc examine residuals to check for homoscedasticity, and/or distribution type, and also consider whether the candidate distributions can be reconciled as corresponding to a physical explanation of the data. The danger of this procedure is identifying a distribution that is inconsistent with best modelling of an expanded data set. The danger of not doing a post hoc procedure is to a priori assign an arbitrarily chosen distribution without proper testing (garbage in-garbage out). The superiority of the post hoc approach is that it limits the errors of fitting, and that is also its weakness, i.e., it may understate the modelling errors through pure chance as many distributions fits are attempted. That then, is the reason for examining residuals and considering physicality. The top down or a priori approach offers no such post hoc check on reasonableness. That is, the only method of comparing the physicality of modelling with different distributions, is to post hoc compare them. Thus arises the nature of physical theory, we test a hypothetical explanation of data with many experiments before we accept them as exhausting alternative explanations. | Overdispersion and modeling alternatives in Poisson random effect models with offsets | There is a maximum possible number of counted answers, related to the number of questions asked. Although one can model this as a Poisson process of the counting type, another interpretation is that a | Overdispersion and modeling alternatives in Poisson random effect models with offsets
There is a maximum possible number of counted answers, related to the number of questions asked. Although one can model this as a Poisson process of the counting type, another interpretation is that a Poisson process has no theoretical limit for the number of counted answers, that is, it is on $[0,\infty)$. Another distribution, i.e., a discrete one that has finite support, e.g., the beta binomial, might be more appropriate as it has a more mutable shape. However, that is just a guess, and, in practice, I would search for an answer to a more general question using brute force...
Rather than check for overdispersion, which has no guarantee of leading to a useful answer, and, although one can examine indices of dispersion to quantify dispersion, I would more usefully suggest searching for a best distribution using a discrete distribution option of a fit quality search program, e.g., Mathematica's FindDistribution routine. That type of a search does a fairly exhaustive job of guessing what known distribution(s) work(s) best not only to mitigate overdispersion, but also to more usefully model many of other data characteristics, e.g., goodness of fit as measured a dozen different ways.
To further examine my candidate distributions, I would post hoc examine residuals to check for homoscedasticity, and/or distribution type, and also consider whether the candidate distributions can be reconciled as corresponding to a physical explanation of the data. The danger of this procedure is identifying a distribution that is inconsistent with best modelling of an expanded data set. The danger of not doing a post hoc procedure is to a priori assign an arbitrarily chosen distribution without proper testing (garbage in-garbage out). The superiority of the post hoc approach is that it limits the errors of fitting, and that is also its weakness, i.e., it may understate the modelling errors through pure chance as many distributions fits are attempted. That then, is the reason for examining residuals and considering physicality. The top down or a priori approach offers no such post hoc check on reasonableness. That is, the only method of comparing the physicality of modelling with different distributions, is to post hoc compare them. Thus arises the nature of physical theory, we test a hypothetical explanation of data with many experiments before we accept them as exhausting alternative explanations. | Overdispersion and modeling alternatives in Poisson random effect models with offsets
There is a maximum possible number of counted answers, related to the number of questions asked. Although one can model this as a Poisson process of the counting type, another interpretation is that a |
24,614 | Forecasting time-series ahead by multiple time horizons | You could consider working with ARIMAX or SARIMAX models.
These models will allow you to deal with any problem of autocorrelation. You can include autoregressive (AR) or moving average (MA) terms as needed, to eliminate autocorrelation.
You can easily include any independent variables along with the AR and MA terms.
You can model any seasonal behaviour as you need to account for fall or rise in population during holiday seasons or any other season.
They usually provide good forecasts. If you are using independent variables, you will need data on those variables to make forecasts for the future. Dynamic forecasts can only be made if the model is purely AR/MA process. | Forecasting time-series ahead by multiple time horizons | You could consider working with ARIMAX or SARIMAX models.
These models will allow you to deal with any problem of autocorrelation. You can include autoregressive (AR) or moving average (MA) terms as | Forecasting time-series ahead by multiple time horizons
You could consider working with ARIMAX or SARIMAX models.
These models will allow you to deal with any problem of autocorrelation. You can include autoregressive (AR) or moving average (MA) terms as needed, to eliminate autocorrelation.
You can easily include any independent variables along with the AR and MA terms.
You can model any seasonal behaviour as you need to account for fall or rise in population during holiday seasons or any other season.
They usually provide good forecasts. If you are using independent variables, you will need data on those variables to make forecasts for the future. Dynamic forecasts can only be made if the model is purely AR/MA process. | Forecasting time-series ahead by multiple time horizons
You could consider working with ARIMAX or SARIMAX models.
These models will allow you to deal with any problem of autocorrelation. You can include autoregressive (AR) or moving average (MA) terms as |
24,615 | Paper on performing hypothesis tests based on outcome of another test | I think that the following research paper on chain procedures is relevant to and might be helpful in answering your question: http://www.multxpert.com/doc/md2011.pdf. | Paper on performing hypothesis tests based on outcome of another test | I think that the following research paper on chain procedures is relevant to and might be helpful in answering your question: http://www.multxpert.com/doc/md2011.pdf. | Paper on performing hypothesis tests based on outcome of another test
I think that the following research paper on chain procedures is relevant to and might be helpful in answering your question: http://www.multxpert.com/doc/md2011.pdf. | Paper on performing hypothesis tests based on outcome of another test
I think that the following research paper on chain procedures is relevant to and might be helpful in answering your question: http://www.multxpert.com/doc/md2011.pdf. |
24,616 | Example Of Strict von Neumann Inequality | An example of strict von Neumann inequality occurs when the risk function $r$ satisfies the following conditions for some values $r_0 < r_1$ (where the former value is "low" and the latter is "high"):
$$\begin{matrix}
\forall \pi \in \Pi, \exists \delta \in \Delta: & & r(\pi, \delta) = r_0, & & (1) \\[8pt]
\forall \delta \in \Delta, \exists \pi \in \Pi: & & r(\pi, \delta) = r_1. & & (2)
\end{matrix}$$
The first condition says that regardless of the prior, there is always a decision rule with low risk $r_0$, which gives $\sup_{\pi\in\Pi} \inf_{\delta\in\Delta} r(\pi, \delta) = r_0$. The second condition says that regardless of the decision rule there is always some prior giving high risk $r_1$, which gives $\inf_{\pi\in\Pi} \sup_{\delta\in\Delta} r(\pi, \delta) = r_1$.
Another way of stating this situation is that there is no decision rule (chosen before seeing the prior) that guarantees low risk for every prior (sometimes it will have high risk), but for every prior, there is some decision rule (chosen after seeing the prior) that guarantees low risk. In other words, in order to impose a low bound on the risk we need to adapt our decision rule to the prior.
Example: A simple example of this kind of situation occurs when you have a pair of allowable priors $\pi_0, \pi_1$ and a pair of allowable decision rules $\delta_0, \delta_1$ with a risk matrix like this:
$$\begin{array}{ll}
r(\pi_0, \delta_0) = r_0 & & r(\pi_1, \delta_0) = r_1, \\[6pt]
r(\pi_0, \delta_1) = r_1 & & r(\pi_1, \delta_1) = r_0. \\[6pt]
\end{array}$$
In this case there is no decision rule that guarantees low risk over both priors, but for each prior there is a decision rule that has low risk. This situation satisfies the above conditions which gives strict inequality in the von Neumann inequality. | Example Of Strict von Neumann Inequality | An example of strict von Neumann inequality occurs when the risk function $r$ satisfies the following conditions for some values $r_0 < r_1$ (where the former value is "low" and the latter is "high"): | Example Of Strict von Neumann Inequality
An example of strict von Neumann inequality occurs when the risk function $r$ satisfies the following conditions for some values $r_0 < r_1$ (where the former value is "low" and the latter is "high"):
$$\begin{matrix}
\forall \pi \in \Pi, \exists \delta \in \Delta: & & r(\pi, \delta) = r_0, & & (1) \\[8pt]
\forall \delta \in \Delta, \exists \pi \in \Pi: & & r(\pi, \delta) = r_1. & & (2)
\end{matrix}$$
The first condition says that regardless of the prior, there is always a decision rule with low risk $r_0$, which gives $\sup_{\pi\in\Pi} \inf_{\delta\in\Delta} r(\pi, \delta) = r_0$. The second condition says that regardless of the decision rule there is always some prior giving high risk $r_1$, which gives $\inf_{\pi\in\Pi} \sup_{\delta\in\Delta} r(\pi, \delta) = r_1$.
Another way of stating this situation is that there is no decision rule (chosen before seeing the prior) that guarantees low risk for every prior (sometimes it will have high risk), but for every prior, there is some decision rule (chosen after seeing the prior) that guarantees low risk. In other words, in order to impose a low bound on the risk we need to adapt our decision rule to the prior.
Example: A simple example of this kind of situation occurs when you have a pair of allowable priors $\pi_0, \pi_1$ and a pair of allowable decision rules $\delta_0, \delta_1$ with a risk matrix like this:
$$\begin{array}{ll}
r(\pi_0, \delta_0) = r_0 & & r(\pi_1, \delta_0) = r_1, \\[6pt]
r(\pi_0, \delta_1) = r_1 & & r(\pi_1, \delta_1) = r_0. \\[6pt]
\end{array}$$
In this case there is no decision rule that guarantees low risk over both priors, but for each prior there is a decision rule that has low risk. This situation satisfies the above conditions which gives strict inequality in the von Neumann inequality. | Example Of Strict von Neumann Inequality
An example of strict von Neumann inequality occurs when the risk function $r$ satisfies the following conditions for some values $r_0 < r_1$ (where the former value is "low" and the latter is "high"): |
24,617 | Prediction evaluation metric for panel/longitudinal data | To evaluate a semi-Markov forecast's predictive ability, there are a number of methods available depending on sample size and other available information.
For evaluating any predictive/forecast model, you have the option of cross validation (specifically leave-one-out or iterative split sample cross validation), where a model is estimated in a "training" sample and model uncertainty assessed in a "validation" sample. Depending on the distribution of the outcome, a number of measures are available by which you can select a model among a panel of eligible models. For general non-parametric measures for model selection, people really like AIC and BIC, especially the latter.
CCC and c-statistics are used to evaluate binary cross-sectional predictions like from tests/assays, so you'll have to rule them out if you're predicting, say, BMI or IQ. They measure calibration (like the Hosmer Lemeshow test) and what's called risk stratification capacity. No intuitive connection to continuous outcomes there, at least not as far as I can tell.
RMSE on the other hand is used to evaluate continuous predictions (save the case of risk prediction in which RMSE is referred to as a Brier score, a pretty archaic and deprecated model evaluation tool). This is an excellent tool and probably is used to calibrate upwards of 80% of predictive models we encounter daily (weather forecasts, energy ratings, MPG on vehicles, etc.).
A caveat in split sample validation or resampling for evaluating forecast models is that you may only be interested in future outcomes when your sample leaves you predicting past outcomes. Don't do this! It doesn't reflect the models application and can vastly sway selection in a negative fashion. Roll forward all available information and predict future, unobserved outcomes in all available cases.
Pretty much any applied linear models book will cover prediction, RMSE, and the nuances of training and validating models. A good start would be Kutner, Nachtsheim, Neter, Li, also consider Diggle's "Time Series Analysis", Diggle Heagerty Zeger Li's, "Longitudinal Data Analysis", and potentially Harrell's "Regression Modeling Strategies". | Prediction evaluation metric for panel/longitudinal data | To evaluate a semi-Markov forecast's predictive ability, there are a number of methods available depending on sample size and other available information.
For evaluating any predictive/forecast model | Prediction evaluation metric for panel/longitudinal data
To evaluate a semi-Markov forecast's predictive ability, there are a number of methods available depending on sample size and other available information.
For evaluating any predictive/forecast model, you have the option of cross validation (specifically leave-one-out or iterative split sample cross validation), where a model is estimated in a "training" sample and model uncertainty assessed in a "validation" sample. Depending on the distribution of the outcome, a number of measures are available by which you can select a model among a panel of eligible models. For general non-parametric measures for model selection, people really like AIC and BIC, especially the latter.
CCC and c-statistics are used to evaluate binary cross-sectional predictions like from tests/assays, so you'll have to rule them out if you're predicting, say, BMI or IQ. They measure calibration (like the Hosmer Lemeshow test) and what's called risk stratification capacity. No intuitive connection to continuous outcomes there, at least not as far as I can tell.
RMSE on the other hand is used to evaluate continuous predictions (save the case of risk prediction in which RMSE is referred to as a Brier score, a pretty archaic and deprecated model evaluation tool). This is an excellent tool and probably is used to calibrate upwards of 80% of predictive models we encounter daily (weather forecasts, energy ratings, MPG on vehicles, etc.).
A caveat in split sample validation or resampling for evaluating forecast models is that you may only be interested in future outcomes when your sample leaves you predicting past outcomes. Don't do this! It doesn't reflect the models application and can vastly sway selection in a negative fashion. Roll forward all available information and predict future, unobserved outcomes in all available cases.
Pretty much any applied linear models book will cover prediction, RMSE, and the nuances of training and validating models. A good start would be Kutner, Nachtsheim, Neter, Li, also consider Diggle's "Time Series Analysis", Diggle Heagerty Zeger Li's, "Longitudinal Data Analysis", and potentially Harrell's "Regression Modeling Strategies". | Prediction evaluation metric for panel/longitudinal data
To evaluate a semi-Markov forecast's predictive ability, there are a number of methods available depending on sample size and other available information.
For evaluating any predictive/forecast model |
24,618 | How to estimate an upperbound for logistic regression by only 5 to 7 data points? | I worked on a similar problem earlier this year. The solution that I used was based on this paper, which uses linear algebra to eliminate $\beta_1$, the maximum. In this way, the results for the remaining parameters, once determined via some procedure (I simply minimized the error surface, same as in the paper), can be used to infer $\beta_1$ at the end.
Intuitively, this solution rests on the premise that all logistic curves with the same rate and location parameters are self-similar, so that setting the upper bound just means "stretching" the sigmoidal curve to the appropriate maximum. | How to estimate an upperbound for logistic regression by only 5 to 7 data points? | I worked on a similar problem earlier this year. The solution that I used was based on this paper, which uses linear algebra to eliminate $\beta_1$, the maximum. In this way, the results for the remai | How to estimate an upperbound for logistic regression by only 5 to 7 data points?
I worked on a similar problem earlier this year. The solution that I used was based on this paper, which uses linear algebra to eliminate $\beta_1$, the maximum. In this way, the results for the remaining parameters, once determined via some procedure (I simply minimized the error surface, same as in the paper), can be used to infer $\beta_1$ at the end.
Intuitively, this solution rests on the premise that all logistic curves with the same rate and location parameters are self-similar, so that setting the upper bound just means "stretching" the sigmoidal curve to the appropriate maximum. | How to estimate an upperbound for logistic regression by only 5 to 7 data points?
I worked on a similar problem earlier this year. The solution that I used was based on this paper, which uses linear algebra to eliminate $\beta_1$, the maximum. In this way, the results for the remai |
24,619 | Can these data be aggregated into a proportion for a binomial glm? | For proportional data, one can take the logarithm of the dependent variable before fitting since logarithms transform multiplication into addition. In a similar vein, if one also takes the logarithms of the independent variables, if they also are proportional, then the resulting fit for multiple linear regression implies a power function product model, not an additive one, i.e., $Y=c X_1^{k1}X_2^{k2}...X_n^{kn}$. That is, one fits $\ln(Y)=\ln(c)+k1 \ln(X_1)+k2 \ln(X_2)...+kn \ln(X_n)$. For proportional variables, this usually gives higher significance than linear fitting, and is more powerful, and has higher $R^2$.
Now if the unaltered regression line (ideally a bivariate regression, e.g., a Deming regression) does not plausibly pass through {0,0}, then it gets a bit more complicated, and one minimizes an offset proportional loss function rather than use ordinary least squares. | Can these data be aggregated into a proportion for a binomial glm? | For proportional data, one can take the logarithm of the dependent variable before fitting since logarithms transform multiplication into addition. In a similar vein, if one also takes the logarithms | Can these data be aggregated into a proportion for a binomial glm?
For proportional data, one can take the logarithm of the dependent variable before fitting since logarithms transform multiplication into addition. In a similar vein, if one also takes the logarithms of the independent variables, if they also are proportional, then the resulting fit for multiple linear regression implies a power function product model, not an additive one, i.e., $Y=c X_1^{k1}X_2^{k2}...X_n^{kn}$. That is, one fits $\ln(Y)=\ln(c)+k1 \ln(X_1)+k2 \ln(X_2)...+kn \ln(X_n)$. For proportional variables, this usually gives higher significance than linear fitting, and is more powerful, and has higher $R^2$.
Now if the unaltered regression line (ideally a bivariate regression, e.g., a Deming regression) does not plausibly pass through {0,0}, then it gets a bit more complicated, and one minimizes an offset proportional loss function rather than use ordinary least squares. | Can these data be aggregated into a proportion for a binomial glm?
For proportional data, one can take the logarithm of the dependent variable before fitting since logarithms transform multiplication into addition. In a similar vein, if one also takes the logarithms |
24,620 | Confidence intervals for difference in time series | If you can simulate from the two time series (let's call them $X_t$ and $Y_t$, where $t=1,2,...,T$), and if you simulate from both of them $S$ times so that you get the time series tuples $(\{X_t^s\}_{t=1}^T, \{Y_t^s\}_{t=1}^T)$ for $s = 1,2,...,S$,
then instead of calculating the median difference throughout time as
\begin{align}\Delta M = \text{median}(X_1^1-Y_1^1, X_2^1-Y_2^1,...,X_T^1-Y_T^1, X_1^2-Y_1^2,...,X_T^S-Y_T^S),\end{align} you could instead simulate from the median difference as a function of time. What I mean by this is that you can define \begin{align}\Delta M(t) = \text{median}( X_t^1-Y_t^1, X_t^2-Y_t^2, ..., X_t^S-Y_t^S),\end{align} so that you now get the median as a function of time. If you can assume that the median is the same across time, the estimates for $\Delta M(t)$ should coincide with the estimate for $\Delta M$ for large enough numbers of simulations $S$. But if the function $\Delta M(t)$ exhibits strong time-dependence (i.e. is very different for different values of $t$), you will be able to see this through simple means as for instance plotting. | Confidence intervals for difference in time series | If you can simulate from the two time series (let's call them $X_t$ and $Y_t$, where $t=1,2,...,T$), and if you simulate from both of them $S$ times so that you get the time series tuples $(\{X_t^s\}_ | Confidence intervals for difference in time series
If you can simulate from the two time series (let's call them $X_t$ and $Y_t$, where $t=1,2,...,T$), and if you simulate from both of them $S$ times so that you get the time series tuples $(\{X_t^s\}_{t=1}^T, \{Y_t^s\}_{t=1}^T)$ for $s = 1,2,...,S$,
then instead of calculating the median difference throughout time as
\begin{align}\Delta M = \text{median}(X_1^1-Y_1^1, X_2^1-Y_2^1,...,X_T^1-Y_T^1, X_1^2-Y_1^2,...,X_T^S-Y_T^S),\end{align} you could instead simulate from the median difference as a function of time. What I mean by this is that you can define \begin{align}\Delta M(t) = \text{median}( X_t^1-Y_t^1, X_t^2-Y_t^2, ..., X_t^S-Y_t^S),\end{align} so that you now get the median as a function of time. If you can assume that the median is the same across time, the estimates for $\Delta M(t)$ should coincide with the estimate for $\Delta M$ for large enough numbers of simulations $S$. But if the function $\Delta M(t)$ exhibits strong time-dependence (i.e. is very different for different values of $t$), you will be able to see this through simple means as for instance plotting. | Confidence intervals for difference in time series
If you can simulate from the two time series (let's call them $X_t$ and $Y_t$, where $t=1,2,...,T$), and if you simulate from both of them $S$ times so that you get the time series tuples $(\{X_t^s\}_ |
24,621 | Approximating integrals using Monte Carlo simulation in R | Just for reference, a low dimensional integral like that is usually more efficiently done via deterministic quadrature instead of Monte Carlo. Monte Carlo comes into its own at about 4 to 6 dimensions. Got to learn it in low dimensions first, of course... | Approximating integrals using Monte Carlo simulation in R | Just for reference, a low dimensional integral like that is usually more efficiently done via deterministic quadrature instead of Monte Carlo. Monte Carlo comes into its own at about 4 to 6 dimensions | Approximating integrals using Monte Carlo simulation in R
Just for reference, a low dimensional integral like that is usually more efficiently done via deterministic quadrature instead of Monte Carlo. Monte Carlo comes into its own at about 4 to 6 dimensions. Got to learn it in low dimensions first, of course... | Approximating integrals using Monte Carlo simulation in R
Just for reference, a low dimensional integral like that is usually more efficiently done via deterministic quadrature instead of Monte Carlo. Monte Carlo comes into its own at about 4 to 6 dimensions |
24,622 | Approximating integrals using Monte Carlo simulation in R | You can do it in Excel with Tukhi.
Enter
=tukhi.average(abs(2*rand()-1 - (2*rand()-1)))
and hit the run button. | Approximating integrals using Monte Carlo simulation in R | You can do it in Excel with Tukhi.
Enter
=tukhi.average(abs(2*rand()-1 - (2*rand()-1)))
and hit the run button. | Approximating integrals using Monte Carlo simulation in R
You can do it in Excel with Tukhi.
Enter
=tukhi.average(abs(2*rand()-1 - (2*rand()-1)))
and hit the run button. | Approximating integrals using Monte Carlo simulation in R
You can do it in Excel with Tukhi.
Enter
=tukhi.average(abs(2*rand()-1 - (2*rand()-1)))
and hit the run button. |
24,623 | Why does entropy as error measure leads to overfitting? | I think the key part for these two loss functions is that they are unbounded due to their using logs.
That is, with $x \in [0,1]$, as $x \rightarrow 0$, $\log{x} \rightarrow -\infty$. Here, "brittleness" seems to be implying that certain records can unduly influence the loss, so that a (small) number of these in the training set (and not the test set) would overly influence the loss score and so the update of training parameters, causing overfitting.
The cross-entropy loss function for classification for $n$ observations and some parameters $w$, predictions $\hat{y}$ and actual values $y$ is:
$$J(w) = -\frac{1}{n}\sum_{i=1}^{n}{(y_i \log\hat{y}_i + (1-y_i)\log{(1-\hat{y}_i)})} $$
You can see that if some prediction $\hat{y}_k$ is very small in this, then $\hat{y}_k$ will unduly influence the loss, especially if the true value $y_k$ is nearer to 1. Of course the function is trying to be expensive in these cases, but it's unbounded, so Langford is saying for some combinations of actual/model distribution, and some records, it's unusually expensive, and without already knowing the true distribution, this is always a risk. The same problem exists with mutual information.
A similar problem still exists with other loss functions e.g. high-leverage points in OLS, but it is not unbounded for a finite input domain, and for OLS at least, can be tested for and handled in all cases, using e.g. an influence matrix. | Why does entropy as error measure leads to overfitting? | I think the key part for these two loss functions is that they are unbounded due to their using logs.
That is, with $x \in [0,1]$, as $x \rightarrow 0$, $\log{x} \rightarrow -\infty$. Here, "brittlene | Why does entropy as error measure leads to overfitting?
I think the key part for these two loss functions is that they are unbounded due to their using logs.
That is, with $x \in [0,1]$, as $x \rightarrow 0$, $\log{x} \rightarrow -\infty$. Here, "brittleness" seems to be implying that certain records can unduly influence the loss, so that a (small) number of these in the training set (and not the test set) would overly influence the loss score and so the update of training parameters, causing overfitting.
The cross-entropy loss function for classification for $n$ observations and some parameters $w$, predictions $\hat{y}$ and actual values $y$ is:
$$J(w) = -\frac{1}{n}\sum_{i=1}^{n}{(y_i \log\hat{y}_i + (1-y_i)\log{(1-\hat{y}_i)})} $$
You can see that if some prediction $\hat{y}_k$ is very small in this, then $\hat{y}_k$ will unduly influence the loss, especially if the true value $y_k$ is nearer to 1. Of course the function is trying to be expensive in these cases, but it's unbounded, so Langford is saying for some combinations of actual/model distribution, and some records, it's unusually expensive, and without already knowing the true distribution, this is always a risk. The same problem exists with mutual information.
A similar problem still exists with other loss functions e.g. high-leverage points in OLS, but it is not unbounded for a finite input domain, and for OLS at least, can be tested for and handled in all cases, using e.g. an influence matrix. | Why does entropy as error measure leads to overfitting?
I think the key part for these two loss functions is that they are unbounded due to their using logs.
That is, with $x \in [0,1]$, as $x \rightarrow 0$, $\log{x} \rightarrow -\infty$. Here, "brittlene |
24,624 | Why does entropy as error measure leads to overfitting? | Any error measure which does not penalize the complexity of the system may lead to overfitting, e.g. entropy.
In general when you fit your training data to a model which you want to generalize well to new data, this training step is accomplished by minimizing some error measure $E (w) $ which depends, among many things, on your parameters $w $ (a vector that comprises all your model parameters which are going to be fit during training).
If your error measure just cares about fitting better and better your training data, you may find that building models with a huge number of parameters (that aditionally may take any value) is good because your model is so flexible that your training data can be perfectly learnt. On the other hand, if your training data is noisy (which is usually the case) you will this way make your model fit noise also, and this is what overfitting is about.
There are techniques to avoid this, which altogether are called "regularization" techniques, being the most common the ones which add a regularization term to the error function, so that now $E (w) = E_D (w) + E_W (w) $ where $E_D$ is an error that measures how good is your fit (e.g. entropy) and $E_W$ a penalization for complex models (larger for models with many parameters or large parameter values). | Why does entropy as error measure leads to overfitting? | Any error measure which does not penalize the complexity of the system may lead to overfitting, e.g. entropy.
In general when you fit your training data to a model which you want to generalize well to | Why does entropy as error measure leads to overfitting?
Any error measure which does not penalize the complexity of the system may lead to overfitting, e.g. entropy.
In general when you fit your training data to a model which you want to generalize well to new data, this training step is accomplished by minimizing some error measure $E (w) $ which depends, among many things, on your parameters $w $ (a vector that comprises all your model parameters which are going to be fit during training).
If your error measure just cares about fitting better and better your training data, you may find that building models with a huge number of parameters (that aditionally may take any value) is good because your model is so flexible that your training data can be perfectly learnt. On the other hand, if your training data is noisy (which is usually the case) you will this way make your model fit noise also, and this is what overfitting is about.
There are techniques to avoid this, which altogether are called "regularization" techniques, being the most common the ones which add a regularization term to the error function, so that now $E (w) = E_D (w) + E_W (w) $ where $E_D$ is an error that measures how good is your fit (e.g. entropy) and $E_W$ a penalization for complex models (larger for models with many parameters or large parameter values). | Why does entropy as error measure leads to overfitting?
Any error measure which does not penalize the complexity of the system may lead to overfitting, e.g. entropy.
In general when you fit your training data to a model which you want to generalize well to |
24,625 | Correlation between two binary variables within one categorical variable | I will try to simplify your question, and consider these simplifications.
If we ignore the group (and only consider group 1). You question is if there is any relation between var1 and var2.
As "hplieninger" comments above there is no way to compare the variables directly if you dont have measurements for both var1 and var2 for the same individual.
However, a practical solution, though not ideal, would be to use matching. In other words you match an individual with var1 with an individual with var2. Thus you get a dataset of 25 matches in each group. Hereafter you pretend that the matches is indeed the same person, and make a regression model.
I will not go into details about matching here, but be careful about conclusion following this metod.
Another way of simplifying is to consider only var1 and group. In this way you can use simple tests or a regression method to evaluate the association between group and var1. Similar with var2. However this does not consider any relation between var 1 and var2.
You can evaluate results to interpretate if var1 and var2 seems to have similar tendency across group, however note that this is only interpretation with not statistical evidence.
I hope this might help you forward in you process. | Correlation between two binary variables within one categorical variable | I will try to simplify your question, and consider these simplifications.
If we ignore the group (and only consider group 1). You question is if there is any relation between var1 and var2.
As "hplien | Correlation between two binary variables within one categorical variable
I will try to simplify your question, and consider these simplifications.
If we ignore the group (and only consider group 1). You question is if there is any relation between var1 and var2.
As "hplieninger" comments above there is no way to compare the variables directly if you dont have measurements for both var1 and var2 for the same individual.
However, a practical solution, though not ideal, would be to use matching. In other words you match an individual with var1 with an individual with var2. Thus you get a dataset of 25 matches in each group. Hereafter you pretend that the matches is indeed the same person, and make a regression model.
I will not go into details about matching here, but be careful about conclusion following this metod.
Another way of simplifying is to consider only var1 and group. In this way you can use simple tests or a regression method to evaluate the association between group and var1. Similar with var2. However this does not consider any relation between var 1 and var2.
You can evaluate results to interpretate if var1 and var2 seems to have similar tendency across group, however note that this is only interpretation with not statistical evidence.
I hope this might help you forward in you process. | Correlation between two binary variables within one categorical variable
I will try to simplify your question, and consider these simplifications.
If we ignore the group (and only consider group 1). You question is if there is any relation between var1 and var2.
As "hplien |
24,626 | Bound the difference between Spearman's Correlation and Kendall's Correlation | You may want to look at this paper! And other works by these authors. I can't remember exactly where, but I have seen your first graph in their papers, and some proofs along with it. I think this can be done by leveraging copulas (as Kendall tau and Spearman rho can be written as a function of the underlying copula between the two variables). Hope it helps.
$C$ is the copula of $(X,Y). $
$$\tau(X,Y) = 4\int_0^1 \int_0^1 C(u,v) c(u,v)~\mathrm du\mathrm dv - 1$$
(Kendall correlation is the expectancy of the copula rescaled into $[0,1]$)
$$\rho(X,Y) = 12 \int_0^1 \int_0^1 C(u,v) ~\mathrm du\mathrm dv- 3.$$
Then, $|\tau - \rho| \leq \ldots$ | Bound the difference between Spearman's Correlation and Kendall's Correlation | You may want to look at this paper! And other works by these authors. I can't remember exactly where, but I have seen your first graph in their papers, and some proofs along with it. I think this can | Bound the difference between Spearman's Correlation and Kendall's Correlation
You may want to look at this paper! And other works by these authors. I can't remember exactly where, but I have seen your first graph in their papers, and some proofs along with it. I think this can be done by leveraging copulas (as Kendall tau and Spearman rho can be written as a function of the underlying copula between the two variables). Hope it helps.
$C$ is the copula of $(X,Y). $
$$\tau(X,Y) = 4\int_0^1 \int_0^1 C(u,v) c(u,v)~\mathrm du\mathrm dv - 1$$
(Kendall correlation is the expectancy of the copula rescaled into $[0,1]$)
$$\rho(X,Y) = 12 \int_0^1 \int_0^1 C(u,v) ~\mathrm du\mathrm dv- 3.$$
Then, $|\tau - \rho| \leq \ldots$ | Bound the difference between Spearman's Correlation and Kendall's Correlation
You may want to look at this paper! And other works by these authors. I can't remember exactly where, but I have seen your first graph in their papers, and some proofs along with it. I think this can |
24,627 | Scaling the backward variable in HMM Baum-Welch | I don't this in itself indicates any problem. $\sum_{s \in S} \alpha_t(s)$ is the probability that the observed output sequence up to $t$ was $t_0, t_1, \dots,$ eSequence.get(t). Thus, it's fine for $c_t$ to be greater than one. Also, for instance for $\beta_{\mathrm{time}-1}$, it's $\sum_{s \in S}\beta_{\mathrm{time}-1}(s) = |S|c_{\mathrm{t}-1}$, which can very well be over one. | Scaling the backward variable in HMM Baum-Welch | I don't this in itself indicates any problem. $\sum_{s \in S} \alpha_t(s)$ is the probability that the observed output sequence up to $t$ was $t_0, t_1, \dots,$ eSequence.get(t). Thus, it's fine for $ | Scaling the backward variable in HMM Baum-Welch
I don't this in itself indicates any problem. $\sum_{s \in S} \alpha_t(s)$ is the probability that the observed output sequence up to $t$ was $t_0, t_1, \dots,$ eSequence.get(t). Thus, it's fine for $c_t$ to be greater than one. Also, for instance for $\beta_{\mathrm{time}-1}$, it's $\sum_{s \in S}\beta_{\mathrm{time}-1}(s) = |S|c_{\mathrm{t}-1}$, which can very well be over one. | Scaling the backward variable in HMM Baum-Welch
I don't this in itself indicates any problem. $\sum_{s \in S} \alpha_t(s)$ is the probability that the observed output sequence up to $t$ was $t_0, t_1, \dots,$ eSequence.get(t). Thus, it's fine for $ |
24,628 | Scaling the backward variable in HMM Baum-Welch | I have another idea, as scaled $\beta$ represents that
$$β_t(s) = \frac {p (x_{t+1},...,x_N | s_t = s)}{p (x_{t+1},...,x_N | x_1,...,x_t)}$$
so, I think $\beta$ can be over 1.
reference this note(page 8) | Scaling the backward variable in HMM Baum-Welch | I have another idea, as scaled $\beta$ represents that
$$β_t(s) = \frac {p (x_{t+1},...,x_N | s_t = s)}{p (x_{t+1},...,x_N | x_1,...,x_t)}$$
so, I think $\beta$ can be over 1.
reference this note(pag | Scaling the backward variable in HMM Baum-Welch
I have another idea, as scaled $\beta$ represents that
$$β_t(s) = \frac {p (x_{t+1},...,x_N | s_t = s)}{p (x_{t+1},...,x_N | x_1,...,x_t)}$$
so, I think $\beta$ can be over 1.
reference this note(page 8) | Scaling the backward variable in HMM Baum-Welch
I have another idea, as scaled $\beta$ represents that
$$β_t(s) = \frac {p (x_{t+1},...,x_N | s_t = s)}{p (x_{t+1},...,x_N | x_1,...,x_t)}$$
so, I think $\beta$ can be over 1.
reference this note(pag |
24,629 | Is binning data valid prior to Pearson correlation? | Not exactly the same as your question, but on a related note, I remember reading an article a while back (either The American Statistician or Chance magazine, sometime between 2000 and 2003) that showed that for any dataset of 2 variables where they are pretty much uncorrelated you can find a way to bin the "predictor" variable, then take the average of the response variable within each bin and depending on how you do the binning show either a positive relationship or a negative relationship in a table or simple plot. | Is binning data valid prior to Pearson correlation? | Not exactly the same as your question, but on a related note, I remember reading an article a while back (either The American Statistician or Chance magazine, sometime between 2000 and 2003) that show | Is binning data valid prior to Pearson correlation?
Not exactly the same as your question, but on a related note, I remember reading an article a while back (either The American Statistician or Chance magazine, sometime between 2000 and 2003) that showed that for any dataset of 2 variables where they are pretty much uncorrelated you can find a way to bin the "predictor" variable, then take the average of the response variable within each bin and depending on how you do the binning show either a positive relationship or a negative relationship in a table or simple plot. | Is binning data valid prior to Pearson correlation?
Not exactly the same as your question, but on a related note, I remember reading an article a while back (either The American Statistician or Chance magazine, sometime between 2000 and 2003) that show |
24,630 | Is binning data valid prior to Pearson correlation? | Correlation coefficient is a measure of uncertainty in predicting value Y from value X measured for an individual sampled object, such as a patient. In focusing on this prediction you do not 'bin' individual readouts: your blood sample is your blood sample not other's. If however the nature of your data permits binning / averaging it normally means that you do not care about individual readouts (happy to mix them together) but want to see if there is a TREND in your sample. Here, you look for a (linear) regression and its significance instead because the correlation coeffcient would depend directly on the way you bin your data. Somehow, most biological papers ignore this. | Is binning data valid prior to Pearson correlation? | Correlation coefficient is a measure of uncertainty in predicting value Y from value X measured for an individual sampled object, such as a patient. In focusing on this prediction you do not 'bin' ind | Is binning data valid prior to Pearson correlation?
Correlation coefficient is a measure of uncertainty in predicting value Y from value X measured for an individual sampled object, such as a patient. In focusing on this prediction you do not 'bin' individual readouts: your blood sample is your blood sample not other's. If however the nature of your data permits binning / averaging it normally means that you do not care about individual readouts (happy to mix them together) but want to see if there is a TREND in your sample. Here, you look for a (linear) regression and its significance instead because the correlation coeffcient would depend directly on the way you bin your data. Somehow, most biological papers ignore this. | Is binning data valid prior to Pearson correlation?
Correlation coefficient is a measure of uncertainty in predicting value Y from value X measured for an individual sampled object, such as a patient. In focusing on this prediction you do not 'bin' ind |
24,631 | Is binning data valid prior to Pearson correlation? | The main reason to bin data is to allow for the possibility of a nonlinear relationship between the variables. The Pearson correlation measures strength of linear association, so it doesn't work well when the relationship is nonlinear.
There are obviously much better ways to handle this issue than binning. For example, you might fit a nonlinear or local regression model and correlate the predicted and actual response values (although this assumes that a predictor-response approach is valid, whereas correlation is symmetric). Binning is just a way of solving the problem of nonlinearity that people without a statistics background or statistical tools might use. | Is binning data valid prior to Pearson correlation? | The main reason to bin data is to allow for the possibility of a nonlinear relationship between the variables. The Pearson correlation measures strength of linear association, so it doesn't work well | Is binning data valid prior to Pearson correlation?
The main reason to bin data is to allow for the possibility of a nonlinear relationship between the variables. The Pearson correlation measures strength of linear association, so it doesn't work well when the relationship is nonlinear.
There are obviously much better ways to handle this issue than binning. For example, you might fit a nonlinear or local regression model and correlate the predicted and actual response values (although this assumes that a predictor-response approach is valid, whereas correlation is symmetric). Binning is just a way of solving the problem of nonlinearity that people without a statistics background or statistical tools might use. | Is binning data valid prior to Pearson correlation?
The main reason to bin data is to allow for the possibility of a nonlinear relationship between the variables. The Pearson correlation measures strength of linear association, so it doesn't work well |
24,632 | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | Normally I wouldn't report $R^2$ at all. Hosmer and Lemeshow, in their textbook Applied Logistic Regression (2nd Ed.), explain why:
In general, [$R^2$ measures] are based on various comparisons of the predicted values from the fitted model to those from [the base model], the no data or intercept only model and, as a result, do not assess goodness-of-fit. We think that a true measure of fit is one based strictly on a comparison of observed to predicted values from the fitted model.
[At p. 164.]
Concerning various ML versions of $R^2$, the "pseudo $R^2$" stat, they mention that it is not "recommended for routine use, as it is not as intuitively easy to explain," but they feel obliged to describe it because various software packages report it.
They conclude this discussion by writing,
...low $R^2$ values in logistic regression are the norm and this presents a problem when reporting their values to an audience accustomed to seeing linear regression values. ... Thus [arguing by reference to running examples in the text] we do not recommend routine publishing of $R^2$ values with results from fitted logistic models. However, they may be helpful in the model building state as a statistic to evaluate competing models.
[At p. 167.]
My experience with some large logistic models (100k to 300k records, 100 - 300 explanatory variables) has been exactly as H & L describe. I could achieve relatively high $R^2$ with my data, up to about 0.40. These corresponded to classification error rates between 3% and 15% (false negatives and false positives, balanced, as confirmed using 50% hold-out datasets). As H & L hinted, I had to spend a lot of time disabusing the client (a sophisticated consultant himself, who was familiar with $R^2$) concerning $R^2$ and getting him to focus on what mattered in the analysis (the classification error rates). I can warmly recommend describing the results of your analysis without reference to $R^2$, which is more likely to mislead than not. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | Normally I wouldn't report $R^2$ at all. Hosmer and Lemeshow, in their textbook Applied Logistic Regression (2nd Ed.), explain why:
In general, [$R^2$ measures] are based on various comparisons of t | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
Normally I wouldn't report $R^2$ at all. Hosmer and Lemeshow, in their textbook Applied Logistic Regression (2nd Ed.), explain why:
In general, [$R^2$ measures] are based on various comparisons of the predicted values from the fitted model to those from [the base model], the no data or intercept only model and, as a result, do not assess goodness-of-fit. We think that a true measure of fit is one based strictly on a comparison of observed to predicted values from the fitted model.
[At p. 164.]
Concerning various ML versions of $R^2$, the "pseudo $R^2$" stat, they mention that it is not "recommended for routine use, as it is not as intuitively easy to explain," but they feel obliged to describe it because various software packages report it.
They conclude this discussion by writing,
...low $R^2$ values in logistic regression are the norm and this presents a problem when reporting their values to an audience accustomed to seeing linear regression values. ... Thus [arguing by reference to running examples in the text] we do not recommend routine publishing of $R^2$ values with results from fitted logistic models. However, they may be helpful in the model building state as a statistic to evaluate competing models.
[At p. 167.]
My experience with some large logistic models (100k to 300k records, 100 - 300 explanatory variables) has been exactly as H & L describe. I could achieve relatively high $R^2$ with my data, up to about 0.40. These corresponded to classification error rates between 3% and 15% (false negatives and false positives, balanced, as confirmed using 50% hold-out datasets). As H & L hinted, I had to spend a lot of time disabusing the client (a sophisticated consultant himself, who was familiar with $R^2$) concerning $R^2$ and getting him to focus on what mattered in the analysis (the classification error rates). I can warmly recommend describing the results of your analysis without reference to $R^2$, which is more likely to mislead than not. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
Normally I wouldn't report $R^2$ at all. Hosmer and Lemeshow, in their textbook Applied Logistic Regression (2nd Ed.), explain why:
In general, [$R^2$ measures] are based on various comparisons of t |
24,633 | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | Both indices are measures of strength of association (i.e. whether any predictor is associated with the outcome, as for an LR test), and can be used to quantify predictive ability or model performance. A single predictor may have a significant effect on the outcome but it might not necessarily be so useful for predicting individual response, hence the need to assess model performance as a whole (wrt. the null model). The Nagelkerke $R^2$ is useful because it has a maximum value of 1.0, as Srikant said. This is just a normalized version of the $R^2$ computed from the likelihood ratio, $R^2_{\text{LR}}=1-\exp(-\text{LR}/n)$, which has connection with the Wald statistic for overall association, as originally proposed by Cox and Snell.
Other indices of predictive ability are Brier score, the C index (concordance probability or ROC area), or Somers' D, the latter two providing a better measure of predictive discrimination.
The only assumptions made in logistic regression are that of linearity and additivity (+ independence). Although many global goodness-of-fit tests (like the Hosmer & Lemeshow $\chi^2$ test, but see my comment to @onestop) have been proposed, they generally lack power. For assessing model fit, it is better to rely on visual criteria (stratified estimates, nonparametric smoothing) that help to spot local or global departure between predicted and observed outcomes (e.g. non-linearity or interaction), and this is largely detailed in Harrell's RMS handout. On a related subject (calibration tests), Steyerberg (Clinical Prediction Models, 2009) points to the same approach for assessing the agreement between observed outcomes and predicted probabilities:
Calibration is related to
goodness-of-fit, which relates to the
ability of a model to fit a given set
of data. Typically, there is no single
goodness-of-fit test that has good
power against all kinds of lack of fit
of a prediction model. Examples of
lack of fit are missed
non-linearities, interactions, or an
inappropriate link function between
the linear predictor and the outcome.
Goodness-of-fit can be tested with a
$\chi^2$ statistic. (p. 274)
He also suggests to rely on the absolute difference between smoothed observed outcomes and predicted probabilities either visually, or with the so-called Harrell's E statistic.
More details can be found in Harrell's book, Regression Modeling Strategies (pp. 203-205, 230-244, 247-249). For a more recent discussion, see also
Steyerberg, EW, Vickers, AJ, Cook, NR, Gerds, T, Gonen, M, Obuchowski, N, Pencina, MJ, and Kattan, MW (2010). Assessing the Performance of Prediction Models, A Framework for Traditional and Novel Measures. Epidemiology, 21(1), 128-138. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | Both indices are measures of strength of association (i.e. whether any predictor is associated with the outcome, as for an LR test), and can be used to quantify predictive ability or model performance | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
Both indices are measures of strength of association (i.e. whether any predictor is associated with the outcome, as for an LR test), and can be used to quantify predictive ability or model performance. A single predictor may have a significant effect on the outcome but it might not necessarily be so useful for predicting individual response, hence the need to assess model performance as a whole (wrt. the null model). The Nagelkerke $R^2$ is useful because it has a maximum value of 1.0, as Srikant said. This is just a normalized version of the $R^2$ computed from the likelihood ratio, $R^2_{\text{LR}}=1-\exp(-\text{LR}/n)$, which has connection with the Wald statistic for overall association, as originally proposed by Cox and Snell.
Other indices of predictive ability are Brier score, the C index (concordance probability or ROC area), or Somers' D, the latter two providing a better measure of predictive discrimination.
The only assumptions made in logistic regression are that of linearity and additivity (+ independence). Although many global goodness-of-fit tests (like the Hosmer & Lemeshow $\chi^2$ test, but see my comment to @onestop) have been proposed, they generally lack power. For assessing model fit, it is better to rely on visual criteria (stratified estimates, nonparametric smoothing) that help to spot local or global departure between predicted and observed outcomes (e.g. non-linearity or interaction), and this is largely detailed in Harrell's RMS handout. On a related subject (calibration tests), Steyerberg (Clinical Prediction Models, 2009) points to the same approach for assessing the agreement between observed outcomes and predicted probabilities:
Calibration is related to
goodness-of-fit, which relates to the
ability of a model to fit a given set
of data. Typically, there is no single
goodness-of-fit test that has good
power against all kinds of lack of fit
of a prediction model. Examples of
lack of fit are missed
non-linearities, interactions, or an
inappropriate link function between
the linear predictor and the outcome.
Goodness-of-fit can be tested with a
$\chi^2$ statistic. (p. 274)
He also suggests to rely on the absolute difference between smoothed observed outcomes and predicted probabilities either visually, or with the so-called Harrell's E statistic.
More details can be found in Harrell's book, Regression Modeling Strategies (pp. 203-205, 230-244, 247-249). For a more recent discussion, see also
Steyerberg, EW, Vickers, AJ, Cook, NR, Gerds, T, Gonen, M, Obuchowski, N, Pencina, MJ, and Kattan, MW (2010). Assessing the Performance of Prediction Models, A Framework for Traditional and Novel Measures. Epidemiology, 21(1), 128-138. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
Both indices are measures of strength of association (i.e. whether any predictor is associated with the outcome, as for an LR test), and can be used to quantify predictive ability or model performance |
24,634 | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | I would have thought the main problem with any kind of $R^2$ measure for logistic regression is that you are dealing with a model which has a known noise value. This is unlike standard linear regression, where the noise level is usually treated as unknown. For we can write a glm probability density function as:
$$f(y_i|\mu_i,\phi)=\exp\left(\frac{y_ib(\mu_i)-c(\mu_i)}{\phi}+d(y_i,\phi)\right)$$
Where $b(.),\ c(.),\ d(.;.)$ are known functions, and $\mu_i=g^{-1}(x_i^T\beta)$ for inverse link function $g^{-1}(.)$. If we define the usual GLM deviance residuals as
\begin{align}
d_i^2 &= 2\phi\left(\log[f(y_i|\mu_i=y_i,\phi)]-\log[f(y_i|\mu_i=\hat{\mu}_i,\phi)]\right) \\
&= 2\phi \left[y_ib(y_i)-y_ib(\hat{\mu}_i)-c(y_i)+c(\hat{\mu}_i)\right]
\end{align}
The we have (via likelihood ratio chi-square, $\chi^2=\frac{1}{\phi}\sum_{i=1}^{N}d_i^2$)
$$E\left(\sum_{i=1}^{N}d_i^2\right)=E(\phi\chi^2)\approx (N-p)\phi$$
Where $p$ is the dimension of $\beta$. For logistic regression we have $\phi=1$, which is known. So we can use this to decide on a definite level of residual that is "acceptable" or "reasonable". This usually cannot be done for OLS regression (unless you have prior information about the noise). Namely, we expect each deviance residual to be about $1$. Too many $d_i^2\gg1$ and it is likely that an important effects are missing from the model (under-fitting); too many $d_i^2\ll1$ and it is likely that there are redundant or spurious effects in the model (over-fitting). (these could also mean model mispecification).
Now this means that the problem for the pseudo-$R^2$ is that it fails to take into account that the level of binomial variation is predictable (provided the binomial error structure isn't being questioned). Thus even though Nagelkerke ranges from $0$ to $1$, it is still not scaled properly. Additionally, I can't see why these are called pseudo $R^2$ if they aren't equal to the usual $R^2$ when you fit a "GLM" with an identity link and normal error. For example, the equivalent cox-snell R-squared for normal error (using REML estimate of variance) is given by:
$$R^2_{CS}=1-\exp\left(-\frac{N-p}{N}\cdot \frac{R^2_{OLS}}{1-R^2_{OLS}}\right)$$
Which certainly looks strange.
I think the better "Goodness of Fit" measure is the sum of the deviance residuals, $\chi^2$. This is mainly because we have a target to aim for. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | I would have thought the main problem with any kind of $R^2$ measure for logistic regression is that you are dealing with a model which has a known noise value. This is unlike standard linear regress | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
I would have thought the main problem with any kind of $R^2$ measure for logistic regression is that you are dealing with a model which has a known noise value. This is unlike standard linear regression, where the noise level is usually treated as unknown. For we can write a glm probability density function as:
$$f(y_i|\mu_i,\phi)=\exp\left(\frac{y_ib(\mu_i)-c(\mu_i)}{\phi}+d(y_i,\phi)\right)$$
Where $b(.),\ c(.),\ d(.;.)$ are known functions, and $\mu_i=g^{-1}(x_i^T\beta)$ for inverse link function $g^{-1}(.)$. If we define the usual GLM deviance residuals as
\begin{align}
d_i^2 &= 2\phi\left(\log[f(y_i|\mu_i=y_i,\phi)]-\log[f(y_i|\mu_i=\hat{\mu}_i,\phi)]\right) \\
&= 2\phi \left[y_ib(y_i)-y_ib(\hat{\mu}_i)-c(y_i)+c(\hat{\mu}_i)\right]
\end{align}
The we have (via likelihood ratio chi-square, $\chi^2=\frac{1}{\phi}\sum_{i=1}^{N}d_i^2$)
$$E\left(\sum_{i=1}^{N}d_i^2\right)=E(\phi\chi^2)\approx (N-p)\phi$$
Where $p$ is the dimension of $\beta$. For logistic regression we have $\phi=1$, which is known. So we can use this to decide on a definite level of residual that is "acceptable" or "reasonable". This usually cannot be done for OLS regression (unless you have prior information about the noise). Namely, we expect each deviance residual to be about $1$. Too many $d_i^2\gg1$ and it is likely that an important effects are missing from the model (under-fitting); too many $d_i^2\ll1$ and it is likely that there are redundant or spurious effects in the model (over-fitting). (these could also mean model mispecification).
Now this means that the problem for the pseudo-$R^2$ is that it fails to take into account that the level of binomial variation is predictable (provided the binomial error structure isn't being questioned). Thus even though Nagelkerke ranges from $0$ to $1$, it is still not scaled properly. Additionally, I can't see why these are called pseudo $R^2$ if they aren't equal to the usual $R^2$ when you fit a "GLM" with an identity link and normal error. For example, the equivalent cox-snell R-squared for normal error (using REML estimate of variance) is given by:
$$R^2_{CS}=1-\exp\left(-\frac{N-p}{N}\cdot \frac{R^2_{OLS}}{1-R^2_{OLS}}\right)$$
Which certainly looks strange.
I think the better "Goodness of Fit" measure is the sum of the deviance residuals, $\chi^2$. This is mainly because we have a target to aim for. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
I would have thought the main problem with any kind of $R^2$ measure for logistic regression is that you are dealing with a model which has a known noise value. This is unlike standard linear regress |
24,635 | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | I found Tue Tjur's short paper "Coefficients of Determination in Logistic Regression Models - A New Proposal: The Coefficient of Discrimination" (2009,
The American Statistician) on various proposals for a coefficient of determination in logistic models quite enlightening. He does a good job highlighting pros and cons - and of course offers a new definition. Very much recommended (though I have no favorite myself). | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | I found Tue Tjur's short paper "Coefficients of Determination in Logistic Regression Models - A New Proposal: The Coefficient of Discrimination" (2009,
The American Statistician) on various proposals | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
I found Tue Tjur's short paper "Coefficients of Determination in Logistic Regression Models - A New Proposal: The Coefficient of Discrimination" (2009,
The American Statistician) on various proposals for a coefficient of determination in logistic models quite enlightening. He does a good job highlighting pros and cons - and of course offers a new definition. Very much recommended (though I have no favorite myself). | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
I found Tue Tjur's short paper "Coefficients of Determination in Logistic Regression Models - A New Proposal: The Coefficient of Discrimination" (2009,
The American Statistician) on various proposals |
24,636 | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | I was also going to say 'neither of them', so i've upvoted whuber's answer.
As well as criticising R^2, Hosmer & Lemeshow did propose an alternative measure of goodness-of-fit for logistic regression that is sometimes useful. This is based on dividing the data into (say) 10 groups of equal size (or as near as possible) by ordering on the predicted probability (or equivalently, the linear predictor) then comparing the observed to expected number of positive responses in each group and performing a chi-squared test. This 'Hosmer-Lemeshow goodness-of-fit test' is implemented in most statistical software packages. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | I was also going to say 'neither of them', so i've upvoted whuber's answer.
As well as criticising R^2, Hosmer & Lemeshow did propose an alternative measure of goodness-of-fit for logistic regression | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
I was also going to say 'neither of them', so i've upvoted whuber's answer.
As well as criticising R^2, Hosmer & Lemeshow did propose an alternative measure of goodness-of-fit for logistic regression that is sometimes useful. This is based on dividing the data into (say) 10 groups of equal size (or as near as possible) by ordering on the predicted probability (or equivalently, the linear predictor) then comparing the observed to expected number of positive responses in each group and performing a chi-squared test. This 'Hosmer-Lemeshow goodness-of-fit test' is implemented in most statistical software packages. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
I was also going to say 'neither of them', so i've upvoted whuber's answer.
As well as criticising R^2, Hosmer & Lemeshow did propose an alternative measure of goodness-of-fit for logistic regression |
24,637 | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | Despite the arguments against using pseudo-r-squareds, some people will for various reasons want to continue using them at least at certain times. What I have internalized from my readings (and I'm sorry I cannot provide citations at the moment) is that
if both C&S and Nag. are below .5, C&S will be a better gauge;
if
they're both above .5, Nag. will; and
if they straddle .5, punt.
Also, a formula whose results often fall between these two, mentioned by Scott Menard in Applied Logistic Regression Analysis (Sage), is
[-2LL0 - (-2LL1)]/-2LL0.
This is denoted as "L" in the chart below. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | Despite the arguments against using pseudo-r-squareds, some people will for various reasons want to continue using them at least at certain times. What I have internalized from my readings (and I'm s | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
Despite the arguments against using pseudo-r-squareds, some people will for various reasons want to continue using them at least at certain times. What I have internalized from my readings (and I'm sorry I cannot provide citations at the moment) is that
if both C&S and Nag. are below .5, C&S will be a better gauge;
if
they're both above .5, Nag. will; and
if they straddle .5, punt.
Also, a formula whose results often fall between these two, mentioned by Scott Menard in Applied Logistic Regression Analysis (Sage), is
[-2LL0 - (-2LL1)]/-2LL0.
This is denoted as "L" in the chart below. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
Despite the arguments against using pseudo-r-squareds, some people will for various reasons want to continue using them at least at certain times. What I have internalized from my readings (and I'm s |
24,638 | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | I would agree in general that just using R2 is not good. But also see that point of @rolando2 comments that focusing on classification metrics could be not enough while comparing the models.
I guess my contribution to the discussion is that I think that several measures are to be reported to assess different model qualities.
For example, one may not only want to know what happens at the optimum threshold which separates cases from non-cases and respective error rates (false positives etc and integrated measure of this which is c-statistic), but also how good model output in terms of probabilities of being a case or non-case is close to reality (or corresponds to the actual rate of cases in the pool of observations with given parameters) across ALL ranges of output. I.e. that if it says an observation is 20% likely to have output of 1, that around 20% of observations with similar risk factors are cases. This is what referred to as calibration quality as opposed to discrimination (e.g. in Steyerberg et al Assessing the performance of prediction models: a framework for traditional and novel measures.) And this is exactly what calibration plot visually assesses, while Hosmer & Lemeshow quantified it in their goodness-of-fit statistics. The critics of H-L is that it depends on how you group observations, and playing with it I see that the value can change quite a bit on different data. Calibration slopes and intercept may be good alternative if one also does cross-validation or evaluates the model on a hold-out data as in predictive modelling.
Finally, some kind of R2, preferably Brier score or scaled Brier score, can be used to assess the overall fit. This measure is the same as R2 for linear regression, where error is defined as diff in probability and binary output, but also takes into account known variance of the binary output and normalises by q*(1-q).
Also, for a narrower discussion on checking of adding a new predictor makes a better model, IDI - integrated discrimination improvement, which is similar to the difference in scaled Brier scores, could be a very good addition to, say, the change in c-statistics or how good reclassification was - as it checks how re-classification got better across all thresholds. (Pencina MJ, D’Agostino RB, D’Agostino RB, Vasan RS. Evaluating the added predictive ability of a new marker: from area under the ROC curve to reclassification and beyond) | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | I would agree in general that just using R2 is not good. But also see that point of @rolando2 comments that focusing on classification metrics could be not enough while comparing the models.
I guess m | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
I would agree in general that just using R2 is not good. But also see that point of @rolando2 comments that focusing on classification metrics could be not enough while comparing the models.
I guess my contribution to the discussion is that I think that several measures are to be reported to assess different model qualities.
For example, one may not only want to know what happens at the optimum threshold which separates cases from non-cases and respective error rates (false positives etc and integrated measure of this which is c-statistic), but also how good model output in terms of probabilities of being a case or non-case is close to reality (or corresponds to the actual rate of cases in the pool of observations with given parameters) across ALL ranges of output. I.e. that if it says an observation is 20% likely to have output of 1, that around 20% of observations with similar risk factors are cases. This is what referred to as calibration quality as opposed to discrimination (e.g. in Steyerberg et al Assessing the performance of prediction models: a framework for traditional and novel measures.) And this is exactly what calibration plot visually assesses, while Hosmer & Lemeshow quantified it in their goodness-of-fit statistics. The critics of H-L is that it depends on how you group observations, and playing with it I see that the value can change quite a bit on different data. Calibration slopes and intercept may be good alternative if one also does cross-validation or evaluates the model on a hold-out data as in predictive modelling.
Finally, some kind of R2, preferably Brier score or scaled Brier score, can be used to assess the overall fit. This measure is the same as R2 for linear regression, where error is defined as diff in probability and binary output, but also takes into account known variance of the binary output and normalises by q*(1-q).
Also, for a narrower discussion on checking of adding a new predictor makes a better model, IDI - integrated discrimination improvement, which is similar to the difference in scaled Brier scores, could be a very good addition to, say, the change in c-statistics or how good reclassification was - as it checks how re-classification got better across all thresholds. (Pencina MJ, D’Agostino RB, D’Agostino RB, Vasan RS. Evaluating the added predictive ability of a new marker: from area under the ROC curve to reclassification and beyond) | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
I would agree in general that just using R2 is not good. But also see that point of @rolando2 comments that focusing on classification metrics could be not enough while comparing the models.
I guess m |
24,639 | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | I would prefer the Nagelkerke as this model fit attains 1 when the model fits perfectly giving the reader a sense of how far your model is from perfect fit. The Cox & Shell does not attain 1 for perfect model fit and hence interpreting a value of 0.09 is a bit harder. See this url for further info on Pseudo RSquared for an explanation of various types of fits. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | I would prefer the Nagelkerke as this model fit attains 1 when the model fits perfectly giving the reader a sense of how far your model is from perfect fit. The Cox & Shell does not attain 1 for perfe | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
I would prefer the Nagelkerke as this model fit attains 1 when the model fits perfectly giving the reader a sense of how far your model is from perfect fit. The Cox & Shell does not attain 1 for perfect model fit and hence interpreting a value of 0.09 is a bit harder. See this url for further info on Pseudo RSquared for an explanation of various types of fits. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
I would prefer the Nagelkerke as this model fit attains 1 when the model fits perfectly giving the reader a sense of how far your model is from perfect fit. The Cox & Shell does not attain 1 for perfe |
24,640 | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | Instead of the Nagelkerke way of scaling $R^2$ to allow a 1.0 to be attained, I prefer to substitute the effective sample size for $N$ in the $R^2$ formula. This will not reach 1.0 for perfect binary predictions but this approach translates to other settings such as survival analysis where often the effective $N$ is the number of events, and to ordinal regression. See https://hbiostat.org/bib/r2.html.
Of those my favorite is the modified Maddala-Cox-Snell $R^{2}_{m,p}$ which uses effective sample size $m$ and penalizes for $p$ covariates. In the normal linear model this is almost exactly the traditional $R^{2}_{\mathrm{adj}}$. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)? | Instead of the Nagelkerke way of scaling $R^2$ to allow a 1.0 to be attained, I prefer to substitute the effective sample size for $N$ in the $R^2$ formula. This will not reach 1.0 for perfect binary | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
Instead of the Nagelkerke way of scaling $R^2$ to allow a 1.0 to be attained, I prefer to substitute the effective sample size for $N$ in the $R^2$ formula. This will not reach 1.0 for perfect binary predictions but this approach translates to other settings such as survival analysis where often the effective $N$ is the number of events, and to ordinal regression. See https://hbiostat.org/bib/r2.html.
Of those my favorite is the modified Maddala-Cox-Snell $R^{2}_{m,p}$ which uses effective sample size $m$ and penalizes for $p$ covariates. In the normal linear model this is almost exactly the traditional $R^{2}_{\mathrm{adj}}$. | Which pseudo-$R^2$ measure is the one to report for logistic regression (Cox & Snell or Nagelkerke)?
Instead of the Nagelkerke way of scaling $R^2$ to allow a 1.0 to be attained, I prefer to substitute the effective sample size for $N$ in the $R^2$ formula. This will not reach 1.0 for perfect binary |
24,641 | Unit testing sampling methods | Apart from the standard checks over the traces (correlation, whether it mixes well and so), for "unit testing" the sampling of each variable, for instance, in my Gibbs samplers, I do the following:
Create a small toy dataset.
In my Gibbs sampler, comment out (I use if True and if False statements) all variables but one, where the fixed variables (the ones not being sampled this time) are set to their true values.
See whether the one sampled variable converges to its true value.
Do it with all the variables one by one. Then sampling two variables (try different pairs), and so, until I sample them all. Then I can use a more complicated toy dataset or just try over real data.
(still, I would love to see how other people do it and whether there is some "good practice" in terms of programming) | Unit testing sampling methods | Apart from the standard checks over the traces (correlation, whether it mixes well and so), for "unit testing" the sampling of each variable, for instance, in my Gibbs samplers, I do the following:
C | Unit testing sampling methods
Apart from the standard checks over the traces (correlation, whether it mixes well and so), for "unit testing" the sampling of each variable, for instance, in my Gibbs samplers, I do the following:
Create a small toy dataset.
In my Gibbs sampler, comment out (I use if True and if False statements) all variables but one, where the fixed variables (the ones not being sampled this time) are set to their true values.
See whether the one sampled variable converges to its true value.
Do it with all the variables one by one. Then sampling two variables (try different pairs), and so, until I sample them all. Then I can use a more complicated toy dataset or just try over real data.
(still, I would love to see how other people do it and whether there is some "good practice" in terms of programming) | Unit testing sampling methods
Apart from the standard checks over the traces (correlation, whether it mixes well and so), for "unit testing" the sampling of each variable, for instance, in my Gibbs samplers, I do the following:
C |
24,642 | Regress residuals in second regression | What you're describing is called 'two-stage residual inclusion' or 'control function' approach. In a linear model, it gives exactly the same estimator as "traditional" two-stage least squares, as for instance derived by Hansen, pp. 335-38. But in both cases, you need a valid IV. So your idea of doing this without an instrument in the first stage won't work. | Regress residuals in second regression | What you're describing is called 'two-stage residual inclusion' or 'control function' approach. In a linear model, it gives exactly the same estimator as "traditional" two-stage least squares, as for | Regress residuals in second regression
What you're describing is called 'two-stage residual inclusion' or 'control function' approach. In a linear model, it gives exactly the same estimator as "traditional" two-stage least squares, as for instance derived by Hansen, pp. 335-38. But in both cases, you need a valid IV. So your idea of doing this without an instrument in the first stage won't work. | Regress residuals in second regression
What you're describing is called 'two-stage residual inclusion' or 'control function' approach. In a linear model, it gives exactly the same estimator as "traditional" two-stage least squares, as for |
24,643 | Confidence Intervals for AUC using cross-validation | (1) and (2) are attempts to summarize the distribution of the estimates over repeating the cross-validation, but as @cbeleites unhappy with SX mentioned, this is not a meaningful interval for the true AUC. As mentioned by @user44764, your answer (3) is wrong as it tacitly assumes independence of AUC values across folds, which is wrong. It would only be correct if you had several AUC estimates of independent test datasets, and even then only apply to the specific training dataset, not to the AUC over all possible training datasets. To estimate the latter, you would need several sets of training and test datasets for which to calculate AUC, and then find the variance between them, which is rare. Instead, cross-validation is commonly used to estimate this latter AUC.
LeDell et al. (2015) provide an attractive method to find the confidence interval for the AUC, with R implementation: Computationally efficient confidence intervals for cross-
validated area under the ROC curve estimates. | Confidence Intervals for AUC using cross-validation | (1) and (2) are attempts to summarize the distribution of the estimates over repeating the cross-validation, but as @cbeleites unhappy with SX mentioned, this is not a meaningful interval for the true | Confidence Intervals for AUC using cross-validation
(1) and (2) are attempts to summarize the distribution of the estimates over repeating the cross-validation, but as @cbeleites unhappy with SX mentioned, this is not a meaningful interval for the true AUC. As mentioned by @user44764, your answer (3) is wrong as it tacitly assumes independence of AUC values across folds, which is wrong. It would only be correct if you had several AUC estimates of independent test datasets, and even then only apply to the specific training dataset, not to the AUC over all possible training datasets. To estimate the latter, you would need several sets of training and test datasets for which to calculate AUC, and then find the variance between them, which is rare. Instead, cross-validation is commonly used to estimate this latter AUC.
LeDell et al. (2015) provide an attractive method to find the confidence interval for the AUC, with R implementation: Computationally efficient confidence intervals for cross-
validated area under the ROC curve estimates. | Confidence Intervals for AUC using cross-validation
(1) and (2) are attempts to summarize the distribution of the estimates over repeating the cross-validation, but as @cbeleites unhappy with SX mentioned, this is not a meaningful interval for the true |
24,644 | Confidence Intervals for AUC using cross-validation | Here is a sample of how you would do it in python.
from sklearn import cross_validation
scores = cross_validation.cross_val_score(your_model, your_data, y, cv=10)
mean_score = scores.mean()
std_dev = scores.std()
std_error = scores.std() / math.sqrt(scores.shape[0])
ci = 2.262 * std_error
lower_bound = mean_score - ci
upper_bound = mean_score + ci
print "Score is %f +/- %f" % (mean_score, ci)
print '95 percent probability that if this experiment were repeated over and
over the average score would be between %f and %f' % (lower_bound, upper_bound) | Confidence Intervals for AUC using cross-validation | Here is a sample of how you would do it in python.
from sklearn import cross_validation
scores = cross_validation.cross_val_score(your_model, your_data, y, cv=10)
mean_score = scores.mean()
std_dev = | Confidence Intervals for AUC using cross-validation
Here is a sample of how you would do it in python.
from sklearn import cross_validation
scores = cross_validation.cross_val_score(your_model, your_data, y, cv=10)
mean_score = scores.mean()
std_dev = scores.std()
std_error = scores.std() / math.sqrt(scores.shape[0])
ci = 2.262 * std_error
lower_bound = mean_score - ci
upper_bound = mean_score + ci
print "Score is %f +/- %f" % (mean_score, ci)
print '95 percent probability that if this experiment were repeated over and
over the average score would be between %f and %f' % (lower_bound, upper_bound) | Confidence Intervals for AUC using cross-validation
Here is a sample of how you would do it in python.
from sklearn import cross_validation
scores = cross_validation.cross_val_score(your_model, your_data, y, cv=10)
mean_score = scores.mean()
std_dev = |
24,645 | What does Gaussian efficiency mean? | I agree with @cardinal and @whuber that this is about asymptotic relative efficiency and here I write an answer if other are interested in the concept.
In statistics, it is very common to measure how efficient an estimator is using its asymptotic variance. Then, in this context, the asymptotic relative efficiency of $d_n$ relative to $s_n$ is defined by
$$ARE=\lim_{n \to \infty}\frac{var(s_n)/E(S_n)^2}{var(d_n)/E(d_n)^2}.$$
In robust statistics, the law with respect to which we take the expectation in ARE is often a corrupted distribution.
For instance, I present an example from the book Robust Statistics by Huber and Ronchetti (see page 3). Suppose $X_1,\dots, X_n$ are from a corrupted gaussian distribution
$$F(x)=(1-\varepsilon)\Phi(x)+\varepsilon \Phi(\frac{x}{3}) $$
so that with high proba ($1-\varepsilon$) the data are standard normal and with small proba ($\varepsilon$) the data are normal with a higher variance. Then, the ARE between
$$d_n=\frac{1}{n}\sum_{i=1}^n |X_i-\overline{X}|\text{ and }s_n=\left(\frac{1}{n}\sum_{i=1}^n (X_i-\overline{X})^2\right)^{1/2}$$ is $\simeq 0.876$ when $\varepsilon = 0$ but as soon as $\varepsilon>0.005$, we have $ARE>1$ and for instance for $\varepsilon=0.01$, we have $ARE \simeq 1.44$. We conclude that the mean absolute deviation is more efficient than the std when the data are corrupted. | What does Gaussian efficiency mean? | I agree with @cardinal and @whuber that this is about asymptotic relative efficiency and here I write an answer if other are interested in the concept.
In statistics, it is very common to measure how | What does Gaussian efficiency mean?
I agree with @cardinal and @whuber that this is about asymptotic relative efficiency and here I write an answer if other are interested in the concept.
In statistics, it is very common to measure how efficient an estimator is using its asymptotic variance. Then, in this context, the asymptotic relative efficiency of $d_n$ relative to $s_n$ is defined by
$$ARE=\lim_{n \to \infty}\frac{var(s_n)/E(S_n)^2}{var(d_n)/E(d_n)^2}.$$
In robust statistics, the law with respect to which we take the expectation in ARE is often a corrupted distribution.
For instance, I present an example from the book Robust Statistics by Huber and Ronchetti (see page 3). Suppose $X_1,\dots, X_n$ are from a corrupted gaussian distribution
$$F(x)=(1-\varepsilon)\Phi(x)+\varepsilon \Phi(\frac{x}{3}) $$
so that with high proba ($1-\varepsilon$) the data are standard normal and with small proba ($\varepsilon$) the data are normal with a higher variance. Then, the ARE between
$$d_n=\frac{1}{n}\sum_{i=1}^n |X_i-\overline{X}|\text{ and }s_n=\left(\frac{1}{n}\sum_{i=1}^n (X_i-\overline{X})^2\right)^{1/2}$$ is $\simeq 0.876$ when $\varepsilon = 0$ but as soon as $\varepsilon>0.005$, we have $ARE>1$ and for instance for $\varepsilon=0.01$, we have $ARE \simeq 1.44$. We conclude that the mean absolute deviation is more efficient than the std when the data are corrupted. | What does Gaussian efficiency mean?
I agree with @cardinal and @whuber that this is about asymptotic relative efficiency and here I write an answer if other are interested in the concept.
In statistics, it is very common to measure how |
24,646 | What does Gaussian efficiency mean? | I guess Gaussian efficiency is something related to computation cost.
The efficiency of Gaussian adaptation relies on the theory of information due to Claude E. Shannon. When an event occurs with probability P, then the information −log(P) may be achieved. For instance, if the mean fitness is P, the information gained for each individual selected for survival will be −log(P) – on the average - and the work/time needed to get the information is proportional to 1/P. Thus, if efficiency, E, is defined as information divided by the work/time needed to get it we have:
E = −P log(P).
This function attains its maximum when P = 1/e = 0.37. The same result has been obtained by Gaines with a different method.
I may simply conclude that the higher the Gaussian Efficiency is, less resources (RAM) is needed for computing something like a robust scale estimator of a large sample. Since CPUs are much faster than the rest of computer we prefer to run a trial/error algorithm for times rather doing it at once with saying 128GB of RAM. when the Gaussian Efficiency is high the job will be done in a shorter time. | What does Gaussian efficiency mean? | I guess Gaussian efficiency is something related to computation cost.
The efficiency of Gaussian adaptation relies on the theory of information due to Claude E. Shannon. When an event occurs with prob | What does Gaussian efficiency mean?
I guess Gaussian efficiency is something related to computation cost.
The efficiency of Gaussian adaptation relies on the theory of information due to Claude E. Shannon. When an event occurs with probability P, then the information −log(P) may be achieved. For instance, if the mean fitness is P, the information gained for each individual selected for survival will be −log(P) – on the average - and the work/time needed to get the information is proportional to 1/P. Thus, if efficiency, E, is defined as information divided by the work/time needed to get it we have:
E = −P log(P).
This function attains its maximum when P = 1/e = 0.37. The same result has been obtained by Gaines with a different method.
I may simply conclude that the higher the Gaussian Efficiency is, less resources (RAM) is needed for computing something like a robust scale estimator of a large sample. Since CPUs are much faster than the rest of computer we prefer to run a trial/error algorithm for times rather doing it at once with saying 128GB of RAM. when the Gaussian Efficiency is high the job will be done in a shorter time. | What does Gaussian efficiency mean?
I guess Gaussian efficiency is something related to computation cost.
The efficiency of Gaussian adaptation relies on the theory of information due to Claude E. Shannon. When an event occurs with prob |
24,647 | My machine learning model has precision of 30%. Can this model be useful? | As Dave argues, if "false negatives have no associated costs", then your best course of action would be not to classify anything as positive, i.e., as 1. You inspect nothing at all, you incur zero cost, and all your inspectors can do something different (or be fired).
Yes, of course this makes no sense. Which is because it makes no sense to claim that false negatives incur no costs. They do, it's the cost of uncaught errors.
This is an example of why precision, sensitivity etc. are all as misleading as accuracy as evaluation metrics, especially (but not only) in "unbalanced" situations.
What I would strongly recommend you do is scrap "hard" classifications, use probabilistic classifications instead and separate the decision aspect from the statistical modeling aspect. The decisions (whether to inspect or not) should not only be driven by the probabilistic classification, but also by the cost structure. | My machine learning model has precision of 30%. Can this model be useful? | As Dave argues, if "false negatives have no associated costs", then your best course of action would be not to classify anything as positive, i.e., as 1. You inspect nothing at all, you incur zero cos | My machine learning model has precision of 30%. Can this model be useful?
As Dave argues, if "false negatives have no associated costs", then your best course of action would be not to classify anything as positive, i.e., as 1. You inspect nothing at all, you incur zero cost, and all your inspectors can do something different (or be fired).
Yes, of course this makes no sense. Which is because it makes no sense to claim that false negatives incur no costs. They do, it's the cost of uncaught errors.
This is an example of why precision, sensitivity etc. are all as misleading as accuracy as evaluation metrics, especially (but not only) in "unbalanced" situations.
What I would strongly recommend you do is scrap "hard" classifications, use probabilistic classifications instead and separate the decision aspect from the statistical modeling aspect. The decisions (whether to inspect or not) should not only be driven by the probabilistic classification, but also by the cost structure. | My machine learning model has precision of 30%. Can this model be useful?
As Dave argues, if "false negatives have no associated costs", then your best course of action would be not to classify anything as positive, i.e., as 1. You inspect nothing at all, you incur zero cos |
24,648 | My machine learning model has precision of 30%. Can this model be useful? | I would say neither group is entirely correct. The question is what do you want to do with the model, and what will happen for positive or negative model predictions?
There are screening tests used in medical practice that have precision (positive predictive value) that low -- mammograms for breast cancer, prostate-specific antigen for prostate cancer. The positive predictive value of low-dose spiral CT for detecting lung cancer in smokers is way lower than 30%.
What these have in common is that you really want to detect cases, so you care much more about sensitivity (recall) than precision. The benefit of a true positive is much more than 3 times the cost of a false positive.
So, what you need to know to decide is the two costs ('losses' in decision theory). You can then work out the expected loss from using the algorithm and from not using it, and see which is lower. | My machine learning model has precision of 30%. Can this model be useful? | I would say neither group is entirely correct. The question is what do you want to do with the model, and what will happen for positive or negative model predictions?
There are screening tests used | My machine learning model has precision of 30%. Can this model be useful?
I would say neither group is entirely correct. The question is what do you want to do with the model, and what will happen for positive or negative model predictions?
There are screening tests used in medical practice that have precision (positive predictive value) that low -- mammograms for breast cancer, prostate-specific antigen for prostate cancer. The positive predictive value of low-dose spiral CT for detecting lung cancer in smokers is way lower than 30%.
What these have in common is that you really want to detect cases, so you care much more about sensitivity (recall) than precision. The benefit of a true positive is much more than 3 times the cost of a false positive.
So, what you need to know to decide is the two costs ('losses' in decision theory). You can then work out the expected loss from using the algorithm and from not using it, and see which is lower. | My machine learning model has precision of 30%. Can this model be useful?
I would say neither group is entirely correct. The question is what do you want to do with the model, and what will happen for positive or negative model predictions?
There are screening tests used |
24,649 | My machine learning model has precision of 30%. Can this model be useful? | This primarily depends on how the model is supposed to be used. From your context it seems you have an alternative test which has an almost perfect classification rate but is very expensive to use because it essentially consists of sending a qualified human to do a manual check. You want to use your model (which in comparision is extremely cheap) to decide where to perform the human tests.
If I understand you correctly than a) your goal is to find as many instances evaluated by a human as 1 as possible (implying instances evaluated as 0 are not valuable) and b) if some instances that are 1 are not checked by a human because the model thinks they are unlikely candidates, this is not a problem because the number of human checks is very limited anyway.
If these assumptions are correct than any model that has a bigger than 5% chance to find instances qualified as 1 is useful and your model with a 30% hit rate will increase the number of instances qualified as 1 sixfold so is a major improvement compared to not using a the model.
There are of course plenty of other situations where such a model would be useless or even actively bad if applied. It just depends on what you want to do with the model. | My machine learning model has precision of 30%. Can this model be useful? | This primarily depends on how the model is supposed to be used. From your context it seems you have an alternative test which has an almost perfect classification rate but is very expensive to use bec | My machine learning model has precision of 30%. Can this model be useful?
This primarily depends on how the model is supposed to be used. From your context it seems you have an alternative test which has an almost perfect classification rate but is very expensive to use because it essentially consists of sending a qualified human to do a manual check. You want to use your model (which in comparision is extremely cheap) to decide where to perform the human tests.
If I understand you correctly than a) your goal is to find as many instances evaluated by a human as 1 as possible (implying instances evaluated as 0 are not valuable) and b) if some instances that are 1 are not checked by a human because the model thinks they are unlikely candidates, this is not a problem because the number of human checks is very limited anyway.
If these assumptions are correct than any model that has a bigger than 5% chance to find instances qualified as 1 is useful and your model with a 30% hit rate will increase the number of instances qualified as 1 sixfold so is a major improvement compared to not using a the model.
There are of course plenty of other situations where such a model would be useless or even actively bad if applied. It just depends on what you want to do with the model. | My machine learning model has precision of 30%. Can this model be useful?
This primarily depends on how the model is supposed to be used. From your context it seems you have an alternative test which has an almost perfect classification rate but is very expensive to use bec |
24,650 | My machine learning model has precision of 30%. Can this model be useful? | As with most things, neither of two polar opinions is wholly correct
If a model can select an area needed for inspection better than random chance then for a singular inspection run you're using your inspector's time more usefully.
As an example, lets say your inspectors are checking welds on a pipeline. A classification model for error/no error may pick up early signs of corrosion but not spot a more subtle error like porosity or an undercut. In the long term, dependence on the model to inform inspectors could mean other error type get inspected less.
I'd recommend trying to look into your false negatives here, I know you say they incur no cost but you've got inspectors for a reason. Is there a particular type of defect that your model isn't picking up? Is there more data you can bring in to better account for the other error types?
tldr;
Better than random sounds like it would be more effective, but if your model is blind to an error type it could be increasing the likelihood that that error goes unnoticed (without knowing the specific situation we can't say more). At the same time 70-80% is just a number picked from thin air. A lot is down to your application. | My machine learning model has precision of 30%. Can this model be useful? | As with most things, neither of two polar opinions is wholly correct
If a model can select an area needed for inspection better than random chance then for a singular inspection run you're using your | My machine learning model has precision of 30%. Can this model be useful?
As with most things, neither of two polar opinions is wholly correct
If a model can select an area needed for inspection better than random chance then for a singular inspection run you're using your inspector's time more usefully.
As an example, lets say your inspectors are checking welds on a pipeline. A classification model for error/no error may pick up early signs of corrosion but not spot a more subtle error like porosity or an undercut. In the long term, dependence on the model to inform inspectors could mean other error type get inspected less.
I'd recommend trying to look into your false negatives here, I know you say they incur no cost but you've got inspectors for a reason. Is there a particular type of defect that your model isn't picking up? Is there more data you can bring in to better account for the other error types?
tldr;
Better than random sounds like it would be more effective, but if your model is blind to an error type it could be increasing the likelihood that that error goes unnoticed (without knowing the specific situation we can't say more). At the same time 70-80% is just a number picked from thin air. A lot is down to your application. | My machine learning model has precision of 30%. Can this model be useful?
As with most things, neither of two polar opinions is wholly correct
If a model can select an area needed for inspection better than random chance then for a singular inspection run you're using your |
24,651 | My machine learning model has precision of 30%. Can this model be useful? | 5% would not be the performance of the model making predictions “at random” or if you just classified everything as 1’s.
I'm not sure if comparing it to the base rate makes sense here. It means comparing to the most primitive alternative possible. Why not try some other simple model (decision tree, logistic regression, $k$NN) as a benchmark?
Moreover, there's nothing magical about “70-80% precision”. For some problems, this would not be achievable, but for others way too low. Those numbers are arbitrary and there's no reason whatsoever to aim at them. | My machine learning model has precision of 30%. Can this model be useful? | 5% would not be the performance of the model making predictions “at random” or if you just classified everything as 1’s.
I'm not sure if comparing it to the base rate makes sense here. It means compar | My machine learning model has precision of 30%. Can this model be useful?
5% would not be the performance of the model making predictions “at random” or if you just classified everything as 1’s.
I'm not sure if comparing it to the base rate makes sense here. It means comparing to the most primitive alternative possible. Why not try some other simple model (decision tree, logistic regression, $k$NN) as a benchmark?
Moreover, there's nothing magical about “70-80% precision”. For some problems, this would not be achievable, but for others way too low. Those numbers are arbitrary and there's no reason whatsoever to aim at them. | My machine learning model has precision of 30%. Can this model be useful?
5% would not be the performance of the model making predictions “at random” or if you just classified everything as 1’s.
I'm not sure if comparing it to the base rate makes sense here. It means compar |
24,652 | My machine learning model has precision of 30%. Can this model be useful? | As hashed over a bit in the comments. The usefulness of the model here is going to hinge heavily on how likely it is that the distribution of your future data is to match the training/validation data.
I think it would be a serious mistake to assume they will match unless you could think of a super obvious reason why they wouldn't. I would assume there will be differences and test that hypothesis. If the generation of this data is stationary and highly likely to remain similar, then the model is probably useful, but you should make an attempt to quantify this (e.g. if your current data was gathered at different times, separate it into the earliest and latest data and check model performance within each subgroup and see if there are time-based trends in the data itself (look for time/geography/population-based trends in a wide range of statistics, means, medians, maxes, mins, curl, etc...) or if there is any other potential reason the data might change, e.g. new professional guidelines). I wouldn't recommend assuming the model will generalize even with good looking generalization on train/test/validation sets until you get a new real-world independent validation set. And then the model might work just for your company with exactly how you gather data right now, if you outsource the data gathering any sort of new semi-systemic idiosyncrasy might throw a serious wrench in the works. Likewise, it may not work at another branch office, etc...
This sort of issue is a plague in precision medicine, in part because the large whole genome and exome data sets and GWAS studies are so biased towards white Europeans but when you want to go to clinical application you're suddenly not treating only white Europeans. Then there are false positives... you can have a SNP associated with their descent look associated with disease but have it turn out to be socioeconomic rather than genetic, etc... This is in part why ML hasn't obliterated much simpler statistical tests in that field. One of the rationales some have offered for including more diverse populations in GWAS is merely to reduce the false positives showing up for the currently available data. I try not to read that too cynically.
Also, I'm aware of various attempts to use more recent ML methods (deep learning, gradient boosted trees, xgboost) for imputation in this field, but none of them have broken into mainstream use despite very flattering initial papers. Largely because when they are applied to new independent data they don't perform better than the HMMs and often quite a bit worse.
When group B says they want to see much better performance, the actual threshold is arbitrary, but I think the sentiment is that they expect some loss of utility due to data differences and, unless the initial performance was strong, expect it is likely for the edge the model has to evaporate or even be harmful.
Edit: I read now the comments where you say it is a logistic regression. Usually people tend not to say "My machine learning model" when it's a logistic regression even though it can indeed be considered machine learning. You are certainly less likely to have some of the issues described above when using simpler models like that, but it can still happen. I do lean towards it being useful, but it can still be worth validating the common assumptions (e.g. stationality). | My machine learning model has precision of 30%. Can this model be useful? | As hashed over a bit in the comments. The usefulness of the model here is going to hinge heavily on how likely it is that the distribution of your future data is to match the training/validation data | My machine learning model has precision of 30%. Can this model be useful?
As hashed over a bit in the comments. The usefulness of the model here is going to hinge heavily on how likely it is that the distribution of your future data is to match the training/validation data.
I think it would be a serious mistake to assume they will match unless you could think of a super obvious reason why they wouldn't. I would assume there will be differences and test that hypothesis. If the generation of this data is stationary and highly likely to remain similar, then the model is probably useful, but you should make an attempt to quantify this (e.g. if your current data was gathered at different times, separate it into the earliest and latest data and check model performance within each subgroup and see if there are time-based trends in the data itself (look for time/geography/population-based trends in a wide range of statistics, means, medians, maxes, mins, curl, etc...) or if there is any other potential reason the data might change, e.g. new professional guidelines). I wouldn't recommend assuming the model will generalize even with good looking generalization on train/test/validation sets until you get a new real-world independent validation set. And then the model might work just for your company with exactly how you gather data right now, if you outsource the data gathering any sort of new semi-systemic idiosyncrasy might throw a serious wrench in the works. Likewise, it may not work at another branch office, etc...
This sort of issue is a plague in precision medicine, in part because the large whole genome and exome data sets and GWAS studies are so biased towards white Europeans but when you want to go to clinical application you're suddenly not treating only white Europeans. Then there are false positives... you can have a SNP associated with their descent look associated with disease but have it turn out to be socioeconomic rather than genetic, etc... This is in part why ML hasn't obliterated much simpler statistical tests in that field. One of the rationales some have offered for including more diverse populations in GWAS is merely to reduce the false positives showing up for the currently available data. I try not to read that too cynically.
Also, I'm aware of various attempts to use more recent ML methods (deep learning, gradient boosted trees, xgboost) for imputation in this field, but none of them have broken into mainstream use despite very flattering initial papers. Largely because when they are applied to new independent data they don't perform better than the HMMs and often quite a bit worse.
When group B says they want to see much better performance, the actual threshold is arbitrary, but I think the sentiment is that they expect some loss of utility due to data differences and, unless the initial performance was strong, expect it is likely for the edge the model has to evaporate or even be harmful.
Edit: I read now the comments where you say it is a logistic regression. Usually people tend not to say "My machine learning model" when it's a logistic regression even though it can indeed be considered machine learning. You are certainly less likely to have some of the issues described above when using simpler models like that, but it can still happen. I do lean towards it being useful, but it can still be worth validating the common assumptions (e.g. stationality). | My machine learning model has precision of 30%. Can this model be useful?
As hashed over a bit in the comments. The usefulness of the model here is going to hinge heavily on how likely it is that the distribution of your future data is to match the training/validation data |
24,653 | My machine learning model has precision of 30%. Can this model be useful? | It depends.
A decision model can only be considered "useful" or not given a particular setting. You can see this in everyday life, where different decision processes result in a wide range of performance measures, from near-perfect to slightly-better-than-random. Take, for example, a few different decision processes, like 1) diagnosing a severe medical issue, 2) returning top search hits, and 3) selecting batches of parts for inspection. In each of these cases, one should conider the relative costs of false positives and negatives, and tune the decision process to optimize for the desired metric.
A medical screening test, for example, should have high recall, catching all true case of disease at the cost of some false diagnoses. A search engine, on the other hand, should have high precision, as it doesn't need to find every relevant webpage, but the ones it does return must be relevant. An industrial decision tool to direct parts inspectors may be useful even if it is only slightly better than random, as virtually any improvement makes the inspectors more efficient.
As you can see, there is not a numerical threshold for any performance measure that separates useful and non-useful models. It all depends on the context. A decision model with 30% precision may indeed be useful in some settings, but not others. | My machine learning model has precision of 30%. Can this model be useful? | It depends.
A decision model can only be considered "useful" or not given a particular setting. You can see this in everyday life, where different decision processes result in a wide range of performa | My machine learning model has precision of 30%. Can this model be useful?
It depends.
A decision model can only be considered "useful" or not given a particular setting. You can see this in everyday life, where different decision processes result in a wide range of performance measures, from near-perfect to slightly-better-than-random. Take, for example, a few different decision processes, like 1) diagnosing a severe medical issue, 2) returning top search hits, and 3) selecting batches of parts for inspection. In each of these cases, one should conider the relative costs of false positives and negatives, and tune the decision process to optimize for the desired metric.
A medical screening test, for example, should have high recall, catching all true case of disease at the cost of some false diagnoses. A search engine, on the other hand, should have high precision, as it doesn't need to find every relevant webpage, but the ones it does return must be relevant. An industrial decision tool to direct parts inspectors may be useful even if it is only slightly better than random, as virtually any improvement makes the inspectors more efficient.
As you can see, there is not a numerical threshold for any performance measure that separates useful and non-useful models. It all depends on the context. A decision model with 30% precision may indeed be useful in some settings, but not others. | My machine learning model has precision of 30%. Can this model be useful?
It depends.
A decision model can only be considered "useful" or not given a particular setting. You can see this in everyday life, where different decision processes result in a wide range of performa |
24,654 | My machine learning model has precision of 30%. Can this model be useful? | This question requires answers to two sub questions. When is a model useful? What is the cost function to determine usefulness?
Group 1 says that the model is useful because it is doing better than nothing.
Group 2 says that the model is not useful because the cost is only reduced in a meaningful way when the performance is above some level (apparently 70-80% for your colleagues).
The two group's conclusion don't really contradict, they just look at it with different perspectives based on answers to the subquestions. | My machine learning model has precision of 30%. Can this model be useful? | This question requires answers to two sub questions. When is a model useful? What is the cost function to determine usefulness?
Group 1 says that the model is useful because it is doing better than no | My machine learning model has precision of 30%. Can this model be useful?
This question requires answers to two sub questions. When is a model useful? What is the cost function to determine usefulness?
Group 1 says that the model is useful because it is doing better than nothing.
Group 2 says that the model is not useful because the cost is only reduced in a meaningful way when the performance is above some level (apparently 70-80% for your colleagues).
The two group's conclusion don't really contradict, they just look at it with different perspectives based on answers to the subquestions. | My machine learning model has precision of 30%. Can this model be useful?
This question requires answers to two sub questions. When is a model useful? What is the cost function to determine usefulness?
Group 1 says that the model is useful because it is doing better than no |
24,655 | Why is the t-test designed for small samples? | There is fundamental misconception in your question and in several of the answers you have received so far.
The choice of $t$-test or $z$-test is about the nature of the test statistic, specifically whether the variance of the sampling distribution of the sample mean is known ($z$-test) or unknown and must be estimated from the sample ($t$-test).
How well either of these tests perform for statistical inference depends on an underlying assumption that the data are realizations from a normal distribution. However, because of the central limit theorem, the larger the sample size, the more robust both of these tests will be with respect to deviations from normality, since with increasing sample size, the CLT states that the sample mean (under certain regularity conditions) will asymptotically tend toward a normal distribution.
These two things (known versus unknown variance, and the relationship between sample size and asymptotic normality) are commonly conflated in statistical practice. They are not the same thing. To illustrate:
If the data are truly observations from a normal distribution, but the mean of the distribution is unknown and the variance is known, the sample size is irrelevant--even a sample size of $n = 1$ is enough to say that the test statistic is exactly normally distributed. Inference on a very small sample size is still possible using a $z$-statistic.
If the data are truly observations from a normal distribution as above, but the variance is unknown, then the test statistic $$T \mid H_0 = \frac{\bar X - \mu_0}{S/\sqrt{n}}$$ is exactly $t$-distributed, because $\bar X$ is exactly normally distributed and $S^2$ is exactly chi-squared distributed.
If the data are not generated from a normal distribution, but the variance is known, then whether a $z$-test may be used depends on the sample size. Specifically, if the sample size is large enough (where "large" depends on the extent of deviation from normality but is often unknown in practice), then the $z$-test may be an acceptable approximation. Otherwise, a nonparametric (i.e., distribution-free in its assumptions) test of location should be used in order to avoid potential failure to control Type I error. But the $t$-test should not be used here.
If the data are not generated from a normal distribution, and the variance is unknown, then the choice is between a $t$-test or a nonparametric test, depending on the extent of deviation from normality and the sample size. If the deviation from normality is minor, then a $t$-test is reasonably robust and may be justified even when the sample size is small. But in the small sample case with larger deviations from normality, a nonparametric test should be used. If the sample size is large, to the point where the CLT kicks in, there is generally little difference between a $t$-test and $z$-test because the degrees of freedom will generally be high enough that the critical values will be nearly identical.
I hope this clarifies the situation, because a LOT of people who use univariate hypothesis tests fail to get this right. | Why is the t-test designed for small samples? | There is fundamental misconception in your question and in several of the answers you have received so far.
The choice of $t$-test or $z$-test is about the nature of the test statistic, specifically w | Why is the t-test designed for small samples?
There is fundamental misconception in your question and in several of the answers you have received so far.
The choice of $t$-test or $z$-test is about the nature of the test statistic, specifically whether the variance of the sampling distribution of the sample mean is known ($z$-test) or unknown and must be estimated from the sample ($t$-test).
How well either of these tests perform for statistical inference depends on an underlying assumption that the data are realizations from a normal distribution. However, because of the central limit theorem, the larger the sample size, the more robust both of these tests will be with respect to deviations from normality, since with increasing sample size, the CLT states that the sample mean (under certain regularity conditions) will asymptotically tend toward a normal distribution.
These two things (known versus unknown variance, and the relationship between sample size and asymptotic normality) are commonly conflated in statistical practice. They are not the same thing. To illustrate:
If the data are truly observations from a normal distribution, but the mean of the distribution is unknown and the variance is known, the sample size is irrelevant--even a sample size of $n = 1$ is enough to say that the test statistic is exactly normally distributed. Inference on a very small sample size is still possible using a $z$-statistic.
If the data are truly observations from a normal distribution as above, but the variance is unknown, then the test statistic $$T \mid H_0 = \frac{\bar X - \mu_0}{S/\sqrt{n}}$$ is exactly $t$-distributed, because $\bar X$ is exactly normally distributed and $S^2$ is exactly chi-squared distributed.
If the data are not generated from a normal distribution, but the variance is known, then whether a $z$-test may be used depends on the sample size. Specifically, if the sample size is large enough (where "large" depends on the extent of deviation from normality but is often unknown in practice), then the $z$-test may be an acceptable approximation. Otherwise, a nonparametric (i.e., distribution-free in its assumptions) test of location should be used in order to avoid potential failure to control Type I error. But the $t$-test should not be used here.
If the data are not generated from a normal distribution, and the variance is unknown, then the choice is between a $t$-test or a nonparametric test, depending on the extent of deviation from normality and the sample size. If the deviation from normality is minor, then a $t$-test is reasonably robust and may be justified even when the sample size is small. But in the small sample case with larger deviations from normality, a nonparametric test should be used. If the sample size is large, to the point where the CLT kicks in, there is generally little difference between a $t$-test and $z$-test because the degrees of freedom will generally be high enough that the critical values will be nearly identical.
I hope this clarifies the situation, because a LOT of people who use univariate hypothesis tests fail to get this right. | Why is the t-test designed for small samples?
There is fundamental misconception in your question and in several of the answers you have received so far.
The choice of $t$-test or $z$-test is about the nature of the test statistic, specifically w |
24,656 | Why is the t-test designed for small samples? | I think this is a slight mis-reading of the place where the quote came from. It is perfectly true that when he was inventing the test which bears his pseudonym Gosset was trying to solve the problem of small samples because that was what he encountered in his work. So he designed them for small samples. That historical fact does not mean they do not work for large samples.
In his original paper he outlined the problem
In routine work there are two ways of dealing with this difficulty: (1) an experiment may he repeated many times, until such a long series is obtained that
the standard deviation is determined once and for all with sufficient accuracy.
This value can then be used for subsequent shorter series of similar experiments.
and points out
There are other experiments, however, which cannot easily be repeated very
often; in such cases it is sometimes necessary to judge of the certainty of the
results from a very small sample, which itself affords the only indication of the
variability. Some chemical, many biological, and most agricultural and large-
scale experiments belong to this class, which has hitherto been almost outside
the range of statistical inquiry.
Gosset himself was working with the brewers, Guinness, and faced the problem that he mentions in that paragraph of being unable to run large-scale repetitions and even if he could have repeated the plots many times there would almost certainly have been drift over time.
The quotes are from his 1908 article in Biometrika "The probable error of a mean" which has been widely reprinted. | Why is the t-test designed for small samples? | I think this is a slight mis-reading of the place where the quote came from. It is perfectly true that when he was inventing the test which bears his pseudonym Gosset was trying to solve the problem o | Why is the t-test designed for small samples?
I think this is a slight mis-reading of the place where the quote came from. It is perfectly true that when he was inventing the test which bears his pseudonym Gosset was trying to solve the problem of small samples because that was what he encountered in his work. So he designed them for small samples. That historical fact does not mean they do not work for large samples.
In his original paper he outlined the problem
In routine work there are two ways of dealing with this difficulty: (1) an experiment may he repeated many times, until such a long series is obtained that
the standard deviation is determined once and for all with sufficient accuracy.
This value can then be used for subsequent shorter series of similar experiments.
and points out
There are other experiments, however, which cannot easily be repeated very
often; in such cases it is sometimes necessary to judge of the certainty of the
results from a very small sample, which itself affords the only indication of the
variability. Some chemical, many biological, and most agricultural and large-
scale experiments belong to this class, which has hitherto been almost outside
the range of statistical inquiry.
Gosset himself was working with the brewers, Guinness, and faced the problem that he mentions in that paragraph of being unable to run large-scale repetitions and even if he could have repeated the plots many times there would almost certainly have been drift over time.
The quotes are from his 1908 article in Biometrika "The probable error of a mean" which has been widely reprinted. | Why is the t-test designed for small samples?
I think this is a slight mis-reading of the place where the quote came from. It is perfectly true that when he was inventing the test which bears his pseudonym Gosset was trying to solve the problem o |
24,657 | Why is the t-test designed for small samples? | The question $t$-tests vs $z$-tests? suggested by @user2974951 seems relevant but perhaps the answer there remains a bit abstract. I like to see it in this way, possibly not 100% correct, though.
With small sample sizes, it's relatively likely that one of the two samples will receive a slightly extreme datapoint that will skew its mean and make you think that there is a real difference between the two samples when instead nothing is going on. To correct for such small-size effect you allow more extreme values of the difference between samples to be relatively likely before claiming "significance of difference". I.e. the t-distribution, against which you map the value of the t-statistics to obtain the p-value, has fatter tails than the normal distribution. As the sample sizes increases, this correction becomes negligible and you don't need to worry about using Normal or T-distribution (or T-test vs Z-test).
Here's an example using simulation. We compare a treatment to a control where in fact there is no difference between to two. We simulate the data from a normal distribution, so no complications about data normality, unequal variance, etc. Since the null-hypothesis holds, by repeating the sampling and testing many times, we expect ~5% of the tests to have p < 0.05. If we use t.test this is actually the case but if we use Z-test (i.e. we don't account for small sample size) we get many more false positives. Here, the sample size is just N=3:
set.seed(1234)
N <- 10000
t.pvalue <- rep(NA, N)
z.pvalue <- rep(NA, N)
z.test <- function(x, y) {
diff <- mean(x) - mean(y)
sd_diff <- sqrt(var(x)/length(x) + var(y)/length(y))
z <- diff/sd_diff
p <- (1 - pnorm(abs(z))) * 2
return(p)
}
my.t.test <- function(x, y) {
# Custom t-test instead of R's to make things
# more transparent
stopifnot(length(x) == length(y))
diff <- mean(x) - mean(y)
sd_diff <- sqrt(var(x)/length(x) + var(y)/length(y))
z <- diff/sd_diff
df <- (2 * length(x)) - 2
p <- (1 - pt(abs(z), df= df)) * 2
return(p)
}
for(i in 1:N) {
treat <- rnorm(n= 3, mean= 10)
ctrl <- rnorm(n= 3, mean= 10)
t.pvalue[i] <- my.t.test(treat, ctrl)
z.pvalue[i] <- z.test(treat, ctrl)
}
sum(t.pvalue < 0.05) # 499 "false positives" as expected
sum(z.pvalue < 0.05) # 1234 "false positives"
The T-test behaves as expected giving 499 cases with p < 0.05, the Z-test gives many more, 1234. If you re-run the simulation with a larger N, say, rnorm(n= 30, ...) the distortion disappears.
You can also check the distribution of pvalues noting that under the null hypothesis the distribution should be uniform (flat) between 0 and 1. This is the case for the T-test but not for the Z-test:
par(mfrow= c(1, 2))
hist(t.pvalue)
hist(z.pvalue) | Why is the t-test designed for small samples? | The question $t$-tests vs $z$-tests? suggested by @user2974951 seems relevant but perhaps the answer there remains a bit abstract. I like to see it in this way, possibly not 100% correct, though.
With | Why is the t-test designed for small samples?
The question $t$-tests vs $z$-tests? suggested by @user2974951 seems relevant but perhaps the answer there remains a bit abstract. I like to see it in this way, possibly not 100% correct, though.
With small sample sizes, it's relatively likely that one of the two samples will receive a slightly extreme datapoint that will skew its mean and make you think that there is a real difference between the two samples when instead nothing is going on. To correct for such small-size effect you allow more extreme values of the difference between samples to be relatively likely before claiming "significance of difference". I.e. the t-distribution, against which you map the value of the t-statistics to obtain the p-value, has fatter tails than the normal distribution. As the sample sizes increases, this correction becomes negligible and you don't need to worry about using Normal or T-distribution (or T-test vs Z-test).
Here's an example using simulation. We compare a treatment to a control where in fact there is no difference between to two. We simulate the data from a normal distribution, so no complications about data normality, unequal variance, etc. Since the null-hypothesis holds, by repeating the sampling and testing many times, we expect ~5% of the tests to have p < 0.05. If we use t.test this is actually the case but if we use Z-test (i.e. we don't account for small sample size) we get many more false positives. Here, the sample size is just N=3:
set.seed(1234)
N <- 10000
t.pvalue <- rep(NA, N)
z.pvalue <- rep(NA, N)
z.test <- function(x, y) {
diff <- mean(x) - mean(y)
sd_diff <- sqrt(var(x)/length(x) + var(y)/length(y))
z <- diff/sd_diff
p <- (1 - pnorm(abs(z))) * 2
return(p)
}
my.t.test <- function(x, y) {
# Custom t-test instead of R's to make things
# more transparent
stopifnot(length(x) == length(y))
diff <- mean(x) - mean(y)
sd_diff <- sqrt(var(x)/length(x) + var(y)/length(y))
z <- diff/sd_diff
df <- (2 * length(x)) - 2
p <- (1 - pt(abs(z), df= df)) * 2
return(p)
}
for(i in 1:N) {
treat <- rnorm(n= 3, mean= 10)
ctrl <- rnorm(n= 3, mean= 10)
t.pvalue[i] <- my.t.test(treat, ctrl)
z.pvalue[i] <- z.test(treat, ctrl)
}
sum(t.pvalue < 0.05) # 499 "false positives" as expected
sum(z.pvalue < 0.05) # 1234 "false positives"
The T-test behaves as expected giving 499 cases with p < 0.05, the Z-test gives many more, 1234. If you re-run the simulation with a larger N, say, rnorm(n= 30, ...) the distortion disappears.
You can also check the distribution of pvalues noting that under the null hypothesis the distribution should be uniform (flat) between 0 and 1. This is the case for the T-test but not for the Z-test:
par(mfrow= c(1, 2))
hist(t.pvalue)
hist(z.pvalue) | Why is the t-test designed for small samples?
The question $t$-tests vs $z$-tests? suggested by @user2974951 seems relevant but perhaps the answer there remains a bit abstract. I like to see it in this way, possibly not 100% correct, though.
With |
24,658 | Why is the t-test designed for small samples? | Short answer: When people say the t test (that is, a test based on a t distribution) is "designed" for small samples what they mean is that if you have a small sample then a t test is going to be be more accurate than a "z test" (which is based on a normal distribution). If a t test and a z test ever give you different answers (which will only happen with small sample sizes), you should prefer the t test answer. But as the sample size increases the two tests approach each other so it doesn't matter which you use.
Longer answer: The underlying logic of both of these tests is that we know that the ERRORS associated with using a random sample (rather than the whole population) are always going to to have a particular bell shaped distribution. This is true regardless of what the distribution of the variables in question looks like. If we know the shape of that distribution we can use it to figure out how likely it is that two estimates that look different really are different in the underlying population (which is what the t test is trying to figure out).
Now, when sample sizes are "large" these sampling errors are described by the famous normal curve. But as the sample size gets smaller the normal curve ends up being too "skinny" to describe how the errors actually work in reality. So we use this other distribution - the t distribution - which is like the normal curve but with some added "fatness" that depends on the sample size. This means that there isn't just one t distribution - there are an infinite number, one for every possible sample size. But the bigger the sample size is the closer the t and normal distributions look to each other, so it doesn't matter what you use, because they will give you the same answer. But if there is ever a situation in which the t and normal distributions DO give you a different answer then you should use the t distribution, because the fact that they are different means that your sample size is "small enough" for the normal curve to be inaccurate. | Why is the t-test designed for small samples? | Short answer: When people say the t test (that is, a test based on a t distribution) is "designed" for small samples what they mean is that if you have a small sample then a t test is going to be be | Why is the t-test designed for small samples?
Short answer: When people say the t test (that is, a test based on a t distribution) is "designed" for small samples what they mean is that if you have a small sample then a t test is going to be be more accurate than a "z test" (which is based on a normal distribution). If a t test and a z test ever give you different answers (which will only happen with small sample sizes), you should prefer the t test answer. But as the sample size increases the two tests approach each other so it doesn't matter which you use.
Longer answer: The underlying logic of both of these tests is that we know that the ERRORS associated with using a random sample (rather than the whole population) are always going to to have a particular bell shaped distribution. This is true regardless of what the distribution of the variables in question looks like. If we know the shape of that distribution we can use it to figure out how likely it is that two estimates that look different really are different in the underlying population (which is what the t test is trying to figure out).
Now, when sample sizes are "large" these sampling errors are described by the famous normal curve. But as the sample size gets smaller the normal curve ends up being too "skinny" to describe how the errors actually work in reality. So we use this other distribution - the t distribution - which is like the normal curve but with some added "fatness" that depends on the sample size. This means that there isn't just one t distribution - there are an infinite number, one for every possible sample size. But the bigger the sample size is the closer the t and normal distributions look to each other, so it doesn't matter what you use, because they will give you the same answer. But if there is ever a situation in which the t and normal distributions DO give you a different answer then you should use the t distribution, because the fact that they are different means that your sample size is "small enough" for the normal curve to be inaccurate. | Why is the t-test designed for small samples?
Short answer: When people say the t test (that is, a test based on a t distribution) is "designed" for small samples what they mean is that if you have a small sample then a t test is going to be be |
24,659 | Why is the t-test designed for small samples? | The simple answer is that in small samples you can't use the sample estimate of the variance as the variance itself, while in large samples you can due to it converging to the true value under realistic assumptions.
So, when you take a small sample of size $n$ of variable $x$, even if you suspect it is from normal distribution $x\sim\mathcal N(0,\sigma^2)$, and estimate its sample variance $\hat\sigma^2=s_n^2$ then try to standardize the variable as $z=\frac x {\hat\sigma}$, it doesn't make $z$ a standard normal variable. The reason is that $\hat\sigma\equiv\sqrt{s^2_n}\ne\sigma$. However, if your sample is "large", then $\hat\sigma\equiv\sqrt{s^2_\infty}=\sigma$, so $z\sim\mathcal N(0,1)$.
In small samples it happens so that $z\sim t_{n-1}$, but you know that $t_\infty=\mathcal N(0,1)$. So it works out. | Why is the t-test designed for small samples? | The simple answer is that in small samples you can't use the sample estimate of the variance as the variance itself, while in large samples you can due to it converging to the true value under realist | Why is the t-test designed for small samples?
The simple answer is that in small samples you can't use the sample estimate of the variance as the variance itself, while in large samples you can due to it converging to the true value under realistic assumptions.
So, when you take a small sample of size $n$ of variable $x$, even if you suspect it is from normal distribution $x\sim\mathcal N(0,\sigma^2)$, and estimate its sample variance $\hat\sigma^2=s_n^2$ then try to standardize the variable as $z=\frac x {\hat\sigma}$, it doesn't make $z$ a standard normal variable. The reason is that $\hat\sigma\equiv\sqrt{s^2_n}\ne\sigma$. However, if your sample is "large", then $\hat\sigma\equiv\sqrt{s^2_\infty}=\sigma$, so $z\sim\mathcal N(0,1)$.
In small samples it happens so that $z\sim t_{n-1}$, but you know that $t_\infty=\mathcal N(0,1)$. So it works out. | Why is the t-test designed for small samples?
The simple answer is that in small samples you can't use the sample estimate of the variance as the variance itself, while in large samples you can due to it converging to the true value under realist |
24,660 | Why is the t-test designed for small samples? | Why is the t-test designed for small samples?
Because it is the small samples where the t-test makes a difference.
For large samples the t-distribution becomes similar to the normal distribution.
What if I use a big sample out of a population to conduct the t-test? Would that be an issue or have potential implications?
No, the t-test works for both large and small samples.
Background
The t-test is a hypothesis test that uses the difference of the observed sample mean $\bar{X}$ with the hypothesized mean $\mu$, and divides/standardizes this by the observed standard deviation. You get the test statistic $t = \frac{\bar{X}-\mu}{\hat \sigma / \sqrt{n}}$ which is not normally distributed but instead t-distributed* with degrees of freedom $\nu = n-1$ (where $n$ is the sample size). The trick of the t-test is to use this t-distribution instead of the normal distribution.
*Assuming normal distribution for the population, although it may still work very well for other population distributions.
This is important for small samples. The normal distribution is not accurate when the sample size is small. For large samples, it does not matter (much). For large sample size, the t-distribution and the z-distribution become very much the same as you can see in the image below.
Additional note. The t-test is designed for cases where the sample is small and when the standard deviation is unknown. If the standard deviation is known, then the sample size does not matter. The issue with the t-test is the uncertainty in the estimate of the standard deviation (which becomes less for a larger sample size).
Related
What is the rationale behind using the t-distribution?
T-distribution versus normal distribution (sample means and linear inference) | Why is the t-test designed for small samples? | Why is the t-test designed for small samples?
Because it is the small samples where the t-test makes a difference.
For large samples the t-distribution becomes similar to the normal distribution.
Wh | Why is the t-test designed for small samples?
Why is the t-test designed for small samples?
Because it is the small samples where the t-test makes a difference.
For large samples the t-distribution becomes similar to the normal distribution.
What if I use a big sample out of a population to conduct the t-test? Would that be an issue or have potential implications?
No, the t-test works for both large and small samples.
Background
The t-test is a hypothesis test that uses the difference of the observed sample mean $\bar{X}$ with the hypothesized mean $\mu$, and divides/standardizes this by the observed standard deviation. You get the test statistic $t = \frac{\bar{X}-\mu}{\hat \sigma / \sqrt{n}}$ which is not normally distributed but instead t-distributed* with degrees of freedom $\nu = n-1$ (where $n$ is the sample size). The trick of the t-test is to use this t-distribution instead of the normal distribution.
*Assuming normal distribution for the population, although it may still work very well for other population distributions.
This is important for small samples. The normal distribution is not accurate when the sample size is small. For large samples, it does not matter (much). For large sample size, the t-distribution and the z-distribution become very much the same as you can see in the image below.
Additional note. The t-test is designed for cases where the sample is small and when the standard deviation is unknown. If the standard deviation is known, then the sample size does not matter. The issue with the t-test is the uncertainty in the estimate of the standard deviation (which becomes less for a larger sample size).
Related
What is the rationale behind using the t-distribution?
T-distribution versus normal distribution (sample means and linear inference) | Why is the t-test designed for small samples?
Why is the t-test designed for small samples?
Because it is the small samples where the t-test makes a difference.
For large samples the t-distribution becomes similar to the normal distribution.
Wh |
24,661 | Why is the t-test designed for small samples? | Many statistical tests use some form of approximation, which makes them only applicable for sufficiently large sample sizes. But the t-test doesn't have this disadvantage. It is also exact for very small sample sizes, if its condition (normal distributed data) is sufficiently fulfilled.
Of course you can use the t-test also for large sample sizes. | Why is the t-test designed for small samples? | Many statistical tests use some form of approximation, which makes them only applicable for sufficiently large sample sizes. But the t-test doesn't have this disadvantage. It is also exact for very sm | Why is the t-test designed for small samples?
Many statistical tests use some form of approximation, which makes them only applicable for sufficiently large sample sizes. But the t-test doesn't have this disadvantage. It is also exact for very small sample sizes, if its condition (normal distributed data) is sufficiently fulfilled.
Of course you can use the t-test also for large sample sizes. | Why is the t-test designed for small samples?
Many statistical tests use some form of approximation, which makes them only applicable for sufficiently large sample sizes. But the t-test doesn't have this disadvantage. It is also exact for very sm |
24,662 | Why is the t-test designed for small samples? | The difference between the t-test and z-test is that the t-test can be used with both small and large sample size, instead the z-test is used only with large sample size.
But now you can ask me:
Why is this so?
Why we use z-test instead of using only t-test?
Well, the reason is simple: z-test is an approximation of the t-test and is valid under the assumption of a large sample size.
The z-test, for a fixed Confidence Level, has a fixed number of SDs from the mean, while in the t-test, for a fixed Confidence Level, the number of SDs from the mean depend also on the sample size;
but the larger the size of the sample, the smaller the difference between the number of SDs used in the t-test and in the z-test;
in other words, the larger the sample size, the thinner the t-test tails become until the 2 distributions match almost perfectly.
i.e. if we use both t-test and z-test on the same dataset with sample_size > 50 we will see no (relevant) difference between the z-test's p-value and the t-test one.
if we use both t-test and z-test on the same dataset with sample_size = 3 we will se a huge difference between the two p-value.
For the last 2 question the answer is:
No, neither issues nor practical implications because the difference between the 2, for large sample size, is irrelevant. | Why is the t-test designed for small samples? | The difference between the t-test and z-test is that the t-test can be used with both small and large sample size, instead the z-test is used only with large sample size.
But now you can ask me:
Why i | Why is the t-test designed for small samples?
The difference between the t-test and z-test is that the t-test can be used with both small and large sample size, instead the z-test is used only with large sample size.
But now you can ask me:
Why is this so?
Why we use z-test instead of using only t-test?
Well, the reason is simple: z-test is an approximation of the t-test and is valid under the assumption of a large sample size.
The z-test, for a fixed Confidence Level, has a fixed number of SDs from the mean, while in the t-test, for a fixed Confidence Level, the number of SDs from the mean depend also on the sample size;
but the larger the size of the sample, the smaller the difference between the number of SDs used in the t-test and in the z-test;
in other words, the larger the sample size, the thinner the t-test tails become until the 2 distributions match almost perfectly.
i.e. if we use both t-test and z-test on the same dataset with sample_size > 50 we will see no (relevant) difference between the z-test's p-value and the t-test one.
if we use both t-test and z-test on the same dataset with sample_size = 3 we will se a huge difference between the two p-value.
For the last 2 question the answer is:
No, neither issues nor practical implications because the difference between the 2, for large sample size, is irrelevant. | Why is the t-test designed for small samples?
The difference between the t-test and z-test is that the t-test can be used with both small and large sample size, instead the z-test is used only with large sample size.
But now you can ask me:
Why i |
24,663 | Why is the t-test designed for small samples? | The t-test allows for the fact that the mean and standard deviation have been calculated from the data rather than known beforehand. It basically is a test on the normal distribution with a "fudge factor." The fudge factor is necessary because in a small sample the experimenter is unlikely to adequately sample the tails of the distribution. So the experimental standard deviation tends to be smaller than the true (or population's) standard deviation.
Tables for the t-test will indeed have a rows for larger sample sizes and a row for an infinite sample size. The infinite sample size is just the normal distribution itself. All -in-all to get a reasonably good value for the standard deviation you need a sample size of at least 30.
I'll add that the t-tables are setup for the degrees of freedom in the sample. Calculating the average from the sample reduces the degrees of freedom by one, and calculating the standard deviation from the sample reduces the degrees of freedom by one again. | Why is the t-test designed for small samples? | The t-test allows for the fact that the mean and standard deviation have been calculated from the data rather than known beforehand. It basically is a test on the normal distribution with a "fudge fac | Why is the t-test designed for small samples?
The t-test allows for the fact that the mean and standard deviation have been calculated from the data rather than known beforehand. It basically is a test on the normal distribution with a "fudge factor." The fudge factor is necessary because in a small sample the experimenter is unlikely to adequately sample the tails of the distribution. So the experimental standard deviation tends to be smaller than the true (or population's) standard deviation.
Tables for the t-test will indeed have a rows for larger sample sizes and a row for an infinite sample size. The infinite sample size is just the normal distribution itself. All -in-all to get a reasonably good value for the standard deviation you need a sample size of at least 30.
I'll add that the t-tables are setup for the degrees of freedom in the sample. Calculating the average from the sample reduces the degrees of freedom by one, and calculating the standard deviation from the sample reduces the degrees of freedom by one again. | Why is the t-test designed for small samples?
The t-test allows for the fact that the mean and standard deviation have been calculated from the data rather than known beforehand. It basically is a test on the normal distribution with a "fudge fac |
24,664 | Interpretation of p-value near alpha level | There are two different approaches to interpreting statistical significance - the Fisher way, and the Neyman-Pearson way. We smush these together (into what Gerd Gigerenzer has called a 'bastardised approach'). The reason that statistical significance testing [Edit, n italics] as it is often taught and discussed doesn't seem to make sense is that, essentially, it doesn't.
Neyman-Pearson said that you pick a cutoff and you use it. It's less than the cutoff(say, 0.05) or it's not. There's no other information to convey.In NP, 0.08 and 0.97 are the same.
Fisher said you take the p-value and you treat it as the level of evidence that there is an effect. <0.2 is some evidence, but it's pretty weak; <0.1 is a bit better, but still kind of weak. <0.05 is what Fisher said is often good enough (but he also wrote that one should change one's significance level according to the situation, which no one does).
Either report the exact significance level and interpret that appropriately. Or use 0.05. Don't do this nonsense of 0.10>p>0.05.
Your p-value presents some evidence. It's not great evidence, but it's not no evidence. You shouldn't be trying to say "Yes" or "No" when maybe is an answer.
In addition, people often say that their p-value of 0.06 is "approaching statistical significance". No one says it is "Running away from significance" or that their p-value of 0.04 is "Approaching non-significance." | Interpretation of p-value near alpha level | There are two different approaches to interpreting statistical significance - the Fisher way, and the Neyman-Pearson way. We smush these together (into what Gerd Gigerenzer has called a 'bastardised a | Interpretation of p-value near alpha level
There are two different approaches to interpreting statistical significance - the Fisher way, and the Neyman-Pearson way. We smush these together (into what Gerd Gigerenzer has called a 'bastardised approach'). The reason that statistical significance testing [Edit, n italics] as it is often taught and discussed doesn't seem to make sense is that, essentially, it doesn't.
Neyman-Pearson said that you pick a cutoff and you use it. It's less than the cutoff(say, 0.05) or it's not. There's no other information to convey.In NP, 0.08 and 0.97 are the same.
Fisher said you take the p-value and you treat it as the level of evidence that there is an effect. <0.2 is some evidence, but it's pretty weak; <0.1 is a bit better, but still kind of weak. <0.05 is what Fisher said is often good enough (but he also wrote that one should change one's significance level according to the situation, which no one does).
Either report the exact significance level and interpret that appropriately. Or use 0.05. Don't do this nonsense of 0.10>p>0.05.
Your p-value presents some evidence. It's not great evidence, but it's not no evidence. You shouldn't be trying to say "Yes" or "No" when maybe is an answer.
In addition, people often say that their p-value of 0.06 is "approaching statistical significance". No one says it is "Running away from significance" or that their p-value of 0.04 is "Approaching non-significance." | Interpretation of p-value near alpha level
There are two different approaches to interpreting statistical significance - the Fisher way, and the Neyman-Pearson way. We smush these together (into what Gerd Gigerenzer has called a 'bastardised a |
24,665 | Interpretation of p-value near alpha level | I will also add to Jeremy Miles' answer that makes a number of valid points. (I wrote initially that "I disagree with the claim that the reason that statistical significance testing doesn't seem to make sense is that, essentially, it doesn't", but Jeremy has made this more precise in the meantime.)
The p-value has a well defined mathematical meaning, which is the probability that given the null hypothesis is true, the test statistics is as far or farther away than what was observed from what is expected under the null hypothesis.
Now in language we are bound to be categorical, so we lack the words for saying how a p-value of 0.064 is different from 0.059, however we can talk for example about strong, weak, no evidence against the $H_0$ meaning here that something has happened that under the $H_0$ would happen very rarely/rarely/be very common.
If we want to make decisions (like going on to work as if the $H_0$ were true, or not true, if these two possibilities were the only ones to consider, i.e., we decide between only two courses of action) of course we need to decide how small is too small to stick with the $H_0$.
Now there are conventions like the ubiquitous $\alpha=0.05$. This is arbitrary to some extent, but you need to realise that specifying such a cutoff is necessary when making a binary decision - otherwise not (this by the way holds as well for any alternative to significance testing).
The interpretation in language of a p-value doesn't have a mathematical basis and will always be to some extent arbitrary, but once more, language is categorical, so if we use a finite number of different wordings, we are more transparent when having well defined cutoff values for them. With all the problems with which cutoff values come - for example if you put the cutoff between "very weak evidence" and "no evidence" at 0.1, you will in language distinguish between 0.99 and 0.101, but not between 0.101 and 0.103. That may not look particularly appropriate but somehow lies in the nature of the problem.
Overall you have some freedom as at least mathematics doesn't determine how you should say things, however you act more professionally when sticking to at least fairly generally accepted and transparent standards.
So using "reject/not reject" with a cutoff at 0.05 (or 0.01 in some fields) is a strong reduction of information and as such problematic, however people cannot accuse you of bending the evidence as you stick to a well established rule. That's something. It is important here though that you only really need to use this kind of binary distinction if a binary action decision is to be made. (Deciding to "believe" the $H_0$ or the alternative is in my view not a direct action, and models should not ever be "believed" in my view anyway.) Still then for those who like precision it can only be good to state the precise p-value.
It is also generally accepted to use "evidence language", although borderlines are not handled consistently all over the place. I don't think you can go very wrong by using 0.01/0.05/0.1 as cutoffs for saying there's "strong"/"some"/"weak"/"no" evidence against the $H_0$, but I have seen others. Also let's always keep in mind that categorisation is to some extent arbitrary, but also a necessity when people communicate in language.
It is also OK to differentiate even more by saying something like "There's some evidence as $p<0.05$ but it's really rather weak as in fact $p=0.046$." Or even "at $p=0.07$ we only have weak evidence against the $H_0$ but some doubt about it is justified and the effect estimator (...) is in fact quite large" (in case it is, in a subject matter sense).
Some wordings are clearly misleading such as "tends toward significance" (as (a) there's no "tending" and (b) the writer reveals implicitly that they would've wanted significance and are willing to sacrifice objectivity to make a certain impression) or "accepting" the $H_0$ (as accepting is routinely misunderstood as thinking it is true, which no p-value can ever tell you, and "all models are wrong" anyway).
PS: "Accept" can be appropriate wording in quality control applications where a batch of products may be "accepted" if a sample does not provide evidence against certain quality standards ("acceptance sampling"). The $\alpha$ in such (and some other) applications is best chosen taking into account considerations regarding costs of consequences, rather than using widespread defaults. Note also that the major benefit of the Neyman-Pearson setup is to characterise tests by error probabilities and to enable optimality theory (finding tests that have optimal power given the level). This does not mean that such tests in practice have to be interpreted exclusively in a binary reject/not reject manner; it does not "overwrite" the more precise information in the p-value. | Interpretation of p-value near alpha level | I will also add to Jeremy Miles' answer that makes a number of valid points. (I wrote initially that "I disagree with the claim that the reason that statistical significance testing doesn't seem to ma | Interpretation of p-value near alpha level
I will also add to Jeremy Miles' answer that makes a number of valid points. (I wrote initially that "I disagree with the claim that the reason that statistical significance testing doesn't seem to make sense is that, essentially, it doesn't", but Jeremy has made this more precise in the meantime.)
The p-value has a well defined mathematical meaning, which is the probability that given the null hypothesis is true, the test statistics is as far or farther away than what was observed from what is expected under the null hypothesis.
Now in language we are bound to be categorical, so we lack the words for saying how a p-value of 0.064 is different from 0.059, however we can talk for example about strong, weak, no evidence against the $H_0$ meaning here that something has happened that under the $H_0$ would happen very rarely/rarely/be very common.
If we want to make decisions (like going on to work as if the $H_0$ were true, or not true, if these two possibilities were the only ones to consider, i.e., we decide between only two courses of action) of course we need to decide how small is too small to stick with the $H_0$.
Now there are conventions like the ubiquitous $\alpha=0.05$. This is arbitrary to some extent, but you need to realise that specifying such a cutoff is necessary when making a binary decision - otherwise not (this by the way holds as well for any alternative to significance testing).
The interpretation in language of a p-value doesn't have a mathematical basis and will always be to some extent arbitrary, but once more, language is categorical, so if we use a finite number of different wordings, we are more transparent when having well defined cutoff values for them. With all the problems with which cutoff values come - for example if you put the cutoff between "very weak evidence" and "no evidence" at 0.1, you will in language distinguish between 0.99 and 0.101, but not between 0.101 and 0.103. That may not look particularly appropriate but somehow lies in the nature of the problem.
Overall you have some freedom as at least mathematics doesn't determine how you should say things, however you act more professionally when sticking to at least fairly generally accepted and transparent standards.
So using "reject/not reject" with a cutoff at 0.05 (or 0.01 in some fields) is a strong reduction of information and as such problematic, however people cannot accuse you of bending the evidence as you stick to a well established rule. That's something. It is important here though that you only really need to use this kind of binary distinction if a binary action decision is to be made. (Deciding to "believe" the $H_0$ or the alternative is in my view not a direct action, and models should not ever be "believed" in my view anyway.) Still then for those who like precision it can only be good to state the precise p-value.
It is also generally accepted to use "evidence language", although borderlines are not handled consistently all over the place. I don't think you can go very wrong by using 0.01/0.05/0.1 as cutoffs for saying there's "strong"/"some"/"weak"/"no" evidence against the $H_0$, but I have seen others. Also let's always keep in mind that categorisation is to some extent arbitrary, but also a necessity when people communicate in language.
It is also OK to differentiate even more by saying something like "There's some evidence as $p<0.05$ but it's really rather weak as in fact $p=0.046$." Or even "at $p=0.07$ we only have weak evidence against the $H_0$ but some doubt about it is justified and the effect estimator (...) is in fact quite large" (in case it is, in a subject matter sense).
Some wordings are clearly misleading such as "tends toward significance" (as (a) there's no "tending" and (b) the writer reveals implicitly that they would've wanted significance and are willing to sacrifice objectivity to make a certain impression) or "accepting" the $H_0$ (as accepting is routinely misunderstood as thinking it is true, which no p-value can ever tell you, and "all models are wrong" anyway).
PS: "Accept" can be appropriate wording in quality control applications where a batch of products may be "accepted" if a sample does not provide evidence against certain quality standards ("acceptance sampling"). The $\alpha$ in such (and some other) applications is best chosen taking into account considerations regarding costs of consequences, rather than using widespread defaults. Note also that the major benefit of the Neyman-Pearson setup is to characterise tests by error probabilities and to enable optimality theory (finding tests that have optimal power given the level). This does not mean that such tests in practice have to be interpreted exclusively in a binary reject/not reject manner; it does not "overwrite" the more precise information in the p-value. | Interpretation of p-value near alpha level
I will also add to Jeremy Miles' answer that makes a number of valid points. (I wrote initially that "I disagree with the claim that the reason that statistical significance testing doesn't seem to ma |
24,666 | Interpretation of p-value near alpha level | I would add to the excellent answer of Jeremy Miles by saying that how you treat your p-values also strongly depends on what you want to do with them. They get a bad reputation (and rightfully so), for being the deciding factor between "Your work is worth publishing" and "Your work is garbage".
However, what you take from your p-value depends for instance on your evaluation on how much you want to avoid type I / II errors.
Let's assume you're running a large-scale clinical trial for very cancer medication which is very expensive and heavy on side effects, and in the end you test whether the treated group had better survivability than the control group. By the medical context, you are incentivised to reject the null hypothesis "The medication is no better than placebo" then and only then if you are very certain that the medication is beneficial. Something like "our p-value is 0.08 which isn't significant but look, there's a trend" isn't going to cut it there.
If you take another example, and you are trying to sift through a large dataset to find associations between, say, environmental factors and microbiome, and you find an anticorrelation between PM2.5 pollution and the abundance of Parabacteroides golsteinii. Then with your statistics you're usually not laying claim to any clear conclusions, but are simply saying "Hey, this could be worth investigating further", in other words, your main goal is hypothesis generation. If here you end up with $p=0.08$ (especially if you fastidiously corrected for multiple testing), it could still be worth mentioning that sure, it wasn't significant at the $\alpha = 0.05$ level, but maybe we should have a look. (And in a perfect world, someone interested in this would then design a dedicated study to see whether there is a link or not).
In other words, if we look at a p-value not as a magic number, but a measure of effect size, or the weight of evidence, it can be seen in a more nuanced way (including for example interpreting it while taking into account other existing evidence on a hypothesis). | Interpretation of p-value near alpha level | I would add to the excellent answer of Jeremy Miles by saying that how you treat your p-values also strongly depends on what you want to do with them. They get a bad reputation (and rightfully so), fo | Interpretation of p-value near alpha level
I would add to the excellent answer of Jeremy Miles by saying that how you treat your p-values also strongly depends on what you want to do with them. They get a bad reputation (and rightfully so), for being the deciding factor between "Your work is worth publishing" and "Your work is garbage".
However, what you take from your p-value depends for instance on your evaluation on how much you want to avoid type I / II errors.
Let's assume you're running a large-scale clinical trial for very cancer medication which is very expensive and heavy on side effects, and in the end you test whether the treated group had better survivability than the control group. By the medical context, you are incentivised to reject the null hypothesis "The medication is no better than placebo" then and only then if you are very certain that the medication is beneficial. Something like "our p-value is 0.08 which isn't significant but look, there's a trend" isn't going to cut it there.
If you take another example, and you are trying to sift through a large dataset to find associations between, say, environmental factors and microbiome, and you find an anticorrelation between PM2.5 pollution and the abundance of Parabacteroides golsteinii. Then with your statistics you're usually not laying claim to any clear conclusions, but are simply saying "Hey, this could be worth investigating further", in other words, your main goal is hypothesis generation. If here you end up with $p=0.08$ (especially if you fastidiously corrected for multiple testing), it could still be worth mentioning that sure, it wasn't significant at the $\alpha = 0.05$ level, but maybe we should have a look. (And in a perfect world, someone interested in this would then design a dedicated study to see whether there is a link or not).
In other words, if we look at a p-value not as a magic number, but a measure of effect size, or the weight of evidence, it can be seen in a more nuanced way (including for example interpreting it while taking into account other existing evidence on a hypothesis). | Interpretation of p-value near alpha level
I would add to the excellent answer of Jeremy Miles by saying that how you treat your p-values also strongly depends on what you want to do with them. They get a bad reputation (and rightfully so), fo |
24,667 | Interpretation of p-value near alpha level | One consideration that is missing from the discussion is the problem when you have more than one test. As your p-value defining significance increases there is a concomitant increase in the chance that one or more of your statistical tests will have a p-value below that cut-off by chance alone given that the null-hypothesis is true. While there are standard methods for controlling for this, these are seldom applied to entire manuscripts.
If given a choice, I would discuss outcomes with p-values < 0.05 and give the p-value. I will not discuss the hugely awesomely gargantuanly significant p-value < 0.0000001 any different than it was significant at 0.037. I don't shift my significance level based on wanting one more significant variable to discuss.
Lastly, please consider the p-value as an estimate. Visualize a 95% confidence interval about your p-value. Given the variability in your data and your sample size do you really feel that your p-value of 0.000001 is accurate to 6 decimal places? Did you report all means and standard errors to that level of accuracy? | Interpretation of p-value near alpha level | One consideration that is missing from the discussion is the problem when you have more than one test. As your p-value defining significance increases there is a concomitant increase in the chance tha | Interpretation of p-value near alpha level
One consideration that is missing from the discussion is the problem when you have more than one test. As your p-value defining significance increases there is a concomitant increase in the chance that one or more of your statistical tests will have a p-value below that cut-off by chance alone given that the null-hypothesis is true. While there are standard methods for controlling for this, these are seldom applied to entire manuscripts.
If given a choice, I would discuss outcomes with p-values < 0.05 and give the p-value. I will not discuss the hugely awesomely gargantuanly significant p-value < 0.0000001 any different than it was significant at 0.037. I don't shift my significance level based on wanting one more significant variable to discuss.
Lastly, please consider the p-value as an estimate. Visualize a 95% confidence interval about your p-value. Given the variability in your data and your sample size do you really feel that your p-value of 0.000001 is accurate to 6 decimal places? Did you report all means and standard errors to that level of accuracy? | Interpretation of p-value near alpha level
One consideration that is missing from the discussion is the problem when you have more than one test. As your p-value defining significance increases there is a concomitant increase in the chance tha |
24,668 | Interpretation of p-value near alpha level | Frame challenge: Focus on the data you gathered and on weighing hypotheses against each other in metrics meaningful to your domain, not on the cult of the $p$-value.
The cult of the $p$-value is a system for journal editors to avoid putting their journal's good name on too many random flukes. Set $\alpha = 0.05$, and assume everyone works in good faith with no selection bias in the garden of forking $p$aths, and only 5% of your journal will be raising false alarms about results that are actually random flukes.1
That's all that "statistical significance" means: it's a false alarm rate under the premise of a status quo conventional wisdom null hypothesis, without reference to alternative hypotheses. Even if the d20 is perfectly fair, you get a journal article every time you roll a critical hit of 20.
Framing $\alpha = 0.05$ terms of "we require $p < 0.05$" is just a standard API for statistical tests: the same tests, computed by the same software (or computed by the same computers, back when "computer" was a job description), can be trivially scaled to different values of $\alpha$—and, perhaps, shopped around to different journals with different levels of tolerance for flukes—without any extra analysis, because under the null hypothesis, the distribution of $p$ is uniform random in $[0,1]$.
By definition, nothing about a $p$-value in general says anything about the plausibility or strength of evidence for alternative hypotheses, at least until you do a power analysis of the specific test in question to raise true alarms about specific alternative hypotheses of interest. For any statistical test of a sampling process under a null hypothesis, the $p$-value is uniformly distributed in $[0,1]$, but under alternative hypotheses, the $p$-value may have any distribution—including, for some alternatives, the same uniform distribution!
You gathered some data from a system; you have some hypotheses about the system, including, perhaps, some status quo assumptions about it in a null hypothesis. If the hypotheses make quantitative predictions, you can now compare those predictions quantitatively to weigh the hypotheses against each other—for example, if you have a likelihood function for two hypotheses, you can compute an odds ratio for the hypotheses to measure the strength of evidence for one over the other, and use that to guide a process of model selection. You might have to meet a $p$-value threshold for publication in a journal you want, but the substance of your research is about the data, methodology, and competing hypotheses.
What distinguishes metrics like odds ratios from $p$-values is that odds ratios are affected by both hypotheses you're examining, whereas $p$-values by definition are meaningful only to a null hypothesis. Now, it may happen that the computation of a $p$-value for some statistical test, $p = F(X)$, is also a useful function in the analysis of alternative hypotheses measuring the strength of evidence over the null hypothesis: you might happen to reuse the same function $F(X)$ of the data $X$ in the computation.2 But that's an accident of the test in question and must be phrased in specific terms of that test to have any meaning. A $p$-value on its face confers no strength of evidence; it's only a standard interface to let editors control the fraction of random flukes in their journals.
1 Of course, you might use the same theory for purposes other than a journal editor vetting paper submissions, but the decision theory of this rule in isolation works the same in whatever domain you apply it to.
2 This is what motivated Fisher's approach of publishing specific $p$-values and treating them with any kind of meaning about strength of evidence. However, although Fisher's method of combining $p$-values of several independent tests into a composite test with the same "statistical significance" (false alarm rate) is technically correct (as is the method of picking one $p$-value and discarding the rest), $p$-values as strength of evidence for alternative hypotheses are incommensurate and there is no general logic to reconcile them. Fisher attempted to create a theory of fiducial inference to address problems like this, but it is largely incoherent and has been abandoned by the wayside in the history of statistics. Unfortunately, vestiges of Fisher's abandoned theory remain in popular wisdom and textbook intellectual copypasta. | Interpretation of p-value near alpha level | Frame challenge: Focus on the data you gathered and on weighing hypotheses against each other in metrics meaningful to your domain, not on the cult of the $p$-value.
The cult of the $p$-value is a sys | Interpretation of p-value near alpha level
Frame challenge: Focus on the data you gathered and on weighing hypotheses against each other in metrics meaningful to your domain, not on the cult of the $p$-value.
The cult of the $p$-value is a system for journal editors to avoid putting their journal's good name on too many random flukes. Set $\alpha = 0.05$, and assume everyone works in good faith with no selection bias in the garden of forking $p$aths, and only 5% of your journal will be raising false alarms about results that are actually random flukes.1
That's all that "statistical significance" means: it's a false alarm rate under the premise of a status quo conventional wisdom null hypothesis, without reference to alternative hypotheses. Even if the d20 is perfectly fair, you get a journal article every time you roll a critical hit of 20.
Framing $\alpha = 0.05$ terms of "we require $p < 0.05$" is just a standard API for statistical tests: the same tests, computed by the same software (or computed by the same computers, back when "computer" was a job description), can be trivially scaled to different values of $\alpha$—and, perhaps, shopped around to different journals with different levels of tolerance for flukes—without any extra analysis, because under the null hypothesis, the distribution of $p$ is uniform random in $[0,1]$.
By definition, nothing about a $p$-value in general says anything about the plausibility or strength of evidence for alternative hypotheses, at least until you do a power analysis of the specific test in question to raise true alarms about specific alternative hypotheses of interest. For any statistical test of a sampling process under a null hypothesis, the $p$-value is uniformly distributed in $[0,1]$, but under alternative hypotheses, the $p$-value may have any distribution—including, for some alternatives, the same uniform distribution!
You gathered some data from a system; you have some hypotheses about the system, including, perhaps, some status quo assumptions about it in a null hypothesis. If the hypotheses make quantitative predictions, you can now compare those predictions quantitatively to weigh the hypotheses against each other—for example, if you have a likelihood function for two hypotheses, you can compute an odds ratio for the hypotheses to measure the strength of evidence for one over the other, and use that to guide a process of model selection. You might have to meet a $p$-value threshold for publication in a journal you want, but the substance of your research is about the data, methodology, and competing hypotheses.
What distinguishes metrics like odds ratios from $p$-values is that odds ratios are affected by both hypotheses you're examining, whereas $p$-values by definition are meaningful only to a null hypothesis. Now, it may happen that the computation of a $p$-value for some statistical test, $p = F(X)$, is also a useful function in the analysis of alternative hypotheses measuring the strength of evidence over the null hypothesis: you might happen to reuse the same function $F(X)$ of the data $X$ in the computation.2 But that's an accident of the test in question and must be phrased in specific terms of that test to have any meaning. A $p$-value on its face confers no strength of evidence; it's only a standard interface to let editors control the fraction of random flukes in their journals.
1 Of course, you might use the same theory for purposes other than a journal editor vetting paper submissions, but the decision theory of this rule in isolation works the same in whatever domain you apply it to.
2 This is what motivated Fisher's approach of publishing specific $p$-values and treating them with any kind of meaning about strength of evidence. However, although Fisher's method of combining $p$-values of several independent tests into a composite test with the same "statistical significance" (false alarm rate) is technically correct (as is the method of picking one $p$-value and discarding the rest), $p$-values as strength of evidence for alternative hypotheses are incommensurate and there is no general logic to reconcile them. Fisher attempted to create a theory of fiducial inference to address problems like this, but it is largely incoherent and has been abandoned by the wayside in the history of statistics. Unfortunately, vestiges of Fisher's abandoned theory remain in popular wisdom and textbook intellectual copypasta. | Interpretation of p-value near alpha level
Frame challenge: Focus on the data you gathered and on weighing hypotheses against each other in metrics meaningful to your domain, not on the cult of the $p$-value.
The cult of the $p$-value is a sys |
24,669 | What are some examples that require the use of Sinusoidal Regression? | Forecasting a process with seasonalities, i.e., recurring patterns. Sinusoidals, or higher Fourier terms, are especially useful if you have seasonalities with long periods, e.g., for daily or weekly data with yearly seasonalities, or for minutely data with daily seasonalities. My answer to Linear regression with “hour of the day” gives a few examples. Alternatively, take a look at the TBATS model for forecasting data with "complex" seasonalities, where the "T" stands for "trigonometric". A literature reference is given in the "multiple-seasonalities" tag wiki. | What are some examples that require the use of Sinusoidal Regression? | Forecasting a process with seasonalities, i.e., recurring patterns. Sinusoidals, or higher Fourier terms, are especially useful if you have seasonalities with long periods, e.g., for daily or weekly d | What are some examples that require the use of Sinusoidal Regression?
Forecasting a process with seasonalities, i.e., recurring patterns. Sinusoidals, or higher Fourier terms, are especially useful if you have seasonalities with long periods, e.g., for daily or weekly data with yearly seasonalities, or for minutely data with daily seasonalities. My answer to Linear regression with “hour of the day” gives a few examples. Alternatively, take a look at the TBATS model for forecasting data with "complex" seasonalities, where the "T" stands for "trigonometric". A literature reference is given in the "multiple-seasonalities" tag wiki. | What are some examples that require the use of Sinusoidal Regression?
Forecasting a process with seasonalities, i.e., recurring patterns. Sinusoidals, or higher Fourier terms, are especially useful if you have seasonalities with long periods, e.g., for daily or weekly d |
24,670 | What are some examples that require the use of Sinusoidal Regression? | Harmonic regression is your term. There's an equivalent and possibly easier form to deal with: $A\sin \omega t+B\cos \omega t+c$. This is also called a regression with Fourier predictors.
This is used anywhere where you expect constant wave like pattern in data, e.g. seasonality in sales revenues or prices. You often use more than one harmonic though, e.g. $ \omega t,2 \omega t,\dots$ to reproduce more complex patterns than a perfect sine wave | What are some examples that require the use of Sinusoidal Regression? | Harmonic regression is your term. There's an equivalent and possibly easier form to deal with: $A\sin \omega t+B\cos \omega t+c$. This is also called a regression with Fourier predictors.
This is used | What are some examples that require the use of Sinusoidal Regression?
Harmonic regression is your term. There's an equivalent and possibly easier form to deal with: $A\sin \omega t+B\cos \omega t+c$. This is also called a regression with Fourier predictors.
This is used anywhere where you expect constant wave like pattern in data, e.g. seasonality in sales revenues or prices. You often use more than one harmonic though, e.g. $ \omega t,2 \omega t,\dots$ to reproduce more complex patterns than a perfect sine wave | What are some examples that require the use of Sinusoidal Regression?
Harmonic regression is your term. There's an equivalent and possibly easier form to deal with: $A\sin \omega t+B\cos \omega t+c$. This is also called a regression with Fourier predictors.
This is used |
24,671 | What are some examples that require the use of Sinusoidal Regression? | There's a whole book on Bayesian approaches to this type of problem: Bayesian Spectrum Analysis and Parameter Estimation by Bretthorst (1988). The underlying problem domain was in nuclear magnetic resonance (NMR) signal processing. | What are some examples that require the use of Sinusoidal Regression? | There's a whole book on Bayesian approaches to this type of problem: Bayesian Spectrum Analysis and Parameter Estimation by Bretthorst (1988). The underlying problem domain was in nuclear magnetic re | What are some examples that require the use of Sinusoidal Regression?
There's a whole book on Bayesian approaches to this type of problem: Bayesian Spectrum Analysis and Parameter Estimation by Bretthorst (1988). The underlying problem domain was in nuclear magnetic resonance (NMR) signal processing. | What are some examples that require the use of Sinusoidal Regression?
There's a whole book on Bayesian approaches to this type of problem: Bayesian Spectrum Analysis and Parameter Estimation by Bretthorst (1988). The underlying problem domain was in nuclear magnetic re |
24,672 | What are some examples that require the use of Sinusoidal Regression? | I have worked in a few different research areas that dealt with unknown periodic trends. In my experience there are almost always better analytic methods to estimating these trends. It turns out that this model, while seeming quite general, actually has too many stringent assumptions. Add to that, the model can't be uniquely identified (offsetting $B$ by $\pi/2$ is equivalent to changing the sign of $A$). Here are the examples I worked on:
Premise: A colony of frogs are observed to migrate from one end of an aquarium to another at an unknown period. Solution: Frogs are affixed with GPS and Euclidean distance from a reference point is mapped over time, forming a sinusoidal trend. The period is estimated with fast Fourier transform (FFT). This is the scientific question and we are done, the amplitude is not of concern.
Premise: PM10 pollutant levels are observed to fluctuate seasonally, and researchers wish to have a granular-in-time prediction model. Solution: seasonality is already known. Plus pollutant levels vary according to other important regression features. Universal kriging is used. Land-use variables -- the regression component -- include model terms for season, so amplitude is known.
Premise: Ionic concentration outside the cardiac membrane is measured as a function of time to assess regular heart beat. The goal is to identify irregular heart beat. Solution: Nothing about the trend is known, the assumptions of sinusoidal regression are too stringent to provide any good alignment of depolarization of heartbeat. A first pass box car filter is used to identify ends of action potential and segment the series. The series are aligned based on depolarization, and smoothing splines are used to regress. Then outliers are identified by MSE for ionic concentration, or by duration.
A good reference for this might be Peter Diggle's Time Series A Biostatistical Introduction | What are some examples that require the use of Sinusoidal Regression? | I have worked in a few different research areas that dealt with unknown periodic trends. In my experience there are almost always better analytic methods to estimating these trends. It turns out that | What are some examples that require the use of Sinusoidal Regression?
I have worked in a few different research areas that dealt with unknown periodic trends. In my experience there are almost always better analytic methods to estimating these trends. It turns out that this model, while seeming quite general, actually has too many stringent assumptions. Add to that, the model can't be uniquely identified (offsetting $B$ by $\pi/2$ is equivalent to changing the sign of $A$). Here are the examples I worked on:
Premise: A colony of frogs are observed to migrate from one end of an aquarium to another at an unknown period. Solution: Frogs are affixed with GPS and Euclidean distance from a reference point is mapped over time, forming a sinusoidal trend. The period is estimated with fast Fourier transform (FFT). This is the scientific question and we are done, the amplitude is not of concern.
Premise: PM10 pollutant levels are observed to fluctuate seasonally, and researchers wish to have a granular-in-time prediction model. Solution: seasonality is already known. Plus pollutant levels vary according to other important regression features. Universal kriging is used. Land-use variables -- the regression component -- include model terms for season, so amplitude is known.
Premise: Ionic concentration outside the cardiac membrane is measured as a function of time to assess regular heart beat. The goal is to identify irregular heart beat. Solution: Nothing about the trend is known, the assumptions of sinusoidal regression are too stringent to provide any good alignment of depolarization of heartbeat. A first pass box car filter is used to identify ends of action potential and segment the series. The series are aligned based on depolarization, and smoothing splines are used to regress. Then outliers are identified by MSE for ionic concentration, or by duration.
A good reference for this might be Peter Diggle's Time Series A Biostatistical Introduction | What are some examples that require the use of Sinusoidal Regression?
I have worked in a few different research areas that dealt with unknown periodic trends. In my experience there are almost always better analytic methods to estimating these trends. It turns out that |
24,673 | What are some examples that require the use of Sinusoidal Regression? | We have a very sensitive optics system¹, where our signal changes slowly over time. However, there is a background noise of 60hz caused by nearby AC current. We sample 25 points over a second, and recover data like:
time signal
0.011 1546
0.044 1615
0.081 1772
0.115 1795
...
0.802 1792
0.838 1498
0.873 1507
Plotted, it looks like:
Note that the periodic behaviour above is aliasing from the 60hz signal.
We could just take the sample average of all points to get a estimate of the signal, but this isn't efficient: consider what happens when the samples start and end both “high”, or both “low” - this biases the average up, or down, respectively.
Instead, we directly model the system using the sinusoidal regression:
$$f(t, A, B, C) = C + A \sin(120\pi t + B) $$
Like the links in the question, we expand this as:
$$f(t, A', B', C) = C + A' \sin(120\pi t) + B'\cos(120\pi t) $$
which turns our problem into a linear regression problem. Solving using least squares and converting back to the original parameterization gives:
C = 1676.40
B = 1.46
A = 200.74
Plotting the fitted model vs the observed:
We use the value of C, 1676.4, as our final estimate. Note that this is different from the sample average of 1654.0.
¹ We are measuring low light signals that bounce of cells in our bioreactors. | What are some examples that require the use of Sinusoidal Regression? | We have a very sensitive optics system¹, where our signal changes slowly over time. However, there is a background noise of 60hz caused by nearby AC current. We sample 25 points over a second, and rec | What are some examples that require the use of Sinusoidal Regression?
We have a very sensitive optics system¹, where our signal changes slowly over time. However, there is a background noise of 60hz caused by nearby AC current. We sample 25 points over a second, and recover data like:
time signal
0.011 1546
0.044 1615
0.081 1772
0.115 1795
...
0.802 1792
0.838 1498
0.873 1507
Plotted, it looks like:
Note that the periodic behaviour above is aliasing from the 60hz signal.
We could just take the sample average of all points to get a estimate of the signal, but this isn't efficient: consider what happens when the samples start and end both “high”, or both “low” - this biases the average up, or down, respectively.
Instead, we directly model the system using the sinusoidal regression:
$$f(t, A, B, C) = C + A \sin(120\pi t + B) $$
Like the links in the question, we expand this as:
$$f(t, A', B', C) = C + A' \sin(120\pi t) + B'\cos(120\pi t) $$
which turns our problem into a linear regression problem. Solving using least squares and converting back to the original parameterization gives:
C = 1676.40
B = 1.46
A = 200.74
Plotting the fitted model vs the observed:
We use the value of C, 1676.4, as our final estimate. Note that this is different from the sample average of 1654.0.
¹ We are measuring low light signals that bounce of cells in our bioreactors. | What are some examples that require the use of Sinusoidal Regression?
We have a very sensitive optics system¹, where our signal changes slowly over time. However, there is a background noise of 60hz caused by nearby AC current. We sample 25 points over a second, and rec |
24,674 | What are some examples that require the use of Sinusoidal Regression? | Just an example that I often perform on MATLAB with my students: content of La Baells dam on Llobregat River, in Catalonia, from 2007 to 2017.
First I run this regression:
$$vol=A \cdot sin(T\cdot 2 \cdot pi/365.25)+B\cdot cos(T\cdot 2 \cdot pi/365.25)+K$$
where $T$ is time in days and $vol$ is water content in cubic hectometres:
That reveals the seasonal nature of water content. A closer inspection reveals a maximum in spring and a minimum in fall because in Central Catalonia the summer is the driest season, so precipitation is at minimum and water usage for irrigation and other uses is at maximum. We can also see that in 2007 we had a severe drought and that rainfall is quite irregular across years.
That can be improved by adding an harmonic:
$$vol=A \cdot sin(T\cdot 2 \cdot pi/365.25)+B\cdot cos(T\cdot 2 \cdot pi/365.25) + C \cdot sin(T\cdot 2 \cdot pi/365.25/2) + D\cdot cos(T\cdot 2 \cdot pi/365.25/2)+K$$
And here we can see a secondary maximum in early winter, after fall rains - fall is the second season with most precipitation, after spring.
The next few harmonics don't seem to improve the fit, and therefore they aren't included in this post. | What are some examples that require the use of Sinusoidal Regression? | Just an example that I often perform on MATLAB with my students: content of La Baells dam on Llobregat River, in Catalonia, from 2007 to 2017.
First I run this regression:
$$vol=A \cdot sin(T\cdot 2 \ | What are some examples that require the use of Sinusoidal Regression?
Just an example that I often perform on MATLAB with my students: content of La Baells dam on Llobregat River, in Catalonia, from 2007 to 2017.
First I run this regression:
$$vol=A \cdot sin(T\cdot 2 \cdot pi/365.25)+B\cdot cos(T\cdot 2 \cdot pi/365.25)+K$$
where $T$ is time in days and $vol$ is water content in cubic hectometres:
That reveals the seasonal nature of water content. A closer inspection reveals a maximum in spring and a minimum in fall because in Central Catalonia the summer is the driest season, so precipitation is at minimum and water usage for irrigation and other uses is at maximum. We can also see that in 2007 we had a severe drought and that rainfall is quite irregular across years.
That can be improved by adding an harmonic:
$$vol=A \cdot sin(T\cdot 2 \cdot pi/365.25)+B\cdot cos(T\cdot 2 \cdot pi/365.25) + C \cdot sin(T\cdot 2 \cdot pi/365.25/2) + D\cdot cos(T\cdot 2 \cdot pi/365.25/2)+K$$
And here we can see a secondary maximum in early winter, after fall rains - fall is the second season with most precipitation, after spring.
The next few harmonics don't seem to improve the fit, and therefore they aren't included in this post. | What are some examples that require the use of Sinusoidal Regression?
Just an example that I often perform on MATLAB with my students: content of La Baells dam on Llobregat River, in Catalonia, from 2007 to 2017.
First I run this regression:
$$vol=A \cdot sin(T\cdot 2 \ |
24,675 | What distributions have an undefined mean but are not symmetric? | I am guessing that you are looking for a positive, continuous probability distribution with infinite mean and with a maximum density away from zero.
I thought that by analogy with a Gamma distribution ($p(x) \propto x^a \exp(-x) \, dx$), we could try something with a rational (polynomial) rather than an exponential tail. After a little bit of lazy R and Python (sympy) experimentation, I came up with
$$
p(x) = \frac{1}{2\sqrt{3}\cdot \pi/9} \cdot \frac{x}{1+x^3} \, dx
$$
(I initially tried $p(x) \propto x/(1+x^2)$, but its integral diverges.) $\int_0^\infty p(x) \, dx$ is 1, as required, and $\int_0^\infty x p(x) \, dx$ diverges.
I don't know if this distribution has a name/literature associated with it.
The CDF is available in closed form but is pretty horrible ... (see Python code below ...)
$$
3 \sqrt{3} \left(- \frac{\log{\left(X + 1 \right)}}{6 \pi} + \frac{\log{\left(X^{2} - X + 1 \right)}}{12 \pi} + \frac{\sqrt{3} \operatorname{atan}{\left(\frac{2 \sqrt{3} X}{3} - \frac{\sqrt{3}}{3} \right)}}{6 \pi}\right) + \frac{1}{4}
$$
Without actually trying anything, I would guess that distributions of the form $x^a/(1+x^{a+2})$ will generally have these properties (but the computations will get progressively nastier). Someone with more analysis skills could probably prove a bunch of things.
An extremely knowledgeable colleague identified this as almost the same as a "Beta-Type 2 (m=2/3,n=1/3)" distribution (a Beta-Type 2 distribution has a term of the form $(1+x)^n$ in the denominator rather than the $1+x^n$ given above). You might want to use the Beta-Type 2 instead of my version; since you know what it's called you can search for useful code, or literature on its properties (e.g. here or here or McDonald et al 2013), or cite it in a paper: "Beta-Type 2" sounds so much better than "a distribution that some guy on CrossValidated made up".
... the Beta-Type 2 family with its density as
$$
f(x) = \frac{1}{\textrm{Beta}(m,n)} \frac{x^{m-1}}{(1+x)^{m+n}}
$$
over the support $(0,\infty)$
It is evident that if $m$ is chosen to be > 1, the mode will be away from 0. Also, if $n$ is chosen to be $\leq 1$, then the mean will be infinite. This family will produce [an] uncountable number of models with the property you are looking for.
... If you set $Y=X^3$ in your model, then it becomes a Beta-Type 2 $(m=2/3,n=1/3)$ and you can see that this fits the description I have given above.
They also identified the name of @ThomasLumley's contribution:
... it is called power gamma model or exponential-gamma model.
McDonald, James B., Jeff Sorensen, and Patrick A. Turley. “Skewness and Kurtosis Properties of Income Distribution Models.” Review of Income and Wealth 59, no. 2 (2013): 360–74. https://doi.org/10.1111/j.1475-4991.2011.00478.x.
R code:
f <- function(x) 1/(2*sqrt(3)*pi/9)*x/(1+x^3)
integrate(f, 0, Inf) ## 1 with absolute error < 4e-07
curve(f, from=0, to=10)
Python code (because I'm too lazy to integrate):
from sympy import *
x, n, N = symbols('x,n,N')
n=integrate(x/(1+x**3), (x, 0, oo)) ## 2*sqrt(3)*pi/9
integrate(x**2/(1+x**3), (x, 0, oo)) ## infinite mean
cdf = integrate(1/n*x/(1+x**3), (x, 0, X))
print(latex(cdf)) | What distributions have an undefined mean but are not symmetric? | I am guessing that you are looking for a positive, continuous probability distribution with infinite mean and with a maximum density away from zero.
I thought that by analogy with a Gamma distribution | What distributions have an undefined mean but are not symmetric?
I am guessing that you are looking for a positive, continuous probability distribution with infinite mean and with a maximum density away from zero.
I thought that by analogy with a Gamma distribution ($p(x) \propto x^a \exp(-x) \, dx$), we could try something with a rational (polynomial) rather than an exponential tail. After a little bit of lazy R and Python (sympy) experimentation, I came up with
$$
p(x) = \frac{1}{2\sqrt{3}\cdot \pi/9} \cdot \frac{x}{1+x^3} \, dx
$$
(I initially tried $p(x) \propto x/(1+x^2)$, but its integral diverges.) $\int_0^\infty p(x) \, dx$ is 1, as required, and $\int_0^\infty x p(x) \, dx$ diverges.
I don't know if this distribution has a name/literature associated with it.
The CDF is available in closed form but is pretty horrible ... (see Python code below ...)
$$
3 \sqrt{3} \left(- \frac{\log{\left(X + 1 \right)}}{6 \pi} + \frac{\log{\left(X^{2} - X + 1 \right)}}{12 \pi} + \frac{\sqrt{3} \operatorname{atan}{\left(\frac{2 \sqrt{3} X}{3} - \frac{\sqrt{3}}{3} \right)}}{6 \pi}\right) + \frac{1}{4}
$$
Without actually trying anything, I would guess that distributions of the form $x^a/(1+x^{a+2})$ will generally have these properties (but the computations will get progressively nastier). Someone with more analysis skills could probably prove a bunch of things.
An extremely knowledgeable colleague identified this as almost the same as a "Beta-Type 2 (m=2/3,n=1/3)" distribution (a Beta-Type 2 distribution has a term of the form $(1+x)^n$ in the denominator rather than the $1+x^n$ given above). You might want to use the Beta-Type 2 instead of my version; since you know what it's called you can search for useful code, or literature on its properties (e.g. here or here or McDonald et al 2013), or cite it in a paper: "Beta-Type 2" sounds so much better than "a distribution that some guy on CrossValidated made up".
... the Beta-Type 2 family with its density as
$$
f(x) = \frac{1}{\textrm{Beta}(m,n)} \frac{x^{m-1}}{(1+x)^{m+n}}
$$
over the support $(0,\infty)$
It is evident that if $m$ is chosen to be > 1, the mode will be away from 0. Also, if $n$ is chosen to be $\leq 1$, then the mean will be infinite. This family will produce [an] uncountable number of models with the property you are looking for.
... If you set $Y=X^3$ in your model, then it becomes a Beta-Type 2 $(m=2/3,n=1/3)$ and you can see that this fits the description I have given above.
They also identified the name of @ThomasLumley's contribution:
... it is called power gamma model or exponential-gamma model.
McDonald, James B., Jeff Sorensen, and Patrick A. Turley. “Skewness and Kurtosis Properties of Income Distribution Models.” Review of Income and Wealth 59, no. 2 (2013): 360–74. https://doi.org/10.1111/j.1475-4991.2011.00478.x.
R code:
f <- function(x) 1/(2*sqrt(3)*pi/9)*x/(1+x^3)
integrate(f, 0, Inf) ## 1 with absolute error < 4e-07
curve(f, from=0, to=10)
Python code (because I'm too lazy to integrate):
from sympy import *
x, n, N = symbols('x,n,N')
n=integrate(x/(1+x**3), (x, 0, oo)) ## 2*sqrt(3)*pi/9
integrate(x**2/(1+x**3), (x, 0, oo)) ## infinite mean
cdf = integrate(1/n*x/(1+x**3), (x, 0, X))
print(latex(cdf)) | What distributions have an undefined mean but are not symmetric?
I am guessing that you are looking for a positive, continuous probability distribution with infinite mean and with a maximum density away from zero.
I thought that by analogy with a Gamma distribution |
24,676 | What distributions have an undefined mean but are not symmetric? | If $X$ comes from Gamma distribution with pdf
$$f(x) = \frac{1}{\Gamma(k)}x^{k-1}e^{-x}$$
then $E[\exp(tX)]$ (the moment-generating function) exists only for $t<1$,
so $Z=\exp(X)$ (or even $Z-1$) is a strictly positive random variable without a finite mean. For $k>1$ the mode is not at the lower limit | What distributions have an undefined mean but are not symmetric? | If $X$ comes from Gamma distribution with pdf
$$f(x) = \frac{1}{\Gamma(k)}x^{k-1}e^{-x}$$
then $E[\exp(tX)]$ (the moment-generating function) exists only for $t<1$,
so $Z=\exp(X)$ (or even $Z-1$) is a | What distributions have an undefined mean but are not symmetric?
If $X$ comes from Gamma distribution with pdf
$$f(x) = \frac{1}{\Gamma(k)}x^{k-1}e^{-x}$$
then $E[\exp(tX)]$ (the moment-generating function) exists only for $t<1$,
so $Z=\exp(X)$ (or even $Z-1$) is a strictly positive random variable without a finite mean. For $k>1$ the mode is not at the lower limit | What distributions have an undefined mean but are not symmetric?
If $X$ comes from Gamma distribution with pdf
$$f(x) = \frac{1}{\Gamma(k)}x^{k-1}e^{-x}$$
then $E[\exp(tX)]$ (the moment-generating function) exists only for $t<1$,
so $Z=\exp(X)$ (or even $Z-1$) is a |
24,677 | What distributions have an undefined mean but are not symmetric? | Pareto distribution with density
$$
f(x) = \begin{cases} \frac{\alpha m^\alpha}{x^{\alpha+1}} &, x\ge m \\
0 &, x<m \end{cases}
$$
for some parameters $m>0, \alpha>0$. When $\alpha > 1 $ the expectation exists and is given by $\frac{\alpha}{\alpha-1}\cdot m$. When $\alpha \le 1$ the expectation do not exist, or as we say, it is infinite, because the integral defining it diverges to infinity.
Details in my answer at What is the difference between finite and infinite variance | What distributions have an undefined mean but are not symmetric? | Pareto distribution with density
$$
f(x) = \begin{cases} \frac{\alpha m^\alpha}{x^{\alpha+1}} &, x\ge m \\
0 &, x<m \end{cases}
$$
for some parameters $m>0, \alpha>0$. Whe | What distributions have an undefined mean but are not symmetric?
Pareto distribution with density
$$
f(x) = \begin{cases} \frac{\alpha m^\alpha}{x^{\alpha+1}} &, x\ge m \\
0 &, x<m \end{cases}
$$
for some parameters $m>0, \alpha>0$. When $\alpha > 1 $ the expectation exists and is given by $\frac{\alpha}{\alpha-1}\cdot m$. When $\alpha \le 1$ the expectation do not exist, or as we say, it is infinite, because the integral defining it diverges to infinity.
Details in my answer at What is the difference between finite and infinite variance | What distributions have an undefined mean but are not symmetric?
Pareto distribution with density
$$
f(x) = \begin{cases} \frac{\alpha m^\alpha}{x^{\alpha+1}} &, x\ge m \\
0 &, x<m \end{cases}
$$
for some parameters $m>0, \alpha>0$. Whe |
24,678 | What distributions have an undefined mean but are not symmetric? | I'll focus on continuous RVs. Let $X$ be a RV supported on $\mathbb R$ with density $f$.
If $X \geq 0$ a.s. (or $X\leq0$ a.s.) then the mean is well-defined, it's just $+\infty$ (or $-\infty$ if negative). This is just like how a sum of non-negative things always converges, it just might converge to $+\infty$. An example of this is the folded Cauchy distribution. In order to have an undefined mean we need $X$ to take both positive and negative values, and the mean on either set of values need to be infinite so that there's no overall mean.
Here's an example: take
$$
f(x) \propto \begin{cases}
\frac 1{(x-1)^2+1} & x < 1 \\
\frac 1{(x-1)^{3/2}+1} & x \geq 1
\end{cases}
$$
Then
$$
\text EX = \int_{-\infty}^\infty xf(x)\,\text dx \propto \int_{-\infty}^1 \frac{x}{(x-1)^2+1}\,\text dx + \int_1^\infty \frac{x}{(x-1)^{3/2}+1}\,\text dx = -\infty + \infty
$$
and this is undefined. I'm just combining two different tails where both are integrable but neither has a finite first moment. I'm also shifting it over to get the mode away from zero. | What distributions have an undefined mean but are not symmetric? | I'll focus on continuous RVs. Let $X$ be a RV supported on $\mathbb R$ with density $f$.
If $X \geq 0$ a.s. (or $X\leq0$ a.s.) then the mean is well-defined, it's just $+\infty$ (or $-\infty$ if negat | What distributions have an undefined mean but are not symmetric?
I'll focus on continuous RVs. Let $X$ be a RV supported on $\mathbb R$ with density $f$.
If $X \geq 0$ a.s. (or $X\leq0$ a.s.) then the mean is well-defined, it's just $+\infty$ (or $-\infty$ if negative). This is just like how a sum of non-negative things always converges, it just might converge to $+\infty$. An example of this is the folded Cauchy distribution. In order to have an undefined mean we need $X$ to take both positive and negative values, and the mean on either set of values need to be infinite so that there's no overall mean.
Here's an example: take
$$
f(x) \propto \begin{cases}
\frac 1{(x-1)^2+1} & x < 1 \\
\frac 1{(x-1)^{3/2}+1} & x \geq 1
\end{cases}
$$
Then
$$
\text EX = \int_{-\infty}^\infty xf(x)\,\text dx \propto \int_{-\infty}^1 \frac{x}{(x-1)^2+1}\,\text dx + \int_1^\infty \frac{x}{(x-1)^{3/2}+1}\,\text dx = -\infty + \infty
$$
and this is undefined. I'm just combining two different tails where both are integrable but neither has a finite first moment. I'm also shifting it over to get the mode away from zero. | What distributions have an undefined mean but are not symmetric?
I'll focus on continuous RVs. Let $X$ be a RV supported on $\mathbb R$ with density $f$.
If $X \geq 0$ a.s. (or $X\leq0$ a.s.) then the mean is well-defined, it's just $+\infty$ (or $-\infty$ if negat |
24,679 | What distributions have an undefined mean but are not symmetric? | A non-central F-distribution with $\nu_1=\nu_2=2$ degrees of freedom and non-centrality shape parameter $\lambda=3$ has support on $\mathbb{R}^+$ and looks like it satisfies all your requirements. Beta functions and Gamma functions have been expanded to put it in this very simple form:
$$
f(x)=\frac{e^{-\frac{3}{2 x+2}} (5 x+2)}{2 (x+1)^3}, \ x\ge0
$$
The CDF is very simple too:
$$
F(x)=\frac{e^{-\frac{3}{2 x+2}} x}{x+1}
$$
We have the following:
$$
\int^\infty_0{f(x)\ \text{d}x} = \displaystyle\lim_{x \to \infty}\frac{e^{-\frac{3}{2 (x+1)}} x}{x+1}=1
$$
The mean doesn't exist when $\nu_2\leq2$, and neither does the variance when $\nu_2\leq4$ which is our case above.
The mode appears at $x=(-7 + 3 \sqrt{41})/40\approx0.305$ so it has a maximum density beyond $0$. | What distributions have an undefined mean but are not symmetric? | A non-central F-distribution with $\nu_1=\nu_2=2$ degrees of freedom and non-centrality shape parameter $\lambda=3$ has support on $\mathbb{R}^+$ and looks like it satisfies all your requirements. Bet | What distributions have an undefined mean but are not symmetric?
A non-central F-distribution with $\nu_1=\nu_2=2$ degrees of freedom and non-centrality shape parameter $\lambda=3$ has support on $\mathbb{R}^+$ and looks like it satisfies all your requirements. Beta functions and Gamma functions have been expanded to put it in this very simple form:
$$
f(x)=\frac{e^{-\frac{3}{2 x+2}} (5 x+2)}{2 (x+1)^3}, \ x\ge0
$$
The CDF is very simple too:
$$
F(x)=\frac{e^{-\frac{3}{2 x+2}} x}{x+1}
$$
We have the following:
$$
\int^\infty_0{f(x)\ \text{d}x} = \displaystyle\lim_{x \to \infty}\frac{e^{-\frac{3}{2 (x+1)}} x}{x+1}=1
$$
The mean doesn't exist when $\nu_2\leq2$, and neither does the variance when $\nu_2\leq4$ which is our case above.
The mode appears at $x=(-7 + 3 \sqrt{41})/40\approx0.305$ so it has a maximum density beyond $0$. | What distributions have an undefined mean but are not symmetric?
A non-central F-distribution with $\nu_1=\nu_2=2$ degrees of freedom and non-centrality shape parameter $\lambda=3$ has support on $\mathbb{R}^+$ and looks like it satisfies all your requirements. Bet |
24,680 | What distributions have an undefined mean but are not symmetric? | One of the Pareto distributions:
\begin{align}
& \Pr(X>x) = \frac 1 x \text{ for }x\ge1. \\[8pt]
& \Pr(X\in A) = \int_A \frac{dx}{x^2} \text{ for } A\subseteq (1,+\infty).
\end{align} | What distributions have an undefined mean but are not symmetric? | One of the Pareto distributions:
\begin{align}
& \Pr(X>x) = \frac 1 x \text{ for }x\ge1. \\[8pt]
& \Pr(X\in A) = \int_A \frac{dx}{x^2} \text{ for } A\subseteq (1,+\infty).
\end{align} | What distributions have an undefined mean but are not symmetric?
One of the Pareto distributions:
\begin{align}
& \Pr(X>x) = \frac 1 x \text{ for }x\ge1. \\[8pt]
& \Pr(X\in A) = \int_A \frac{dx}{x^2} \text{ for } A\subseteq (1,+\infty).
\end{align} | What distributions have an undefined mean but are not symmetric?
One of the Pareto distributions:
\begin{align}
& \Pr(X>x) = \frac 1 x \text{ for }x\ge1. \\[8pt]
& \Pr(X\in A) = \int_A \frac{dx}{x^2} \text{ for } A\subseteq (1,+\infty).
\end{align} |
24,681 | What distributions have an undefined mean but are not symmetric? | The St. Petersburg distribution:
$$
\Pr(X= 2^n) = \frac 1 {2^{n+1}} \text{ for } n = 0,1,2,3,\ldots
$$ | What distributions have an undefined mean but are not symmetric? | The St. Petersburg distribution:
$$
\Pr(X= 2^n) = \frac 1 {2^{n+1}} \text{ for } n = 0,1,2,3,\ldots
$$ | What distributions have an undefined mean but are not symmetric?
The St. Petersburg distribution:
$$
\Pr(X= 2^n) = \frac 1 {2^{n+1}} \text{ for } n = 0,1,2,3,\ldots
$$ | What distributions have an undefined mean but are not symmetric?
The St. Petersburg distribution:
$$
\Pr(X= 2^n) = \frac 1 {2^{n+1}} \text{ for } n = 0,1,2,3,\ldots
$$ |
24,682 | Is it valid to change the model after seeing the results of test data? | If you do that, then your "test" data is no longer entirely test data --- it is now partly training data. Indeed, the entire distinction between these two classes is that the training data is used to formulate hypotheses and models, and the test data is then used to make inferences in relation to those hypotheses under the model. For that reason, it is a good idea to take care to formulate a sufficiently general model at the training stage, noting that you might want to include higher-order effects that allow for more general functional forms than are exhibited in the training data.
In any case, if you use your "test" data to adjust the model, but then still treat it as test data, you are effectively using the data twice, first as training data, then as test data. The danger here is that the model choice might relate to the hypotheses of interest, in which case this method induces confirmation bias in your analysis, whereby the tests are biased in favour of acceptance of the hypotheses. If your modelling changes are unrelated to the hypotheses of interest then you might get away with it without imposing bias (or at least, without imposing too much bias), but it is very difficult to be sure. If you decide to do this, I would suggest that you at least conduct a sensitivity analysis that compares the conclusions from your preferred model with the conclusions from the original model. That way you can check to see if the change in the model affected any of the conclusions in relation to the hypotheses of interest (or if it just fit better in other respects). | Is it valid to change the model after seeing the results of test data? | If you do that, then your "test" data is no longer entirely test data --- it is now partly training data. Indeed, the entire distinction between these two classes is that the training data is used to | Is it valid to change the model after seeing the results of test data?
If you do that, then your "test" data is no longer entirely test data --- it is now partly training data. Indeed, the entire distinction between these two classes is that the training data is used to formulate hypotheses and models, and the test data is then used to make inferences in relation to those hypotheses under the model. For that reason, it is a good idea to take care to formulate a sufficiently general model at the training stage, noting that you might want to include higher-order effects that allow for more general functional forms than are exhibited in the training data.
In any case, if you use your "test" data to adjust the model, but then still treat it as test data, you are effectively using the data twice, first as training data, then as test data. The danger here is that the model choice might relate to the hypotheses of interest, in which case this method induces confirmation bias in your analysis, whereby the tests are biased in favour of acceptance of the hypotheses. If your modelling changes are unrelated to the hypotheses of interest then you might get away with it without imposing bias (or at least, without imposing too much bias), but it is very difficult to be sure. If you decide to do this, I would suggest that you at least conduct a sensitivity analysis that compares the conclusions from your preferred model with the conclusions from the original model. That way you can check to see if the change in the model affected any of the conclusions in relation to the hypotheses of interest (or if it just fit better in other respects). | Is it valid to change the model after seeing the results of test data?
If you do that, then your "test" data is no longer entirely test data --- it is now partly training data. Indeed, the entire distinction between these two classes is that the training data is used to |
24,683 | Is it valid to change the model after seeing the results of test data? | One way to solve your problem is to just use Cross-validation across the whole set, as opposed to a normal test-train split. The theoretical details of how this works are explained in Chapter 7 of ESL. Intuitively a test-train split is just a 1-fold cross-validation, so, sample size permitting, you can try a k-fold cross-validation instead.
Ch. 7 of ESL also mentions other possibilities such as using information criteria (AIC, BIC, etc...) or structural risk minimization as proxies for out-of-sample model performance.
There is a more interesting "big picture" question implicit in your post though. If you are going to use your model for a real world problem, it is more than likely that your production data distribution will eventually drift, and the challenge of re-estimating your model accordingly is part of the much wider topic of ML Ops, which I definitely recommend you look at if you are interested in applying DS and ML to real world use cases. | Is it valid to change the model after seeing the results of test data? | One way to solve your problem is to just use Cross-validation across the whole set, as opposed to a normal test-train split. The theoretical details of how this works are explained in Chapter 7 of ESL | Is it valid to change the model after seeing the results of test data?
One way to solve your problem is to just use Cross-validation across the whole set, as opposed to a normal test-train split. The theoretical details of how this works are explained in Chapter 7 of ESL. Intuitively a test-train split is just a 1-fold cross-validation, so, sample size permitting, you can try a k-fold cross-validation instead.
Ch. 7 of ESL also mentions other possibilities such as using information criteria (AIC, BIC, etc...) or structural risk minimization as proxies for out-of-sample model performance.
There is a more interesting "big picture" question implicit in your post though. If you are going to use your model for a real world problem, it is more than likely that your production data distribution will eventually drift, and the challenge of re-estimating your model accordingly is part of the much wider topic of ML Ops, which I definitely recommend you look at if you are interested in applying DS and ML to real world use cases. | Is it valid to change the model after seeing the results of test data?
One way to solve your problem is to just use Cross-validation across the whole set, as opposed to a normal test-train split. The theoretical details of how this works are explained in Chapter 7 of ESL |
24,684 | Is it valid to change the model after seeing the results of test data? | The process you describe is not appropriate. By using the test set twice, you are allowing that data to influence your model selection. That data thus becomes part of your modeling process rather than serving as a means of external validation. | Is it valid to change the model after seeing the results of test data? | The process you describe is not appropriate. By using the test set twice, you are allowing that data to influence your model selection. That data thus becomes part of your modeling process rather than | Is it valid to change the model after seeing the results of test data?
The process you describe is not appropriate. By using the test set twice, you are allowing that data to influence your model selection. That data thus becomes part of your modeling process rather than serving as a means of external validation. | Is it valid to change the model after seeing the results of test data?
The process you describe is not appropriate. By using the test set twice, you are allowing that data to influence your model selection. That data thus becomes part of your modeling process rather than |
24,685 | Is it valid to change the model after seeing the results of test data? | If you did so, you added "additional information" in your training process and that would incur over-parameterization issues in your final model.
Suppose you are performing supervised learning techniques for your tasks, from the empirical risk minimization perspective, we try to look for a function $h$ that minimizes the loss between prediction $\hat{y}$ and true outcome $y$, in other words, we look for a function that best represents the map $X\to Y$. The reason why we need more data to better approximate our model is that CLT guarantees as $n \to \infty$, the risk will converge to 0, which laid the theoretical foundation for the reason why we need more examples to train our model in supervised learning problems.
Back to your example, what if a polynomial function fits better than the linear model? I assume this discrepancy comes from two possible situations:
1 the class distribution is severally imbalanced.
2 the training data isn't representative of the entire data set.
In order to handle these issues, you can obviously try cross-validation procedures in order to get an overall sense of entire data distribution. In addition, oversampling or undersampling methods are alternatives for dealing with class-imbalanced issues. But test data should only be used when a model is already trained, otherwise, it shall be independent of any steps beforehand. Hope this answer helps. | Is it valid to change the model after seeing the results of test data? | If you did so, you added "additional information" in your training process and that would incur over-parameterization issues in your final model.
Suppose you are performing supervised learning techni | Is it valid to change the model after seeing the results of test data?
If you did so, you added "additional information" in your training process and that would incur over-parameterization issues in your final model.
Suppose you are performing supervised learning techniques for your tasks, from the empirical risk minimization perspective, we try to look for a function $h$ that minimizes the loss between prediction $\hat{y}$ and true outcome $y$, in other words, we look for a function that best represents the map $X\to Y$. The reason why we need more data to better approximate our model is that CLT guarantees as $n \to \infty$, the risk will converge to 0, which laid the theoretical foundation for the reason why we need more examples to train our model in supervised learning problems.
Back to your example, what if a polynomial function fits better than the linear model? I assume this discrepancy comes from two possible situations:
1 the class distribution is severally imbalanced.
2 the training data isn't representative of the entire data set.
In order to handle these issues, you can obviously try cross-validation procedures in order to get an overall sense of entire data distribution. In addition, oversampling or undersampling methods are alternatives for dealing with class-imbalanced issues. But test data should only be used when a model is already trained, otherwise, it shall be independent of any steps beforehand. Hope this answer helps. | Is it valid to change the model after seeing the results of test data?
If you did so, you added "additional information" in your training process and that would incur over-parameterization issues in your final model.
Suppose you are performing supervised learning techni |
24,686 | How to generate a $\pm 1$ sequence with mean $0.05$? | Your desired mean is given by equation:
$\frac{N\cdot p - N \cdot (1-p)}{N} = .05$
from which follows that the probability of the 1s should be .525
In Python:
x = np.random.choice([-1,1], size=int(1e6), replace = True, p = [.475, .525])
Proof:
x.mean()
0.050742000000000002
1'000 experiments with 1'000'000 samples of 1s and -1s:
For the sake of completeness (hat tip to @Elvis ):
import scipy.stats as st
x = 2*st.binom(1, .525).rvs(1000000) - 1
x.mean()
0.053859999999999998
1'000 experiments with 1'000'000 samples of 1s and -1s:
And finally drawing from uniform distribution, as suggested by @Łukasz Deryło (also, in Python):
u = st.uniform(0,1).rvs(1000000)
x = 2*(u<.525) -1
x.mean()
0.049585999999999998
1'000 experiments with 1'000'000 samples of 1s and -1s:
All the three look virtually identical!
EDIT
Couple of lines on Central limit theorem and the spread of resulting distributions.
First of all, the draws of means indeed follow Normal Distribution.
Second, @Elvis in his comment to this answer did some nice calculations on the exact spread of the means drawn over 1'000 experiments (circa (0.048;0.052)), 95% confidence interval.
And these are results of the simulations, to confirm his results:
mn = []
for _ in range(1000):
mn.append((2*st.binom(1, .525).rvs(1000000) - 1).mean())
np.percentile(mn, [2.5,97.5])
array([ 0.0480773, 0.0518703]) | How to generate a $\pm 1$ sequence with mean $0.05$? | Your desired mean is given by equation:
$\frac{N\cdot p - N \cdot (1-p)}{N} = .05$
from which follows that the probability of the 1s should be .525
In Python:
x = np.random.choice([-1,1], size=int(1e6 | How to generate a $\pm 1$ sequence with mean $0.05$?
Your desired mean is given by equation:
$\frac{N\cdot p - N \cdot (1-p)}{N} = .05$
from which follows that the probability of the 1s should be .525
In Python:
x = np.random.choice([-1,1], size=int(1e6), replace = True, p = [.475, .525])
Proof:
x.mean()
0.050742000000000002
1'000 experiments with 1'000'000 samples of 1s and -1s:
For the sake of completeness (hat tip to @Elvis ):
import scipy.stats as st
x = 2*st.binom(1, .525).rvs(1000000) - 1
x.mean()
0.053859999999999998
1'000 experiments with 1'000'000 samples of 1s and -1s:
And finally drawing from uniform distribution, as suggested by @Łukasz Deryło (also, in Python):
u = st.uniform(0,1).rvs(1000000)
x = 2*(u<.525) -1
x.mean()
0.049585999999999998
1'000 experiments with 1'000'000 samples of 1s and -1s:
All the three look virtually identical!
EDIT
Couple of lines on Central limit theorem and the spread of resulting distributions.
First of all, the draws of means indeed follow Normal Distribution.
Second, @Elvis in his comment to this answer did some nice calculations on the exact spread of the means drawn over 1'000 experiments (circa (0.048;0.052)), 95% confidence interval.
And these are results of the simulations, to confirm his results:
mn = []
for _ in range(1000):
mn.append((2*st.binom(1, .525).rvs(1000000) - 1).mean())
np.percentile(mn, [2.5,97.5])
array([ 0.0480773, 0.0518703]) | How to generate a $\pm 1$ sequence with mean $0.05$?
Your desired mean is given by equation:
$\frac{N\cdot p - N \cdot (1-p)}{N} = .05$
from which follows that the probability of the 1s should be .525
In Python:
x = np.random.choice([-1,1], size=int(1e6 |
24,687 | How to generate a $\pm 1$ sequence with mean $0.05$? | A variable with values $-1$ and $1$ is of the form $Y = 2X - 1$ with $X$ a Bernoulli with parameter $p$. Its expected value is $E(Y) = 2 E(X) - 1 = 2p - 1$, so you know how to obtain $p$ (here $p = 0.525$).
In R you can generate Bernoulli variables with rbinom(n, size = 1, prob = p), so for example
x <- rbinom(100, 1, 0.525)
y <- 2*x-1 | How to generate a $\pm 1$ sequence with mean $0.05$? | A variable with values $-1$ and $1$ is of the form $Y = 2X - 1$ with $X$ a Bernoulli with parameter $p$. Its expected value is $E(Y) = 2 E(X) - 1 = 2p - 1$, so you know how to obtain $p$ (here $p = 0. | How to generate a $\pm 1$ sequence with mean $0.05$?
A variable with values $-1$ and $1$ is of the form $Y = 2X - 1$ with $X$ a Bernoulli with parameter $p$. Its expected value is $E(Y) = 2 E(X) - 1 = 2p - 1$, so you know how to obtain $p$ (here $p = 0.525$).
In R you can generate Bernoulli variables with rbinom(n, size = 1, prob = p), so for example
x <- rbinom(100, 1, 0.525)
y <- 2*x-1 | How to generate a $\pm 1$ sequence with mean $0.05$?
A variable with values $-1$ and $1$ is of the form $Y = 2X - 1$ with $X$ a Bernoulli with parameter $p$. Its expected value is $E(Y) = 2 E(X) - 1 = 2p - 1$, so you know how to obtain $p$ (here $p = 0. |
24,688 | How to generate a $\pm 1$ sequence with mean $0.05$? | Generate $N$ samples uniformly from $[0,1]$, recode numbers lower than 0.525 to 1 and rest to -1.
Then your expected value is
$1 \cdot 0.525 + (-1)\cdot (1-0.525) = 0.525 - 0.475 = 0.05$
I'm not a Matlab user, but I guess it sholud be
2*(rand(1, 10000, 1)<=.525)-1 | How to generate a $\pm 1$ sequence with mean $0.05$? | Generate $N$ samples uniformly from $[0,1]$, recode numbers lower than 0.525 to 1 and rest to -1.
Then your expected value is
$1 \cdot 0.525 + (-1)\cdot (1-0.525) = 0.525 - 0.475 = 0.05$
I'm not a Mat | How to generate a $\pm 1$ sequence with mean $0.05$?
Generate $N$ samples uniformly from $[0,1]$, recode numbers lower than 0.525 to 1 and rest to -1.
Then your expected value is
$1 \cdot 0.525 + (-1)\cdot (1-0.525) = 0.525 - 0.475 = 0.05$
I'm not a Matlab user, but I guess it sholud be
2*(rand(1, 10000, 1)<=.525)-1 | How to generate a $\pm 1$ sequence with mean $0.05$?
Generate $N$ samples uniformly from $[0,1]$, recode numbers lower than 0.525 to 1 and rest to -1.
Then your expected value is
$1 \cdot 0.525 + (-1)\cdot (1-0.525) = 0.525 - 0.475 = 0.05$
I'm not a Mat |
24,689 | How to generate a $\pm 1$ sequence with mean $0.05$? | You need to generate more 1s than -1s. Precisely, 5% more 1s because you want your mean to be 0.05. So, you increase the probability of 1s by 2.5% and decrease -1s by 2.5%. In your code it's equivalent to changing 0.5 to 0.525, i.e. from 50% to 52.5% | How to generate a $\pm 1$ sequence with mean $0.05$? | You need to generate more 1s than -1s. Precisely, 5% more 1s because you want your mean to be 0.05. So, you increase the probability of 1s by 2.5% and decrease -1s by 2.5%. In your code it's equivalen | How to generate a $\pm 1$ sequence with mean $0.05$?
You need to generate more 1s than -1s. Precisely, 5% more 1s because you want your mean to be 0.05. So, you increase the probability of 1s by 2.5% and decrease -1s by 2.5%. In your code it's equivalent to changing 0.5 to 0.525, i.e. from 50% to 52.5% | How to generate a $\pm 1$ sequence with mean $0.05$?
You need to generate more 1s than -1s. Precisely, 5% more 1s because you want your mean to be 0.05. So, you increase the probability of 1s by 2.5% and decrease -1s by 2.5%. In your code it's equivalen |
24,690 | Can I use a Mann-Whitney U Test with a very small sample? | This has been discussed at length on this site. Briefly, the test is valid. But no test is especially helpful because of our inability to interpret large p-values, which do not indicate "no difference". Instead I would replace a test with a confidence interval or Bayesian credible interval. These have interpretations regardless of sample size and regardless of whether a null hypothesis is true. | Can I use a Mann-Whitney U Test with a very small sample? | This has been discussed at length on this site. Briefly, the test is valid. But no test is especially helpful because of our inability to interpret large p-values, which do not indicate "no differen | Can I use a Mann-Whitney U Test with a very small sample?
This has been discussed at length on this site. Briefly, the test is valid. But no test is especially helpful because of our inability to interpret large p-values, which do not indicate "no difference". Instead I would replace a test with a confidence interval or Bayesian credible interval. These have interpretations regardless of sample size and regardless of whether a null hypothesis is true. | Can I use a Mann-Whitney U Test with a very small sample?
This has been discussed at length on this site. Briefly, the test is valid. But no test is especially helpful because of our inability to interpret large p-values, which do not indicate "no differen |
24,691 | Can I use a Mann-Whitney U Test with a very small sample? | Frank's advice is useful; I don't wish my answer to suggest any disagreement with that answer.
The Wilcoxon-Mann-Whitney test "works as it should" in small samples. There's a few things to note:
You will have the usual issues with trying to use hypothesis tests in small samples, like low power against anything but large effects (and all the consequences that come along with that). That's not specific to the test you're using -- other tests will also have the same issues because of the same small sample sizes.
A permutation test (such as the Wilcoxon-Mann-Whitney test) will not typically attain exactly the desired type I error rate, though this impact will only be particularly noticeable in quite small samples. For example, if your rejection rule is "reject if the computer tells me the p-value is $\leq$ 0.05", then you won't actually attain the 5% significance level you were aiming for, because of the discreteness of the test statistic. With the Wilcoxon-Mann-Whitney at $n_1=n_2=6$, and a two-sided alternative, that rejection rule actually leads to a 4.1% type I error rate (if the computer is using exact p-value calculations, at least), so the test conducted that way is somewhat conservative. [There's a way to mitigate this issue at least somewhat without going to randomized tests, though it may be best to avoid distracting
from the main question here by detailing it.]
Casting the rejection rule in terms of the p-value means you only get the next lower significance level to the one you were seeking. Imagine you wanted a 1% test; then the type I error rate you get goes down from there, even if there was one only just above 1% that you might perhaps have been happy to use had you only realized it was there. For example, if the available significance levels were 0.4% and 1.01%, you'll get the 0.4% level with the approach of comparing the p-value to the significance level you were originally aiming for. This problem becomes more noticeable when adjusting individual significance levels for multiple testing to control overall type I error, and considerably worse at even smaller sample sizes than yours.
It's quite possible this way to get into a situation where your actual significance level is not just "lower than you wanted", but exactly $0$. This is not merely a theoretical possibility that would not occur in practice $-$ I have seen multiple occasions where people have done just this without even realizing it. I think it's better (before seeing the data to avoid any appearance of p-hacking) to consider the available significance levels and choose the testing strategy in full knowledge of the situation one is to be faced with, rather than being surprised by it after seeing the data - or worse, to never even realize that it was not possible to reject the null with the rejection rule that was being used.
It's not difficult to identify all the available significance levels for whatever test you're using (e.g. for the specific situation you're asking about, it can be done with a single line of R code), and I can't see any good reason not to do so as a matter of course, whenever you would be faced with small sample sizes and a discrete test statistic. | Can I use a Mann-Whitney U Test with a very small sample? | Frank's advice is useful; I don't wish my answer to suggest any disagreement with that answer.
The Wilcoxon-Mann-Whitney test "works as it should" in small samples. There's a few things to note:
You | Can I use a Mann-Whitney U Test with a very small sample?
Frank's advice is useful; I don't wish my answer to suggest any disagreement with that answer.
The Wilcoxon-Mann-Whitney test "works as it should" in small samples. There's a few things to note:
You will have the usual issues with trying to use hypothesis tests in small samples, like low power against anything but large effects (and all the consequences that come along with that). That's not specific to the test you're using -- other tests will also have the same issues because of the same small sample sizes.
A permutation test (such as the Wilcoxon-Mann-Whitney test) will not typically attain exactly the desired type I error rate, though this impact will only be particularly noticeable in quite small samples. For example, if your rejection rule is "reject if the computer tells me the p-value is $\leq$ 0.05", then you won't actually attain the 5% significance level you were aiming for, because of the discreteness of the test statistic. With the Wilcoxon-Mann-Whitney at $n_1=n_2=6$, and a two-sided alternative, that rejection rule actually leads to a 4.1% type I error rate (if the computer is using exact p-value calculations, at least), so the test conducted that way is somewhat conservative. [There's a way to mitigate this issue at least somewhat without going to randomized tests, though it may be best to avoid distracting
from the main question here by detailing it.]
Casting the rejection rule in terms of the p-value means you only get the next lower significance level to the one you were seeking. Imagine you wanted a 1% test; then the type I error rate you get goes down from there, even if there was one only just above 1% that you might perhaps have been happy to use had you only realized it was there. For example, if the available significance levels were 0.4% and 1.01%, you'll get the 0.4% level with the approach of comparing the p-value to the significance level you were originally aiming for. This problem becomes more noticeable when adjusting individual significance levels for multiple testing to control overall type I error, and considerably worse at even smaller sample sizes than yours.
It's quite possible this way to get into a situation where your actual significance level is not just "lower than you wanted", but exactly $0$. This is not merely a theoretical possibility that would not occur in practice $-$ I have seen multiple occasions where people have done just this without even realizing it. I think it's better (before seeing the data to avoid any appearance of p-hacking) to consider the available significance levels and choose the testing strategy in full knowledge of the situation one is to be faced with, rather than being surprised by it after seeing the data - or worse, to never even realize that it was not possible to reject the null with the rejection rule that was being used.
It's not difficult to identify all the available significance levels for whatever test you're using (e.g. for the specific situation you're asking about, it can be done with a single line of R code), and I can't see any good reason not to do so as a matter of course, whenever you would be faced with small sample sizes and a discrete test statistic. | Can I use a Mann-Whitney U Test with a very small sample?
Frank's advice is useful; I don't wish my answer to suggest any disagreement with that answer.
The Wilcoxon-Mann-Whitney test "works as it should" in small samples. There's a few things to note:
You |
24,692 | Can I use a Mann-Whitney U Test with a very small sample? | For a 2-sample Wilcoxon Rank Sum test (equivalent to Mann-Whitney U test),
the smallest sample size of each of the two samples is $n_1=n_2=3$
in order for a one-sided test to give significance level 5% or less.
Even then, significance requires complete separation; that is, all
observations in one sample must be smaller than any observation in
the other (and with no tied data). Using R:
wilcox.test(c(5,6,7),c(2,3,4), alt="g")
Wilcoxon rank sum test
data: c(5, 6, 7) and c(2, 3, 4)
W = 9, p-value = 0.05
alternative hypothesis:
true location shift is greater than 0
That is because ${6 \choose 3} = 20.$
1/choose(6,3)
[1] 0.05
Similarly, for a two-sided test at or below level 5%, the smallest sample sizes are $n_1 = n_2=4.$
wilcox.test(c(5,6,7,8),c(1,2,3,4))
Wilcoxon rank sum test
data: c(5, 6, 7, 8) and c(1, 2, 3, 4)
W = 16, p-value = 0.02857
alternative hypothesis:
true location shift is not equal to 0
That is because $\frac{2}{{8\choose 4}} = 2/70 = 0.02857.$
2/choose(8,4)
[1] 0.02857143
Also,
wilcox.test(c(5,6,7,8),c(1,2,3))$p.val
[1] 0.05714286 | Can I use a Mann-Whitney U Test with a very small sample? | For a 2-sample Wilcoxon Rank Sum test (equivalent to Mann-Whitney U test),
the smallest sample size of each of the two samples is $n_1=n_2=3$
in order for a one-sided test to give significance level 5 | Can I use a Mann-Whitney U Test with a very small sample?
For a 2-sample Wilcoxon Rank Sum test (equivalent to Mann-Whitney U test),
the smallest sample size of each of the two samples is $n_1=n_2=3$
in order for a one-sided test to give significance level 5% or less.
Even then, significance requires complete separation; that is, all
observations in one sample must be smaller than any observation in
the other (and with no tied data). Using R:
wilcox.test(c(5,6,7),c(2,3,4), alt="g")
Wilcoxon rank sum test
data: c(5, 6, 7) and c(2, 3, 4)
W = 9, p-value = 0.05
alternative hypothesis:
true location shift is greater than 0
That is because ${6 \choose 3} = 20.$
1/choose(6,3)
[1] 0.05
Similarly, for a two-sided test at or below level 5%, the smallest sample sizes are $n_1 = n_2=4.$
wilcox.test(c(5,6,7,8),c(1,2,3,4))
Wilcoxon rank sum test
data: c(5, 6, 7, 8) and c(1, 2, 3, 4)
W = 16, p-value = 0.02857
alternative hypothesis:
true location shift is not equal to 0
That is because $\frac{2}{{8\choose 4}} = 2/70 = 0.02857.$
2/choose(8,4)
[1] 0.02857143
Also,
wilcox.test(c(5,6,7,8),c(1,2,3))$p.val
[1] 0.05714286 | Can I use a Mann-Whitney U Test with a very small sample?
For a 2-sample Wilcoxon Rank Sum test (equivalent to Mann-Whitney U test),
the smallest sample size of each of the two samples is $n_1=n_2=3$
in order for a one-sided test to give significance level 5 |
24,693 | Dubious use of signal processing principles to identify a trend | It sounds dodgy to me as the trend estimate will be biased near the point where you splice on the false data. An alternative approach is a nonparametric regression smoother such as loess or splines. | Dubious use of signal processing principles to identify a trend | It sounds dodgy to me as the trend estimate will be biased near the point where you splice on the false data. An alternative approach is a nonparametric regression smoother such as loess or splines. | Dubious use of signal processing principles to identify a trend
It sounds dodgy to me as the trend estimate will be biased near the point where you splice on the false data. An alternative approach is a nonparametric regression smoother such as loess or splines. | Dubious use of signal processing principles to identify a trend
It sounds dodgy to me as the trend estimate will be biased near the point where you splice on the false data. An alternative approach is a nonparametric regression smoother such as loess or splines. |
24,694 | Dubious use of signal processing principles to identify a trend | If you want to filter the long term trend out using signal processing, why not just use a low-pass?
The simplest thing I can think of would be an exponential moving average. | Dubious use of signal processing principles to identify a trend | If you want to filter the long term trend out using signal processing, why not just use a low-pass?
The simplest thing I can think of would be an exponential moving average. | Dubious use of signal processing principles to identify a trend
If you want to filter the long term trend out using signal processing, why not just use a low-pass?
The simplest thing I can think of would be an exponential moving average. | Dubious use of signal processing principles to identify a trend
If you want to filter the long term trend out using signal processing, why not just use a low-pass?
The simplest thing I can think of would be an exponential moving average. |
24,695 | Dubious use of signal processing principles to identify a trend | I think you can get some distortion on the pasting point as not all the underlying waves will connect very well.
I would suggest using a Hilbert Huang transform for this. Just do the split into intrinsic mode functions and see what is left over as residue when calculating them. | Dubious use of signal processing principles to identify a trend | I think you can get some distortion on the pasting point as not all the underlying waves will connect very well.
I would suggest using a Hilbert Huang transform for this. Just do the split into intrin | Dubious use of signal processing principles to identify a trend
I think you can get some distortion on the pasting point as not all the underlying waves will connect very well.
I would suggest using a Hilbert Huang transform for this. Just do the split into intrinsic mode functions and see what is left over as residue when calculating them. | Dubious use of signal processing principles to identify a trend
I think you can get some distortion on the pasting point as not all the underlying waves will connect very well.
I would suggest using a Hilbert Huang transform for this. Just do the split into intrin |
24,696 | Dubious use of signal processing principles to identify a trend | You could use the (fast :) ) discrete wavelet transform. The package wavethresh under R will do all the work.
Anyway, I like the solution of @James because it is simple and seems to go straigh to the point. | Dubious use of signal processing principles to identify a trend | You could use the (fast :) ) discrete wavelet transform. The package wavethresh under R will do all the work.
Anyway, I like the solution of @James because it is simple and seems to go straigh to the | Dubious use of signal processing principles to identify a trend
You could use the (fast :) ) discrete wavelet transform. The package wavethresh under R will do all the work.
Anyway, I like the solution of @James because it is simple and seems to go straigh to the point. | Dubious use of signal processing principles to identify a trend
You could use the (fast :) ) discrete wavelet transform. The package wavethresh under R will do all the work.
Anyway, I like the solution of @James because it is simple and seems to go straigh to the |
24,697 | Dubious use of signal processing principles to identify a trend | Most of the time when I hear "long-term trend", I think of long-term upward trends or long-term downward trends, neither one of which is properly captured by a Fourier transform.
Such one-way trends are better analyzed by using linear regression.
(Fourier transforms and periodograms are more appropriate for things that go up and down).
Linear regression is easy to do in most spreadsheets. (a) Display equations for regression lines (b) Creating XY Scattergraphs with Spreadsheets
Linear regression tries to approximate your data with a straight line.
Fourier transforms try to approximate your data with a few sine-waves added together.
There are other techniques ("non-linear regression") that try to approximate your data to polynomials or other shapes. | Dubious use of signal processing principles to identify a trend | Most of the time when I hear "long-term trend", I think of long-term upward trends or long-term downward trends, neither one of which is properly captured by a Fourier transform.
Such one-way trends a | Dubious use of signal processing principles to identify a trend
Most of the time when I hear "long-term trend", I think of long-term upward trends or long-term downward trends, neither one of which is properly captured by a Fourier transform.
Such one-way trends are better analyzed by using linear regression.
(Fourier transforms and periodograms are more appropriate for things that go up and down).
Linear regression is easy to do in most spreadsheets. (a) Display equations for regression lines (b) Creating XY Scattergraphs with Spreadsheets
Linear regression tries to approximate your data with a straight line.
Fourier transforms try to approximate your data with a few sine-waves added together.
There are other techniques ("non-linear regression") that try to approximate your data to polynomials or other shapes. | Dubious use of signal processing principles to identify a trend
Most of the time when I hear "long-term trend", I think of long-term upward trends or long-term downward trends, neither one of which is properly captured by a Fourier transform.
Such one-way trends a |
24,698 | Dubious use of signal processing principles to identify a trend | The Fourier transform assumes wide sense signal stationarity and linear time invariance (LTI). While it is robust to some violation of these conditions, I don't really think it is appropriate for analysis of trends due to the assumption of stationarity, i.e. you are trying to measure something which violates one of the FFTs basic assumptions.
I would agree with the posters above; mirroring your data and adding the mirrored data to the end of your time-series is dodgy.
I would suggest that fitting a linear regression model with a time trend as mentioned above is probably more appropriate.
If you were looking to examine periodicity, you could remove the trend by high pass filtering and performing a Fourier analysis. If the trend remains visible after filtering you could subtract a fitted linear regression line from the original signal prior to FFT. | Dubious use of signal processing principles to identify a trend | The Fourier transform assumes wide sense signal stationarity and linear time invariance (LTI). While it is robust to some violation of these conditions, I don't really think it is appropriate for anal | Dubious use of signal processing principles to identify a trend
The Fourier transform assumes wide sense signal stationarity and linear time invariance (LTI). While it is robust to some violation of these conditions, I don't really think it is appropriate for analysis of trends due to the assumption of stationarity, i.e. you are trying to measure something which violates one of the FFTs basic assumptions.
I would agree with the posters above; mirroring your data and adding the mirrored data to the end of your time-series is dodgy.
I would suggest that fitting a linear regression model with a time trend as mentioned above is probably more appropriate.
If you were looking to examine periodicity, you could remove the trend by high pass filtering and performing a Fourier analysis. If the trend remains visible after filtering you could subtract a fitted linear regression line from the original signal prior to FFT. | Dubious use of signal processing principles to identify a trend
The Fourier transform assumes wide sense signal stationarity and linear time invariance (LTI). While it is robust to some violation of these conditions, I don't really think it is appropriate for anal |
24,699 | Sum of $n$ Poisson random variables with parameter $\frac 1 n$ | What do you think of this argument?
This is a neat example of a magic trick: state a false version of the central limit theorem to distract the reader's attention, use hypotheses that are not the same as in the central theorem, and then claim that there is a flaw in the central limit theorem. So I don't think much of the argument.
The simplest version of the central limit theorem (CLT) is about the limit distribution (as $n$ tends to $\infty$) of the quantity
$$\frac{X_1 + X_2 + \cdots + X_n - n\mu}{\sigma\sqrt{n}}$$ where $X_1, X_2, \cdots$ are independent random variables with common (finite) mean $\mu$ and common (finite) standard deviation $\sigma$. The limit distribution is that of the standard normal random variable. More general versions of the CLT say that the conclusion of the CLT (that the limit distribution is that of a standard normal random variable) holds under slightly weaker conditions on the $X_i$. But no version of the CLT claims that the limit distribution of the sum
$$X_1 + X_2 + \cdots + X_n$$ is a normal distribution (indeed, there is no limit distribution), nor does it claim that the limit distribution of the average
$$\frac{X_1 + X_2 + \cdots + X_n}{n}$$
is a normal distribution. Indeed, the weak law of large numbers says that the limit distribution of the average is degenerate with all its probability concentrated at $\mu$.
For the statement quoted by the OP from his textbook, it is indeed true that the sum of $n$ independent Poisson random variables $X_1, X_2, \cdots, X_n$ with parameter $\frac 1n$ is a Poisson random variable with parameter $1$; but when $n$ increases to $n+1$, $X_1, X_2, \cdots, X_n$ no longer are Poisson random variables with parameter $\frac 1n$: they have morphed into Poisson random variables with parameter $\frac{1}{n+1}$. How is this variability in the definition of the random variables as $n$ increases fitting in any reasonable way into what the hypotheses of the CLT are saying?
Abracadabra! Look at the screen and not what's behind the curtain! | Sum of $n$ Poisson random variables with parameter $\frac 1 n$ | What do you think of this argument?
This is a neat example of a magic trick: state a false version of the central limit theorem to distract the reader's attention, use hypotheses that are not the sam | Sum of $n$ Poisson random variables with parameter $\frac 1 n$
What do you think of this argument?
This is a neat example of a magic trick: state a false version of the central limit theorem to distract the reader's attention, use hypotheses that are not the same as in the central theorem, and then claim that there is a flaw in the central limit theorem. So I don't think much of the argument.
The simplest version of the central limit theorem (CLT) is about the limit distribution (as $n$ tends to $\infty$) of the quantity
$$\frac{X_1 + X_2 + \cdots + X_n - n\mu}{\sigma\sqrt{n}}$$ where $X_1, X_2, \cdots$ are independent random variables with common (finite) mean $\mu$ and common (finite) standard deviation $\sigma$. The limit distribution is that of the standard normal random variable. More general versions of the CLT say that the conclusion of the CLT (that the limit distribution is that of a standard normal random variable) holds under slightly weaker conditions on the $X_i$. But no version of the CLT claims that the limit distribution of the sum
$$X_1 + X_2 + \cdots + X_n$$ is a normal distribution (indeed, there is no limit distribution), nor does it claim that the limit distribution of the average
$$\frac{X_1 + X_2 + \cdots + X_n}{n}$$
is a normal distribution. Indeed, the weak law of large numbers says that the limit distribution of the average is degenerate with all its probability concentrated at $\mu$.
For the statement quoted by the OP from his textbook, it is indeed true that the sum of $n$ independent Poisson random variables $X_1, X_2, \cdots, X_n$ with parameter $\frac 1n$ is a Poisson random variable with parameter $1$; but when $n$ increases to $n+1$, $X_1, X_2, \cdots, X_n$ no longer are Poisson random variables with parameter $\frac 1n$: they have morphed into Poisson random variables with parameter $\frac{1}{n+1}$. How is this variability in the definition of the random variables as $n$ increases fitting in any reasonable way into what the hypotheses of the CLT are saying?
Abracadabra! Look at the screen and not what's behind the curtain! | Sum of $n$ Poisson random variables with parameter $\frac 1 n$
What do you think of this argument?
This is a neat example of a magic trick: state a false version of the central limit theorem to distract the reader's attention, use hypotheses that are not the sam |
24,700 | Sum of $n$ Poisson random variables with parameter $\frac 1 n$ | There are a lot of great answers already but I want to add a perspective interpreting this in light of Lindeberg's CLT. I think this is a natural way to look at it because we have a collection of random variables $\{X_{nj} : n= 1,2\dots\text{ and }j = 1,\dots,n\}$ with all independent and $X_{nj} \sim \text{Pois}(n^{-1})$. This is a triangular array and, letting $S_n = \sum_{j\leq n} X_{nj}$ be the sum of the $n$th row, Lindeberg's CLT gives us a sufficient condition for when
$$
\frac{S_n - \text E[S_n]}{\sqrt{\text{Var}[S_n]}} \stackrel{\text d}\to \mathcal N(0,1).
$$
Unlike the simplest form of the CLT, Lindeberg's CLT allows for non-identically distributed RVs so the changing distribution of the $X_{nj}$ alone won't be what prevents convergence to a Gaussian here.
The theorem is as follows (adapted from Jun Shao's Mathematical Statistics Theorem 1.15 2nd ed.):
Consider a triangular array of random variables $\{X_{nj} : n=
1,2,\dots \text{ and }j = 1, \dots, n\}$ where all are independent and
let $S_n = \sum_{j\leq n} X_{nj}$ be the sum across each row of the
array. The Lindeberg CLT states that if $0 < \sigma_n^2 :=
\text{Var}(S_n) < \infty$ for $n=1,2,3,\dots$ and
if$\newcommand{\e}{\varepsilon}$ Lindeberg's condition holds, which
is that $$ \sigma^{-2}_n\sum_{j=1}^n \text E[(X_{nj} - \text
EX_{nj})^2\mathbf 1_{|X_{nj} - \text EX_{nj}| > \e\sigma_n}] \to 0 \tag{1}$$
for all $\e > 0$ as $n\to\infty$, then $$ \sigma_n^{-1}\sum_{j=1}^n
(X_{nj} - \text EX_{nj}) = \frac{S_n - \text
E[S_n]}{\sqrt{\text{Var}[S_n]}} \stackrel{\text d}\to \mathcal N(0,
1). $$
Lindeberg's condition means that the variance of the row sum dominates the sum of the tail variances of each element as we advance down the triangular array, and in particular the tails relative to the row sum variance. Intuitively, this will fail to hold if any of the individual $X_{nj}$ are heavy tailed enough to contribute a lot relative to the row sum variance.
In our case we know that we have $S_n\sim\text{Pois}(1)$ for all $n$ so $\sigma^2_n = 1 < \infty$. Lindeberg's condition in this case is
$$
n \operatorname E[(X_{n1} - 1/n)^2\mathbf 1_{|X_{n1} - 1/n|> \e}] \stackrel ?\to 0
$$
for all $\e > 0$.
If the conclusion were true then we'd have $S_n - \text E[S_n] \stackrel{\text d}\to \mathcal N(0,1)$ which is certainly not true as $S_n - \text E[S_n] \sim \text{Pois}(1)-1$ and doesn't change with $n$. This is a nondegenerate limiting distribution but it's not Gaussian so there must be something wrong about the condition.
Let $\e > 0$. I'll drop the "$1$" from the subscript and just use $X_n$, so $X_n := X_{n1}$. The condition $|X_n - 1/n|>\e$ means that we only want to consider values $x$ of $X_n$ where $x > 1/n+\e$ or $x < 1/n - \e$; in other words, at least $\e$ away from $1/n$. We are taking $n\to\infty$ so we only need to consider $n$ when sufficiently large. This needs to hold for any $\e$, but the bigger $\e$ is then the fewer $x$ we consider, so the worst case will be $\e$ small.
$\e$ is fixed and eventually $1/n < \e$ which means $x < 1/n-\e < 0$ and that's a place with zero probability for the Poisson, so we only need to consider $x>1/n+\e$ which is just $x > 0$ eventually. Lindeberg's condition is therefore about the limit of
$$
n \operatorname E[(X_{n} - 1/n)^2\mathbf 1_{|X_{n} - 1/n|> \e}] = n \sum_{x > 0} (x - 1/n)^2 P(X_n = x) \\
= n \left(\operatorname E[(X_n-1/n)^2] - \frac 1{n^2}P(X_n = 0)\right) \\
= n\left(\frac 1n - \frac{1}{n^2}e^{-1/n}\right) \\
= 1 - \frac 1n e^{-1/n} \to 1.
$$
Thus Lindeberg's condition fails to hold. The problem is that the mean of the $X_{nj}$ moves to zero as they do too, so the tail variances are too large relative to the row sum variance which is constant. We don't lose the effects of the individual summands in the way that we need for the CLT to hold.
In general Lindeberg's condition is not necessary, i.e. it can fail to hold yet the CLT result still applies, but since we know the limiting distribution is not Gaussian I think we can still gain insight from the failure of the condition. | Sum of $n$ Poisson random variables with parameter $\frac 1 n$ | There are a lot of great answers already but I want to add a perspective interpreting this in light of Lindeberg's CLT. I think this is a natural way to look at it because we have a collection of rand | Sum of $n$ Poisson random variables with parameter $\frac 1 n$
There are a lot of great answers already but I want to add a perspective interpreting this in light of Lindeberg's CLT. I think this is a natural way to look at it because we have a collection of random variables $\{X_{nj} : n= 1,2\dots\text{ and }j = 1,\dots,n\}$ with all independent and $X_{nj} \sim \text{Pois}(n^{-1})$. This is a triangular array and, letting $S_n = \sum_{j\leq n} X_{nj}$ be the sum of the $n$th row, Lindeberg's CLT gives us a sufficient condition for when
$$
\frac{S_n - \text E[S_n]}{\sqrt{\text{Var}[S_n]}} \stackrel{\text d}\to \mathcal N(0,1).
$$
Unlike the simplest form of the CLT, Lindeberg's CLT allows for non-identically distributed RVs so the changing distribution of the $X_{nj}$ alone won't be what prevents convergence to a Gaussian here.
The theorem is as follows (adapted from Jun Shao's Mathematical Statistics Theorem 1.15 2nd ed.):
Consider a triangular array of random variables $\{X_{nj} : n=
1,2,\dots \text{ and }j = 1, \dots, n\}$ where all are independent and
let $S_n = \sum_{j\leq n} X_{nj}$ be the sum across each row of the
array. The Lindeberg CLT states that if $0 < \sigma_n^2 :=
\text{Var}(S_n) < \infty$ for $n=1,2,3,\dots$ and
if$\newcommand{\e}{\varepsilon}$ Lindeberg's condition holds, which
is that $$ \sigma^{-2}_n\sum_{j=1}^n \text E[(X_{nj} - \text
EX_{nj})^2\mathbf 1_{|X_{nj} - \text EX_{nj}| > \e\sigma_n}] \to 0 \tag{1}$$
for all $\e > 0$ as $n\to\infty$, then $$ \sigma_n^{-1}\sum_{j=1}^n
(X_{nj} - \text EX_{nj}) = \frac{S_n - \text
E[S_n]}{\sqrt{\text{Var}[S_n]}} \stackrel{\text d}\to \mathcal N(0,
1). $$
Lindeberg's condition means that the variance of the row sum dominates the sum of the tail variances of each element as we advance down the triangular array, and in particular the tails relative to the row sum variance. Intuitively, this will fail to hold if any of the individual $X_{nj}$ are heavy tailed enough to contribute a lot relative to the row sum variance.
In our case we know that we have $S_n\sim\text{Pois}(1)$ for all $n$ so $\sigma^2_n = 1 < \infty$. Lindeberg's condition in this case is
$$
n \operatorname E[(X_{n1} - 1/n)^2\mathbf 1_{|X_{n1} - 1/n|> \e}] \stackrel ?\to 0
$$
for all $\e > 0$.
If the conclusion were true then we'd have $S_n - \text E[S_n] \stackrel{\text d}\to \mathcal N(0,1)$ which is certainly not true as $S_n - \text E[S_n] \sim \text{Pois}(1)-1$ and doesn't change with $n$. This is a nondegenerate limiting distribution but it's not Gaussian so there must be something wrong about the condition.
Let $\e > 0$. I'll drop the "$1$" from the subscript and just use $X_n$, so $X_n := X_{n1}$. The condition $|X_n - 1/n|>\e$ means that we only want to consider values $x$ of $X_n$ where $x > 1/n+\e$ or $x < 1/n - \e$; in other words, at least $\e$ away from $1/n$. We are taking $n\to\infty$ so we only need to consider $n$ when sufficiently large. This needs to hold for any $\e$, but the bigger $\e$ is then the fewer $x$ we consider, so the worst case will be $\e$ small.
$\e$ is fixed and eventually $1/n < \e$ which means $x < 1/n-\e < 0$ and that's a place with zero probability for the Poisson, so we only need to consider $x>1/n+\e$ which is just $x > 0$ eventually. Lindeberg's condition is therefore about the limit of
$$
n \operatorname E[(X_{n} - 1/n)^2\mathbf 1_{|X_{n} - 1/n|> \e}] = n \sum_{x > 0} (x - 1/n)^2 P(X_n = x) \\
= n \left(\operatorname E[(X_n-1/n)^2] - \frac 1{n^2}P(X_n = 0)\right) \\
= n\left(\frac 1n - \frac{1}{n^2}e^{-1/n}\right) \\
= 1 - \frac 1n e^{-1/n} \to 1.
$$
Thus Lindeberg's condition fails to hold. The problem is that the mean of the $X_{nj}$ moves to zero as they do too, so the tail variances are too large relative to the row sum variance which is constant. We don't lose the effects of the individual summands in the way that we need for the CLT to hold.
In general Lindeberg's condition is not necessary, i.e. it can fail to hold yet the CLT result still applies, but since we know the limiting distribution is not Gaussian I think we can still gain insight from the failure of the condition. | Sum of $n$ Poisson random variables with parameter $\frac 1 n$
There are a lot of great answers already but I want to add a perspective interpreting this in light of Lindeberg's CLT. I think this is a natural way to look at it because we have a collection of rand |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.