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
26,901
Hidden state models vs. stateless models for time series regression
In short, I think they are working in different learning paradigm. State-space model (hidden state model) and other stateless model you mentioned are going to discover the underlying relationship of your time series in different learning paradigm: (1) maximum-likelihood estimation, (2) Bayes' inference, (3) empirical risk minimization. In state-space model, Let $x_t$ as the hidden state, $y_t$ as the observables, $t>0$ (assume there is no control) You assume the following relationship for the model: $P(x_0)$ as a prior $P(x_t | x_{t-1})$ for $t \geq 1$ as how your state change (in HMM, it is a transition matrix) $P(y_t | x_t)$ for $t \geq 1$ as how you observe (in HMM, it could be normal distributions that conditioned on $x_t$) and $y_t$ only depends on $x_t$. When you use Baum-Welch to estimate the parameters, you are in fact looking for a maximum-likelihood estimate of the HMM. If you use Kalman filter, you are solving a special case of Bayesian filter problem (which is in fact an application of Bayes' theorem on update step): Prediction step: $\displaystyle P(x_t|y_{1:t-1}) = \int P(x_t|x_{t-1})P(x_{t-1}|y_{1:t-1}) \, dx_{t-1}$ Update step: $\displaystyle P(x_t|y_{1:t}) = \frac{P(y_t|x_t)P(x_t|y_{1:t-1})}{\int P(y_t|x_t)P(x_t|y_{1:t-1}) \, dx_t}$ In Kalman filter, since we assume the noise statistic is Gaussian and the relationship of $P(x_t|x_{t-1})$ and $P(y_t|x_t)$ are linear. Therefore you can write $P(x_t|y_{1:t-1})$ and $P(x_t|y_{1:t})$ simply as the $x_t$ (mean + variance is sufficient for normal distribution) and the algorithm works as matrix formulas. On the other hand, for other stateless model you mentioned, like SVM, splines, regression trees, nearest neighbors. They are trying to discover the underlying relationship of $(\{y_0,y_1,...,y_{t-1}\}, y_t)$ by empirical risk minimization. For maximum-likelihood estimation, you need to parametrize the underlying probability distribution first (like HMM, you have the transition matrix, the observable are $(\mu_j,\sigma_j)$ for some $j$) For application of Bayes' theorem, you need to have "correct" a priori $P(A)$ first in the sense that $P(A) \neq 0$. If $P(A)=0$, then any inference results in $0$ since $P(A|B) = \frac{P(B|A)P(A)}{P(B)}$. For empirical risk minimization, universal consistency is guaranteed for any underlying probability distribution if the VC dimension of the learning rule is not growing too fast as the number of available data $n \to \infty$
Hidden state models vs. stateless models for time series regression
In short, I think they are working in different learning paradigm. State-space model (hidden state model) and other stateless model you mentioned are going to discover the underlying relationship of y
Hidden state models vs. stateless models for time series regression In short, I think they are working in different learning paradigm. State-space model (hidden state model) and other stateless model you mentioned are going to discover the underlying relationship of your time series in different learning paradigm: (1) maximum-likelihood estimation, (2) Bayes' inference, (3) empirical risk minimization. In state-space model, Let $x_t$ as the hidden state, $y_t$ as the observables, $t>0$ (assume there is no control) You assume the following relationship for the model: $P(x_0)$ as a prior $P(x_t | x_{t-1})$ for $t \geq 1$ as how your state change (in HMM, it is a transition matrix) $P(y_t | x_t)$ for $t \geq 1$ as how you observe (in HMM, it could be normal distributions that conditioned on $x_t$) and $y_t$ only depends on $x_t$. When you use Baum-Welch to estimate the parameters, you are in fact looking for a maximum-likelihood estimate of the HMM. If you use Kalman filter, you are solving a special case of Bayesian filter problem (which is in fact an application of Bayes' theorem on update step): Prediction step: $\displaystyle P(x_t|y_{1:t-1}) = \int P(x_t|x_{t-1})P(x_{t-1}|y_{1:t-1}) \, dx_{t-1}$ Update step: $\displaystyle P(x_t|y_{1:t}) = \frac{P(y_t|x_t)P(x_t|y_{1:t-1})}{\int P(y_t|x_t)P(x_t|y_{1:t-1}) \, dx_t}$ In Kalman filter, since we assume the noise statistic is Gaussian and the relationship of $P(x_t|x_{t-1})$ and $P(y_t|x_t)$ are linear. Therefore you can write $P(x_t|y_{1:t-1})$ and $P(x_t|y_{1:t})$ simply as the $x_t$ (mean + variance is sufficient for normal distribution) and the algorithm works as matrix formulas. On the other hand, for other stateless model you mentioned, like SVM, splines, regression trees, nearest neighbors. They are trying to discover the underlying relationship of $(\{y_0,y_1,...,y_{t-1}\}, y_t)$ by empirical risk minimization. For maximum-likelihood estimation, you need to parametrize the underlying probability distribution first (like HMM, you have the transition matrix, the observable are $(\mu_j,\sigma_j)$ for some $j$) For application of Bayes' theorem, you need to have "correct" a priori $P(A)$ first in the sense that $P(A) \neq 0$. If $P(A)=0$, then any inference results in $0$ since $P(A|B) = \frac{P(B|A)P(A)}{P(B)}$. For empirical risk minimization, universal consistency is guaranteed for any underlying probability distribution if the VC dimension of the learning rule is not growing too fast as the number of available data $n \to \infty$
Hidden state models vs. stateless models for time series regression In short, I think they are working in different learning paradigm. State-space model (hidden state model) and other stateless model you mentioned are going to discover the underlying relationship of y
26,902
Fitting distribution to spatial data
It sounds like you want to simulate the formation of tracks and then conduct a Monte Carlo simulation to see how many tracks fall into the red region. To do this, I would first convert the lines to two functions, one giving direction and the other distance from one point to the next on that track. Now you can study the probability distributions associated with those two functions. For example, you might find that distance travelled follows a specific distribution (be careful that the distribution doesn't change over time). If either variable does change over time then you have to delve into time series analysis (not my field, sorry). Another thought that comes to mind is that, since the direction of movement in x-y changes gradually in most of the tracks, you might do better examining the change in direction vs time for the tracks. You will also need to estimate the probability of a track starting at a given x-y co-ordinate with a given direction. You may want to consider using kernel density estimation to smooth the resulting PDF or, if it appears to follow a distribution for which there is an analytical model then expectation maximisation could be used to fit that distribution to the data. The Monte Carlo simulation would then draw random samples from these distributions to simulate the shapes of the tracks. Then you have to simulate a large number of tracks and see how often those tracks pass through the red region. This could be thousands or millions of tracks, you'll have to experiment to see when the distribution stops changing as you add more tracks.
Fitting distribution to spatial data
It sounds like you want to simulate the formation of tracks and then conduct a Monte Carlo simulation to see how many tracks fall into the red region. To do this, I would first convert the lines to t
Fitting distribution to spatial data It sounds like you want to simulate the formation of tracks and then conduct a Monte Carlo simulation to see how many tracks fall into the red region. To do this, I would first convert the lines to two functions, one giving direction and the other distance from one point to the next on that track. Now you can study the probability distributions associated with those two functions. For example, you might find that distance travelled follows a specific distribution (be careful that the distribution doesn't change over time). If either variable does change over time then you have to delve into time series analysis (not my field, sorry). Another thought that comes to mind is that, since the direction of movement in x-y changes gradually in most of the tracks, you might do better examining the change in direction vs time for the tracks. You will also need to estimate the probability of a track starting at a given x-y co-ordinate with a given direction. You may want to consider using kernel density estimation to smooth the resulting PDF or, if it appears to follow a distribution for which there is an analytical model then expectation maximisation could be used to fit that distribution to the data. The Monte Carlo simulation would then draw random samples from these distributions to simulate the shapes of the tracks. Then you have to simulate a large number of tracks and see how often those tracks pass through the red region. This could be thousands or millions of tracks, you'll have to experiment to see when the distribution stops changing as you add more tracks.
Fitting distribution to spatial data It sounds like you want to simulate the formation of tracks and then conduct a Monte Carlo simulation to see how many tracks fall into the red region. To do this, I would first convert the lines to t
26,903
Geometric interpretation of the maximum likelihood estimation
Out of context this passage is a bit vague but here is how I interpreted it. Suppose I wanted to perform a linear regression on $cY$. I would write $cY = a' +Xb' + u$ where $u \sim N(0, c^2 \sigma^2)$. If $Y=a_0+Xb_0$ are the true parameters then clearly $cY = c a_0 + Xcb_0$ are the true parameters of $cY$. For fixed $c$ the likelihood function for this regression on $cY$ has a unique maximum at the point $a'=ca_0$ and $b' = cb_0$. Thus, for general $c$ the ray of scalar multiplies of the true parameter forms the ridge of the likelihood function as a function of three variables. Now take $c=1$ to intersect with the $c=1$ plane.
Geometric interpretation of the maximum likelihood estimation
Out of context this passage is a bit vague but here is how I interpreted it. Suppose I wanted to perform a linear regression on $cY$. I would write $cY = a' +Xb' + u$ where $u \sim N(0, c^2 \sigma^2)
Geometric interpretation of the maximum likelihood estimation Out of context this passage is a bit vague but here is how I interpreted it. Suppose I wanted to perform a linear regression on $cY$. I would write $cY = a' +Xb' + u$ where $u \sim N(0, c^2 \sigma^2)$. If $Y=a_0+Xb_0$ are the true parameters then clearly $cY = c a_0 + Xcb_0$ are the true parameters of $cY$. For fixed $c$ the likelihood function for this regression on $cY$ has a unique maximum at the point $a'=ca_0$ and $b' = cb_0$. Thus, for general $c$ the ray of scalar multiplies of the true parameter forms the ridge of the likelihood function as a function of three variables. Now take $c=1$ to intersect with the $c=1$ plane.
Geometric interpretation of the maximum likelihood estimation Out of context this passage is a bit vague but here is how I interpreted it. Suppose I wanted to perform a linear regression on $cY$. I would write $cY = a' +Xb' + u$ where $u \sim N(0, c^2 \sigma^2)
26,904
Significance of average correlation coefficient
A better approach to analysing this data is to use a mixed-model (a.k.a. mixed effects model, hierarchical model) with subject as a random effect (random intercept or random intercept + slope). To summarize a different answer of mine: This is essentially a regression that models a single overall relationship while allowing that relationship to differ between groups (the human subjects). This approach benefits from partial pooling and uses your data more efficiently.
Significance of average correlation coefficient
A better approach to analysing this data is to use a mixed-model (a.k.a. mixed effects model, hierarchical model) with subject as a random effect (random intercept or random intercept + slope). To sum
Significance of average correlation coefficient A better approach to analysing this data is to use a mixed-model (a.k.a. mixed effects model, hierarchical model) with subject as a random effect (random intercept or random intercept + slope). To summarize a different answer of mine: This is essentially a regression that models a single overall relationship while allowing that relationship to differ between groups (the human subjects). This approach benefits from partial pooling and uses your data more efficiently.
Significance of average correlation coefficient A better approach to analysing this data is to use a mixed-model (a.k.a. mixed effects model, hierarchical model) with subject as a random effect (random intercept or random intercept + slope). To sum
26,905
Significance of average correlation coefficient
I assume that the $12$ variables ($6$ $X$'s and $6$ $Y$'s) are the same for all individuals (actually I'm not sure I understand what you mean by saying that the levels are not equal across subjects: I hope you are referring about the independence among the ranges of the variables, not about which variables are measured for each individual). Yes, the formula you showed applies to the correlation coefficient between two variables. In your point 2, you talk about normalizing: I think this would make sense if you did it for each of the $6*2$ variables separately. However, even so, the problem with this approach is that it does not control for within-individual dependency. I believe your approach 1 is not valid either, because it would be a test among $6$ variables with distribution $t$ with just $10$ degrees of freedom, so I don't think you can apply the Central Limit Theorem in this case. Maybe, with larger numbers, you could use a random effect approach, allowing for a random slope and simultaneously testing for both a null average coefficient (of $X_i$ on $Y_i$) and non-existence of a random coefficient. I believe however 6 variables and 12 observations are not enough to do it. I suggest you see it as a test on 6 values (becoming 12 if you also consider values below the diagonal) of the correlation matrix among the $12$ variables (both the $X$ and the $Y$), i.e. those on the diagonal of the 2nd (and equivalently of the 3rd) quadrant. Thus, I would make a likelihood ratio test between the restricted and the unrestricted model. @Alexis My understanding is that centering $X_1, \dots, X_6$, $Y_1, \dots, Y_6$, by replacing them with $X_1^*=X_1-\bar{X_1}, \dots, X_6^*=X_6-\bar{X_6}, Y_1^*=Y_1-\bar{Y_1}, \dots, Y_6^*=Y_6-\bar{Y_6}$ would make sense (I think it would also make sense to divide them by their $SE$'s). In this way, the variables $X^*$ and $Y^*$ (created by considering the $X_i^*, 1 \leq i \leq 6$ as if they were occurrences of a unique variable, and the same for $Y_i^*$) would all have a $0$ mean. On the contrary, if we build two variables $X, Y$ first (created by considering the $X_i, 1 \leq i \leq 6$ as if they were occurrences of a unique variable, and the same for $Y_i$), then of course subtracting the mean (and also dividing by the SE of $X$ and $Y$) would not change things. EDIT 01/01/18 Let $i$ indicate the variable and $j$ ($1\leq j\leq 12$) the individual. Then, suppose we have: $X_{1j}=Y_{1j}=10, \forall j$; $X_{2j}=Y_{2j}=8, \forall j$; $X_{3j}=Y_{3j}=6, \forall j$; $X_{4j}=Y_{4j}=4, \forall j$; $X_{5j}=Y_{5j}=2, \forall j$; $X_{6j}=-Y_{6j}=j, \forall j$. The correlation in this case should be $0.5428$. If we center each variable, given that, for $1 \leq i \leq 5$, both $X_i$ and $Y_i$ have no variation, we have: $X_{ij}^*=Y_{ij}^*=0$. As for $i=6$, we get the values $X_{6j}^*=j-6.5, Y_{j6}^*=(13-j)-6.5=6.5-j$ (i.e., for the $X$'s: $-5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5$, and exactly the opposite for the $Y$'s). Since $0=-0$ and $j-6.5=-(6.5-j)$, we get: $X_{ij}^*=-Y_{ij}^* \forall i,j \rightarrow X^*=-Y^*$, implying a correlation of $-1$.
Significance of average correlation coefficient
I assume that the $12$ variables ($6$ $X$'s and $6$ $Y$'s) are the same for all individuals (actually I'm not sure I understand what you mean by saying that the levels are not equal across subjects: I
Significance of average correlation coefficient I assume that the $12$ variables ($6$ $X$'s and $6$ $Y$'s) are the same for all individuals (actually I'm not sure I understand what you mean by saying that the levels are not equal across subjects: I hope you are referring about the independence among the ranges of the variables, not about which variables are measured for each individual). Yes, the formula you showed applies to the correlation coefficient between two variables. In your point 2, you talk about normalizing: I think this would make sense if you did it for each of the $6*2$ variables separately. However, even so, the problem with this approach is that it does not control for within-individual dependency. I believe your approach 1 is not valid either, because it would be a test among $6$ variables with distribution $t$ with just $10$ degrees of freedom, so I don't think you can apply the Central Limit Theorem in this case. Maybe, with larger numbers, you could use a random effect approach, allowing for a random slope and simultaneously testing for both a null average coefficient (of $X_i$ on $Y_i$) and non-existence of a random coefficient. I believe however 6 variables and 12 observations are not enough to do it. I suggest you see it as a test on 6 values (becoming 12 if you also consider values below the diagonal) of the correlation matrix among the $12$ variables (both the $X$ and the $Y$), i.e. those on the diagonal of the 2nd (and equivalently of the 3rd) quadrant. Thus, I would make a likelihood ratio test between the restricted and the unrestricted model. @Alexis My understanding is that centering $X_1, \dots, X_6$, $Y_1, \dots, Y_6$, by replacing them with $X_1^*=X_1-\bar{X_1}, \dots, X_6^*=X_6-\bar{X_6}, Y_1^*=Y_1-\bar{Y_1}, \dots, Y_6^*=Y_6-\bar{Y_6}$ would make sense (I think it would also make sense to divide them by their $SE$'s). In this way, the variables $X^*$ and $Y^*$ (created by considering the $X_i^*, 1 \leq i \leq 6$ as if they were occurrences of a unique variable, and the same for $Y_i^*$) would all have a $0$ mean. On the contrary, if we build two variables $X, Y$ first (created by considering the $X_i, 1 \leq i \leq 6$ as if they were occurrences of a unique variable, and the same for $Y_i$), then of course subtracting the mean (and also dividing by the SE of $X$ and $Y$) would not change things. EDIT 01/01/18 Let $i$ indicate the variable and $j$ ($1\leq j\leq 12$) the individual. Then, suppose we have: $X_{1j}=Y_{1j}=10, \forall j$; $X_{2j}=Y_{2j}=8, \forall j$; $X_{3j}=Y_{3j}=6, \forall j$; $X_{4j}=Y_{4j}=4, \forall j$; $X_{5j}=Y_{5j}=2, \forall j$; $X_{6j}=-Y_{6j}=j, \forall j$. The correlation in this case should be $0.5428$. If we center each variable, given that, for $1 \leq i \leq 5$, both $X_i$ and $Y_i$ have no variation, we have: $X_{ij}^*=Y_{ij}^*=0$. As for $i=6$, we get the values $X_{6j}^*=j-6.5, Y_{j6}^*=(13-j)-6.5=6.5-j$ (i.e., for the $X$'s: $-5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5$, and exactly the opposite for the $Y$'s). Since $0=-0$ and $j-6.5=-(6.5-j)$, we get: $X_{ij}^*=-Y_{ij}^* \forall i,j \rightarrow X^*=-Y^*$, implying a correlation of $-1$.
Significance of average correlation coefficient I assume that the $12$ variables ($6$ $X$'s and $6$ $Y$'s) are the same for all individuals (actually I'm not sure I understand what you mean by saying that the levels are not equal across subjects: I
26,906
p-value adjustment for Local Moran's I statistic (LISA)
briefly, the problem that you are facing is called multiple hypothesis testing. It arises when you are testing, as the name indicates, many hypothesis at the same time. Let's say that you have a given probability of incorrectly rejecting the null hypothesis (false positive) for a test, say 5%. As you increase the number of datasets that you are testing (in this case, each of the sets where you apply the local Moran statistic), the probability of observing in any dataset a false positive will increase, independently from the fact that probability of observing a false positive for a single dataset is the same. There are many possible "corrections", which are the ones that you found, to correct this problem; if you really need a local statistic, you cannot dodge it. Otherwise, you can use the global statistic as a single hypothesis.
p-value adjustment for Local Moran's I statistic (LISA)
briefly, the problem that you are facing is called multiple hypothesis testing. It arises when you are testing, as the name indicates, many hypothesis at the same time. Let's say that you have a given
p-value adjustment for Local Moran's I statistic (LISA) briefly, the problem that you are facing is called multiple hypothesis testing. It arises when you are testing, as the name indicates, many hypothesis at the same time. Let's say that you have a given probability of incorrectly rejecting the null hypothesis (false positive) for a test, say 5%. As you increase the number of datasets that you are testing (in this case, each of the sets where you apply the local Moran statistic), the probability of observing in any dataset a false positive will increase, independently from the fact that probability of observing a false positive for a single dataset is the same. There are many possible "corrections", which are the ones that you found, to correct this problem; if you really need a local statistic, you cannot dodge it. Otherwise, you can use the global statistic as a single hypothesis.
p-value adjustment for Local Moran's I statistic (LISA) briefly, the problem that you are facing is called multiple hypothesis testing. It arises when you are testing, as the name indicates, many hypothesis at the same time. Let's say that you have a given
26,907
Expected number of times the empirical mean will exceed a value
This is a rather hand-made approach, and I would really appreciate some comment on it, (and the criticizing ones are usually the most helpful). If I understand correctly, the OP calculates sample means $\bar x_j$, where each sample contains the previous sample +1 observation from a new r.v. Denote $F_j$ the distribution of each sample mean. Then we can write $$\mathcal{T} \overset{def}{=} \sum_{j=1}^n \left(1-F_j(c)\right) = n- \sum_{j=1}^n F_j(c)$$ Consider a sample size $m$ after which the distribution of the sample mean is almost normal, denote it $\hat G$. Then we can write $$\mathcal{T} = n- \sum_{j=1}^m F_j(c)-\sum_{j=m+1}^n \hat G_j(c) < n-\sum_{j=m+1}^n \hat G_j(c)$$ Solving $\hat G_j(c)$ we obtain $$\hat G_j(c) = 1- \Phi\left(\frac{\sqrt j}{\sigma}(\mu-c)\right) $$ where $\Phi$ is the standard normal cdf, $\sigma$ is the standard deviation of the i.i.d process, and $\mu$ is its mean. Inserting into the bound and re-arranging we get $$\mathcal{T} < m+\sum_{j=m+1}^n \Phi\left(\frac{\sqrt j}{\sigma}(-a)\right)$$ Note that this bound depends also on the variance of the process. Is this a better bound than the one presented in the question? This will depend crucially on how "quickly" the distribution of the sample mean becomes "almost normal". To give a numerical example, assume that $m= 30$. Assume also that the random variables are uniform in $[0,1]$. Then $\sigma = \sqrt \frac{1}{12}$ and $\mu = \frac 12$. Consider a 10% deviation from the mean, i.e. set $a=0.05$. then : already for $n=34$ the bound I propose (which is meaningful for $n>30$) becomes tighter. For $n=100$ the Hoeffding bound is $78.5$ while the bound I propose is $36.2$. The Hoeffding bound converges to $\approx 199.5$ while the bound I propose to $\approx 38.5$ If you increase $a$ the discrepancy between the two bounds reduces but remains visible: for a 20% deviation, $a=0.1$, the Hoeffding bound converges to $49.5$ while the bound I propose converges to $30.5$ (i.e the sum of the normal cdfs contributes very little to the overall bound). Somewhat more generally, we note that for $n\rightarrow \infty$ the Hoeffding bound converges to $$H_b\rightarrow \frac{1}{e^{2 a^2}-1} $$ while my bound to $$A_b \rightarrow m$$ Since for small values of $a$ (which is rather the case of interest) $H_b$ becomes a large number, there is still the case that $A_b$ may outperform it in tightness, even if the sample is such that the distribution of the sample mean converges slowly to the normal distribution.
Expected number of times the empirical mean will exceed a value
This is a rather hand-made approach, and I would really appreciate some comment on it, (and the criticizing ones are usually the most helpful). If I understand correctly, the OP calculates sample mean
Expected number of times the empirical mean will exceed a value This is a rather hand-made approach, and I would really appreciate some comment on it, (and the criticizing ones are usually the most helpful). If I understand correctly, the OP calculates sample means $\bar x_j$, where each sample contains the previous sample +1 observation from a new r.v. Denote $F_j$ the distribution of each sample mean. Then we can write $$\mathcal{T} \overset{def}{=} \sum_{j=1}^n \left(1-F_j(c)\right) = n- \sum_{j=1}^n F_j(c)$$ Consider a sample size $m$ after which the distribution of the sample mean is almost normal, denote it $\hat G$. Then we can write $$\mathcal{T} = n- \sum_{j=1}^m F_j(c)-\sum_{j=m+1}^n \hat G_j(c) < n-\sum_{j=m+1}^n \hat G_j(c)$$ Solving $\hat G_j(c)$ we obtain $$\hat G_j(c) = 1- \Phi\left(\frac{\sqrt j}{\sigma}(\mu-c)\right) $$ where $\Phi$ is the standard normal cdf, $\sigma$ is the standard deviation of the i.i.d process, and $\mu$ is its mean. Inserting into the bound and re-arranging we get $$\mathcal{T} < m+\sum_{j=m+1}^n \Phi\left(\frac{\sqrt j}{\sigma}(-a)\right)$$ Note that this bound depends also on the variance of the process. Is this a better bound than the one presented in the question? This will depend crucially on how "quickly" the distribution of the sample mean becomes "almost normal". To give a numerical example, assume that $m= 30$. Assume also that the random variables are uniform in $[0,1]$. Then $\sigma = \sqrt \frac{1}{12}$ and $\mu = \frac 12$. Consider a 10% deviation from the mean, i.e. set $a=0.05$. then : already for $n=34$ the bound I propose (which is meaningful for $n>30$) becomes tighter. For $n=100$ the Hoeffding bound is $78.5$ while the bound I propose is $36.2$. The Hoeffding bound converges to $\approx 199.5$ while the bound I propose to $\approx 38.5$ If you increase $a$ the discrepancy between the two bounds reduces but remains visible: for a 20% deviation, $a=0.1$, the Hoeffding bound converges to $49.5$ while the bound I propose converges to $30.5$ (i.e the sum of the normal cdfs contributes very little to the overall bound). Somewhat more generally, we note that for $n\rightarrow \infty$ the Hoeffding bound converges to $$H_b\rightarrow \frac{1}{e^{2 a^2}-1} $$ while my bound to $$A_b \rightarrow m$$ Since for small values of $a$ (which is rather the case of interest) $H_b$ becomes a large number, there is still the case that $A_b$ may outperform it in tightness, even if the sample is such that the distribution of the sample mean converges slowly to the normal distribution.
Expected number of times the empirical mean will exceed a value This is a rather hand-made approach, and I would really appreciate some comment on it, (and the criticizing ones are usually the most helpful). If I understand correctly, the OP calculates sample mean
26,908
Tail bounds on Euclidean norm for uniform distribution on $\{-n,-(n-1),...,n-1,n\}^d$
Intuitively, it should be obvious that a point whose coordinates are sampled at random from the uniform distribution should have small modulus due to the curse of dimensionality. As $d$ increases, the probability that a point sampled at random from the volume of the $d$-dimensional unit ball will have distance less than or equal to $\epsilon$ from the center is $\epsilon^{d}$, which drops exponentially fast. I'll give the full version of cardinal's solution. Let $X_i$ be one independent copy of a discrete, uniform distribution over the integers $-n \leqslant k \leqslant n$. Clearly, $\mathbb{E}[X] = 0$, and it is easily computed that $\text{Var}(X_i) = \frac{n(n+1)}{3}$ Recall that $\mathbb{E}[X_i^2] = \text{Var}(X_i) + \mathbb{E}[X_i]^2$ and that $\text{Var}(X_i^2) = \mathbb{E}[X_i^4] - \mathbb{E}[X_i^2]^2$ Thus, $\mathbb{E}[X_i^2] = \text{Var}(X_i) = \frac{n(n+1)}{3}$ $\text{Var}(X_i^2) = \mathbb{E}[X_i^4] - \mathbb{E}[X_i^2]^2 = \frac{n(n+1)(3n^2 + 3n + 1)}{15} - \left( \frac{n(n+1)}{3} \right)^2$ $\mathbb{E}[X_i^4]$ computation Let $Y_i = X_i^2$ $$\sum_{i=1}^d Y_i = (\text{Distance of Randomly Sampled Point to Origin})^2$$ I'll finish this tomorrow, but you can see that this variable has a mean of about $\frac{n^2}{3}$, while less than $2^{-d}$ fraction of points have distances less than half the maximum distance $\frac{dn^2}{2}$
Tail bounds on Euclidean norm for uniform distribution on $\{-n,-(n-1),...,n-1,n\}^d$
Intuitively, it should be obvious that a point whose coordinates are sampled at random from the uniform distribution should have small modulus due to the curse of dimensionality. As $d$ increases, the
Tail bounds on Euclidean norm for uniform distribution on $\{-n,-(n-1),...,n-1,n\}^d$ Intuitively, it should be obvious that a point whose coordinates are sampled at random from the uniform distribution should have small modulus due to the curse of dimensionality. As $d$ increases, the probability that a point sampled at random from the volume of the $d$-dimensional unit ball will have distance less than or equal to $\epsilon$ from the center is $\epsilon^{d}$, which drops exponentially fast. I'll give the full version of cardinal's solution. Let $X_i$ be one independent copy of a discrete, uniform distribution over the integers $-n \leqslant k \leqslant n$. Clearly, $\mathbb{E}[X] = 0$, and it is easily computed that $\text{Var}(X_i) = \frac{n(n+1)}{3}$ Recall that $\mathbb{E}[X_i^2] = \text{Var}(X_i) + \mathbb{E}[X_i]^2$ and that $\text{Var}(X_i^2) = \mathbb{E}[X_i^4] - \mathbb{E}[X_i^2]^2$ Thus, $\mathbb{E}[X_i^2] = \text{Var}(X_i) = \frac{n(n+1)}{3}$ $\text{Var}(X_i^2) = \mathbb{E}[X_i^4] - \mathbb{E}[X_i^2]^2 = \frac{n(n+1)(3n^2 + 3n + 1)}{15} - \left( \frac{n(n+1)}{3} \right)^2$ $\mathbb{E}[X_i^4]$ computation Let $Y_i = X_i^2$ $$\sum_{i=1}^d Y_i = (\text{Distance of Randomly Sampled Point to Origin})^2$$ I'll finish this tomorrow, but you can see that this variable has a mean of about $\frac{n^2}{3}$, while less than $2^{-d}$ fraction of points have distances less than half the maximum distance $\frac{dn^2}{2}$
Tail bounds on Euclidean norm for uniform distribution on $\{-n,-(n-1),...,n-1,n\}^d$ Intuitively, it should be obvious that a point whose coordinates are sampled at random from the uniform distribution should have small modulus due to the curse of dimensionality. As $d$ increases, the
26,909
Tail bounds on Euclidean norm for uniform distribution on $\{-n,-(n-1),...,n-1,n\}^d$
If all $X_i$ follow independent discrete uniforms over $[-n, n]$, then as there are $2n+1$ values to choose from and their mean is 0, we have for all $i$: $\mathbb{E}(X_i)= 0$, and $\mathbb{V}(X_i)= \mathbb{E}\left((X_i - \mathbb{E}(X_i))^2\right)= \mathbb{E}(X_i^2)= \frac{(2n+1)^2 - 1}{12}= \frac{n(n+1)}{3}$ Then if $S$ is the squared euclidean norm of vector $(X_1, X_2, ... X_d)$, and because of the independence of the $X_i$: $S= \sum_{i=1}^d X_i^2$ $\mathbb{E}(S)= \sum_{i=1}^d \mathbb{E}(X_i^2) = d \frac{n(n+1)}{3}$ From here on you could use Markov's inequality: $\forall a >0, \mathbb{P}(S \geq a) \leq \frac{1}{a}\mathbb{E}(S)$ $\mathbb{P}(S \geq a) \leq \frac{d}{a}\frac{n(n+1)}{3}$ This bound rises with $d$, which is normal because when $d$ gets larger the euclidean norm gets larger when compared to a fixed threshold $a$. Now if you define $S^*$ as a "normalized" squared norm (that has the same expected value no matter how big $d$) you get: $S^*= \frac{1}{d} Y = \frac{1}{d} \sum_{i=1}^d X_i^2$ $\mathbb{E}(S^*) = \frac{n(n+1)}{3} $ $\mathbb{P}(S \geq a) \leq \frac{n(n+1)}{3a}$ At least this bound doesn't rise with $d$, but it still far from solves your quest for an exponentially decreasing bound! I wonder if this can be due to the weakness of the Markov inequality... I think you should precise your question, because as stated above the mean euclidean norm of your vectors linearly rises in $d$, so you are very unlikely to find an upper bound for $\mathbb{P}(S > a)$ that is decreasing in $d$ with a fixed threshold $a$.
Tail bounds on Euclidean norm for uniform distribution on $\{-n,-(n-1),...,n-1,n\}^d$
If all $X_i$ follow independent discrete uniforms over $[-n, n]$, then as there are $2n+1$ values to choose from and their mean is 0, we have for all $i$: $\mathbb{E}(X_i)= 0$, and $\mathbb{V}(X_i)=
Tail bounds on Euclidean norm for uniform distribution on $\{-n,-(n-1),...,n-1,n\}^d$ If all $X_i$ follow independent discrete uniforms over $[-n, n]$, then as there are $2n+1$ values to choose from and their mean is 0, we have for all $i$: $\mathbb{E}(X_i)= 0$, and $\mathbb{V}(X_i)= \mathbb{E}\left((X_i - \mathbb{E}(X_i))^2\right)= \mathbb{E}(X_i^2)= \frac{(2n+1)^2 - 1}{12}= \frac{n(n+1)}{3}$ Then if $S$ is the squared euclidean norm of vector $(X_1, X_2, ... X_d)$, and because of the independence of the $X_i$: $S= \sum_{i=1}^d X_i^2$ $\mathbb{E}(S)= \sum_{i=1}^d \mathbb{E}(X_i^2) = d \frac{n(n+1)}{3}$ From here on you could use Markov's inequality: $\forall a >0, \mathbb{P}(S \geq a) \leq \frac{1}{a}\mathbb{E}(S)$ $\mathbb{P}(S \geq a) \leq \frac{d}{a}\frac{n(n+1)}{3}$ This bound rises with $d$, which is normal because when $d$ gets larger the euclidean norm gets larger when compared to a fixed threshold $a$. Now if you define $S^*$ as a "normalized" squared norm (that has the same expected value no matter how big $d$) you get: $S^*= \frac{1}{d} Y = \frac{1}{d} \sum_{i=1}^d X_i^2$ $\mathbb{E}(S^*) = \frac{n(n+1)}{3} $ $\mathbb{P}(S \geq a) \leq \frac{n(n+1)}{3a}$ At least this bound doesn't rise with $d$, but it still far from solves your quest for an exponentially decreasing bound! I wonder if this can be due to the weakness of the Markov inequality... I think you should precise your question, because as stated above the mean euclidean norm of your vectors linearly rises in $d$, so you are very unlikely to find an upper bound for $\mathbb{P}(S > a)$ that is decreasing in $d$ with a fixed threshold $a$.
Tail bounds on Euclidean norm for uniform distribution on $\{-n,-(n-1),...,n-1,n\}^d$ If all $X_i$ follow independent discrete uniforms over $[-n, n]$, then as there are $2n+1$ values to choose from and their mean is 0, we have for all $i$: $\mathbb{E}(X_i)= 0$, and $\mathbb{V}(X_i)=
26,910
Understanding the effect of a continuous random factor in a mixed effects model
I had to think hard about what you were asking. At first I thought along the lines of @user11852, that you were wanting every observation to have its own unique random effect. That would make the model hopelessly unidentified, as there would be no conceivable way to distinguish random effect variation from the model error. But I believe that in the scope of your intended question, all random effects are actually continuous, and probably normally distributed. However, your allusion to "categorical" is not off the wall, because the design matrix for a random intercept (typically called Z) would look like a design matrix for a categorical variable. Let's add a bit of concreteness and say that the linear predictor is $$(\bar{\alpha} + \alpha_i) + (\bar{\beta} + \beta_i) x_{ij},$$ where $\bar{\alpha}$ and $\bar{\beta}$ are the fixed effects and $\alpha_i$ and $\beta_i$ are the $i$-specific random effects. I think that by "continuous," you mean a random effect like $\beta_i$ rather than $\alpha_i$. Note that both of these are still constant within a subject $i$. Now let's think of your proposed situation: different levels of the fixed effect came from far ends of the random effect continuum If we consider $\bar{\beta}$ to be the fixed effect, then it couldn't have different levels, but $x_{ij}$ could. Let's assume that for small values of $x_{ij}$, the slope is smaller; $\beta_i$ is negative for subjects $i$ with mostly small values of $x_{ij}$. Now by construction, the extremes of the $x_{ij}$ correspond to the extremes in $\beta_i$. That leaves us with what happens with vs without the random effect. My thoughts are, if there were only a few extreme cases of the situation above, adding a random effect would tend to pull the estimate of $\beta$ upwards. But I'm not totally sure. In traditional linear mixed modeling, the estimates of the fixed effects are really just weighted least squares estimates. While those weights are directly related to the random effects distribution, their impact will diminish as your sample size increases. In a realistic setting with even moderate sample sizes, I wouldn't expect anything too extreme to happen to your fixed effect estimates when you add in a random effect.
Understanding the effect of a continuous random factor in a mixed effects model
I had to think hard about what you were asking. At first I thought along the lines of @user11852, that you were wanting every observation to have its own unique random effect. That would make the mode
Understanding the effect of a continuous random factor in a mixed effects model I had to think hard about what you were asking. At first I thought along the lines of @user11852, that you were wanting every observation to have its own unique random effect. That would make the model hopelessly unidentified, as there would be no conceivable way to distinguish random effect variation from the model error. But I believe that in the scope of your intended question, all random effects are actually continuous, and probably normally distributed. However, your allusion to "categorical" is not off the wall, because the design matrix for a random intercept (typically called Z) would look like a design matrix for a categorical variable. Let's add a bit of concreteness and say that the linear predictor is $$(\bar{\alpha} + \alpha_i) + (\bar{\beta} + \beta_i) x_{ij},$$ where $\bar{\alpha}$ and $\bar{\beta}$ are the fixed effects and $\alpha_i$ and $\beta_i$ are the $i$-specific random effects. I think that by "continuous," you mean a random effect like $\beta_i$ rather than $\alpha_i$. Note that both of these are still constant within a subject $i$. Now let's think of your proposed situation: different levels of the fixed effect came from far ends of the random effect continuum If we consider $\bar{\beta}$ to be the fixed effect, then it couldn't have different levels, but $x_{ij}$ could. Let's assume that for small values of $x_{ij}$, the slope is smaller; $\beta_i$ is negative for subjects $i$ with mostly small values of $x_{ij}$. Now by construction, the extremes of the $x_{ij}$ correspond to the extremes in $\beta_i$. That leaves us with what happens with vs without the random effect. My thoughts are, if there were only a few extreme cases of the situation above, adding a random effect would tend to pull the estimate of $\beta$ upwards. But I'm not totally sure. In traditional linear mixed modeling, the estimates of the fixed effects are really just weighted least squares estimates. While those weights are directly related to the random effects distribution, their impact will diminish as your sample size increases. In a realistic setting with even moderate sample sizes, I wouldn't expect anything too extreme to happen to your fixed effect estimates when you add in a random effect.
Understanding the effect of a continuous random factor in a mixed effects model I had to think hard about what you were asking. At first I thought along the lines of @user11852, that you were wanting every observation to have its own unique random effect. That would make the mode
26,911
Rao-Blackwellization of sequential Monte Carlo filters
In $\widehat{I^1}$ the Monte Carlo estimate of $\mathbb{E}[f]$ is used. In $\widehat{I^2}$ the expectation is computed exactly. This is the RB-part. Later in the paper the expectation is computed using Kalman filters.
Rao-Blackwellization of sequential Monte Carlo filters
In $\widehat{I^1}$ the Monte Carlo estimate of $\mathbb{E}[f]$ is used. In $\widehat{I^2}$ the expectation is computed exactly. This is the RB-part. Later in the paper the expectation is computed usin
Rao-Blackwellization of sequential Monte Carlo filters In $\widehat{I^1}$ the Monte Carlo estimate of $\mathbb{E}[f]$ is used. In $\widehat{I^2}$ the expectation is computed exactly. This is the RB-part. Later in the paper the expectation is computed using Kalman filters.
Rao-Blackwellization of sequential Monte Carlo filters In $\widehat{I^1}$ the Monte Carlo estimate of $\mathbb{E}[f]$ is used. In $\widehat{I^2}$ the expectation is computed exactly. This is the RB-part. Later in the paper the expectation is computed usin
26,912
Enrichment analysis by gene duplication level
While I agree that Fisher's test (or something similar) may be the most natural approach here, how about this: For each unique gene, you determine the difference in number of duplications in L and B Order genes by this difference. Now the genes showing most differences between the species will be on the top of your list. Apply a gene set enrichment test to the ordered list of genes. For example, you can use a modified Fisher's method from my package tmod, for which you would have to define your gene sets (it should be quite straightforward). Note that Fisher's method is not related to Fisher's test. The modified Fisher's test (dubbed CERNO by the authors who first described it in this context) takes any ordered list of genes as the input, as long as you can group them in some useful categories. The advantage of this approach is that apart from a p-value, you can easily calculate the effect size of the enrichment and visualize it (for example, as a ROC curve over the ordered list of genes). This gives you a much better idea how much what you observe really matters for the biology you study.
Enrichment analysis by gene duplication level
While I agree that Fisher's test (or something similar) may be the most natural approach here, how about this: For each unique gene, you determine the difference in number of duplications in L and B
Enrichment analysis by gene duplication level While I agree that Fisher's test (or something similar) may be the most natural approach here, how about this: For each unique gene, you determine the difference in number of duplications in L and B Order genes by this difference. Now the genes showing most differences between the species will be on the top of your list. Apply a gene set enrichment test to the ordered list of genes. For example, you can use a modified Fisher's method from my package tmod, for which you would have to define your gene sets (it should be quite straightforward). Note that Fisher's method is not related to Fisher's test. The modified Fisher's test (dubbed CERNO by the authors who first described it in this context) takes any ordered list of genes as the input, as long as you can group them in some useful categories. The advantage of this approach is that apart from a p-value, you can easily calculate the effect size of the enrichment and visualize it (for example, as a ROC curve over the ordered list of genes). This gives you a much better idea how much what you observe really matters for the biology you study.
Enrichment analysis by gene duplication level While I agree that Fisher's test (or something similar) may be the most natural approach here, how about this: For each unique gene, you determine the difference in number of duplications in L and B
26,913
Enrichment analysis by gene duplication level
As you say, you're asking two distinct questions. Question 1 "is the ratio L*/L1+ different from B*/B1+ for a given gene function" this might be best answered with Fisher's exact test using data across the row as you found previously. Question 2 "is the ratio: genes where there is a single copy / genes where there is more than one copy, different between gene functions?" I think this also might be best answered with Fisher's exact test. You'd test the ratio of L*/L1+ for gene function 1 against L*/L1+ for gene function 2. Then gene function 1 Vs gene function 3, etc. Neither of these sets of questions gets at whether or not they are being maintained/deleted faster than expected purely by chance, only whether they are being deleted/maintained at rates different from each other. To know if they were being deleted/maintained at a rate different than by chance, you'd need to know the ratio of singlecopy/multiplecopies for lots of DNA regions that are only being affected by chance. If you could find such regions, you'd end up with a "Function group" where function is "None". You'd then compare this to your other gene function groups in the same way as I described in question 2.
Enrichment analysis by gene duplication level
As you say, you're asking two distinct questions. Question 1 "is the ratio L*/L1+ different from B*/B1+ for a given gene function" this might be best answered with Fisher's exact test using data acros
Enrichment analysis by gene duplication level As you say, you're asking two distinct questions. Question 1 "is the ratio L*/L1+ different from B*/B1+ for a given gene function" this might be best answered with Fisher's exact test using data across the row as you found previously. Question 2 "is the ratio: genes where there is a single copy / genes where there is more than one copy, different between gene functions?" I think this also might be best answered with Fisher's exact test. You'd test the ratio of L*/L1+ for gene function 1 against L*/L1+ for gene function 2. Then gene function 1 Vs gene function 3, etc. Neither of these sets of questions gets at whether or not they are being maintained/deleted faster than expected purely by chance, only whether they are being deleted/maintained at rates different from each other. To know if they were being deleted/maintained at a rate different than by chance, you'd need to know the ratio of singlecopy/multiplecopies for lots of DNA regions that are only being affected by chance. If you could find such regions, you'd end up with a "Function group" where function is "None". You'd then compare this to your other gene function groups in the same way as I described in question 2.
Enrichment analysis by gene duplication level As you say, you're asking two distinct questions. Question 1 "is the ratio L*/L1+ different from B*/B1+ for a given gene function" this might be best answered with Fisher's exact test using data acros
26,914
What is point-wise variance?
On page 267 of ISLR: What is the variance of the fit, i.e. $\mathrm{Var}(\hat f(x_0))$? Least squares returns variance estimates for each of the fitted coefficients $\hat \beta_j$, as well as the covariances between pairs of coefficient estimates. We can use these to compute the estimated variance of $\hat f(x_0)$.
What is point-wise variance?
On page 267 of ISLR: What is the variance of the fit, i.e. $\mathrm{Var}(\hat f(x_0))$? Least squares returns variance estimates for each of the fitted coefficients $\hat \beta_j$, as well as the
What is point-wise variance? On page 267 of ISLR: What is the variance of the fit, i.e. $\mathrm{Var}(\hat f(x_0))$? Least squares returns variance estimates for each of the fitted coefficients $\hat \beta_j$, as well as the covariances between pairs of coefficient estimates. We can use these to compute the estimated variance of $\hat f(x_0)$.
What is point-wise variance? On page 267 of ISLR: What is the variance of the fit, i.e. $\mathrm{Var}(\hat f(x_0))$? Least squares returns variance estimates for each of the fitted coefficients $\hat \beta_j$, as well as the
26,915
Statistical test suggestion
Let's investigate the distribution of $Z=X+Y$. $E[X+Y] = \mu_1 + \mu_2$ and $var(Z) = var(X+Y) = var(X) + var(Y) + 2Cov(X,Y)$ which equals to 3 in your case. What remains is testing $H_0: Z < 1$ which can be done with the usual t-test. Hope this helps.
Statistical test suggestion
Let's investigate the distribution of $Z=X+Y$. $E[X+Y] = \mu_1 + \mu_2$ and $var(Z) = var(X+Y) = var(X) + var(Y) + 2Cov(X,Y)$ which equals to 3 in your case. What remains is testing $H_0: Z < 1$ w
Statistical test suggestion Let's investigate the distribution of $Z=X+Y$. $E[X+Y] = \mu_1 + \mu_2$ and $var(Z) = var(X+Y) = var(X) + var(Y) + 2Cov(X,Y)$ which equals to 3 in your case. What remains is testing $H_0: Z < 1$ which can be done with the usual t-test. Hope this helps.
Statistical test suggestion Let's investigate the distribution of $Z=X+Y$. $E[X+Y] = \mu_1 + \mu_2$ and $var(Z) = var(X+Y) = var(X) + var(Y) + 2Cov(X,Y)$ which equals to 3 in your case. What remains is testing $H_0: Z < 1$ w
26,916
Can a model of P(Y|X) be trained via stochastic gradient descent from non-i.i.d. samples of P(X) and i.i.d. samples of P(Y|X)?
I think you could do either 2 or 3. However the problem with 3 is that in allowing arbitrary distributions for X you include distributions that would have all or almost all of the probability concentrated is a small interval in the x-space. This would hurt the overall estimation of P(Y|X) because you would have little or no data for certain values of X.
Can a model of P(Y|X) be trained via stochastic gradient descent from non-i.i.d. samples of P(X) and
I think you could do either 2 or 3. However the problem with 3 is that in allowing arbitrary distributions for X you include distributions that would have all or almost all of the probability concent
Can a model of P(Y|X) be trained via stochastic gradient descent from non-i.i.d. samples of P(X) and i.i.d. samples of P(Y|X)? I think you could do either 2 or 3. However the problem with 3 is that in allowing arbitrary distributions for X you include distributions that would have all or almost all of the probability concentrated is a small interval in the x-space. This would hurt the overall estimation of P(Y|X) because you would have little or no data for certain values of X.
Can a model of P(Y|X) be trained via stochastic gradient descent from non-i.i.d. samples of P(X) and I think you could do either 2 or 3. However the problem with 3 is that in allowing arbitrary distributions for X you include distributions that would have all or almost all of the probability concent
26,917
Finding a comparable Control group for a treatment group?
If I understand correctly, you want to find optimal balance in covariates between your control and treatment group. If that's so I'd use a matching procedure. R package Matching has all the functions needed for this, including some tools to assess if balance between groups has been achieved after the matching. Check this paper with details about its use and some examples.
Finding a comparable Control group for a treatment group?
If I understand correctly, you want to find optimal balance in covariates between your control and treatment group. If that's so I'd use a matching procedure. R package Matching has all the functions
Finding a comparable Control group for a treatment group? If I understand correctly, you want to find optimal balance in covariates between your control and treatment group. If that's so I'd use a matching procedure. R package Matching has all the functions needed for this, including some tools to assess if balance between groups has been achieved after the matching. Check this paper with details about its use and some examples.
Finding a comparable Control group for a treatment group? If I understand correctly, you want to find optimal balance in covariates between your control and treatment group. If that's so I'd use a matching procedure. R package Matching has all the functions
26,918
Is the observed allele frequency significantly less than the predicted?
This question may be dead, but the graphs here are gorgeous, and the answer here feels intuitively obvious. If you're looking for a "mountain" allele, the obvious choice would be to use altitude (or some surrogate of it) as your predictor. If that showed a significant association with allele frequency, it would provide strong evidence for your hypothesis. You might add in more predictor variables describing other aspects of the mountain than its altitude--for example, terrain "roughness" or vegetation type--that are uniquely mountainous and may also be associated with allele frequency.
Is the observed allele frequency significantly less than the predicted?
This question may be dead, but the graphs here are gorgeous, and the answer here feels intuitively obvious. If you're looking for a "mountain" allele, the obvious choice would be to use altitude (or s
Is the observed allele frequency significantly less than the predicted? This question may be dead, but the graphs here are gorgeous, and the answer here feels intuitively obvious. If you're looking for a "mountain" allele, the obvious choice would be to use altitude (or some surrogate of it) as your predictor. If that showed a significant association with allele frequency, it would provide strong evidence for your hypothesis. You might add in more predictor variables describing other aspects of the mountain than its altitude--for example, terrain "roughness" or vegetation type--that are uniquely mountainous and may also be associated with allele frequency.
Is the observed allele frequency significantly less than the predicted? This question may be dead, but the graphs here are gorgeous, and the answer here feels intuitively obvious. If you're looking for a "mountain" allele, the obvious choice would be to use altitude (or s
26,919
Bayesian, MDL or ML interpretation of cross-validation?
Cross validation is aimed at unbiased estimation of the risk (aka Test Error, or Prediction Error). In the case your loss function, is minus the (generative) log likelihood, then cross validation will return the expected log likelihood of your model. The same holds if your loss function has a Bayesian motivation. MDL is also aimed at unbiased estimation of the risk. It is thus an analytic approach to what CV does computationally. See Section 7.2 in Elements of Statistical Learning.
Bayesian, MDL or ML interpretation of cross-validation?
Cross validation is aimed at unbiased estimation of the risk (aka Test Error, or Prediction Error). In the case your loss function, is minus the (generative) log likelihood, then cross validation will
Bayesian, MDL or ML interpretation of cross-validation? Cross validation is aimed at unbiased estimation of the risk (aka Test Error, or Prediction Error). In the case your loss function, is minus the (generative) log likelihood, then cross validation will return the expected log likelihood of your model. The same holds if your loss function has a Bayesian motivation. MDL is also aimed at unbiased estimation of the risk. It is thus an analytic approach to what CV does computationally. See Section 7.2 in Elements of Statistical Learning.
Bayesian, MDL or ML interpretation of cross-validation? Cross validation is aimed at unbiased estimation of the risk (aka Test Error, or Prediction Error). In the case your loss function, is minus the (generative) log likelihood, then cross validation will
26,920
Compare fits of model to transformed and untransformed response
My experience with transformed data suggests that the correlation improves after transformation as well as the homoscedasticity and/or normality, although they are not necessarily all optimal for any single transformation. One simple answer may be to calculate correlation coefficients between the two models and their respective data sets. One can even test for the significance of difference of correlated correlation coefficients. Tests for homoscedasticity and density function type of residuals can also offer a means to evaluate them.
Compare fits of model to transformed and untransformed response
My experience with transformed data suggests that the correlation improves after transformation as well as the homoscedasticity and/or normality, although they are not necessarily all optimal for any
Compare fits of model to transformed and untransformed response My experience with transformed data suggests that the correlation improves after transformation as well as the homoscedasticity and/or normality, although they are not necessarily all optimal for any single transformation. One simple answer may be to calculate correlation coefficients between the two models and their respective data sets. One can even test for the significance of difference of correlated correlation coefficients. Tests for homoscedasticity and density function type of residuals can also offer a means to evaluate them.
Compare fits of model to transformed and untransformed response My experience with transformed data suggests that the correlation improves after transformation as well as the homoscedasticity and/or normality, although they are not necessarily all optimal for any
26,921
Extending 2-class models to multi-class problems
One way to improve is to use "weighted all pairs" approach which is supposedly better than "one against all" while still scalable. As for existing packages, glmnet supports (regularized) multinomial logit which can be used as a multi-class classifier.
Extending 2-class models to multi-class problems
One way to improve is to use "weighted all pairs" approach which is supposedly better than "one against all" while still scalable. As for existing packages, glmnet supports (regularized) multinomial l
Extending 2-class models to multi-class problems One way to improve is to use "weighted all pairs" approach which is supposedly better than "one against all" while still scalable. As for existing packages, glmnet supports (regularized) multinomial logit which can be used as a multi-class classifier.
Extending 2-class models to multi-class problems One way to improve is to use "weighted all pairs" approach which is supposedly better than "one against all" while still scalable. As for existing packages, glmnet supports (regularized) multinomial l
26,922
What questions would a statistician ask about analysis of E. coli outbreak?
If you have no a priori scientific questions you want/need answered - I would look at the spatial distribution of cases. In particular, I would estimate a sort of spatial "intensity" function-- that is some function $f( {\bf s} ) = E({\rm prevalence} | {\rm \ you \ are \ in \ location \ } {\bf s} )$. So that you don't overfit the data, some smoothing would be appropriate, which would effectively "bin" nearby locations together. The simplest approach would be using a kernel density estimation function (e.g. the kde2d function in R, although some pre-processing of the data may be necessary). This would help identify "hot spots" in the spatial distribution and could lead an investigator to identify environmental reservoirs of E. Coli. Depending on what other data you have, more sophisticated spatial models that adjust for known confounders could be used.
What questions would a statistician ask about analysis of E. coli outbreak?
If you have no a priori scientific questions you want/need answered - I would look at the spatial distribution of cases. In particular, I would estimate a sort of spatial "intensity" function-- that i
What questions would a statistician ask about analysis of E. coli outbreak? If you have no a priori scientific questions you want/need answered - I would look at the spatial distribution of cases. In particular, I would estimate a sort of spatial "intensity" function-- that is some function $f( {\bf s} ) = E({\rm prevalence} | {\rm \ you \ are \ in \ location \ } {\bf s} )$. So that you don't overfit the data, some smoothing would be appropriate, which would effectively "bin" nearby locations together. The simplest approach would be using a kernel density estimation function (e.g. the kde2d function in R, although some pre-processing of the data may be necessary). This would help identify "hot spots" in the spatial distribution and could lead an investigator to identify environmental reservoirs of E. Coli. Depending on what other data you have, more sophisticated spatial models that adjust for known confounders could be used.
What questions would a statistician ask about analysis of E. coli outbreak? If you have no a priori scientific questions you want/need answered - I would look at the spatial distribution of cases. In particular, I would estimate a sort of spatial "intensity" function-- that i
26,923
Modifying linear ballistic accumulator (LBA) simulation in R
This is not a complete answer. It is just an attempt to give a pointer. I know nothing about LBA, I just like R code, so your millage may vary. The key to finding the appropriate section of code was knowing that the value Ter was simply added to the end result of the model calculations (and backtracking from the obj function which is in the optim and parameterization wrapper 'fitter'). That lead me to pqlba and lbameans. In lbameans, Ter is added as at the end of tmp$mean, in turn derived from the n1mean function which accepts as parameters x0max, chi, drift, and sdI which seemed like reasonable matches for your X1:X4 names. But, nothing calls lbameans, leading me back to pqlba. Digging through that I can see that pqlba (prior to adding Ter) bounces through a couple functions - and ends up at fptpdf. At this point I am stymied. The nice part is that, if I am right, fptpdf has all of the major players present. The bad part is that, 1) it would take more time to see whether the parameters are doing other things and need to be controlled prior to fptpdf (probably), and 2) Eliminating X1 (aka x0max) is problematic because the function is divided by x0max. Setting it to 0 then causes obvious problems (dividing by 0 is bad mkay?). Thus a greater understanding of how the model is working is probably needed before you can achieve your aims. Good luck.
Modifying linear ballistic accumulator (LBA) simulation in R
This is not a complete answer. It is just an attempt to give a pointer. I know nothing about LBA, I just like R code, so your millage may vary. The key to finding the appropriate section of code was
Modifying linear ballistic accumulator (LBA) simulation in R This is not a complete answer. It is just an attempt to give a pointer. I know nothing about LBA, I just like R code, so your millage may vary. The key to finding the appropriate section of code was knowing that the value Ter was simply added to the end result of the model calculations (and backtracking from the obj function which is in the optim and parameterization wrapper 'fitter'). That lead me to pqlba and lbameans. In lbameans, Ter is added as at the end of tmp$mean, in turn derived from the n1mean function which accepts as parameters x0max, chi, drift, and sdI which seemed like reasonable matches for your X1:X4 names. But, nothing calls lbameans, leading me back to pqlba. Digging through that I can see that pqlba (prior to adding Ter) bounces through a couple functions - and ends up at fptpdf. At this point I am stymied. The nice part is that, if I am right, fptpdf has all of the major players present. The bad part is that, 1) it would take more time to see whether the parameters are doing other things and need to be controlled prior to fptpdf (probably), and 2) Eliminating X1 (aka x0max) is problematic because the function is divided by x0max. Setting it to 0 then causes obvious problems (dividing by 0 is bad mkay?). Thus a greater understanding of how the model is working is probably needed before you can achieve your aims. Good luck.
Modifying linear ballistic accumulator (LBA) simulation in R This is not a complete answer. It is just an attempt to give a pointer. I know nothing about LBA, I just like R code, so your millage may vary. The key to finding the appropriate section of code was
26,924
What graphical methods are useful for visualising how uncertainties aggregate?
Apperently http://www.getguesstimate.com/ is what you are searching for. They are offering spreadsheets for prediction that aggregate the uncertainty in each prediction. They also include some visualisations. A nice example could be found here: http://www.getguesstimate.com/models/314 What can Guesstimate be used for? Guesstimate is great at making estimates of things that aren't certain. You can forecast your earnings from a new venture, predict the amount of time a big project will take, or experiment with scientific theories. People have used it to optimize video games, understand lottery payoffs, and estimate the costs of their childcare.
What graphical methods are useful for visualising how uncertainties aggregate?
Apperently http://www.getguesstimate.com/ is what you are searching for. They are offering spreadsheets for prediction that aggregate the uncertainty in each prediction. They also include some visuali
What graphical methods are useful for visualising how uncertainties aggregate? Apperently http://www.getguesstimate.com/ is what you are searching for. They are offering spreadsheets for prediction that aggregate the uncertainty in each prediction. They also include some visualisations. A nice example could be found here: http://www.getguesstimate.com/models/314 What can Guesstimate be used for? Guesstimate is great at making estimates of things that aren't certain. You can forecast your earnings from a new venture, predict the amount of time a big project will take, or experiment with scientific theories. People have used it to optimize video games, understand lottery payoffs, and estimate the costs of their childcare.
What graphical methods are useful for visualising how uncertainties aggregate? Apperently http://www.getguesstimate.com/ is what you are searching for. They are offering spreadsheets for prediction that aggregate the uncertainty in each prediction. They also include some visuali
26,925
Sample size required to determine which of a set of advertisements has the highest click through rate
The test you probably want is Fisher's exact test. Unfortunately, given the likely very low click-through rate and small expected effect size, you will need enormous N to achieve the confidence interval you want. Lets say that the 'true' click-through rate of your best ad is .11, and your second best .1. Further, let's say you want the probability that you improperly fail to reject the null hypothesis (that there is no difference between the two ads), to be less than .20. If this is so, you will need an N on the order of 10,000. > library(statmod) > power.fisher.test(.1,.11,20000,20000,.05) [1] 0.84 As a commenter suggested, you likely should not care about a ten percent difference in ad performance. For grosser differences, the necessary size of the samples decreases quickly. > power.fisher.test(.1,.2,200,200,.05) [1] 0.785
Sample size required to determine which of a set of advertisements has the highest click through rat
The test you probably want is Fisher's exact test. Unfortunately, given the likely very low click-through rate and small expected effect size, you will need enormous N to achieve the confidence interv
Sample size required to determine which of a set of advertisements has the highest click through rate The test you probably want is Fisher's exact test. Unfortunately, given the likely very low click-through rate and small expected effect size, you will need enormous N to achieve the confidence interval you want. Lets say that the 'true' click-through rate of your best ad is .11, and your second best .1. Further, let's say you want the probability that you improperly fail to reject the null hypothesis (that there is no difference between the two ads), to be less than .20. If this is so, you will need an N on the order of 10,000. > library(statmod) > power.fisher.test(.1,.11,20000,20000,.05) [1] 0.84 As a commenter suggested, you likely should not care about a ten percent difference in ad performance. For grosser differences, the necessary size of the samples decreases quickly. > power.fisher.test(.1,.2,200,200,.05) [1] 0.785
Sample size required to determine which of a set of advertisements has the highest click through rat The test you probably want is Fisher's exact test. Unfortunately, given the likely very low click-through rate and small expected effect size, you will need enormous N to achieve the confidence interv
26,926
Power analysis for survival analysis
Yes, your power will change based on the ratio of exposed to unexposed. For example, in a recent study I did the power calculations for, at an equal sample size, an Exposed:Unexposed ratio of 1:2 achieved power = 0.80 at a HR of ~1.3. It took until HR ~1.6 or so for a ratio of 1:10. In your case, since the sample size will vary but your HR won't, the smaller the ratio, the larger your sample size will need to be.
Power analysis for survival analysis
Yes, your power will change based on the ratio of exposed to unexposed. For example, in a recent study I did the power calculations for, at an equal sample size, an Exposed:Unexposed ratio of 1:2 achi
Power analysis for survival analysis Yes, your power will change based on the ratio of exposed to unexposed. For example, in a recent study I did the power calculations for, at an equal sample size, an Exposed:Unexposed ratio of 1:2 achieved power = 0.80 at a HR of ~1.3. It took until HR ~1.6 or so for a ratio of 1:10. In your case, since the sample size will vary but your HR won't, the smaller the ratio, the larger your sample size will need to be.
Power analysis for survival analysis Yes, your power will change based on the ratio of exposed to unexposed. For example, in a recent study I did the power calculations for, at an equal sample size, an Exposed:Unexposed ratio of 1:2 achi
26,927
Predicting long-memory processes
Have you tried "Variable Length Markov Chains", VLMC The paper is "Variable Length Markov Chains: Methodology, Computing, and Software", Martin MACHLER and Peter BUHLMANN, 2004, Journal of Computational and Graphical Statistics, Vol. 13, No. 2.
Predicting long-memory processes
Have you tried "Variable Length Markov Chains", VLMC The paper is "Variable Length Markov Chains: Methodology, Computing, and Software", Martin MACHLER and Peter BUHLMANN, 2004, Journal of Computation
Predicting long-memory processes Have you tried "Variable Length Markov Chains", VLMC The paper is "Variable Length Markov Chains: Methodology, Computing, and Software", Martin MACHLER and Peter BUHLMANN, 2004, Journal of Computational and Graphical Statistics, Vol. 13, No. 2.
Predicting long-memory processes Have you tried "Variable Length Markov Chains", VLMC The paper is "Variable Length Markov Chains: Methodology, Computing, and Software", Martin MACHLER and Peter BUHLMANN, 2004, Journal of Computation
26,928
statsmodels seasonal_decompose(): What is the right "period of the series" in the context of a list column (constant vs. varying number of items)
Without cycles The "period" parameter does not play a role if the data does not have any cycles. This short example cannot have a seasonality in it. Thus, the answer to the question is that there is no answer. With cycles, and with observations at regular intervals The "period" parameter is the number of observations in a seasonal cycle. For example, if you have daily observations and weekly seasonality, the period is 7. With cycles, and with observations at irregular intervals Not asked in the example of this question, but if the data had a seasonality and by the same time irregular intervals, there are questions dealing with this: Trend in irregular time series data How to analyse irregular time-series in R Thanks go to the remarks of user Scortchi.
statsmodels seasonal_decompose(): What is the right "period of the series" in the context of a list
Without cycles The "period" parameter does not play a role if the data does not have any cycles. This short example cannot have a seasonality in it. Thus, the answer to the question is that there is n
statsmodels seasonal_decompose(): What is the right "period of the series" in the context of a list column (constant vs. varying number of items) Without cycles The "period" parameter does not play a role if the data does not have any cycles. This short example cannot have a seasonality in it. Thus, the answer to the question is that there is no answer. With cycles, and with observations at regular intervals The "period" parameter is the number of observations in a seasonal cycle. For example, if you have daily observations and weekly seasonality, the period is 7. With cycles, and with observations at irregular intervals Not asked in the example of this question, but if the data had a seasonality and by the same time irregular intervals, there are questions dealing with this: Trend in irregular time series data How to analyse irregular time-series in R Thanks go to the remarks of user Scortchi.
statsmodels seasonal_decompose(): What is the right "period of the series" in the context of a list Without cycles The "period" parameter does not play a role if the data does not have any cycles. This short example cannot have a seasonality in it. Thus, the answer to the question is that there is n
26,929
How to test for the difference in skewness of two samples?
Normally you can compare the distribution of data with some exploratory analysis,(i.e if you produce boxplots) or statistical wise looking at where your mean, median and percentiles are to get a feel of your distributions. Besides that there are some tests that shows if the equality of variances can be assumed or not where comparing two or more groups.. such as Kolmogorov–Smirnov test.. for this you need a non-significant result, that is the two distributions are not significantly different from one another.
How to test for the difference in skewness of two samples?
Normally you can compare the distribution of data with some exploratory analysis,(i.e if you produce boxplots) or statistical wise looking at where your mean, median and percentiles are to get a feel
How to test for the difference in skewness of two samples? Normally you can compare the distribution of data with some exploratory analysis,(i.e if you produce boxplots) or statistical wise looking at where your mean, median and percentiles are to get a feel of your distributions. Besides that there are some tests that shows if the equality of variances can be assumed or not where comparing two or more groups.. such as Kolmogorov–Smirnov test.. for this you need a non-significant result, that is the two distributions are not significantly different from one another.
How to test for the difference in skewness of two samples? Normally you can compare the distribution of data with some exploratory analysis,(i.e if you produce boxplots) or statistical wise looking at where your mean, median and percentiles are to get a feel
26,930
Obtaining knowledge from a random forest
Random Forests are hardly a black box. They are based on decision trees, which are very easy to interpret: #Setup a binary classification problem require(randomForest) data(iris) set.seed(1) dat <- iris dat$Species <- factor(ifelse(dat$Species=='virginica','virginica','other')) trainrows <- runif(nrow(dat)) > 0.3 train <- dat[trainrows,] test <- dat[!trainrows,] #Build a decision tree require(rpart) model.rpart <- rpart(Species~., train) This results in a simple decision tree: > model.rpart n= 111 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 111 35 other (0.68468468 0.31531532) 2) Petal.Length< 4.95 77 3 other (0.96103896 0.03896104) * 3) Petal.Length>=4.95 34 2 virginica (0.05882353 0.94117647) * If Petal.Length < 4.95, this tree classifies the observation as "other." If it's greater than 4.95, it classifies the observation as "virginica." A random forest is simple a collection of many such trees, where each one is trained on a random subset of the data. Each tree then "votes" on the final classification of each observation. model.rf <- randomForest(Species~., train, ntree=25, proximity=TRUE, importance=TRUE, nodesize=5) > getTree(model.rf, k=1, labelVar=TRUE) left daughter right daughter split var split point status prediction 1 2 3 Petal.Width 1.70 1 <NA> 2 4 5 Petal.Length 4.95 1 <NA> 3 6 7 Petal.Length 4.95 1 <NA> 4 0 0 <NA> 0.00 -1 other 5 0 0 <NA> 0.00 -1 virginica 6 0 0 <NA> 0.00 -1 other 7 0 0 <NA> 0.00 -1 virginica You can even pull out individual trees from the rf, and look at their structure. The format is slightly different than for rpart models, but you could inspect each tree if you wanted and see how it's modeling the data. Furthermore, no model is truly a black box, because you can examine predicted responses vs actual responses for each variable in the dataset. This is a good idea regardless of what sort of model you are building: library(ggplot2) pSpecies <- predict(model.rf,test,'vote')[,2] plotData <- lapply(names(test[,1:4]), function(x){ out <- data.frame( var = x, type = c(rep('Actual',nrow(test)),rep('Predicted',nrow(test))), value = c(test[,x],test[,x]), species = c(as.numeric(test$Species)-1,pSpecies) ) out$value <- out$value-min(out$value) #Normalize to [0,1] out$value <- out$value/max(out$value) out }) plotData <- do.call(rbind,plotData) qplot(value, species, data=plotData, facets = type ~ var, geom='smooth', span = 0.5) I've normalized the variables (sepal and petal length and width) to a 0-1 range. The response is also 0-1, where 0 is other and 1 is virginica. As you can see the random forest is a good model, even on the test set. Additionally, a random forest will compute various measure of variable importance, which can be very informative: > importance(model.rf, type=1) MeanDecreaseAccuracy Sepal.Length 0.28567162 Sepal.Width -0.08584199 Petal.Length 0.64705819 Petal.Width 0.58176828 This table represents how much removing each variable reduces the accuracy of the model. Finally, there are many other plots you can make from a random forest model, to view what's going on in the black box: plot(model.rf) plot(margin(model.rf)) MDSplot(model.rf, iris$Species, k=5) plot(outlier(model.rf), type="h", col=c("red", "green", "blue")[as.numeric(dat$Species)]) You can view the help files for each of these functions to get a better idea of what they display.
Obtaining knowledge from a random forest
Random Forests are hardly a black box. They are based on decision trees, which are very easy to interpret: #Setup a binary classification problem require(randomForest) data(iris) set.seed(1) dat <- i
Obtaining knowledge from a random forest Random Forests are hardly a black box. They are based on decision trees, which are very easy to interpret: #Setup a binary classification problem require(randomForest) data(iris) set.seed(1) dat <- iris dat$Species <- factor(ifelse(dat$Species=='virginica','virginica','other')) trainrows <- runif(nrow(dat)) > 0.3 train <- dat[trainrows,] test <- dat[!trainrows,] #Build a decision tree require(rpart) model.rpart <- rpart(Species~., train) This results in a simple decision tree: > model.rpart n= 111 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 111 35 other (0.68468468 0.31531532) 2) Petal.Length< 4.95 77 3 other (0.96103896 0.03896104) * 3) Petal.Length>=4.95 34 2 virginica (0.05882353 0.94117647) * If Petal.Length < 4.95, this tree classifies the observation as "other." If it's greater than 4.95, it classifies the observation as "virginica." A random forest is simple a collection of many such trees, where each one is trained on a random subset of the data. Each tree then "votes" on the final classification of each observation. model.rf <- randomForest(Species~., train, ntree=25, proximity=TRUE, importance=TRUE, nodesize=5) > getTree(model.rf, k=1, labelVar=TRUE) left daughter right daughter split var split point status prediction 1 2 3 Petal.Width 1.70 1 <NA> 2 4 5 Petal.Length 4.95 1 <NA> 3 6 7 Petal.Length 4.95 1 <NA> 4 0 0 <NA> 0.00 -1 other 5 0 0 <NA> 0.00 -1 virginica 6 0 0 <NA> 0.00 -1 other 7 0 0 <NA> 0.00 -1 virginica You can even pull out individual trees from the rf, and look at their structure. The format is slightly different than for rpart models, but you could inspect each tree if you wanted and see how it's modeling the data. Furthermore, no model is truly a black box, because you can examine predicted responses vs actual responses for each variable in the dataset. This is a good idea regardless of what sort of model you are building: library(ggplot2) pSpecies <- predict(model.rf,test,'vote')[,2] plotData <- lapply(names(test[,1:4]), function(x){ out <- data.frame( var = x, type = c(rep('Actual',nrow(test)),rep('Predicted',nrow(test))), value = c(test[,x],test[,x]), species = c(as.numeric(test$Species)-1,pSpecies) ) out$value <- out$value-min(out$value) #Normalize to [0,1] out$value <- out$value/max(out$value) out }) plotData <- do.call(rbind,plotData) qplot(value, species, data=plotData, facets = type ~ var, geom='smooth', span = 0.5) I've normalized the variables (sepal and petal length and width) to a 0-1 range. The response is also 0-1, where 0 is other and 1 is virginica. As you can see the random forest is a good model, even on the test set. Additionally, a random forest will compute various measure of variable importance, which can be very informative: > importance(model.rf, type=1) MeanDecreaseAccuracy Sepal.Length 0.28567162 Sepal.Width -0.08584199 Petal.Length 0.64705819 Petal.Width 0.58176828 This table represents how much removing each variable reduces the accuracy of the model. Finally, there are many other plots you can make from a random forest model, to view what's going on in the black box: plot(model.rf) plot(margin(model.rf)) MDSplot(model.rf, iris$Species, k=5) plot(outlier(model.rf), type="h", col=c("red", "green", "blue")[as.numeric(dat$Species)]) You can view the help files for each of these functions to get a better idea of what they display.
Obtaining knowledge from a random forest Random Forests are hardly a black box. They are based on decision trees, which are very easy to interpret: #Setup a binary classification problem require(randomForest) data(iris) set.seed(1) dat <- i
26,931
Obtaining knowledge from a random forest
Some time ago I had to justify a RF model-fit to some chemists in my company. I spent quite time trying different visualization techniques. During the process, I accidentally also came up with some new techniques which I put into an R package (forestFloor) specifically for random forest visualizations. The classical approach are partial dependence plots supported by: Rminer(data-based sensitivity analysis is reinvented partial dependence), or partialPlot in randomForest package. I find the partial dependence package iceBOX as an elegant way to discover interactions. Have not used edarf package, but seems to have some fine visualizations dedicated for RF. The ggRandomForest package also contain a large set of useful visualizations. Currently forestFloor supports randomForest objects(support for other RF implementions is on its way). Also feature contributions can be computed for gradient boosted trees, as these trees after training are not much different from random forest trees. So forestFloor could support XGBoost in future. Partial dependence plots are completely model invariant. All packages have in common to visualize the geometrical mapping structure of a model from feature space to target space. A sine curve y = sin(x) would be a mapping from x to y and can be plotted in 2D. To plot a RF mapping directly would often require too many dimensions. Instead the overall mapping structure can be projected, sliced or decomposed, such that the entire mapping structure is boiled down into a sequence of 2D marginal plots. If your RF model only has captured main effects and no interactions between variables, classic visualizations methods will do just fine. Then you can simplify your model structure like this $y = F(X) \approx f_1(x_1) + f_2(x_2) + ... + f_d(x_d)$. Then each partial function by each variable can be visualized just as the sine curve. If your RF model has captured sizable interactions, then it is more problematic. 3D slices of the structure can visualize interactions between two features and the output. The problem is to know which combination of features to visualize, (iceBOX does address this issue). Also it is not easy to tell if other latent interactions still are not accounted for. In this paper, I used an very early version of forestFloor to explain what actual biochemical relationship a very small RF model had captured. And in this paper we thoroughly describe visualizations of feature contributions, Forest Floor Visualizations of Random Forests. I have pasted the simulated example from forestFloor package, where I show how to uncover a simulated hidden function $y = {x_1}^2 + sin(x_2\pi) + 2 * x_3 * x_4 + $ noise #1 - Regression example: set.seed(1234) library(forestFloor) library(randomForest) #simulate data y = x1^2+sin(x2*pi)+x3*x4 + noise obs = 5000 #how many observations/samples vars = 6 #how many variables/features #create 6 normal distr. uncorr. variables X = data.frame(replicate(vars,rnorm(obs))) #create target by hidden function Y = with(X, X1^2 + sin(X2*pi) + 2 * X3 * X4 + 0.5 * rnorm(obs)) #grow a forest rfo = randomForest( X, #features, data.frame or matrix. Recommended to name columns. Y, #targets, vector of integers or floats keep.inbag = TRUE, # mandatory, importance = TRUE, # recommended, else ordering by giniImpurity (unstable) sampsize = 1500 , # optional, reduce tree sizes to compute faster ntree = if(interactive()) 500 else 50 #speedup CRAN testing ) #compute forestFloor object, often only 5-10% time of growing forest ff = forestFloor( rf.fit = rfo, # mandatory X = X, # mandatory calc_np = FALSE, # TRUE or FALSE both works, makes no difference binary_reg = FALSE # takes no effect here when rfo$type="regression" ) #plot partial functions of most important variables first plot(ff, # forestFloor object plot_seq = 1:6, # optional sequence of features to plot orderByImportance=TRUE # if TRUE index sequence by importance, else by X column ) #Non interacting features are well displayed, whereas X3 and X4 are not #by applying color gradient, interactions reveal themself #also a k-nearest neighbor fit is applied to evaluate goodness-of-fit Col=fcol(ff,3,orderByImportance=FALSE) #create color gradient see help(fcol) plot(ff,col=Col,plot_GOF=TRUE) #feature contributions of X3 and X4 are well explained in the context of X3 and X4 # as GOF R^2>.8 show3d(ff,3:4,col=Col,plot_GOF=TRUE,orderByImportance=FALSE) Lastly the code for partial dependence plots coded by A.Liaw described by J.Friedman. Which do fine for main effects. par(mfrow=c(2,3)) for(i in 1:6) partialPlot(rfo,X,x.var=names(X)[i])
Obtaining knowledge from a random forest
Some time ago I had to justify a RF model-fit to some chemists in my company. I spent quite time trying different visualization techniques. During the process, I accidentally also came up with some ne
Obtaining knowledge from a random forest Some time ago I had to justify a RF model-fit to some chemists in my company. I spent quite time trying different visualization techniques. During the process, I accidentally also came up with some new techniques which I put into an R package (forestFloor) specifically for random forest visualizations. The classical approach are partial dependence plots supported by: Rminer(data-based sensitivity analysis is reinvented partial dependence), or partialPlot in randomForest package. I find the partial dependence package iceBOX as an elegant way to discover interactions. Have not used edarf package, but seems to have some fine visualizations dedicated for RF. The ggRandomForest package also contain a large set of useful visualizations. Currently forestFloor supports randomForest objects(support for other RF implementions is on its way). Also feature contributions can be computed for gradient boosted trees, as these trees after training are not much different from random forest trees. So forestFloor could support XGBoost in future. Partial dependence plots are completely model invariant. All packages have in common to visualize the geometrical mapping structure of a model from feature space to target space. A sine curve y = sin(x) would be a mapping from x to y and can be plotted in 2D. To plot a RF mapping directly would often require too many dimensions. Instead the overall mapping structure can be projected, sliced or decomposed, such that the entire mapping structure is boiled down into a sequence of 2D marginal plots. If your RF model only has captured main effects and no interactions between variables, classic visualizations methods will do just fine. Then you can simplify your model structure like this $y = F(X) \approx f_1(x_1) + f_2(x_2) + ... + f_d(x_d)$. Then each partial function by each variable can be visualized just as the sine curve. If your RF model has captured sizable interactions, then it is more problematic. 3D slices of the structure can visualize interactions between two features and the output. The problem is to know which combination of features to visualize, (iceBOX does address this issue). Also it is not easy to tell if other latent interactions still are not accounted for. In this paper, I used an very early version of forestFloor to explain what actual biochemical relationship a very small RF model had captured. And in this paper we thoroughly describe visualizations of feature contributions, Forest Floor Visualizations of Random Forests. I have pasted the simulated example from forestFloor package, where I show how to uncover a simulated hidden function $y = {x_1}^2 + sin(x_2\pi) + 2 * x_3 * x_4 + $ noise #1 - Regression example: set.seed(1234) library(forestFloor) library(randomForest) #simulate data y = x1^2+sin(x2*pi)+x3*x4 + noise obs = 5000 #how many observations/samples vars = 6 #how many variables/features #create 6 normal distr. uncorr. variables X = data.frame(replicate(vars,rnorm(obs))) #create target by hidden function Y = with(X, X1^2 + sin(X2*pi) + 2 * X3 * X4 + 0.5 * rnorm(obs)) #grow a forest rfo = randomForest( X, #features, data.frame or matrix. Recommended to name columns. Y, #targets, vector of integers or floats keep.inbag = TRUE, # mandatory, importance = TRUE, # recommended, else ordering by giniImpurity (unstable) sampsize = 1500 , # optional, reduce tree sizes to compute faster ntree = if(interactive()) 500 else 50 #speedup CRAN testing ) #compute forestFloor object, often only 5-10% time of growing forest ff = forestFloor( rf.fit = rfo, # mandatory X = X, # mandatory calc_np = FALSE, # TRUE or FALSE both works, makes no difference binary_reg = FALSE # takes no effect here when rfo$type="regression" ) #plot partial functions of most important variables first plot(ff, # forestFloor object plot_seq = 1:6, # optional sequence of features to plot orderByImportance=TRUE # if TRUE index sequence by importance, else by X column ) #Non interacting features are well displayed, whereas X3 and X4 are not #by applying color gradient, interactions reveal themself #also a k-nearest neighbor fit is applied to evaluate goodness-of-fit Col=fcol(ff,3,orderByImportance=FALSE) #create color gradient see help(fcol) plot(ff,col=Col,plot_GOF=TRUE) #feature contributions of X3 and X4 are well explained in the context of X3 and X4 # as GOF R^2>.8 show3d(ff,3:4,col=Col,plot_GOF=TRUE,orderByImportance=FALSE) Lastly the code for partial dependence plots coded by A.Liaw described by J.Friedman. Which do fine for main effects. par(mfrow=c(2,3)) for(i in 1:6) partialPlot(rfo,X,x.var=names(X)[i])
Obtaining knowledge from a random forest Some time ago I had to justify a RF model-fit to some chemists in my company. I spent quite time trying different visualization techniques. During the process, I accidentally also came up with some ne
26,932
Obtaining knowledge from a random forest
To supplement these fine responses, I would mention use of gradient boosted trees (e.g. the GBM Package in R). In R, I prefer this to random forests because missing values are allowed as compared to randomForest where imputation is required. Variable importance and partial plots are available (as in randomForest) to aid in feature selection and nonlinear transformation exploration in your logit model. Further, variable interaction is addressed with Friedman’s H-statistic (interact.gbm) with reference given as J.H. Friedman and B.E. Popescu (2005). “Predictive Learning via Rule Ensembles.” Section 8.1. A commercial version called TreeNet is available from Salford Systems and this video presentation speaks to their take on variable interaction estimation Video.
Obtaining knowledge from a random forest
To supplement these fine responses, I would mention use of gradient boosted trees (e.g. the GBM Package in R). In R, I prefer this to random forests because missing values are allowed as compared to r
Obtaining knowledge from a random forest To supplement these fine responses, I would mention use of gradient boosted trees (e.g. the GBM Package in R). In R, I prefer this to random forests because missing values are allowed as compared to randomForest where imputation is required. Variable importance and partial plots are available (as in randomForest) to aid in feature selection and nonlinear transformation exploration in your logit model. Further, variable interaction is addressed with Friedman’s H-statistic (interact.gbm) with reference given as J.H. Friedman and B.E. Popescu (2005). “Predictive Learning via Rule Ensembles.” Section 8.1. A commercial version called TreeNet is available from Salford Systems and this video presentation speaks to their take on variable interaction estimation Video.
Obtaining knowledge from a random forest To supplement these fine responses, I would mention use of gradient boosted trees (e.g. the GBM Package in R). In R, I prefer this to random forests because missing values are allowed as compared to r
26,933
Obtaining knowledge from a random forest
Late answer, but I came across a recent R package forestFloor (2015) that helps you doing this "unblackboxing" task in an automated fashion. It looks very promising! library(forestFloor) library(randomForest) #simulate data obs=1000 vars = 18 X = data.frame(replicate(vars,rnorm(obs))) Y = with(X, X1^2 + sin(X2*pi) + 2 * X3 * X4 + 1 * rnorm(obs)) #grow a forest, remeber to include inbag rfo=randomForest(X,Y,keep.inbag = TRUE,sampsize=250,ntree=50) #compute topology ff = forestFloor(rfo,X) #ggPlotForestFloor(ff,1:9) plot(ff,1:9,col=fcol(ff)) Produces the following plots: It also provides three-dimensional visualization if you are looking for interactions.
Obtaining knowledge from a random forest
Late answer, but I came across a recent R package forestFloor (2015) that helps you doing this "unblackboxing" task in an automated fashion. It looks very promising! library(forestFloor) library(rando
Obtaining knowledge from a random forest Late answer, but I came across a recent R package forestFloor (2015) that helps you doing this "unblackboxing" task in an automated fashion. It looks very promising! library(forestFloor) library(randomForest) #simulate data obs=1000 vars = 18 X = data.frame(replicate(vars,rnorm(obs))) Y = with(X, X1^2 + sin(X2*pi) + 2 * X3 * X4 + 1 * rnorm(obs)) #grow a forest, remeber to include inbag rfo=randomForest(X,Y,keep.inbag = TRUE,sampsize=250,ntree=50) #compute topology ff = forestFloor(rfo,X) #ggPlotForestFloor(ff,1:9) plot(ff,1:9,col=fcol(ff)) Produces the following plots: It also provides three-dimensional visualization if you are looking for interactions.
Obtaining knowledge from a random forest Late answer, but I came across a recent R package forestFloor (2015) that helps you doing this "unblackboxing" task in an automated fashion. It looks very promising! library(forestFloor) library(rando
26,934
Obtaining knowledge from a random forest
As mentioned by Zach, one way of understanding a model is to plot the response as the predictors vary. You can do this easily for "any" model with the plotmo R package. For example library(randomForest) data <- iris data$Species <- factor(ifelse(data$Species=='virginica','virginica','other')) mod <- randomForest(Species~Sepal.Length+Sepal.Width, data=data) library(plotmo) plotmo(mod, type="prob") which gives This changes one variable while holding the others at their median values. For interaction plots, it changes two variables. (Note added Nov 2016: plotmo now also supports partial dependence plots.) The example above uses only two variables; more complicated models can be visualized in a piecemeal fashion by looking at one or two variables at a time. Since the "other" variables are held at their median values, this shows only a slice of the data, but can still be useful. Some examples are in the vignette for the plotmo package. Other examples are in Chapter 10 of Plotting rpart trees with the rpart.plot package.
Obtaining knowledge from a random forest
As mentioned by Zach, one way of understanding a model is to plot the response as the predictors vary. You can do this easily for "any" model with the plotmo R package. For example library(randomFor
Obtaining knowledge from a random forest As mentioned by Zach, one way of understanding a model is to plot the response as the predictors vary. You can do this easily for "any" model with the plotmo R package. For example library(randomForest) data <- iris data$Species <- factor(ifelse(data$Species=='virginica','virginica','other')) mod <- randomForest(Species~Sepal.Length+Sepal.Width, data=data) library(plotmo) plotmo(mod, type="prob") which gives This changes one variable while holding the others at their median values. For interaction plots, it changes two variables. (Note added Nov 2016: plotmo now also supports partial dependence plots.) The example above uses only two variables; more complicated models can be visualized in a piecemeal fashion by looking at one or two variables at a time. Since the "other" variables are held at their median values, this shows only a slice of the data, but can still be useful. Some examples are in the vignette for the plotmo package. Other examples are in Chapter 10 of Plotting rpart trees with the rpart.plot package.
Obtaining knowledge from a random forest As mentioned by Zach, one way of understanding a model is to plot the response as the predictors vary. You can do this easily for "any" model with the plotmo R package. For example library(randomFor
26,935
Obtaining knowledge from a random forest
Late in the game but there are some new developments in this front, for example LIME and SHAP. Also a package worth checking is DALEX (in particular if using R but in any case contains nice cheatsheets etc.), though doesn't seem to cover interactions at the moment. And these are all model-agnostic so will work for random forests, GBMs, neural networks, etc.
Obtaining knowledge from a random forest
Late in the game but there are some new developments in this front, for example LIME and SHAP. Also a package worth checking is DALEX (in particular if using R but in any case contains nice cheatsheet
Obtaining knowledge from a random forest Late in the game but there are some new developments in this front, for example LIME and SHAP. Also a package worth checking is DALEX (in particular if using R but in any case contains nice cheatsheets etc.), though doesn't seem to cover interactions at the moment. And these are all model-agnostic so will work for random forests, GBMs, neural networks, etc.
Obtaining knowledge from a random forest Late in the game but there are some new developments in this front, for example LIME and SHAP. Also a package worth checking is DALEX (in particular if using R but in any case contains nice cheatsheet
26,936
Obtaining knowledge from a random forest
I'm very interested in these types of questions myself. I do think there is a lot of information we can get out of a random forest. About interactions, it seems like Breiman and Cutler have already tried to look at it, especially for classification RFs. To my knowledge, this has not been implemented in the randomForest R package. Maybe because it might not be as simple and because the meaning of "variable interactions" is very dependent of your problem. About the nonlinearity, I'm not sure what you are looking for, regression forest are used for nonlinear multiple regression problems without any priors on what type of nonlinear function to use.
Obtaining knowledge from a random forest
I'm very interested in these types of questions myself. I do think there is a lot of information we can get out of a random forest. About interactions, it seems like Breiman and Cutler have already tr
Obtaining knowledge from a random forest I'm very interested in these types of questions myself. I do think there is a lot of information we can get out of a random forest. About interactions, it seems like Breiman and Cutler have already tried to look at it, especially for classification RFs. To my knowledge, this has not been implemented in the randomForest R package. Maybe because it might not be as simple and because the meaning of "variable interactions" is very dependent of your problem. About the nonlinearity, I'm not sure what you are looking for, regression forest are used for nonlinear multiple regression problems without any priors on what type of nonlinear function to use.
Obtaining knowledge from a random forest I'm very interested in these types of questions myself. I do think there is a lot of information we can get out of a random forest. About interactions, it seems like Breiman and Cutler have already tr
26,937
Obtaining knowledge from a random forest
A slight modification of random forests that provide more information about the data are the recently-developed causal forest methods. See the GRF R-package and the motivating paper here. The idea is to use the random forest baseline methods to find heterogeneity in causal effects. An earlier paper (here) gives a detailed approach to a simple causal forest. Page 9 of the paper gives a step-by-step procedure for growing a causal tree, which can then be expanded to a forest in the usual ways. Equation 4: Equation 5:
Obtaining knowledge from a random forest
A slight modification of random forests that provide more information about the data are the recently-developed causal forest methods. See the GRF R-package and the motivating paper here. The idea is
Obtaining knowledge from a random forest A slight modification of random forests that provide more information about the data are the recently-developed causal forest methods. See the GRF R-package and the motivating paper here. The idea is to use the random forest baseline methods to find heterogeneity in causal effects. An earlier paper (here) gives a detailed approach to a simple causal forest. Page 9 of the paper gives a step-by-step procedure for growing a causal tree, which can then be expanded to a forest in the usual ways. Equation 4: Equation 5:
Obtaining knowledge from a random forest A slight modification of random forests that provide more information about the data are the recently-developed causal forest methods. See the GRF R-package and the motivating paper here. The idea is
26,938
Obtaining knowledge from a random forest
Late answer related to my question here (Can we make Random Forest 100% interpretable by fixing the seed?): Let $z_1$ be the seed in the creation of boostrapped training set, and $z_2 $ be the seed in the selection of feature's subset (for simplification, I only list 2 kinds of seeds here). From $z_1$, $m$ boostrapped training sets are created: $D_1(z_1)$, $D_2(z_1)$, $D_3(z_1)$, ..., $D_m(z_1)$. From those traning sets, $m$ corresponding decision trees are created, and tuned via cross-validation: $T_1(z_1,z_2)$, $T_2(z_1,z_2)$, $T_3(z_1,z_2)$,..., $T_m(z_1,z_2)$. Let's denote predictions from the ${j^\text{th}}_{(j=1,2,...,m)}$ tree for an individual $x_i$ (from training or testing set, whatever) as $\hat{f}^j(x_i)_{(i \le n, j \le m)}$. Hence the final predictions by the ensemble trees are: $$\hat{F}(x_i) = > \frac{1}{m}\sum\limits_{j=1}^m \hat{f}^j(x_i)$$ Once the model is validated, and is stable (meaning $\hat{F}(x_i)$ doesn't depend strongly on the pair $(z_1,z_2)$). I start to create every possible combinations of my features, which give me a very big set ($x'_i$). Applying my forest on each $x'_i$ gives me the corresponding predictions: $$x'_1 \rightarrow \hat{F}(x'_1) \text{ - which is fixed > thanks to $(z_1, z_2)$}$$ $$x'_2 \rightarrow \hat{F}(x'_2) \text{ - > which is fixed thanks to $(z_1, z_2)$}$$ $$x'_3 \rightarrow > \hat{F}(x'_3) \text{ - which is fixed thanks to $(z_1, z_2)$}$$ $$x'_4 > \rightarrow \hat{F}(x'_4) \text{ - which is fixed thanks to $(z_1, > z_2)$}$$ $$....$$ The latter can be easily represented in form of a single (huge) tree. For example: $x'_1$: (Age = 18, sex = M, ...), $x'_2$ = (Age = 18, sex = F, ...), ... could be regrouped to create a leaf. This works also for every ensemble methods based on aggregation of trees.
Obtaining knowledge from a random forest
Late answer related to my question here (Can we make Random Forest 100% interpretable by fixing the seed?): Let $z_1$ be the seed in the creation of boostrapped training set, and $z_2 $ be the seed
Obtaining knowledge from a random forest Late answer related to my question here (Can we make Random Forest 100% interpretable by fixing the seed?): Let $z_1$ be the seed in the creation of boostrapped training set, and $z_2 $ be the seed in the selection of feature's subset (for simplification, I only list 2 kinds of seeds here). From $z_1$, $m$ boostrapped training sets are created: $D_1(z_1)$, $D_2(z_1)$, $D_3(z_1)$, ..., $D_m(z_1)$. From those traning sets, $m$ corresponding decision trees are created, and tuned via cross-validation: $T_1(z_1,z_2)$, $T_2(z_1,z_2)$, $T_3(z_1,z_2)$,..., $T_m(z_1,z_2)$. Let's denote predictions from the ${j^\text{th}}_{(j=1,2,...,m)}$ tree for an individual $x_i$ (from training or testing set, whatever) as $\hat{f}^j(x_i)_{(i \le n, j \le m)}$. Hence the final predictions by the ensemble trees are: $$\hat{F}(x_i) = > \frac{1}{m}\sum\limits_{j=1}^m \hat{f}^j(x_i)$$ Once the model is validated, and is stable (meaning $\hat{F}(x_i)$ doesn't depend strongly on the pair $(z_1,z_2)$). I start to create every possible combinations of my features, which give me a very big set ($x'_i$). Applying my forest on each $x'_i$ gives me the corresponding predictions: $$x'_1 \rightarrow \hat{F}(x'_1) \text{ - which is fixed > thanks to $(z_1, z_2)$}$$ $$x'_2 \rightarrow \hat{F}(x'_2) \text{ - > which is fixed thanks to $(z_1, z_2)$}$$ $$x'_3 \rightarrow > \hat{F}(x'_3) \text{ - which is fixed thanks to $(z_1, z_2)$}$$ $$x'_4 > \rightarrow \hat{F}(x'_4) \text{ - which is fixed thanks to $(z_1, > z_2)$}$$ $$....$$ The latter can be easily represented in form of a single (huge) tree. For example: $x'_1$: (Age = 18, sex = M, ...), $x'_2$ = (Age = 18, sex = F, ...), ... could be regrouped to create a leaf. This works also for every ensemble methods based on aggregation of trees.
Obtaining knowledge from a random forest Late answer related to my question here (Can we make Random Forest 100% interpretable by fixing the seed?): Let $z_1$ be the seed in the creation of boostrapped training set, and $z_2 $ be the seed
26,939
Neg Binomial and the Jeffreys' Prior
The problem arises because the negative binomial distribution can be formulated differently. As a consequence, the expectation differs for different formulations. The way you have specified the negative binomial distribution, the expectation of $n$ is $E(n) = m/\theta$ (e.g. see here on page 3). With that, the Fisher information simplifies to $$I(\theta) = m\left(\frac{1}{\theta^2(1-\theta)}\right)$$ Thus the Jeffreys' prior is $$ \pi_{J}(\theta) = |I(\theta)|^{1/2}\propto \theta^{-1}(1-\theta)^{-1/2} $$ as you already noted.
Neg Binomial and the Jeffreys' Prior
The problem arises because the negative binomial distribution can be formulated differently. As a consequence, the expectation differs for different formulations. The way you have specified the negati
Neg Binomial and the Jeffreys' Prior The problem arises because the negative binomial distribution can be formulated differently. As a consequence, the expectation differs for different formulations. The way you have specified the negative binomial distribution, the expectation of $n$ is $E(n) = m/\theta$ (e.g. see here on page 3). With that, the Fisher information simplifies to $$I(\theta) = m\left(\frac{1}{\theta^2(1-\theta)}\right)$$ Thus the Jeffreys' prior is $$ \pi_{J}(\theta) = |I(\theta)|^{1/2}\propto \theta^{-1}(1-\theta)^{-1/2} $$ as you already noted.
Neg Binomial and the Jeffreys' Prior The problem arises because the negative binomial distribution can be formulated differently. As a consequence, the expectation differs for different formulations. The way you have specified the negati
26,940
Variance of a bounded random variable
You can prove Popoviciu's inequality as follows. Use the notation $m=\inf X$ and $M=\sup X$. Define a function $g$ by $$ g(t)=\mathbb{E}\!\left[\left(X-t\right)^2\right] \, . $$ Computing the derivative $g'$, and solving $$ g'(t) = -2\mathbb{E}[X] +2t=0 \, , $$ we find that $g$ achieves its minimum at $t=\mathbb{E}[X]$ (note that $g''>0$). Now, consider the value of the function $g$ at the special point $t=\frac{M+m}{2}$. It must be the case that $$ \mathbb{Var}[X]=g(\mathbb{E}[X])\leq g\left(\frac{M+m}{2}\right) \, . $$ But $$ g\left(\frac{M+m}{2}\right) = \mathbb{E}\!\left[\left(X - \frac{M+m}{2}\right)^2 \right] = \frac{1}{4}\mathbb{E}\!\left[\left((X-m) + (X-M)\right)^2 \right] \, . $$ Since $X-m\geq 0$ and $X-M\leq 0$, we have $$ \left((X-m)+(X-M)\right)^2\leq\left((X-m)-(X-M)\right)^2=\left(M-m\right)^2 \, , $$ implying that $$ \frac{1}{4}\mathbb{E}\!\left[\left((X-m) + (X-M)\right)^2 \right] \leq \frac{1}{4}\mathbb{E}\!\left[\left((X-m) - (X-M)\right)^2 \right] = \frac{(M-m)^2}{4} \, . $$ Therefore, we proved Popoviciu's inequality $$ \mathbb{Var}[X]\leq \frac{(M-m)^2}{4} \, . $$
Variance of a bounded random variable
You can prove Popoviciu's inequality as follows. Use the notation $m=\inf X$ and $M=\sup X$. Define a function $g$ by $$ g(t)=\mathbb{E}\!\left[\left(X-t\right)^2\right] \, . $$ Computing the deriva
Variance of a bounded random variable You can prove Popoviciu's inequality as follows. Use the notation $m=\inf X$ and $M=\sup X$. Define a function $g$ by $$ g(t)=\mathbb{E}\!\left[\left(X-t\right)^2\right] \, . $$ Computing the derivative $g'$, and solving $$ g'(t) = -2\mathbb{E}[X] +2t=0 \, , $$ we find that $g$ achieves its minimum at $t=\mathbb{E}[X]$ (note that $g''>0$). Now, consider the value of the function $g$ at the special point $t=\frac{M+m}{2}$. It must be the case that $$ \mathbb{Var}[X]=g(\mathbb{E}[X])\leq g\left(\frac{M+m}{2}\right) \, . $$ But $$ g\left(\frac{M+m}{2}\right) = \mathbb{E}\!\left[\left(X - \frac{M+m}{2}\right)^2 \right] = \frac{1}{4}\mathbb{E}\!\left[\left((X-m) + (X-M)\right)^2 \right] \, . $$ Since $X-m\geq 0$ and $X-M\leq 0$, we have $$ \left((X-m)+(X-M)\right)^2\leq\left((X-m)-(X-M)\right)^2=\left(M-m\right)^2 \, , $$ implying that $$ \frac{1}{4}\mathbb{E}\!\left[\left((X-m) + (X-M)\right)^2 \right] \leq \frac{1}{4}\mathbb{E}\!\left[\left((X-m) - (X-M)\right)^2 \right] = \frac{(M-m)^2}{4} \, . $$ Therefore, we proved Popoviciu's inequality $$ \mathbb{Var}[X]\leq \frac{(M-m)^2}{4} \, . $$
Variance of a bounded random variable You can prove Popoviciu's inequality as follows. Use the notation $m=\inf X$ and $M=\sup X$. Define a function $g$ by $$ g(t)=\mathbb{E}\!\left[\left(X-t\right)^2\right] \, . $$ Computing the deriva
26,941
Variance of a bounded random variable
If the random variable is restricted to $[a,b]$ and we know the mean $\mu=E[X]$, the variance is bounded by $(b-\mu)(\mu-a)$. Let us first consider the case $a=0, b=1$. Note that for all $x\in [0,1]$, $x^2\leq x$, wherefore also $E[X^2]\leq E[X]$. Using this result, \begin{equation} \sigma^2 = E[X^2] - (E[X]^2) = E[X^2] - \mu^2 \leq \mu - \mu^2 = \mu(1-\mu). \end{equation} To generalize to intervals $[a,b]$ with $b>a$, consider $Y$ restricted to $[a,b]$. Define $X=\frac{Y-a}{b-a}$, which is restricted in $[0,1]$. Equivalently, $Y = (b-a)X + a$, and thus \begin{equation} Var[Y] = (b-a)^2Var[X] \leq (b-a)^2\mu_X (1-\mu_X). \end{equation} where the inequality is based on the first result. Now, by substituting $\mu_X = \frac{\mu_Y - a}{b-a}$, the bound equals \begin{equation} (b-a)^2\, \frac{\mu_Y - a}{b-a}\,\left(1- \frac{\mu_Y - a}{b-a}\right) = (b-a)^2 \frac{\mu_Y -a}{b-a}\,\frac{b - \mu_Y}{b-a} = (\mu_Y - a)(b- \mu_Y), \end{equation} which is the desired result.
Variance of a bounded random variable
If the random variable is restricted to $[a,b]$ and we know the mean $\mu=E[X]$, the variance is bounded by $(b-\mu)(\mu-a)$. Let us first consider the case $a=0, b=1$. Note that for all $x\in [0,1]$,
Variance of a bounded random variable If the random variable is restricted to $[a,b]$ and we know the mean $\mu=E[X]$, the variance is bounded by $(b-\mu)(\mu-a)$. Let us first consider the case $a=0, b=1$. Note that for all $x\in [0,1]$, $x^2\leq x$, wherefore also $E[X^2]\leq E[X]$. Using this result, \begin{equation} \sigma^2 = E[X^2] - (E[X]^2) = E[X^2] - \mu^2 \leq \mu - \mu^2 = \mu(1-\mu). \end{equation} To generalize to intervals $[a,b]$ with $b>a$, consider $Y$ restricted to $[a,b]$. Define $X=\frac{Y-a}{b-a}$, which is restricted in $[0,1]$. Equivalently, $Y = (b-a)X + a$, and thus \begin{equation} Var[Y] = (b-a)^2Var[X] \leq (b-a)^2\mu_X (1-\mu_X). \end{equation} where the inequality is based on the first result. Now, by substituting $\mu_X = \frac{\mu_Y - a}{b-a}$, the bound equals \begin{equation} (b-a)^2\, \frac{\mu_Y - a}{b-a}\,\left(1- \frac{\mu_Y - a}{b-a}\right) = (b-a)^2 \frac{\mu_Y -a}{b-a}\,\frac{b - \mu_Y}{b-a} = (\mu_Y - a)(b- \mu_Y), \end{equation} which is the desired result.
Variance of a bounded random variable If the random variable is restricted to $[a,b]$ and we know the mean $\mu=E[X]$, the variance is bounded by $(b-\mu)(\mu-a)$. Let us first consider the case $a=0, b=1$. Note that for all $x\in [0,1]$,
26,942
Variance of a bounded random variable
Let $F$ be a distribution on $[0,1]$. We will show that if the variance of $F$ is maximal, then $F$ can have no support in the interior, from which it follows that $F$ is Bernoulli and the rest is trivial. As a matter of notation, let $\mu_k = \int_0^1 x^k dF(x)$ be the $k$th raw moment of $F$ (and, as usual, we write $\mu = \mu_1$ and $\sigma^2 = \mu_2 - \mu^2$ for the variance). We know $F$ does not have all its support at one point (the variance is minimal in that case). Among other things, this implies $\mu$ lies strictly between $0$ and $1$. In order to argue by contradiction, suppose there is some measurable subset $I$ in the interior $(0,1)$ for which $F(I)\gt 0$. Without any loss of generality we may assume (by changing $X$ to $1-X$ if need be) that $F(J = I \cap (0, \mu]) \gt 0$: in other words, $J$ is obtained by cutting off any part of $I$ above the mean and $J$ has positive probability. Let us alter $F$ to $F'$ by taking all the probability out of $J$ and placing it at $0$. In so doing, $\mu_k$ changes to $$\mu'_k = \mu_k - \int_J x^k dF(x).$$ As a matter of notation, let us write $[g(x)] = \int_J g(x) dF(x)$ for such integrals, whence $$\mu'_2 = \mu_2 - [x^2], \quad \mu' = \mu - [x].$$ Calculate $$\sigma'^2 = \mu'_2 - \mu'^2 = \mu_2 - [x^2] - (\mu - [x])^2 = \sigma^2 + \left((\mu[x] - [x^2]) + (\mu[x] - [x]^2)\right).$$ The second term on the right, $(\mu[x] - [x]^2)$, is non-negative because $\mu \ge x$ everywhere on $J$. The first term on the right can be rewritten $$\mu[x] - [x^2] = \mu(1 - [1]) + ([\mu][x] - [x^2]).$$ The first term on the right is strictly positive because (a) $\mu \gt 0$ and (b) $[1] = F(J) \lt 1$ because we assumed $F$ is not concentrated at a point. The second term is non-negative because it can be rewritten as $[(\mu-x)(x)]$ and this integrand is nonnegative from the assumptions $\mu \ge x$ on $J$ and $0 \le x \le 1$. It follows that $\sigma'^2 - \sigma^2 \gt 0$. We have just shown that under our assumptions, changing $F$ to $F'$ strictly increases its variance. The only way this cannot happen, then, is when all the probability of $F'$ is concentrated at the endpoints $0$ and $1$, with (say) values $1-p$ and $p$, respectively. Its variance is easily calculated to equal $p(1-p)$ which is maximal when $p=1/2$ and equals $1/4$ there. Now when $F$ is a distribution on $[a,b]$, we recenter and rescale it to a distribution on $[0,1]$. The recentering does not change the variance whereas the rescaling divides it by $(b-a)^2$. Thus an $F$ with maximal variance on $[a,b]$ corresponds to the distribution with maximal variance on $[0,1]$: it therefore is a Bernoulli$(1/2)$ distribution rescaled and translated to $[a,b]$ having variance $(b-a)^2/4$, QED.
Variance of a bounded random variable
Let $F$ be a distribution on $[0,1]$. We will show that if the variance of $F$ is maximal, then $F$ can have no support in the interior, from which it follows that $F$ is Bernoulli and the rest is tr
Variance of a bounded random variable Let $F$ be a distribution on $[0,1]$. We will show that if the variance of $F$ is maximal, then $F$ can have no support in the interior, from which it follows that $F$ is Bernoulli and the rest is trivial. As a matter of notation, let $\mu_k = \int_0^1 x^k dF(x)$ be the $k$th raw moment of $F$ (and, as usual, we write $\mu = \mu_1$ and $\sigma^2 = \mu_2 - \mu^2$ for the variance). We know $F$ does not have all its support at one point (the variance is minimal in that case). Among other things, this implies $\mu$ lies strictly between $0$ and $1$. In order to argue by contradiction, suppose there is some measurable subset $I$ in the interior $(0,1)$ for which $F(I)\gt 0$. Without any loss of generality we may assume (by changing $X$ to $1-X$ if need be) that $F(J = I \cap (0, \mu]) \gt 0$: in other words, $J$ is obtained by cutting off any part of $I$ above the mean and $J$ has positive probability. Let us alter $F$ to $F'$ by taking all the probability out of $J$ and placing it at $0$. In so doing, $\mu_k$ changes to $$\mu'_k = \mu_k - \int_J x^k dF(x).$$ As a matter of notation, let us write $[g(x)] = \int_J g(x) dF(x)$ for such integrals, whence $$\mu'_2 = \mu_2 - [x^2], \quad \mu' = \mu - [x].$$ Calculate $$\sigma'^2 = \mu'_2 - \mu'^2 = \mu_2 - [x^2] - (\mu - [x])^2 = \sigma^2 + \left((\mu[x] - [x^2]) + (\mu[x] - [x]^2)\right).$$ The second term on the right, $(\mu[x] - [x]^2)$, is non-negative because $\mu \ge x$ everywhere on $J$. The first term on the right can be rewritten $$\mu[x] - [x^2] = \mu(1 - [1]) + ([\mu][x] - [x^2]).$$ The first term on the right is strictly positive because (a) $\mu \gt 0$ and (b) $[1] = F(J) \lt 1$ because we assumed $F$ is not concentrated at a point. The second term is non-negative because it can be rewritten as $[(\mu-x)(x)]$ and this integrand is nonnegative from the assumptions $\mu \ge x$ on $J$ and $0 \le x \le 1$. It follows that $\sigma'^2 - \sigma^2 \gt 0$. We have just shown that under our assumptions, changing $F$ to $F'$ strictly increases its variance. The only way this cannot happen, then, is when all the probability of $F'$ is concentrated at the endpoints $0$ and $1$, with (say) values $1-p$ and $p$, respectively. Its variance is easily calculated to equal $p(1-p)$ which is maximal when $p=1/2$ and equals $1/4$ there. Now when $F$ is a distribution on $[a,b]$, we recenter and rescale it to a distribution on $[0,1]$. The recentering does not change the variance whereas the rescaling divides it by $(b-a)^2$. Thus an $F$ with maximal variance on $[a,b]$ corresponds to the distribution with maximal variance on $[0,1]$: it therefore is a Bernoulli$(1/2)$ distribution rescaled and translated to $[a,b]$ having variance $(b-a)^2/4$, QED.
Variance of a bounded random variable Let $F$ be a distribution on $[0,1]$. We will show that if the variance of $F$ is maximal, then $F$ can have no support in the interior, from which it follows that $F$ is Bernoulli and the rest is tr
26,943
Variance of a bounded random variable
At @user603's request.... A useful upper bound on the variance $\sigma^2$ of a random variable that takes on values in $[a,b]$ with probability $1$ is $\sigma^2 \leq \frac{(b−a)^2}{4}$. A proof for the special case $a=0, b=1$ (which is what the OP asked about) can be found here on math.SE, and it is easily adapted to the more general case. As noted in my comment above and also in the answer referenced herein, a discrete random variable that takes on values $a$ and $b$ with equal probability $\frac{1}{2}$ has variance $\frac{(b−a)^2}{4}$ and thus no tighter general bound can be found. Another point to keep in mind is that a bounded random variable has finite variance, whereas for an unbounded random variable, the variance might not be finite, and in some cases might not even be definable. For example, the mean cannot be defined for Cauchy random variables, and so one cannot define the variance (as the expectation of the squared deviation from the mean).
Variance of a bounded random variable
At @user603's request.... A useful upper bound on the variance $\sigma^2$ of a random variable that takes on values in $[a,b]$ with probability $1$ is $\sigma^2 \leq \frac{(b−a)^2}{4}$. A proof for th
Variance of a bounded random variable At @user603's request.... A useful upper bound on the variance $\sigma^2$ of a random variable that takes on values in $[a,b]$ with probability $1$ is $\sigma^2 \leq \frac{(b−a)^2}{4}$. A proof for the special case $a=0, b=1$ (which is what the OP asked about) can be found here on math.SE, and it is easily adapted to the more general case. As noted in my comment above and also in the answer referenced herein, a discrete random variable that takes on values $a$ and $b$ with equal probability $\frac{1}{2}$ has variance $\frac{(b−a)^2}{4}$ and thus no tighter general bound can be found. Another point to keep in mind is that a bounded random variable has finite variance, whereas for an unbounded random variable, the variance might not be finite, and in some cases might not even be definable. For example, the mean cannot be defined for Cauchy random variables, and so one cannot define the variance (as the expectation of the squared deviation from the mean).
Variance of a bounded random variable At @user603's request.... A useful upper bound on the variance $\sigma^2$ of a random variable that takes on values in $[a,b]$ with probability $1$ is $\sigma^2 \leq \frac{(b−a)^2}{4}$. A proof for th
26,944
Variance of a bounded random variable
Here's a really simple proof I found in Sheldon Ross's A first course in probability 10th ed., "theory problem 5.8". Suppose we have a random variable $X$ between $0$ and $c$. Then $X \leq c$ and thus $E(X^2) \leq c E(X)$. We thus have $$\mathrm{Var}(X) \leq c E(X) - E(X)^2 = c^2 \alpha (1 - \alpha) \leq c^2 / 4$$ where $\alpha \equiv E(X) / c$ and the final step follows from straightforward differentiation to see that $\alpha (1 - \alpha)$ is minimized at $\alpha = 1/2$.
Variance of a bounded random variable
Here's a really simple proof I found in Sheldon Ross's A first course in probability 10th ed., "theory problem 5.8". Suppose we have a random variable $X$ between $0$ and $c$. Then $X \leq c$ and thus
Variance of a bounded random variable Here's a really simple proof I found in Sheldon Ross's A first course in probability 10th ed., "theory problem 5.8". Suppose we have a random variable $X$ between $0$ and $c$. Then $X \leq c$ and thus $E(X^2) \leq c E(X)$. We thus have $$\mathrm{Var}(X) \leq c E(X) - E(X)^2 = c^2 \alpha (1 - \alpha) \leq c^2 / 4$$ where $\alpha \equiv E(X) / c$ and the final step follows from straightforward differentiation to see that $\alpha (1 - \alpha)$ is minimized at $\alpha = 1/2$.
Variance of a bounded random variable Here's a really simple proof I found in Sheldon Ross's A first course in probability 10th ed., "theory problem 5.8". Suppose we have a random variable $X$ between $0$ and $c$. Then $X \leq c$ and thus
26,945
Variance of a bounded random variable
Given random variable $D$ with mean $E D=\mu$, when $a\le D\le b$, we have \begin{eqnarray*} E (D-\mu)^2&\le& E[(D-\mu)^2-(D-a)(D-b)]\\ &=& E[\mu^2-2\mu D+(a+b)D-ab]\\ &=& (a+b)\mu-\mu^2-ab\\ &=&(\mu-a)(b-\mu), \end{eqnarray*} where the equation holds if and only if $D\in\{a,b\}$ with probability $1$. Moreover, if $\mu$ can be arbitrary in the support set $[a,b]$, then clearly $$E(D-\mu)^2\le \left(\tfrac{a+b}{2}-a\right)\left(\tfrac{a+b}{2}-b\right)=\left(\tfrac{b-a}{2}\right)^2.$$
Variance of a bounded random variable
Given random variable $D$ with mean $E D=\mu$, when $a\le D\le b$, we have \begin{eqnarray*} E (D-\mu)^2&\le& E[(D-\mu)^2-(D-a)(D-b)]\\ &=& E[\mu^2-2\mu D+(a+b)D-ab]\\ &=& (a+b)\mu-\mu^2-ab\\ &=&(\mu-
Variance of a bounded random variable Given random variable $D$ with mean $E D=\mu$, when $a\le D\le b$, we have \begin{eqnarray*} E (D-\mu)^2&\le& E[(D-\mu)^2-(D-a)(D-b)]\\ &=& E[\mu^2-2\mu D+(a+b)D-ab]\\ &=& (a+b)\mu-\mu^2-ab\\ &=&(\mu-a)(b-\mu), \end{eqnarray*} where the equation holds if and only if $D\in\{a,b\}$ with probability $1$. Moreover, if $\mu$ can be arbitrary in the support set $[a,b]$, then clearly $$E(D-\mu)^2\le \left(\tfrac{a+b}{2}-a\right)\left(\tfrac{a+b}{2}-b\right)=\left(\tfrac{b-a}{2}\right)^2.$$
Variance of a bounded random variable Given random variable $D$ with mean $E D=\mu$, when $a\le D\le b$, we have \begin{eqnarray*} E (D-\mu)^2&\le& E[(D-\mu)^2-(D-a)(D-b)]\\ &=& E[\mu^2-2\mu D+(a+b)D-ab]\\ &=& (a+b)\mu-\mu^2-ab\\ &=&(\mu-
26,946
Variance of a bounded random variable
are you sure that this is true in general - for continuous as well as discrete distributions? Can you provide a link to the other pages? For a general distibution on $[a,b]$ it is trivial to show that $$ Var(X) = E[(X-E[X])^2] \le E[(b-a)^2] = (b-a)^2. $$ I can imagine that sharper inequalities exist ... Do you need the factor $1/4$ for your result? On the other hand one can find it with the factor $1/4$ under the name Popoviciu's_inequality on wikipedia. This article looks better than the wikipedia article ... For a uniform distribution it holds that $$ Var(X) = \frac{(b-a)^2}{12}. $$
Variance of a bounded random variable
are you sure that this is true in general - for continuous as well as discrete distributions? Can you provide a link to the other pages? For a general distibution on $[a,b]$ it is trivial to show that
Variance of a bounded random variable are you sure that this is true in general - for continuous as well as discrete distributions? Can you provide a link to the other pages? For a general distibution on $[a,b]$ it is trivial to show that $$ Var(X) = E[(X-E[X])^2] \le E[(b-a)^2] = (b-a)^2. $$ I can imagine that sharper inequalities exist ... Do you need the factor $1/4$ for your result? On the other hand one can find it with the factor $1/4$ under the name Popoviciu's_inequality on wikipedia. This article looks better than the wikipedia article ... For a uniform distribution it holds that $$ Var(X) = \frac{(b-a)^2}{12}. $$
Variance of a bounded random variable are you sure that this is true in general - for continuous as well as discrete distributions? Can you provide a link to the other pages? For a general distibution on $[a,b]$ it is trivial to show that
26,947
Variance of a bounded random variable
The key elements here are that $f(x) = x^2$ is convex, $EX$ minimises $E(X-t)^2$ and $X(\omega) \in [a,b]$. Let $x \in [a,b]$, then $f(x-{1 \over 2}(a+b)) \le {1 \over 2} (f({x-a \over 2}) + f({x-b \over 2}))$, or $(x-{1 \over 2}(a+b))^2 \le {1 \over 2} (({x-a \over 2})^2 + ({x-b \over 2})^2 ) \le ({b-a \over 2})^2$. Since $E(X-t)^2 = E(X-EX + EX-t)^2 = \operatorname{var} X + (EX-t)^2$ for any $t$, setting $t={1 \over 2}(a+b)$ shows that $ \operatorname{var} X \le E(X-{1 \over 2}(a+b))^2 \le ({b-a \over 2})^2$.
Variance of a bounded random variable
The key elements here are that $f(x) = x^2$ is convex, $EX$ minimises $E(X-t)^2$ and $X(\omega) \in [a,b]$. Let $x \in [a,b]$, then $f(x-{1 \over 2}(a+b)) \le {1 \over 2} (f({x-a \over 2}) + f({x-b \o
Variance of a bounded random variable The key elements here are that $f(x) = x^2$ is convex, $EX$ minimises $E(X-t)^2$ and $X(\omega) \in [a,b]$. Let $x \in [a,b]$, then $f(x-{1 \over 2}(a+b)) \le {1 \over 2} (f({x-a \over 2}) + f({x-b \over 2}))$, or $(x-{1 \over 2}(a+b))^2 \le {1 \over 2} (({x-a \over 2})^2 + ({x-b \over 2})^2 ) \le ({b-a \over 2})^2$. Since $E(X-t)^2 = E(X-EX + EX-t)^2 = \operatorname{var} X + (EX-t)^2$ for any $t$, setting $t={1 \over 2}(a+b)$ shows that $ \operatorname{var} X \le E(X-{1 \over 2}(a+b))^2 \le ({b-a \over 2})^2$.
Variance of a bounded random variable The key elements here are that $f(x) = x^2$ is convex, $EX$ minimises $E(X-t)^2$ and $X(\omega) \in [a,b]$. Let $x \in [a,b]$, then $f(x-{1 \over 2}(a+b)) \le {1 \over 2} (f({x-a \over 2}) + f({x-b \o
26,948
Variance of a bounded random variable
A simple proof of Popoviciu's inequality is the following, where $X\in [m, M]$: \begin{equation} \color{blue}{\operatorname{Var}[X] \le \operatorname{Var}[X] + \mathbb{E}[(M-X)(X-m)] = \frac{(M-m)^2}{4} - \left(\mathbb{E}[X] - \frac{M+m}{2}\right)^2 \le \frac{(M-m)^2}{4}.} \end{equation} Source: https://math.stackexchange.com/a/4264325/31498 (Check this answer out for a one-liner proof of Bhatia—Davis's inequality as well.)
Variance of a bounded random variable
A simple proof of Popoviciu's inequality is the following, where $X\in [m, M]$: \begin{equation} \color{blue}{\operatorname{Var}[X] \le \operatorname{Var}[X] + \mathbb{E}[(M-X)(X-m)] = \frac{(M-m)^2}{
Variance of a bounded random variable A simple proof of Popoviciu's inequality is the following, where $X\in [m, M]$: \begin{equation} \color{blue}{\operatorname{Var}[X] \le \operatorname{Var}[X] + \mathbb{E}[(M-X)(X-m)] = \frac{(M-m)^2}{4} - \left(\mathbb{E}[X] - \frac{M+m}{2}\right)^2 \le \frac{(M-m)^2}{4}.} \end{equation} Source: https://math.stackexchange.com/a/4264325/31498 (Check this answer out for a one-liner proof of Bhatia—Davis's inequality as well.)
Variance of a bounded random variable A simple proof of Popoviciu's inequality is the following, where $X\in [m, M]$: \begin{equation} \color{blue}{\operatorname{Var}[X] \le \operatorname{Var}[X] + \mathbb{E}[(M-X)(X-m)] = \frac{(M-m)^2}{
26,949
Why does including latitude and longitude in a GAM account for spatial autocorrelation?
The main issue in any statistical model is the assumptions that underlay any inference procedure. In the sort of model you describe, the residuals are assumed independent. If they have some spatial dependence and this is not modelled in the sytematic part of the model, the residuals from that model will also exhibit spatial dependence, or in other words they will be spatially autocorrelated. Such dependence would invalidate the theory that produces p-values from test statistics in the GAM for example; you can't trust the p-values because they were computed assuming independence. You have two main options for handling such data; i) model the spatial dependence in the systematic part of the model, or ii) relax the assumption of independence and estimate the correlation between residuals. i) is what is being attempted by including a smooth of the spatial locations in the model. ii) requires estimation of the correlation matrix of the residuals often during model fitting using a procedure like generalised least squares. How well either of these approaches deal with the spatial dependence will depend upon the nature & complexity of the spatial dependence and how easily it can be modelled. In summary, if you can model the spatial dependence between observations then the residuals are more likely to be independent random variables and therefore not violate the assumptions of any inferential procedure.
Why does including latitude and longitude in a GAM account for spatial autocorrelation?
The main issue in any statistical model is the assumptions that underlay any inference procedure. In the sort of model you describe, the residuals are assumed independent. If they have some spatial de
Why does including latitude and longitude in a GAM account for spatial autocorrelation? The main issue in any statistical model is the assumptions that underlay any inference procedure. In the sort of model you describe, the residuals are assumed independent. If they have some spatial dependence and this is not modelled in the sytematic part of the model, the residuals from that model will also exhibit spatial dependence, or in other words they will be spatially autocorrelated. Such dependence would invalidate the theory that produces p-values from test statistics in the GAM for example; you can't trust the p-values because they were computed assuming independence. You have two main options for handling such data; i) model the spatial dependence in the systematic part of the model, or ii) relax the assumption of independence and estimate the correlation between residuals. i) is what is being attempted by including a smooth of the spatial locations in the model. ii) requires estimation of the correlation matrix of the residuals often during model fitting using a procedure like generalised least squares. How well either of these approaches deal with the spatial dependence will depend upon the nature & complexity of the spatial dependence and how easily it can be modelled. In summary, if you can model the spatial dependence between observations then the residuals are more likely to be independent random variables and therefore not violate the assumptions of any inferential procedure.
Why does including latitude and longitude in a GAM account for spatial autocorrelation? The main issue in any statistical model is the assumptions that underlay any inference procedure. In the sort of model you describe, the residuals are assumed independent. If they have some spatial de
26,950
Why does including latitude and longitude in a GAM account for spatial autocorrelation?
"Spatial autocorrelation" means various things to various people. An overarching concept, though, is that a phenomenon observed at locations $\mathbf{z}$ may depend in some definite way on (a) covariates, (b) location, and (c) its values at nearby locations. (Where the technical definitions vary lie in the kind of data being considered, what "definite way" is postulated, and what "nearby" means: all of these have to be made quantitative in order to proceed.) To see what might be going on, let's consider a simple example of such a spatial model to describe the topography of a region. Let the measured elevation at a point $\mathbf{z}$ be $y(\mathbf{z})$. One possible model is that $y$ depends in some definite mathematical way on the coordinates of $\mathbf{z}$, which I will write $(z_1,z_2)$ in this two-dimensional situation. Letting $\varepsilon$ represent (hypothetically independent) deviations between the observations and the model (which as usual are assumed to have zero expectation), we may write $$y(\mathbf{z}) = \beta_0 + \beta_1 z_1 + \beta_2 z_2 + \varepsilon(\mathbf{z})$$ for a linear trend model. The linear trend (represented by the $\beta_1$ and $\beta_2$ coefficients) is one way to capture the idea that nearby values $y(\mathbf{z})$ and $y(\mathbf{z}')$, for $\mathbf{z}$ close to $\mathbf{z}'$, should tend to be close to one another. We can even calculate this by considering the expected value of the size of the difference between $y(\mathbf{z})$ and $y(\mathbf{z}')$, $E[|y(\mathbf{z}) - y(\mathbf{z}')|]$. It turns out the mathematics is much simpler if we use a slightly different measure of difference: instead, we compute the expected squared difference: $$\eqalign{ E[\left(y(\mathbf{z}) - y(\mathbf{z}')\right)^2] &= E[\left(\beta_0 + \beta_1 z_1 + \beta_2 z_2 + \varepsilon(\mathbf{z}) - \left(\beta_0 + \beta_1 z_1' + \beta_2 z_2' + \varepsilon(\mathbf{z}')\right)\right)^2] \\ &=E[\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)' + \varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)^2] \\ &=E[\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)^2 \\ &\quad+ 2\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)\left(\varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)\\ &\quad+ \left(\varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)^2] \\ &=\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)^2 + E[\left(\varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)^2] }$$ This model is free of any explicit spatial autocorrelation, because there is no term in it directly relating $y(\mathbf{z})$ to nearby values $y(\mathbf{z}')$. An alternative, different, model ignores the linear trend and supposes only that there is autocorrelation. One way to do that is through the structure of the deviations $\varepsilon(\mathbf{z})$. We might posit that $$y(\mathbf{z}) = \beta_0 + \varepsilon(\mathbf{z})$$ and, to account for our anticipation of correlation, we will assume some kind of "covariance structure" for the $\varepsilon$. For this to be spatially meaningful, we will assume the covariance between $\varepsilon(\mathbf{z})$ and $\varepsilon(\mathbf{z}')$, equal to $E[\varepsilon(\mathbf{z})\varepsilon(\mathbf{z}')]$ because the $\varepsilon$ have zero means, tends to decrease as $\mathbf{z}$ and $\mathbf{z}'$ become more and more distant. Because the details do not matter, let's just call this covariance $C(\mathbf{z}, \mathbf{z}')$. This is spatial autocorrelation. Indeed, the (usual Pearson) correlation between $y(\mathbf{z})$ and $y(\mathbf{z}')$ is $$\rho(y(\mathbf{z}), y(\mathbf{z}')) = \frac{C(\mathbf{z}, \mathbf{z}')}{\sqrt{C(\mathbf{z}, \mathbf{z})C(\mathbf{z}', \mathbf{z}')}}.$$ In this notation, the previous expected squared difference of $y$'s for the first model is $$\eqalign{ E[\left(y(\mathbf{z}) - y(\mathbf{z}')\right)^2] &= \left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)^2 + E[\left(\varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)^2] \\ &=\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)^2 + C_1(\mathbf{z}, \mathbf{z}) + C_1(\mathbf{z}', \mathbf{z}') }$$ (assuming $\mathbf{z} \ne \mathbf{z}'$) because the $\varepsilon$ at different locations have been assumed to be independent. I have written $C_1$ instead of $C$ to indicate this is the covariance function for the first model. When the covariances of the $\varepsilon$ do not vary dramatically from one location to another (indeed, they are usually assumed to be constant), this equation shows that the expected squared difference in $y$'s increases quadratically with the separation between $\mathbf{z}$ and $\mathbf{z}'$. The actual amount of increase is determined by the trend coefficients $\beta_0$ and $\beta_1$. Let's see what the expected squared differences in the $y$'s is for the new model, model 2: $$\eqalign{ E[\left(y(\mathbf{z}) - y(\mathbf{z}')\right)^2] &= E[\left(\beta_0 + \varepsilon(\mathbf{z}) - \left(\beta_0 + \varepsilon(\mathbf{z}')\right)\right)^2] \\ &=E[\left(\varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)^2] \\ &=E[\varepsilon(\mathbf{z})^2 - 2 \varepsilon(\mathbf{z})\varepsilon(\mathbf{z}') + \varepsilon(\mathbf{z}')^2] \\ &=C_2(\mathbf{z}, \mathbf{z}) - 2C_2(\mathbf{z}, \mathbf{z}') + C_2(\mathbf{z}', \mathbf{z}'). }$$ Again this behaves in the right way: because we figured $C_2(\mathbf{z}, \mathbf{z}')$ should decrease as $\mathbf{z}$ and $\mathbf{z}'$ become more separated, the expected squared difference in $y$'s indeed goes up with increasing separation of the locations. Comparing the two expressions for $E[\left(y(\mathbf{z}) - y(\mathbf{z}')\right)^2]$ in the two models shows us that $\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)^2$ in the first model is playing a role mathematically identical to $-2C_2(\mathbf{z}, \mathbf{z}')$ in the second model. (There's an additive constant lurking there, buried in the different meanings of the $C_i(\mathbf{z}, \mathbf{z})$, but it doesn't matter in this analysis.) Ergo, depending on the model, spatial correlation is typically represented as some combination of a trend and a stipulated correlation structure on random errors. We now have, I hope, a clear answer to the question: one can represent the idea behind Tobler's Law of Geography ("everything is related to everything else, but nearer things are more related") in different ways. In some models, Tobler's Law is adequately represented by including trends (or "drift" terms) that are functions of spatial coordinates like longitude and latitude. In others, Tobler's Law is captured by means of a nontrivial covariance structure among additive random terms (the $\varepsilon$). In practice, models incorporate both methods. Which one you choose depends on what you want to accomplish with the model and on your view of how spatial autocorrelation arises--whether it is implied by underlying trends or reflects variations you wish to consider random. Neither one is always right and, in any given problem, it's often possible to use both kinds of models to analyze the data, understand the phenomenon, and predict its values at other locations (interpolation).
Why does including latitude and longitude in a GAM account for spatial autocorrelation?
"Spatial autocorrelation" means various things to various people. An overarching concept, though, is that a phenomenon observed at locations $\mathbf{z}$ may depend in some definite way on (a) covaria
Why does including latitude and longitude in a GAM account for spatial autocorrelation? "Spatial autocorrelation" means various things to various people. An overarching concept, though, is that a phenomenon observed at locations $\mathbf{z}$ may depend in some definite way on (a) covariates, (b) location, and (c) its values at nearby locations. (Where the technical definitions vary lie in the kind of data being considered, what "definite way" is postulated, and what "nearby" means: all of these have to be made quantitative in order to proceed.) To see what might be going on, let's consider a simple example of such a spatial model to describe the topography of a region. Let the measured elevation at a point $\mathbf{z}$ be $y(\mathbf{z})$. One possible model is that $y$ depends in some definite mathematical way on the coordinates of $\mathbf{z}$, which I will write $(z_1,z_2)$ in this two-dimensional situation. Letting $\varepsilon$ represent (hypothetically independent) deviations between the observations and the model (which as usual are assumed to have zero expectation), we may write $$y(\mathbf{z}) = \beta_0 + \beta_1 z_1 + \beta_2 z_2 + \varepsilon(\mathbf{z})$$ for a linear trend model. The linear trend (represented by the $\beta_1$ and $\beta_2$ coefficients) is one way to capture the idea that nearby values $y(\mathbf{z})$ and $y(\mathbf{z}')$, for $\mathbf{z}$ close to $\mathbf{z}'$, should tend to be close to one another. We can even calculate this by considering the expected value of the size of the difference between $y(\mathbf{z})$ and $y(\mathbf{z}')$, $E[|y(\mathbf{z}) - y(\mathbf{z}')|]$. It turns out the mathematics is much simpler if we use a slightly different measure of difference: instead, we compute the expected squared difference: $$\eqalign{ E[\left(y(\mathbf{z}) - y(\mathbf{z}')\right)^2] &= E[\left(\beta_0 + \beta_1 z_1 + \beta_2 z_2 + \varepsilon(\mathbf{z}) - \left(\beta_0 + \beta_1 z_1' + \beta_2 z_2' + \varepsilon(\mathbf{z}')\right)\right)^2] \\ &=E[\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)' + \varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)^2] \\ &=E[\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)^2 \\ &\quad+ 2\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)\left(\varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)\\ &\quad+ \left(\varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)^2] \\ &=\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)^2 + E[\left(\varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)^2] }$$ This model is free of any explicit spatial autocorrelation, because there is no term in it directly relating $y(\mathbf{z})$ to nearby values $y(\mathbf{z}')$. An alternative, different, model ignores the linear trend and supposes only that there is autocorrelation. One way to do that is through the structure of the deviations $\varepsilon(\mathbf{z})$. We might posit that $$y(\mathbf{z}) = \beta_0 + \varepsilon(\mathbf{z})$$ and, to account for our anticipation of correlation, we will assume some kind of "covariance structure" for the $\varepsilon$. For this to be spatially meaningful, we will assume the covariance between $\varepsilon(\mathbf{z})$ and $\varepsilon(\mathbf{z}')$, equal to $E[\varepsilon(\mathbf{z})\varepsilon(\mathbf{z}')]$ because the $\varepsilon$ have zero means, tends to decrease as $\mathbf{z}$ and $\mathbf{z}'$ become more and more distant. Because the details do not matter, let's just call this covariance $C(\mathbf{z}, \mathbf{z}')$. This is spatial autocorrelation. Indeed, the (usual Pearson) correlation between $y(\mathbf{z})$ and $y(\mathbf{z}')$ is $$\rho(y(\mathbf{z}), y(\mathbf{z}')) = \frac{C(\mathbf{z}, \mathbf{z}')}{\sqrt{C(\mathbf{z}, \mathbf{z})C(\mathbf{z}', \mathbf{z}')}}.$$ In this notation, the previous expected squared difference of $y$'s for the first model is $$\eqalign{ E[\left(y(\mathbf{z}) - y(\mathbf{z}')\right)^2] &= \left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)^2 + E[\left(\varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)^2] \\ &=\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)^2 + C_1(\mathbf{z}, \mathbf{z}) + C_1(\mathbf{z}', \mathbf{z}') }$$ (assuming $\mathbf{z} \ne \mathbf{z}'$) because the $\varepsilon$ at different locations have been assumed to be independent. I have written $C_1$ instead of $C$ to indicate this is the covariance function for the first model. When the covariances of the $\varepsilon$ do not vary dramatically from one location to another (indeed, they are usually assumed to be constant), this equation shows that the expected squared difference in $y$'s increases quadratically with the separation between $\mathbf{z}$ and $\mathbf{z}'$. The actual amount of increase is determined by the trend coefficients $\beta_0$ and $\beta_1$. Let's see what the expected squared differences in the $y$'s is for the new model, model 2: $$\eqalign{ E[\left(y(\mathbf{z}) - y(\mathbf{z}')\right)^2] &= E[\left(\beta_0 + \varepsilon(\mathbf{z}) - \left(\beta_0 + \varepsilon(\mathbf{z}')\right)\right)^2] \\ &=E[\left(\varepsilon(\mathbf{z}) - \varepsilon(\mathbf{z}')\right)^2] \\ &=E[\varepsilon(\mathbf{z})^2 - 2 \varepsilon(\mathbf{z})\varepsilon(\mathbf{z}') + \varepsilon(\mathbf{z}')^2] \\ &=C_2(\mathbf{z}, \mathbf{z}) - 2C_2(\mathbf{z}, \mathbf{z}') + C_2(\mathbf{z}', \mathbf{z}'). }$$ Again this behaves in the right way: because we figured $C_2(\mathbf{z}, \mathbf{z}')$ should decrease as $\mathbf{z}$ and $\mathbf{z}'$ become more separated, the expected squared difference in $y$'s indeed goes up with increasing separation of the locations. Comparing the two expressions for $E[\left(y(\mathbf{z}) - y(\mathbf{z}')\right)^2]$ in the two models shows us that $\left(\beta_1 (z_1-z_1') + \beta_2 (z_2-z_2)'\right)^2$ in the first model is playing a role mathematically identical to $-2C_2(\mathbf{z}, \mathbf{z}')$ in the second model. (There's an additive constant lurking there, buried in the different meanings of the $C_i(\mathbf{z}, \mathbf{z})$, but it doesn't matter in this analysis.) Ergo, depending on the model, spatial correlation is typically represented as some combination of a trend and a stipulated correlation structure on random errors. We now have, I hope, a clear answer to the question: one can represent the idea behind Tobler's Law of Geography ("everything is related to everything else, but nearer things are more related") in different ways. In some models, Tobler's Law is adequately represented by including trends (or "drift" terms) that are functions of spatial coordinates like longitude and latitude. In others, Tobler's Law is captured by means of a nontrivial covariance structure among additive random terms (the $\varepsilon$). In practice, models incorporate both methods. Which one you choose depends on what you want to accomplish with the model and on your view of how spatial autocorrelation arises--whether it is implied by underlying trends or reflects variations you wish to consider random. Neither one is always right and, in any given problem, it's often possible to use both kinds of models to analyze the data, understand the phenomenon, and predict its values at other locations (interpolation).
Why does including latitude and longitude in a GAM account for spatial autocorrelation? "Spatial autocorrelation" means various things to various people. An overarching concept, though, is that a phenomenon observed at locations $\mathbf{z}$ may depend in some definite way on (a) covaria
26,951
Why does including latitude and longitude in a GAM account for spatial autocorrelation?
The other answers are good I just wanted to add something about 'accounting for' spatial autocorrelation. Sometimes this claim is made more strongly along the lines of "accounting for spatial autocorrelation not explained by the covariates". This can present a misleading picture of what the spatial smooth does. It is not like there is some orderly queue in the likelihood where the smooth patiently waits for the covariates to go first and then smooth will mop up the 'unexplained' parts. In reality they all get a chance to explain the data. This paper with an aptly named title presents the issue really clearly, although it is from the point of view of a CAR model the principles apply to GAM smooths. Adding Spatially-Correlated Errors Can Mess Up the Fixed Effect You Love The 'solution' in the paper is to smooth the residuals instead of smoothing on space. That would have the effect of allowing your covariates to explain what they can. Of course, there are many applications in which this would not be a desireable solution.
Why does including latitude and longitude in a GAM account for spatial autocorrelation?
The other answers are good I just wanted to add something about 'accounting for' spatial autocorrelation. Sometimes this claim is made more strongly along the lines of "accounting for spatial autocor
Why does including latitude and longitude in a GAM account for spatial autocorrelation? The other answers are good I just wanted to add something about 'accounting for' spatial autocorrelation. Sometimes this claim is made more strongly along the lines of "accounting for spatial autocorrelation not explained by the covariates". This can present a misleading picture of what the spatial smooth does. It is not like there is some orderly queue in the likelihood where the smooth patiently waits for the covariates to go first and then smooth will mop up the 'unexplained' parts. In reality they all get a chance to explain the data. This paper with an aptly named title presents the issue really clearly, although it is from the point of view of a CAR model the principles apply to GAM smooths. Adding Spatially-Correlated Errors Can Mess Up the Fixed Effect You Love The 'solution' in the paper is to smooth the residuals instead of smoothing on space. That would have the effect of allowing your covariates to explain what they can. Of course, there are many applications in which this would not be a desireable solution.
Why does including latitude and longitude in a GAM account for spatial autocorrelation? The other answers are good I just wanted to add something about 'accounting for' spatial autocorrelation. Sometimes this claim is made more strongly along the lines of "accounting for spatial autocor
26,952
Why does including latitude and longitude in a GAM account for spatial autocorrelation?
Spatial correlation is simply how the x and y coordinates relate to the magnitude of the resulting surface in the space. So the autocorrelation between the coordinates can be expressed in terms of a functional relationship between the neighboring points.
Why does including latitude and longitude in a GAM account for spatial autocorrelation?
Spatial correlation is simply how the x and y coordinates relate to the magnitude of the resulting surface in the space. So the autocorrelation between the coordinates can be expressed in terms of a
Why does including latitude and longitude in a GAM account for spatial autocorrelation? Spatial correlation is simply how the x and y coordinates relate to the magnitude of the resulting surface in the space. So the autocorrelation between the coordinates can be expressed in terms of a functional relationship between the neighboring points.
Why does including latitude and longitude in a GAM account for spatial autocorrelation? Spatial correlation is simply how the x and y coordinates relate to the magnitude of the resulting surface in the space. So the autocorrelation between the coordinates can be expressed in terms of a
26,953
Distribution of standard deviation
A. van der Vaart gives derivation of assymptotic distribution of sample variance in his book as an example of delta method. It would be not that hard (and very instructive) to adapt the derivation for the case of standard deviation.
Distribution of standard deviation
A. van der Vaart gives derivation of assymptotic distribution of sample variance in his book as an example of delta method. It would be not that hard (and very instructive) to adapt the derivation for
Distribution of standard deviation A. van der Vaart gives derivation of assymptotic distribution of sample variance in his book as an example of delta method. It would be not that hard (and very instructive) to adapt the derivation for the case of standard deviation.
Distribution of standard deviation A. van der Vaart gives derivation of assymptotic distribution of sample variance in his book as an example of delta method. It would be not that hard (and very instructive) to adapt the derivation for
26,954
Distribution of standard deviation
If the distribution has a mean and standard deviation, then I'd say yes.
Distribution of standard deviation
If the distribution has a mean and standard deviation, then I'd say yes.
Distribution of standard deviation If the distribution has a mean and standard deviation, then I'd say yes.
Distribution of standard deviation If the distribution has a mean and standard deviation, then I'd say yes.
26,955
How to do factor analysis when the covariance matrix is not positive definite?
Let's define the correlation matrix by $C$. Since it is positive semi-definite, but not positive definite, its spectral decomposition looks something like $$C = Q D Q^{-1},$$ where the columns of $Q$ consist of orthonormal eigenvectors of $C$ and $$D = \begin{pmatrix}\lambda_1 & 0 & \cdots & \cdots &\cdots & \cdots& 0\\ 0 & \lambda_2 & \ddots & && &\vdots \\ \vdots & \ddots &\ddots & \ddots && &\vdots \\ \vdots & &\ddots &\lambda_n &\ddots &&\vdots \\ \vdots & & & \ddots &0 & \ddots& \vdots \\ \vdots & & & &\ddots & \ddots& 0\\ 0 & \cdots &\cdots & \cdots &\cdots & 0& 0\end{pmatrix}$$ is a diagonal matrix containing the eigenvalues corresponding to the eigenvectors in $Q$. Some of those are $0$. Moreover, $n$ is the rank of $C$. A simple way to restore positive definiteness is setting the $0$-eigenvalues to some value that is numerically non-zero, e.g. $$\lambda_{n+1}, \lambda_{n+2},... = 10^{-15}.$$ Hence, set $$\tilde{C} = Q \tilde{D} Q^{-1},$$ where $$\tilde{D} = \begin{pmatrix}\lambda_1 & 0 & \cdots & \cdots &\cdots & \cdots& 0\\ 0 & \lambda_2 & \ddots & && &\vdots \\ \vdots & \ddots &\ddots & \ddots && &\vdots \\ \vdots & &\ddots &\lambda_n &\ddots &&\vdots \\ \vdots & & & \ddots &10^{-15} & \ddots& \vdots \\ \vdots & & & &\ddots & \ddots& 0\\ 0 & \cdots &\cdots & \cdots &\cdots & 0& 10^{-15}\end{pmatrix}$$ Then, perform the factor analysis for $\tilde{C}. In Matlab, one can obtain $Q,D$ using the command: [Q,D] = eig(C) Constructing $\tilde{C}$ is then just simple Matrix manipulations. Remark: It would be hard to tell how this influences the factor analysis though; hence, one should probably be careful with this method. Moreover, even though this is a $C$ is a correlation matrix, $\tilde{C}$ may well be not. Hence, another normalisation of the entries might be necessary.
How to do factor analysis when the covariance matrix is not positive definite?
Let's define the correlation matrix by $C$. Since it is positive semi-definite, but not positive definite, its spectral decomposition looks something like $$C = Q D Q^{-1},$$ where the columns of $Q$
How to do factor analysis when the covariance matrix is not positive definite? Let's define the correlation matrix by $C$. Since it is positive semi-definite, but not positive definite, its spectral decomposition looks something like $$C = Q D Q^{-1},$$ where the columns of $Q$ consist of orthonormal eigenvectors of $C$ and $$D = \begin{pmatrix}\lambda_1 & 0 & \cdots & \cdots &\cdots & \cdots& 0\\ 0 & \lambda_2 & \ddots & && &\vdots \\ \vdots & \ddots &\ddots & \ddots && &\vdots \\ \vdots & &\ddots &\lambda_n &\ddots &&\vdots \\ \vdots & & & \ddots &0 & \ddots& \vdots \\ \vdots & & & &\ddots & \ddots& 0\\ 0 & \cdots &\cdots & \cdots &\cdots & 0& 0\end{pmatrix}$$ is a diagonal matrix containing the eigenvalues corresponding to the eigenvectors in $Q$. Some of those are $0$. Moreover, $n$ is the rank of $C$. A simple way to restore positive definiteness is setting the $0$-eigenvalues to some value that is numerically non-zero, e.g. $$\lambda_{n+1}, \lambda_{n+2},... = 10^{-15}.$$ Hence, set $$\tilde{C} = Q \tilde{D} Q^{-1},$$ where $$\tilde{D} = \begin{pmatrix}\lambda_1 & 0 & \cdots & \cdots &\cdots & \cdots& 0\\ 0 & \lambda_2 & \ddots & && &\vdots \\ \vdots & \ddots &\ddots & \ddots && &\vdots \\ \vdots & &\ddots &\lambda_n &\ddots &&\vdots \\ \vdots & & & \ddots &10^{-15} & \ddots& \vdots \\ \vdots & & & &\ddots & \ddots& 0\\ 0 & \cdots &\cdots & \cdots &\cdots & 0& 10^{-15}\end{pmatrix}$$ Then, perform the factor analysis for $\tilde{C}. In Matlab, one can obtain $Q,D$ using the command: [Q,D] = eig(C) Constructing $\tilde{C}$ is then just simple Matrix manipulations. Remark: It would be hard to tell how this influences the factor analysis though; hence, one should probably be careful with this method. Moreover, even though this is a $C$ is a correlation matrix, $\tilde{C}$ may well be not. Hence, another normalisation of the entries might be necessary.
How to do factor analysis when the covariance matrix is not positive definite? Let's define the correlation matrix by $C$. Since it is positive semi-definite, but not positive definite, its spectral decomposition looks something like $$C = Q D Q^{-1},$$ where the columns of $Q$
26,956
How to do factor analysis when the covariance matrix is not positive definite?
It is possible that you are facing numeric issues with your matrix. It is possibly actually positive definite, but the numerical computation says otherwise. A very common solution, in that case, is to add a very low value (1.E-10 for instance) to all diagonal elements. If this does not solve the problem, try to progressively increase this value.
How to do factor analysis when the covariance matrix is not positive definite?
It is possible that you are facing numeric issues with your matrix. It is possibly actually positive definite, but the numerical computation says otherwise. A very common solution, in that case, is to
How to do factor analysis when the covariance matrix is not positive definite? It is possible that you are facing numeric issues with your matrix. It is possibly actually positive definite, but the numerical computation says otherwise. A very common solution, in that case, is to add a very low value (1.E-10 for instance) to all diagonal elements. If this does not solve the problem, try to progressively increase this value.
How to do factor analysis when the covariance matrix is not positive definite? It is possible that you are facing numeric issues with your matrix. It is possibly actually positive definite, but the numerical computation says otherwise. A very common solution, in that case, is to
26,957
How to do factor analysis when the covariance matrix is not positive definite?
FA works best when your data is Gaussian, therefore you may want to try some pre-processing approaches to have a more Gaussian-like data.
How to do factor analysis when the covariance matrix is not positive definite?
FA works best when your data is Gaussian, therefore you may want to try some pre-processing approaches to have a more Gaussian-like data.
How to do factor analysis when the covariance matrix is not positive definite? FA works best when your data is Gaussian, therefore you may want to try some pre-processing approaches to have a more Gaussian-like data.
How to do factor analysis when the covariance matrix is not positive definite? FA works best when your data is Gaussian, therefore you may want to try some pre-processing approaches to have a more Gaussian-like data.
26,958
Revolutions in statistics for the last 50 years? [closed]
Efron's work on the Bootstrap comes to mind.
Revolutions in statistics for the last 50 years? [closed]
Efron's work on the Bootstrap comes to mind.
Revolutions in statistics for the last 50 years? [closed] Efron's work on the Bootstrap comes to mind.
Revolutions in statistics for the last 50 years? [closed] Efron's work on the Bootstrap comes to mind.
26,959
Revolutions in statistics for the last 50 years? [closed]
The application of Bayesian statistics with Monte Carlo methods.
Revolutions in statistics for the last 50 years? [closed]
The application of Bayesian statistics with Monte Carlo methods.
Revolutions in statistics for the last 50 years? [closed] The application of Bayesian statistics with Monte Carlo methods.
Revolutions in statistics for the last 50 years? [closed] The application of Bayesian statistics with Monte Carlo methods.
26,960
Revolutions in statistics for the last 50 years? [closed]
Ensemble methods like boosting, bagging, ... etc are another potential candidate.
Revolutions in statistics for the last 50 years? [closed]
Ensemble methods like boosting, bagging, ... etc are another potential candidate.
Revolutions in statistics for the last 50 years? [closed] Ensemble methods like boosting, bagging, ... etc are another potential candidate.
Revolutions in statistics for the last 50 years? [closed] Ensemble methods like boosting, bagging, ... etc are another potential candidate.
26,961
Revolutions in statistics for the last 50 years? [closed]
In 1960 most people doing statistics were calculating with a four-function manual calculator or a slide rule or by hand; mainframe computers were just beginning to run some programs in Algol and Fortran; graphical output devices were rare and crude. Because of these limitations, Bayesian analysis was considered formidably difficult due to the calculations required. Databases were managed on punch cards and computer tape drives limited to a few megabytes. Statistical education focused initially on learning formulas for t-testing and ANOVA. Statistical practice usually did not go beyond such routine hypothesis testing (although some brilliant minds had just begun to exploit computers for deeper analysis, as exemplified by Mosteller & Wallace's book on the Federalist papers, for instance). I recounted this well-known history as a reminder that all of statistics has undergone a revolution due to the rise and spread of computing power during this last half century, a revolution that has made possible almost every other innovation in statistics during that time (with the notable exception of Tukey's pencil-and-paper EDA methods, as Thylacoleo has already observed).
Revolutions in statistics for the last 50 years? [closed]
In 1960 most people doing statistics were calculating with a four-function manual calculator or a slide rule or by hand; mainframe computers were just beginning to run some programs in Algol and Fortr
Revolutions in statistics for the last 50 years? [closed] In 1960 most people doing statistics were calculating with a four-function manual calculator or a slide rule or by hand; mainframe computers were just beginning to run some programs in Algol and Fortran; graphical output devices were rare and crude. Because of these limitations, Bayesian analysis was considered formidably difficult due to the calculations required. Databases were managed on punch cards and computer tape drives limited to a few megabytes. Statistical education focused initially on learning formulas for t-testing and ANOVA. Statistical practice usually did not go beyond such routine hypothesis testing (although some brilliant minds had just begun to exploit computers for deeper analysis, as exemplified by Mosteller & Wallace's book on the Federalist papers, for instance). I recounted this well-known history as a reminder that all of statistics has undergone a revolution due to the rise and spread of computing power during this last half century, a revolution that has made possible almost every other innovation in statistics during that time (with the notable exception of Tukey's pencil-and-paper EDA methods, as Thylacoleo has already observed).
Revolutions in statistics for the last 50 years? [closed] In 1960 most people doing statistics were calculating with a four-function manual calculator or a slide rule or by hand; mainframe computers were just beginning to run some programs in Algol and Fortr
26,962
Revolutions in statistics for the last 50 years? [closed]
John Tukey's truly strange idea: exploratory data analysis. http://en.wikipedia.org/wiki/Exploratory_data_analysis
Revolutions in statistics for the last 50 years? [closed]
John Tukey's truly strange idea: exploratory data analysis. http://en.wikipedia.org/wiki/Exploratory_data_analysis
Revolutions in statistics for the last 50 years? [closed] John Tukey's truly strange idea: exploratory data analysis. http://en.wikipedia.org/wiki/Exploratory_data_analysis
Revolutions in statistics for the last 50 years? [closed] John Tukey's truly strange idea: exploratory data analysis. http://en.wikipedia.org/wiki/Exploratory_data_analysis
26,963
Revolutions in statistics for the last 50 years? [closed]
Generalized linear models due to the recently deceased John Nelder and Robert Wedderburn.
Revolutions in statistics for the last 50 years? [closed]
Generalized linear models due to the recently deceased John Nelder and Robert Wedderburn.
Revolutions in statistics for the last 50 years? [closed] Generalized linear models due to the recently deceased John Nelder and Robert Wedderburn.
Revolutions in statistics for the last 50 years? [closed] Generalized linear models due to the recently deceased John Nelder and Robert Wedderburn.
26,964
Revolutions in statistics for the last 50 years? [closed]
There was a great discussion on metaoptimize called "Most Influential Ideas 1995 - 2005" Which holds a great collection of ideas. The one I mentioned there, and will repeat here, is the "revolution" in the concept of multiple comparisons, specifically the shift from using FWE to FDR methods, for testing very many hypothesis (like in micro array or fMRI and so on) Here is one of the first articles that introduced this notion to the scientific community: Benjamini, Yoav; Hochberg, Yosef (1995). "Controlling the false discovery rate: a practical and powerful approach to multiple testing". Journal of the Royal Statistical Society
Revolutions in statistics for the last 50 years? [closed]
There was a great discussion on metaoptimize called "Most Influential Ideas 1995 - 2005" Which holds a great collection of ideas. The one I mentioned there, and will repeat here, is the "revolution"
Revolutions in statistics for the last 50 years? [closed] There was a great discussion on metaoptimize called "Most Influential Ideas 1995 - 2005" Which holds a great collection of ideas. The one I mentioned there, and will repeat here, is the "revolution" in the concept of multiple comparisons, specifically the shift from using FWE to FDR methods, for testing very many hypothesis (like in micro array or fMRI and so on) Here is one of the first articles that introduced this notion to the scientific community: Benjamini, Yoav; Hochberg, Yosef (1995). "Controlling the false discovery rate: a practical and powerful approach to multiple testing". Journal of the Royal Statistical Society
Revolutions in statistics for the last 50 years? [closed] There was a great discussion on metaoptimize called "Most Influential Ideas 1995 - 2005" Which holds a great collection of ideas. The one I mentioned there, and will repeat here, is the "revolution"
26,965
Revolutions in statistics for the last 50 years? [closed]
The creation of this site ;-)
Revolutions in statistics for the last 50 years? [closed]
The creation of this site ;-)
Revolutions in statistics for the last 50 years? [closed] The creation of this site ;-)
Revolutions in statistics for the last 50 years? [closed] The creation of this site ;-)
26,966
Revolutions in statistics for the last 50 years? [closed]
Revolution 1: S (ACM Software Systems Award) Revolution 2: R (Ross Ihaka (1998) on the history of R to that point)
Revolutions in statistics for the last 50 years? [closed]
Revolution 1: S (ACM Software Systems Award) Revolution 2: R (Ross Ihaka (1998) on the history of R to that point)
Revolutions in statistics for the last 50 years? [closed] Revolution 1: S (ACM Software Systems Award) Revolution 2: R (Ross Ihaka (1998) on the history of R to that point)
Revolutions in statistics for the last 50 years? [closed] Revolution 1: S (ACM Software Systems Award) Revolution 2: R (Ross Ihaka (1998) on the history of R to that point)
26,967
Revolutions in statistics for the last 50 years? [closed]
Cox proportional hazards survival analysis: http://en.wikipedia.org/wiki/Cox_proportional_hazards_model
Revolutions in statistics for the last 50 years? [closed]
Cox proportional hazards survival analysis: http://en.wikipedia.org/wiki/Cox_proportional_hazards_model
Revolutions in statistics for the last 50 years? [closed] Cox proportional hazards survival analysis: http://en.wikipedia.org/wiki/Cox_proportional_hazards_model
Revolutions in statistics for the last 50 years? [closed] Cox proportional hazards survival analysis: http://en.wikipedia.org/wiki/Cox_proportional_hazards_model
26,968
Revolutions in statistics for the last 50 years? [closed]
The Box-Jenkins approach to time-series modelling: ARIMA models etc. http://en.wikipedia.org/wiki/Box-Jenkins
Revolutions in statistics for the last 50 years? [closed]
The Box-Jenkins approach to time-series modelling: ARIMA models etc. http://en.wikipedia.org/wiki/Box-Jenkins
Revolutions in statistics for the last 50 years? [closed] The Box-Jenkins approach to time-series modelling: ARIMA models etc. http://en.wikipedia.org/wiki/Box-Jenkins
Revolutions in statistics for the last 50 years? [closed] The Box-Jenkins approach to time-series modelling: ARIMA models etc. http://en.wikipedia.org/wiki/Box-Jenkins
26,969
If 'B is more likely given A', then 'A is more likely given B'
By way of intuition, real world examples such as Peter Flom gives are most helpful for some people. The other thing that commonly helps people is pictures. So, to cover most bases, let's have some pictures. What we have here are two very basic diagrams showing probabilities. The first shows two independent predicates I'll call Red and Plain. It is clear that they are independent because the lines line up. The proportion of plain area that is red is the same as the proportion of stripy area that is red and is also the same as the total proportion that is red. In the second image, we have non-independent distributions. Specifically, we have expanded some of the plain red area into the stripy area without changing the fact that it is red. Clearly then, being red makes being plain more likely. Meanwhile, have a look at the plain side of that image. Clearly the proportion of the plain region that is red is greater than the proportion of the whole image that is red. That is because the plain region has been given a bunch more area and all of it is red. So, red makes plain more likely, and plain makes red more likely. What's actually happening here? A is evidence for B (that is, A makes B more likely) when the area that contains both A and B is bigger than would be predicted if they were independent. Because the intersection between A and B is the same as the intersection between B and A, that also implies that B is evidence for A. One note of caution: although the argument above seems very symmetrical, it may not be the case that the strength of evidence in both directions is equal. For example, consider this third image. Here the same thing has happened: plain red has eaten up territory previously belonging to stripy red. In fact, it has completely finished the job! Note that the point being red outright guarantees plainness because there are no stripy red regions left. However a point being plain has not guaranteed redness, because there are still green regions left. Nevertheless, a point in the box being plain increases the chance that it is red, and a point being red increases the chance that it is plain. Both directions imply more likely, just not by the same amount.
If 'B is more likely given A', then 'A is more likely given B'
By way of intuition, real world examples such as Peter Flom gives are most helpful for some people. The other thing that commonly helps people is pictures. So, to cover most bases, let's have some pic
If 'B is more likely given A', then 'A is more likely given B' By way of intuition, real world examples such as Peter Flom gives are most helpful for some people. The other thing that commonly helps people is pictures. So, to cover most bases, let's have some pictures. What we have here are two very basic diagrams showing probabilities. The first shows two independent predicates I'll call Red and Plain. It is clear that they are independent because the lines line up. The proportion of plain area that is red is the same as the proportion of stripy area that is red and is also the same as the total proportion that is red. In the second image, we have non-independent distributions. Specifically, we have expanded some of the plain red area into the stripy area without changing the fact that it is red. Clearly then, being red makes being plain more likely. Meanwhile, have a look at the plain side of that image. Clearly the proportion of the plain region that is red is greater than the proportion of the whole image that is red. That is because the plain region has been given a bunch more area and all of it is red. So, red makes plain more likely, and plain makes red more likely. What's actually happening here? A is evidence for B (that is, A makes B more likely) when the area that contains both A and B is bigger than would be predicted if they were independent. Because the intersection between A and B is the same as the intersection between B and A, that also implies that B is evidence for A. One note of caution: although the argument above seems very symmetrical, it may not be the case that the strength of evidence in both directions is equal. For example, consider this third image. Here the same thing has happened: plain red has eaten up territory previously belonging to stripy red. In fact, it has completely finished the job! Note that the point being red outright guarantees plainness because there are no stripy red regions left. However a point being plain has not guaranteed redness, because there are still green regions left. Nevertheless, a point in the box being plain increases the chance that it is red, and a point being red increases the chance that it is plain. Both directions imply more likely, just not by the same amount.
If 'B is more likely given A', then 'A is more likely given B' By way of intuition, real world examples such as Peter Flom gives are most helpful for some people. The other thing that commonly helps people is pictures. So, to cover most bases, let's have some pic
26,970
If 'B is more likely given A', then 'A is more likely given B'
I think another mathematical way of putting it may help. Consider the claim in the context of Bayes' rule: Claim: if $P(B|A)>P(B)$ then $P(A|B) > P(A)$ Bayes' rule: $$ P(A \mid B) = \frac{P(B \mid A) \, P(A)}{P(B)} $$ assuming $P(B)$ nonzero. Thus $$\frac{P(A|B)}{P(A)} = \frac{P(B|A)}{P(B)}$$ If $P(B|A)>P(B)$, then $\frac{P(B|A)}{P(B)} > 1$. Then $\frac{P(A|B)}{P(A)} > 1$, and so $P(A|B) > P(A)$. This proves the claim and an even stronger conclusion - that the respective proportions of the likelihoods must be equal.
If 'B is more likely given A', then 'A is more likely given B'
I think another mathematical way of putting it may help. Consider the claim in the context of Bayes' rule: Claim: if $P(B|A)>P(B)$ then $P(A|B) > P(A)$ Bayes' rule: $$ P(A \mid B) = \frac{P(B \mid A)
If 'B is more likely given A', then 'A is more likely given B' I think another mathematical way of putting it may help. Consider the claim in the context of Bayes' rule: Claim: if $P(B|A)>P(B)$ then $P(A|B) > P(A)$ Bayes' rule: $$ P(A \mid B) = \frac{P(B \mid A) \, P(A)}{P(B)} $$ assuming $P(B)$ nonzero. Thus $$\frac{P(A|B)}{P(A)} = \frac{P(B|A)}{P(B)}$$ If $P(B|A)>P(B)$, then $\frac{P(B|A)}{P(B)} > 1$. Then $\frac{P(A|B)}{P(A)} > 1$, and so $P(A|B) > P(A)$. This proves the claim and an even stronger conclusion - that the respective proportions of the likelihoods must be equal.
If 'B is more likely given A', then 'A is more likely given B' I think another mathematical way of putting it may help. Consider the claim in the context of Bayes' rule: Claim: if $P(B|A)>P(B)$ then $P(A|B) > P(A)$ Bayes' rule: $$ P(A \mid B) = \frac{P(B \mid A)
26,971
If 'B is more likely given A', then 'A is more likely given B'
Well, I don't like the word "makes" in the question. That implies some sort of causality and causality usually doesn't reverse. But you asked for intuition. So, I'd think about some examples, because that seems to spark intuition. Choose one you like: If a person is a woman, it is more likely that the person voted for a Democrat. If a person voted for a Democrat, it is more likely that the person is a woman. If a man is a professional basketball center, it is more likely that he is over 2 meters tall. If a man is over 2 meters tall, it is more likely that he is a basketball center. If it is over 40 degrees Celsius, it is more likely that there will be a blackout. If there has been a blackout, it is more likely that it is over 40 degrees. And so on.
If 'B is more likely given A', then 'A is more likely given B'
Well, I don't like the word "makes" in the question. That implies some sort of causality and causality usually doesn't reverse. But you asked for intuition. So, I'd think about some examples, because
If 'B is more likely given A', then 'A is more likely given B' Well, I don't like the word "makes" in the question. That implies some sort of causality and causality usually doesn't reverse. But you asked for intuition. So, I'd think about some examples, because that seems to spark intuition. Choose one you like: If a person is a woman, it is more likely that the person voted for a Democrat. If a person voted for a Democrat, it is more likely that the person is a woman. If a man is a professional basketball center, it is more likely that he is over 2 meters tall. If a man is over 2 meters tall, it is more likely that he is a basketball center. If it is over 40 degrees Celsius, it is more likely that there will be a blackout. If there has been a blackout, it is more likely that it is over 40 degrees. And so on.
If 'B is more likely given A', then 'A is more likely given B' Well, I don't like the word "makes" in the question. That implies some sort of causality and causality usually doesn't reverse. But you asked for intuition. So, I'd think about some examples, because
26,972
If 'B is more likely given A', then 'A is more likely given B'
To add on the answer by @Dasherman: What can it mean to say that two events are related, or maybe associated or correlated? Maybe we could for a definition compare the joint probability (Assuming $\DeclareMathOperator{\P}{\mathbb{P}} \P(A)>0, \P(B)>0$): $$ \eta(A,B)=\frac{\P(A \cap B)}{\P(A) \P(B)} $$ so if $\eta$ is larger than one, $A$ and $B$ occurs together more often than under independence. Then we can say that $A$ and $B$ are positively related. But now, using the definition of conditional probability, $\frac{\P(A \cap B)}{\P(A) \P(B)}>1$ is an easy consequence of $\P(B \mid A) > \P(B)$. But $\frac{\P(A \cap B)}{\P(A) \P(B)}$ is completely symmetric in $A$ and $B$ (interchanging all occurrences of the symbol $A$ with $B$ and vice versa) leaves the same formulas, so is also equivalent with $\P(A \mid B) > \P(A)$. That gives the result. So the intuition you ask for is that $\eta(A,B)$ is symmetric in $A$ and $B$. The answer by @gunes gave a practical example, and it is easy to make others the same way.
If 'B is more likely given A', then 'A is more likely given B'
To add on the answer by @Dasherman: What can it mean to say that two events are related, or maybe associated or correlated? Maybe we could for a definition compare the joint probability (Assuming $\De
If 'B is more likely given A', then 'A is more likely given B' To add on the answer by @Dasherman: What can it mean to say that two events are related, or maybe associated or correlated? Maybe we could for a definition compare the joint probability (Assuming $\DeclareMathOperator{\P}{\mathbb{P}} \P(A)>0, \P(B)>0$): $$ \eta(A,B)=\frac{\P(A \cap B)}{\P(A) \P(B)} $$ so if $\eta$ is larger than one, $A$ and $B$ occurs together more often than under independence. Then we can say that $A$ and $B$ are positively related. But now, using the definition of conditional probability, $\frac{\P(A \cap B)}{\P(A) \P(B)}>1$ is an easy consequence of $\P(B \mid A) > \P(B)$. But $\frac{\P(A \cap B)}{\P(A) \P(B)}$ is completely symmetric in $A$ and $B$ (interchanging all occurrences of the symbol $A$ with $B$ and vice versa) leaves the same formulas, so is also equivalent with $\P(A \mid B) > \P(A)$. That gives the result. So the intuition you ask for is that $\eta(A,B)$ is symmetric in $A$ and $B$. The answer by @gunes gave a practical example, and it is easy to make others the same way.
If 'B is more likely given A', then 'A is more likely given B' To add on the answer by @Dasherman: What can it mean to say that two events are related, or maybe associated or correlated? Maybe we could for a definition compare the joint probability (Assuming $\De
26,973
If 'B is more likely given A', then 'A is more likely given B'
If A makes B more likely, this means the events are somehow related. This relation works both ways. If A makes B more likely, this means that A and B tend to happen together. This then means that B also makes A more likely.
If 'B is more likely given A', then 'A is more likely given B'
If A makes B more likely, this means the events are somehow related. This relation works both ways. If A makes B more likely, this means that A and B tend to happen together. This then means that B al
If 'B is more likely given A', then 'A is more likely given B' If A makes B more likely, this means the events are somehow related. This relation works both ways. If A makes B more likely, this means that A and B tend to happen together. This then means that B also makes A more likely.
If 'B is more likely given A', then 'A is more likely given B' If A makes B more likely, this means the events are somehow related. This relation works both ways. If A makes B more likely, this means that A and B tend to happen together. This then means that B al
26,974
If 'B is more likely given A', then 'A is more likely given B'
If A makes B more likely, A has crucial information that B can infer about itself. Despite the fact that it might not contribute the same amount, that information is not lost the other way around. Eventually, we have two events that their occurrence support each other. I can’t seem to imagine a scenario where occurrence of A increases the likelihood of B, and occurrence of B decreases the likelihood of A. For example, if it rains, the floor will be wet with high probability, and if the floor is wet, it doesn’t mean that it rained but it doesn’t decrease the chances.
If 'B is more likely given A', then 'A is more likely given B'
If A makes B more likely, A has crucial information that B can infer about itself. Despite the fact that it might not contribute the same amount, that information is not lost the other way around. Eve
If 'B is more likely given A', then 'A is more likely given B' If A makes B more likely, A has crucial information that B can infer about itself. Despite the fact that it might not contribute the same amount, that information is not lost the other way around. Eventually, we have two events that their occurrence support each other. I can’t seem to imagine a scenario where occurrence of A increases the likelihood of B, and occurrence of B decreases the likelihood of A. For example, if it rains, the floor will be wet with high probability, and if the floor is wet, it doesn’t mean that it rained but it doesn’t decrease the chances.
If 'B is more likely given A', then 'A is more likely given B' If A makes B more likely, A has crucial information that B can infer about itself. Despite the fact that it might not contribute the same amount, that information is not lost the other way around. Eve
26,975
If 'B is more likely given A', then 'A is more likely given B'
You can make the math more intuitive by imagining a contingency table. $\begin{array}{cc} \begin{array}{cc|cc} && A & \lnot A & \\ &a+b+c+d & a+c & b+d \\\hline B& a+b& a & b \\ \lnot B & c+d& c & d \\ \end{array} \end{array}$ When $A$ and $B$ are independent then the joint probabilities are products of the marginal probabilities $$\begin{array}{cc} \begin{array}{cc|cc} && A & \lnot A & \\ &1 & x & 1-x \\\hline B& y& a=xy & b=(1-x)y \\ \lnot B & 1-y& c=x (1-y) & d=(1-x)(1-y)\\ \end{array} \end{array}$$ In such case you would have similar marginal and conditional probabilities, e.g. $P (A) = P (A|B) $ and $P (B)=P (B|A) $. When there is no independence then you could see this as leaving the parameters $a,b,c,d $ the same (as products of the margins) but with just an adjustment by $\pm z $ $$\begin{array}{cc} \begin{array}{cc|cc} && A & \lnot A & \\ &1 & x & 1-x \\\hline B& y& a+z & b-z \\ \lnot B & 1-y& c-z & d+z\\ \end{array} \end{array}$$ You could see this $z$ as breaking the equality of the marginal and conditional probabilities or breaking the relationship for the joint probabilities being products of the marginal probabilities. Now, from this point of view (of breaking these equalities) you can see that this breaking happens in two ways both for $P(A|B) \neq P(A)$ and $P(B|A) \neq P(B)$. And the inequality will be for both cases $>$ when $z$ is positive and $<$ when $z $ is negative. So you could see the connection $P(A|B) > P(A)$ then $P(B|A) > P(B)$ via the joint probability $P(B,A) > P (A) P (B) $. If A and B often happen together (joint probability is higher then product of marginal probabilities) then observing the one will make the (conditional) probability of the other higher.
If 'B is more likely given A', then 'A is more likely given B'
You can make the math more intuitive by imagining a contingency table. $\begin{array}{cc} \begin{array}{cc|cc} && A & \lnot A & \\ &a+b+c+d & a+c & b+d \\\hline B& a+b& a & b \\ \lnot B & c+d& c & d
If 'B is more likely given A', then 'A is more likely given B' You can make the math more intuitive by imagining a contingency table. $\begin{array}{cc} \begin{array}{cc|cc} && A & \lnot A & \\ &a+b+c+d & a+c & b+d \\\hline B& a+b& a & b \\ \lnot B & c+d& c & d \\ \end{array} \end{array}$ When $A$ and $B$ are independent then the joint probabilities are products of the marginal probabilities $$\begin{array}{cc} \begin{array}{cc|cc} && A & \lnot A & \\ &1 & x & 1-x \\\hline B& y& a=xy & b=(1-x)y \\ \lnot B & 1-y& c=x (1-y) & d=(1-x)(1-y)\\ \end{array} \end{array}$$ In such case you would have similar marginal and conditional probabilities, e.g. $P (A) = P (A|B) $ and $P (B)=P (B|A) $. When there is no independence then you could see this as leaving the parameters $a,b,c,d $ the same (as products of the margins) but with just an adjustment by $\pm z $ $$\begin{array}{cc} \begin{array}{cc|cc} && A & \lnot A & \\ &1 & x & 1-x \\\hline B& y& a+z & b-z \\ \lnot B & 1-y& c-z & d+z\\ \end{array} \end{array}$$ You could see this $z$ as breaking the equality of the marginal and conditional probabilities or breaking the relationship for the joint probabilities being products of the marginal probabilities. Now, from this point of view (of breaking these equalities) you can see that this breaking happens in two ways both for $P(A|B) \neq P(A)$ and $P(B|A) \neq P(B)$. And the inequality will be for both cases $>$ when $z$ is positive and $<$ when $z $ is negative. So you could see the connection $P(A|B) > P(A)$ then $P(B|A) > P(B)$ via the joint probability $P(B,A) > P (A) P (B) $. If A and B often happen together (joint probability is higher then product of marginal probabilities) then observing the one will make the (conditional) probability of the other higher.
If 'B is more likely given A', then 'A is more likely given B' You can make the math more intuitive by imagining a contingency table. $\begin{array}{cc} \begin{array}{cc|cc} && A & \lnot A & \\ &a+b+c+d & a+c & b+d \\\hline B& a+b& a & b \\ \lnot B & c+d& c & d
26,976
If 'B is more likely given A', then 'A is more likely given B'
Suppose we denote the posterior-to-prior probability ratio of an event as: $$\Delta(A|B) \equiv \frac{\mathbb{P}(A|B)}{\mathbb{P}(A)}$$ Then an alternative expression of Bayes' theorem (see this related post) is: $$\Delta(A|B) = \frac{\mathbb{P}(A|B)}{\mathbb{P}(A)} = \frac{\mathbb{P}(A \cap B)}{\mathbb{P}(A) \mathbb{P}(B)} = \frac{\mathbb{P}(B|A)}{\mathbb{P}(B)} = \Delta(B|A).$$ The posterior-to-prior probability ratio tells us whether the argument event is made more or less likely by the occurrence of the conditioning event (and how much more or less likely). The above form of Bayes' theorem shows use that posterior-to-prior probability ratio is symmetric in the variables.$^\dagger$ For example, if observing $B$ makes $A$ more likely than it was a priori, then observing $A$ makes $B$ more likely than it was a priori. $^\dagger$ Note that this is a probability rule, and so it should not be interpreted causally. This symmetry is true in a probabilistic sense for passive observation ---however, it is not true if you intervene in the system to change $A$ or $B$. In that latter case you would need to use causal operations (e.g., the $\text{do}$ operator) to find the effect of the change in the conditioning variable.
If 'B is more likely given A', then 'A is more likely given B'
Suppose we denote the posterior-to-prior probability ratio of an event as: $$\Delta(A|B) \equiv \frac{\mathbb{P}(A|B)}{\mathbb{P}(A)}$$ Then an alternative expression of Bayes' theorem (see this relat
If 'B is more likely given A', then 'A is more likely given B' Suppose we denote the posterior-to-prior probability ratio of an event as: $$\Delta(A|B) \equiv \frac{\mathbb{P}(A|B)}{\mathbb{P}(A)}$$ Then an alternative expression of Bayes' theorem (see this related post) is: $$\Delta(A|B) = \frac{\mathbb{P}(A|B)}{\mathbb{P}(A)} = \frac{\mathbb{P}(A \cap B)}{\mathbb{P}(A) \mathbb{P}(B)} = \frac{\mathbb{P}(B|A)}{\mathbb{P}(B)} = \Delta(B|A).$$ The posterior-to-prior probability ratio tells us whether the argument event is made more or less likely by the occurrence of the conditioning event (and how much more or less likely). The above form of Bayes' theorem shows use that posterior-to-prior probability ratio is symmetric in the variables.$^\dagger$ For example, if observing $B$ makes $A$ more likely than it was a priori, then observing $A$ makes $B$ more likely than it was a priori. $^\dagger$ Note that this is a probability rule, and so it should not be interpreted causally. This symmetry is true in a probabilistic sense for passive observation ---however, it is not true if you intervene in the system to change $A$ or $B$. In that latter case you would need to use causal operations (e.g., the $\text{do}$ operator) to find the effect of the change in the conditioning variable.
If 'B is more likely given A', then 'A is more likely given B' Suppose we denote the posterior-to-prior probability ratio of an event as: $$\Delta(A|B) \equiv \frac{\mathbb{P}(A|B)}{\mathbb{P}(A)}$$ Then an alternative expression of Bayes' theorem (see this relat
26,977
If 'B is more likely given A', then 'A is more likely given B'
You are told that Sam is a woman and Kim is a man, and one of the two wears make-up and the other does not. Who of them would you guess wears make-up? You are told that Sam wears make-up and Kim doesn't, and one of the two is a man and one is a woman. Who would you guess is the woman?
If 'B is more likely given A', then 'A is more likely given B'
You are told that Sam is a woman and Kim is a man, and one of the two wears make-up and the other does not. Who of them would you guess wears make-up? You are told that Sam wears make-up and Kim doesn
If 'B is more likely given A', then 'A is more likely given B' You are told that Sam is a woman and Kim is a man, and one of the two wears make-up and the other does not. Who of them would you guess wears make-up? You are told that Sam wears make-up and Kim doesn't, and one of the two is a man and one is a woman. Who would you guess is the woman?
If 'B is more likely given A', then 'A is more likely given B' You are told that Sam is a woman and Kim is a man, and one of the two wears make-up and the other does not. Who of them would you guess wears make-up? You are told that Sam wears make-up and Kim doesn
26,978
If 'B is more likely given A', then 'A is more likely given B'
It seems there is some confusion between causation and correlation. Indeed, the question statement is false for causation, as can be seen by an example such as: If a dog is wearing a scarf, then it is a domesticated animal. The following is not true: Seeing a domesticated animal wearing a scarf implies it is a dog. Seeing a domesticated dog implies it is wearing a scarf. However, if you are thinking of probabilities (correlation) then it IS true: Dogs wearing scarfs are much more likely to be a domesticated animal than dogs not wearing scarfs (or animals in general for that matter) The following is true: A domesticated animal wearing a scarf is more likely to be a dog than another animal. A domesticated dog is more likely to be wearing a scarf than a non-domesticated dog. If this is not intuitive, think of a pool of animals including ants, dogs and cats. Dogs and cats can both be domesticated and wear scarfs, ants can't neither. If you increase the probability of domesticated animals in your pool, it also will mean you will increase the chance of seeing an animal wearing a scarf. If you increase the probability of either cats or dogs, then you will also increase the probability of seeing an animal wearing a scarf. Being domesticated is the "secret" link between the animal and wearing a scarf, and that "secret" link will exert its influence both ways. Edit: Giving an example to your question in the comments: Imagine a world where animals are either Cats or Dogs. They can be either domesticated or not. They can wear a scarf or not. Imagine there exist 100 total animals, 50 Dogs and 50 Cats. Now consider the statement A to be: "Dogs wearing scarfs are thrice as likely to be a domesticated animal than dogs not wearing scarfs". If A is not true, then you can imagine that the world could be made of 50 Dogs, 25 of them domesticated (of which 10 wear scarfs), 25 of them wild (of which 10 wear scarfs). Same stats for cats. Then, if you saw a domesticated animal in this world, it would have 50% chance of being a dog (25/50, 25 dogs out of 50 domesticated animals) and 40% chance of having a scarf (20/50, 10 Dogs and 10 Cats out of 50 domesticated animals). However, if A is true, then you have a world where there are 50 Dogs, 25 of them domesticated (of which 15 wear scarfs), 25 of them wild (of which 5 wear scarfs). Cats maintain the old stats: 50 Cats, 25 of them domesticated (of which 10 wear scarfs), 25 of them wild (of which 10 wear scarfs). Then, if you saw a domesticated animal in this world, it would have the same 50% chance of being a dog (25/50, 25 dogs out of 50 domesticated animals) but would have 50% (25/50, 15 Dogs and 10 Cats out of 50 domesticated animals). As you can see, if you say that A is true, then if you saw a domesticated animal wearing a scarf in the world, it would be more likely a Dog (60% or 15/25) than any other animal (in this case Cat, 40% or 10/25).
If 'B is more likely given A', then 'A is more likely given B'
It seems there is some confusion between causation and correlation. Indeed, the question statement is false for causation, as can be seen by an example such as: If a dog is wearing a scarf, then it i
If 'B is more likely given A', then 'A is more likely given B' It seems there is some confusion between causation and correlation. Indeed, the question statement is false for causation, as can be seen by an example such as: If a dog is wearing a scarf, then it is a domesticated animal. The following is not true: Seeing a domesticated animal wearing a scarf implies it is a dog. Seeing a domesticated dog implies it is wearing a scarf. However, if you are thinking of probabilities (correlation) then it IS true: Dogs wearing scarfs are much more likely to be a domesticated animal than dogs not wearing scarfs (or animals in general for that matter) The following is true: A domesticated animal wearing a scarf is more likely to be a dog than another animal. A domesticated dog is more likely to be wearing a scarf than a non-domesticated dog. If this is not intuitive, think of a pool of animals including ants, dogs and cats. Dogs and cats can both be domesticated and wear scarfs, ants can't neither. If you increase the probability of domesticated animals in your pool, it also will mean you will increase the chance of seeing an animal wearing a scarf. If you increase the probability of either cats or dogs, then you will also increase the probability of seeing an animal wearing a scarf. Being domesticated is the "secret" link between the animal and wearing a scarf, and that "secret" link will exert its influence both ways. Edit: Giving an example to your question in the comments: Imagine a world where animals are either Cats or Dogs. They can be either domesticated or not. They can wear a scarf or not. Imagine there exist 100 total animals, 50 Dogs and 50 Cats. Now consider the statement A to be: "Dogs wearing scarfs are thrice as likely to be a domesticated animal than dogs not wearing scarfs". If A is not true, then you can imagine that the world could be made of 50 Dogs, 25 of them domesticated (of which 10 wear scarfs), 25 of them wild (of which 10 wear scarfs). Same stats for cats. Then, if you saw a domesticated animal in this world, it would have 50% chance of being a dog (25/50, 25 dogs out of 50 domesticated animals) and 40% chance of having a scarf (20/50, 10 Dogs and 10 Cats out of 50 domesticated animals). However, if A is true, then you have a world where there are 50 Dogs, 25 of them domesticated (of which 15 wear scarfs), 25 of them wild (of which 5 wear scarfs). Cats maintain the old stats: 50 Cats, 25 of them domesticated (of which 10 wear scarfs), 25 of them wild (of which 10 wear scarfs). Then, if you saw a domesticated animal in this world, it would have the same 50% chance of being a dog (25/50, 25 dogs out of 50 domesticated animals) but would have 50% (25/50, 15 Dogs and 10 Cats out of 50 domesticated animals). As you can see, if you say that A is true, then if you saw a domesticated animal wearing a scarf in the world, it would be more likely a Dog (60% or 15/25) than any other animal (in this case Cat, 40% or 10/25).
If 'B is more likely given A', then 'A is more likely given B' It seems there is some confusion between causation and correlation. Indeed, the question statement is false for causation, as can be seen by an example such as: If a dog is wearing a scarf, then it i
26,979
If 'B is more likely given A', then 'A is more likely given B'
There is a confusion here between causation and correlation. So I'll give you an example where the exact opposite happens. Some people are rich, some are poor. Some poor people are given benefits, which makes them less poor. But people who get benefits are still more likely to be poor, even with benefits. If you are given benefits, that makes it more likely that you can afford cinema tickets. ("Makes it more likely" meaning causality). But if you can afford cinema tickets, that makes it less likely that you are among the people who are poor enough to get benefits, so if you can afford cinema tickets, you are less likely to get benefits.
If 'B is more likely given A', then 'A is more likely given B'
There is a confusion here between causation and correlation. So I'll give you an example where the exact opposite happens. Some people are rich, some are poor. Some poor people are given benefits, whi
If 'B is more likely given A', then 'A is more likely given B' There is a confusion here between causation and correlation. So I'll give you an example where the exact opposite happens. Some people are rich, some are poor. Some poor people are given benefits, which makes them less poor. But people who get benefits are still more likely to be poor, even with benefits. If you are given benefits, that makes it more likely that you can afford cinema tickets. ("Makes it more likely" meaning causality). But if you can afford cinema tickets, that makes it less likely that you are among the people who are poor enough to get benefits, so if you can afford cinema tickets, you are less likely to get benefits.
If 'B is more likely given A', then 'A is more likely given B' There is a confusion here between causation and correlation. So I'll give you an example where the exact opposite happens. Some people are rich, some are poor. Some poor people are given benefits, whi
26,980
If 'B is more likely given A', then 'A is more likely given B'
The intuition becomes clear if you look at the stronger statement: If A implies B, then B makes A more likely. Implication: A true -> B true A false -> B true or false Reverse implication: B true -> A true or false B false -> A false Obviously A is more likely to be true if B is known to be true as well, because if B was false then so would be A. The same logic applies to the weaker statement: If A makes B more likely, then B makes A more likely. Weak implication: A true -> B true or (unlikely) false A false -> B true or false Reverse weak implication: B true -> A true or false B false -> A false or (unlikely) true
If 'B is more likely given A', then 'A is more likely given B'
The intuition becomes clear if you look at the stronger statement: If A implies B, then B makes A more likely. Implication: A true -> B true A false -> B true or false Reverse implication: B
If 'B is more likely given A', then 'A is more likely given B' The intuition becomes clear if you look at the stronger statement: If A implies B, then B makes A more likely. Implication: A true -> B true A false -> B true or false Reverse implication: B true -> A true or false B false -> A false Obviously A is more likely to be true if B is known to be true as well, because if B was false then so would be A. The same logic applies to the weaker statement: If A makes B more likely, then B makes A more likely. Weak implication: A true -> B true or (unlikely) false A false -> B true or false Reverse weak implication: B true -> A true or false B false -> A false or (unlikely) true
If 'B is more likely given A', then 'A is more likely given B' The intuition becomes clear if you look at the stronger statement: If A implies B, then B makes A more likely. Implication: A true -> B true A false -> B true or false Reverse implication: B
26,981
If 'B is more likely given A', then 'A is more likely given B'
Suppose Alice has a higher free throw rate than average. Then the probability of a shot being successful, given that it's attempted by Alice, is greater than the probability of a shot being successful in general $P(successful|Alice)>P(successful)$. We can also conclude that Alice's share of successful shots is greater than her share of shots in general: $P(Alice|successful)>P(Alice)$. Or suppose there's a school that has 10% of the students in its school district, but 15% of the straight-A students. Then clearly the percentage of students at that school who are straight-A students is higher than the district-wide percentage. Another way of looking at it: A is more likely, given B, if $P(A\&B)>P(A)P(B)$, and that is completely symmetrical with respect to $A$ and $B$.
If 'B is more likely given A', then 'A is more likely given B'
Suppose Alice has a higher free throw rate than average. Then the probability of a shot being successful, given that it's attempted by Alice, is greater than the probability of a shot being successful
If 'B is more likely given A', then 'A is more likely given B' Suppose Alice has a higher free throw rate than average. Then the probability of a shot being successful, given that it's attempted by Alice, is greater than the probability of a shot being successful in general $P(successful|Alice)>P(successful)$. We can also conclude that Alice's share of successful shots is greater than her share of shots in general: $P(Alice|successful)>P(Alice)$. Or suppose there's a school that has 10% of the students in its school district, but 15% of the straight-A students. Then clearly the percentage of students at that school who are straight-A students is higher than the district-wide percentage. Another way of looking at it: A is more likely, given B, if $P(A\&B)>P(A)P(B)$, and that is completely symmetrical with respect to $A$ and $B$.
If 'B is more likely given A', then 'A is more likely given B' Suppose Alice has a higher free throw rate than average. Then the probability of a shot being successful, given that it's attempted by Alice, is greater than the probability of a shot being successful
26,982
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram?
Ben has already explained much. If you only want some kind of classifier based on, say, variance, then you could use a common variance estimator and you don't need normality. Your distributions should have second moments, though. You wrote that you did "many tests" - this is rather suspicious. Are you aware of the multiple hypothesis testing issues? Are you aware of the "formulating hypotheses on the data" issues? I got the impression, that you'd prefer estimators, not hypothesis testing. Your statistical work seems to have some basic flaws...
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram?
Ben has already explained much. If you only want some kind of classifier based on, say, variance, then you could use a common variance estimator and you don't need normality. Your distributions should
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? Ben has already explained much. If you only want some kind of classifier based on, say, variance, then you could use a common variance estimator and you don't need normality. Your distributions should have second moments, though. You wrote that you did "many tests" - this is rather suspicious. Are you aware of the multiple hypothesis testing issues? Are you aware of the "formulating hypotheses on the data" issues? I got the impression, that you'd prefer estimators, not hypothesis testing. Your statistical work seems to have some basic flaws...
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? Ben has already explained much. If you only want some kind of classifier based on, say, variance, then you could use a common variance estimator and you don't need normality. Your distributions should
26,983
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram?
You QQ plot shows that there is departure from normality in the tails of your distribution. Since you have a very large sample size, your test is able to detect even a relatively minor departure from normality, so it is not surprising that it is rejecting the null hypothesis with a very low p-value. Your test is correctly identifying that your data do not come from a normal distribution (or their tail behaviour would not look like that). Incidentally, this is one of the properties of a classical hypothesis test when you use it to test a narrow hypothesis such as this one --- if the hypothesis is even slightly false then the p-value will converge to zero as the sample size becomes large. Statisticians are therefore cautious when we use hypothesis tests and we are wary of using them to test very narrow hypotheses. If the null hypothesis is too narrow then it will almost certainly be false, and the test will detect that once you give it enough data.
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram?
You QQ plot shows that there is departure from normality in the tails of your distribution. Since you have a very large sample size, your test is able to detect even a relatively minor departure from
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? You QQ plot shows that there is departure from normality in the tails of your distribution. Since you have a very large sample size, your test is able to detect even a relatively minor departure from normality, so it is not surprising that it is rejecting the null hypothesis with a very low p-value. Your test is correctly identifying that your data do not come from a normal distribution (or their tail behaviour would not look like that). Incidentally, this is one of the properties of a classical hypothesis test when you use it to test a narrow hypothesis such as this one --- if the hypothesis is even slightly false then the p-value will converge to zero as the sample size becomes large. Statisticians are therefore cautious when we use hypothesis tests and we are wary of using them to test very narrow hypotheses. If the null hypothesis is too narrow then it will almost certainly be false, and the test will detect that once you give it enough data.
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? You QQ plot shows that there is departure from normality in the tails of your distribution. Since you have a very large sample size, your test is able to detect even a relatively minor departure from
26,984
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram?
No data will ever be perfectly normally distributed, so it is not surprising that your data are "not normal", and note that no test ever will say "data are normal"; the best any test can tell you is that according to the test statistic data do not deviate from what is expected under the normal distribution, but data may not be normal anyway (for example due to not being truly continuous, as no data are). As data are never truly normal, true normality is not what is of interest in applied data analysis. What is really relevant is if you have deviations from normality that have the potential to mislead conclusions of methods that supposedly assume normality. But this depends on what you think you need normality for, i.e., what you want to do with the data after having tested normality. Chances are the data shown in your plots are fine for most things you'd like to do (there are no extreme outliers and no strong skewness, so theory based on normality will give very good approximations), but without knowing what you want to do based on normality, we can't know for sure. (Note that most analyses have further assumptions on top of normality, and sometimes problems with those are worse, particularly independence.)
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram?
No data will ever be perfectly normally distributed, so it is not surprising that your data are "not normal", and note that no test ever will say "data are normal"; the best any test can tell you is t
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? No data will ever be perfectly normally distributed, so it is not surprising that your data are "not normal", and note that no test ever will say "data are normal"; the best any test can tell you is that according to the test statistic data do not deviate from what is expected under the normal distribution, but data may not be normal anyway (for example due to not being truly continuous, as no data are). As data are never truly normal, true normality is not what is of interest in applied data analysis. What is really relevant is if you have deviations from normality that have the potential to mislead conclusions of methods that supposedly assume normality. But this depends on what you think you need normality for, i.e., what you want to do with the data after having tested normality. Chances are the data shown in your plots are fine for most things you'd like to do (there are no extreme outliers and no strong skewness, so theory based on normality will give very good approximations), but without knowing what you want to do based on normality, we can't know for sure. (Note that most analyses have further assumptions on top of normality, and sometimes problems with those are worse, particularly independence.)
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? No data will ever be perfectly normally distributed, so it is not surprising that your data are "not normal", and note that no test ever will say "data are normal"; the best any test can tell you is t
26,985
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram?
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? Because it is not perfect Your qq plot is not perfect. You have some clear deviations from a normal distribution that are statistically significant. Normal distributions exist in mathematics but not in nature These type of deviations occur a lot. The Normal distribution occurs as a limit distribution for a sum of many different sources of variation. See for instance the central limit theorem. But this limit occurs at infinity and that is almost never exactly obtained in practice (although with physical experiments, which can have extremely large numbers of sources of variation, it can get extremely close). Potential causes for your difference In your case there is a deviation from normality in the limits of the distribution. Your sample has a limit between -8.75 and -6.5. On the other hand a normal distribution has limits $\pm \infty$. Such bounds can occur because you do not have a large sum of variables with variations. For instance the sum of 100 rolls with a six sided dice can be well approximated by a normal distribution. But, the dice rolls are limited in the range from 0 to 600. Another possibility: it is very likely that there might be some theoretical limit. Take for instance the performance of a 100 meter sprinter. This might be very well approximated with a normal distribution since there are many sources of error involved in the performance (reaction time at the start, wind speed, physical state, positioning the feet correct every step, etc.). But, you will never get a human running faster than 0 seconds, whereas a normal distribution includes this as an option. Before these 0 seconds there will be some other limit. The sources of error mostly add linearly but once the runner obtains a certain speed then wind resistance starts to increase, coordination becomes more difficult and many other factors start to play a role. The addition of the error is not linear and independent (which means that the normal distribution approximation works less well) It seems to me that it is physically impossible for your variable to be normal distributed, and you do not need a statistical test for this (I imagine that sessility, although I am not sure how you measure this and get negative values, is bounded). Practical solution Very often you do not need exact normality. (edit: as Christian Hennig mentions in the comments, this is too liberal, it should be more strict instead and the statement should be "You never need exact normality". This relates to 'all models are wrong'. The assumption of normality is a part of a model that is likely (or certainly) to be false, but the point of modeling with the assumption of a normal distribution is that it is close enough.) More important than significance is the effect size. Although a problem here is that there is not really a good rule of thumb in the case of normality tests. Depending on your goals/case there might be recommendations. For instance, the qq-plot shows that you variable has smaller tails. This means that your estimate is gonna have a smaller excessive variability. Then you do not have to worry about underestimating p-values and increased type I errors (if the variability of your estimate is less, then you are less likely to exceed a certain range of statistical significance).
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram?
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? Because it is not perfect Your qq plot is not perfect. You have some clear deviations from a normal distr
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? Because it is not perfect Your qq plot is not perfect. You have some clear deviations from a normal distribution that are statistically significant. Normal distributions exist in mathematics but not in nature These type of deviations occur a lot. The Normal distribution occurs as a limit distribution for a sum of many different sources of variation. See for instance the central limit theorem. But this limit occurs at infinity and that is almost never exactly obtained in practice (although with physical experiments, which can have extremely large numbers of sources of variation, it can get extremely close). Potential causes for your difference In your case there is a deviation from normality in the limits of the distribution. Your sample has a limit between -8.75 and -6.5. On the other hand a normal distribution has limits $\pm \infty$. Such bounds can occur because you do not have a large sum of variables with variations. For instance the sum of 100 rolls with a six sided dice can be well approximated by a normal distribution. But, the dice rolls are limited in the range from 0 to 600. Another possibility: it is very likely that there might be some theoretical limit. Take for instance the performance of a 100 meter sprinter. This might be very well approximated with a normal distribution since there are many sources of error involved in the performance (reaction time at the start, wind speed, physical state, positioning the feet correct every step, etc.). But, you will never get a human running faster than 0 seconds, whereas a normal distribution includes this as an option. Before these 0 seconds there will be some other limit. The sources of error mostly add linearly but once the runner obtains a certain speed then wind resistance starts to increase, coordination becomes more difficult and many other factors start to play a role. The addition of the error is not linear and independent (which means that the normal distribution approximation works less well) It seems to me that it is physically impossible for your variable to be normal distributed, and you do not need a statistical test for this (I imagine that sessility, although I am not sure how you measure this and get negative values, is bounded). Practical solution Very often you do not need exact normality. (edit: as Christian Hennig mentions in the comments, this is too liberal, it should be more strict instead and the statement should be "You never need exact normality". This relates to 'all models are wrong'. The assumption of normality is a part of a model that is likely (or certainly) to be false, but the point of modeling with the assumption of a normal distribution is that it is close enough.) More important than significance is the effect size. Although a problem here is that there is not really a good rule of thumb in the case of normality tests. Depending on your goals/case there might be recommendations. For instance, the qq-plot shows that you variable has smaller tails. This means that your estimate is gonna have a smaller excessive variability. Then you do not have to worry about underestimating p-values and increased type I errors (if the variability of your estimate is less, then you are less likely to exceed a certain range of statistical significance).
Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? Why is my data not normally distributed while I have an almost perfect QQ plot and histogram? Because it is not perfect Your qq plot is not perfect. You have some clear deviations from a normal distr
26,986
Why is linear regression not able to predict the outcome of a simple deterministic sequence?
A regression model, such as the one fit by lm() implicitly assumes that the underlying data generating process is probabilistic. You are assuming that the rule you are trying to model is deterministic. Therefore, there is a mismatch between what you are trying to do and the way you are trying to do it. There are other software (i.e., not R) that is explicitly designed to find / fit the simplest function to deterministic data (an example would be Eureqa). There may be an R package for that (that I don't know of), but R is intended for statistical modeling of probabilistic data. As for the answer that lm() gave you, it looks reasonable, and could be right. However, I gather the context in which this problem was presented strongly implied that it should be understood as deterministic. If that hadn't been the case, and you were wondering if the fit was reasonable, one thing you might notice is that the two extreme data points are above the regression line, while the middle data are all below it. This suggests a mis-specified functional form. This can also be seen in the residuals vs. fitted plot (plot(lm1, which=1): As for the model fit by @AlexWilliams, it looks much better:
Why is linear regression not able to predict the outcome of a simple deterministic sequence?
A regression model, such as the one fit by lm() implicitly assumes that the underlying data generating process is probabilistic. You are assuming that the rule you are trying to model is deterministi
Why is linear regression not able to predict the outcome of a simple deterministic sequence? A regression model, such as the one fit by lm() implicitly assumes that the underlying data generating process is probabilistic. You are assuming that the rule you are trying to model is deterministic. Therefore, there is a mismatch between what you are trying to do and the way you are trying to do it. There are other software (i.e., not R) that is explicitly designed to find / fit the simplest function to deterministic data (an example would be Eureqa). There may be an R package for that (that I don't know of), but R is intended for statistical modeling of probabilistic data. As for the answer that lm() gave you, it looks reasonable, and could be right. However, I gather the context in which this problem was presented strongly implied that it should be understood as deterministic. If that hadn't been the case, and you were wondering if the fit was reasonable, one thing you might notice is that the two extreme data points are above the regression line, while the middle data are all below it. This suggests a mis-specified functional form. This can also be seen in the residuals vs. fitted plot (plot(lm1, which=1): As for the model fit by @AlexWilliams, it looks much better:
Why is linear regression not able to predict the outcome of a simple deterministic sequence? A regression model, such as the one fit by lm() implicitly assumes that the underlying data generating process is probabilistic. You are assuming that the rule you are trying to model is deterministi
26,987
Why is linear regression not able to predict the outcome of a simple deterministic sequence?
The trend is quadratic not linear. Try: lm1 <- lm(b~I(a^2), data=data) Update: Here is the code. data <- data.frame(a=c(3,4,5,6,7),b=c(18,32,50,72,98)) lm1 <- lm(b~I(a^2), data=data) new.data <- data.frame(a=c(10,20,30)) predict(lm1, newdata = new.data, interval='prediction') And output: fit lwr upr 1 200 200 200 2 800 800 800 3 1800 1800 1800
Why is linear regression not able to predict the outcome of a simple deterministic sequence?
The trend is quadratic not linear. Try: lm1 <- lm(b~I(a^2), data=data) Update: Here is the code. data <- data.frame(a=c(3,4,5,6,7),b=c(18,32,50,72,98)) lm1 <- lm(b~I(a^2), data=data) new.data <- data
Why is linear regression not able to predict the outcome of a simple deterministic sequence? The trend is quadratic not linear. Try: lm1 <- lm(b~I(a^2), data=data) Update: Here is the code. data <- data.frame(a=c(3,4,5,6,7),b=c(18,32,50,72,98)) lm1 <- lm(b~I(a^2), data=data) new.data <- data.frame(a=c(10,20,30)) predict(lm1, newdata = new.data, interval='prediction') And output: fit lwr upr 1 200 200 200 2 800 800 800 3 1800 1800 1800
Why is linear regression not able to predict the outcome of a simple deterministic sequence? The trend is quadratic not linear. Try: lm1 <- lm(b~I(a^2), data=data) Update: Here is the code. data <- data.frame(a=c(3,4,5,6,7),b=c(18,32,50,72,98)) lm1 <- lm(b~I(a^2), data=data) new.data <- data
26,988
Why is linear regression not able to predict the outcome of a simple deterministic sequence?
I hesitate to add to the excellent answers given by Alex Williams and gung, but there is a further point that should I think be made. The question uses the phrases 'linear regression' and 'linear model', possibly suggesting that they mean the same. However, the usual meaning of 'linear regression' refers to the Classical Linear Regression Model (CLRM) in which 'linear' means 'linear in the parameters'. This is a condition on the parameters, not on the independent variables. So a quadratic model such as: $$Y_i = \beta_1 + \beta_2X_i^2$$ is still linear in the sense of CLRM, because it is linear in the parameters $\beta_1$ and $\beta_2$. By contrast, the model: $$Y_i = \beta_1 + \beta_2X_i$$ is linear in its parameters and also linear in $X_i$. Rather than calling it a linear model, a more precise statement is that it is linear in its parameters and has linear functional form. So it can be said that the series can be analysed by a model that is linear in its parameters, provided it has quadratic functional form (as shown by Alex Williams), but not by a model having linear functional form.
Why is linear regression not able to predict the outcome of a simple deterministic sequence?
I hesitate to add to the excellent answers given by Alex Williams and gung, but there is a further point that should I think be made. The question uses the phrases 'linear regression' and 'linear mod
Why is linear regression not able to predict the outcome of a simple deterministic sequence? I hesitate to add to the excellent answers given by Alex Williams and gung, but there is a further point that should I think be made. The question uses the phrases 'linear regression' and 'linear model', possibly suggesting that they mean the same. However, the usual meaning of 'linear regression' refers to the Classical Linear Regression Model (CLRM) in which 'linear' means 'linear in the parameters'. This is a condition on the parameters, not on the independent variables. So a quadratic model such as: $$Y_i = \beta_1 + \beta_2X_i^2$$ is still linear in the sense of CLRM, because it is linear in the parameters $\beta_1$ and $\beta_2$. By contrast, the model: $$Y_i = \beta_1 + \beta_2X_i$$ is linear in its parameters and also linear in $X_i$. Rather than calling it a linear model, a more precise statement is that it is linear in its parameters and has linear functional form. So it can be said that the series can be analysed by a model that is linear in its parameters, provided it has quadratic functional form (as shown by Alex Williams), but not by a model having linear functional form.
Why is linear regression not able to predict the outcome of a simple deterministic sequence? I hesitate to add to the excellent answers given by Alex Williams and gung, but there is a further point that should I think be made. The question uses the phrases 'linear regression' and 'linear mod
26,989
Exponential-like distribution with support [0,1]
If you want a distrbution that looks identically to the exponential distribution, up to a multiplicative constant, you can use a truncated exponential distribution. It is defined by restricting the support of an exponential distribution to the interval of interest and then re-normalizing the density to obtain a distribution. Your case would yield $$f(x) = \frac{\lambda e^{-\lambda x}}{1 - e^{-\lambda}}$$
Exponential-like distribution with support [0,1]
If you want a distrbution that looks identically to the exponential distribution, up to a multiplicative constant, you can use a truncated exponential distribution. It is defined by restricting the su
Exponential-like distribution with support [0,1] If you want a distrbution that looks identically to the exponential distribution, up to a multiplicative constant, you can use a truncated exponential distribution. It is defined by restricting the support of an exponential distribution to the interval of interest and then re-normalizing the density to obtain a distribution. Your case would yield $$f(x) = \frac{\lambda e^{-\lambda x}}{1 - e^{-\lambda}}$$
Exponential-like distribution with support [0,1] If you want a distrbution that looks identically to the exponential distribution, up to a multiplicative constant, you can use a truncated exponential distribution. It is defined by restricting the su
26,990
Exponential-like distribution with support [0,1]
The beta distribution will work if and only if $\alpha<1$ and $\beta>1$ (one of the two inequalities can be replaced by $\leq$ and $\geq$ if you don't mind a flat PDF at $x=0$ or $x=1$.) Its PDF is $$ f(x)=\frac{x^{\alpha-1}(1-x)^{\beta-1}}{B(\alpha,\beta)}, $$ so its derivative is $$ f'(x) = \frac{x^{\alpha-2}(1-x)^{\beta-2}}{B(\alpha,\beta)}\big((\alpha-1)(1-x)-(\beta-1)x\big). $$ For the PDF to be strictly monotonically decreasing for $0<x<1$, we need $$(\alpha-1)(1-x)-(\beta-1)x=(2-\alpha-\beta)x+\alpha-1<0$$ on this interval. This describes a linear function of $x$, so it has its maximum (which we need to be negative) at either $x=0$ or $x=1$, depending on the sign of the slope $2-\alpha-\beta$. We thus have two cases: Case 1: $2-\alpha-\beta<0$, or $\alpha+\beta>2$. Then our linear function has a negative slope and its maximum at $x=0$, with value $\alpha-1$, so we need $\alpha<1$. The parameter combinations $\alpha+\beta>2$ and $\alpha<1$ are shown by the light gray area in the diagram below. (The bold line is $\alpha+\beta=2$.) Case 2: $2-\alpha-\beta\geq0$, or $\alpha+\beta\leq2$. Then our linear function has a positive or zero slope and its maximum at $x=1$, with a value of $$2-\alpha-\beta+\alpha-1=1-\beta.$$ We want this to be negative, which is equivalent to $\beta>1$. The parameter combinations of $\alpha+\beta\leq2$ and $\beta>1$ are shown by the dark gray area in the diagram. The total area is exactly $\alpha<1$ and $\beta>1$. Here are a few such beta PDFs: R code for the plots: plot(0,0,xlim=c(0,3),ylim=c(0,3),type="n",xlab="alpha",ylab="beta",las=1) polygon(c(0,1,1,0),c(2,1,3,3),col="lightgray",border=NA) polygon(c(0,1,0),c(1,1,2),col="darkgray",border=NA) lines(c(0,2),c(2,0),lwd=2) xx <- seq(0,1,.01) plot(xx,dbeta(xx,shape1=.3,shape2=2),type="l",las=1,xlab="",ylab="") lines(xx,dbeta(xx,shape1=.7,shape2=1.4)) lines(xx,dbeta(xx,shape1=.3,shape2=1.1))
Exponential-like distribution with support [0,1]
The beta distribution will work if and only if $\alpha<1$ and $\beta>1$ (one of the two inequalities can be replaced by $\leq$ and $\geq$ if you don't mind a flat PDF at $x=0$ or $x=1$.) Its PDF is $$
Exponential-like distribution with support [0,1] The beta distribution will work if and only if $\alpha<1$ and $\beta>1$ (one of the two inequalities can be replaced by $\leq$ and $\geq$ if you don't mind a flat PDF at $x=0$ or $x=1$.) Its PDF is $$ f(x)=\frac{x^{\alpha-1}(1-x)^{\beta-1}}{B(\alpha,\beta)}, $$ so its derivative is $$ f'(x) = \frac{x^{\alpha-2}(1-x)^{\beta-2}}{B(\alpha,\beta)}\big((\alpha-1)(1-x)-(\beta-1)x\big). $$ For the PDF to be strictly monotonically decreasing for $0<x<1$, we need $$(\alpha-1)(1-x)-(\beta-1)x=(2-\alpha-\beta)x+\alpha-1<0$$ on this interval. This describes a linear function of $x$, so it has its maximum (which we need to be negative) at either $x=0$ or $x=1$, depending on the sign of the slope $2-\alpha-\beta$. We thus have two cases: Case 1: $2-\alpha-\beta<0$, or $\alpha+\beta>2$. Then our linear function has a negative slope and its maximum at $x=0$, with value $\alpha-1$, so we need $\alpha<1$. The parameter combinations $\alpha+\beta>2$ and $\alpha<1$ are shown by the light gray area in the diagram below. (The bold line is $\alpha+\beta=2$.) Case 2: $2-\alpha-\beta\geq0$, or $\alpha+\beta\leq2$. Then our linear function has a positive or zero slope and its maximum at $x=1$, with a value of $$2-\alpha-\beta+\alpha-1=1-\beta.$$ We want this to be negative, which is equivalent to $\beta>1$. The parameter combinations of $\alpha+\beta\leq2$ and $\beta>1$ are shown by the dark gray area in the diagram. The total area is exactly $\alpha<1$ and $\beta>1$. Here are a few such beta PDFs: R code for the plots: plot(0,0,xlim=c(0,3),ylim=c(0,3),type="n",xlab="alpha",ylab="beta",las=1) polygon(c(0,1,1,0),c(2,1,3,3),col="lightgray",border=NA) polygon(c(0,1,0),c(1,1,2),col="darkgray",border=NA) lines(c(0,2),c(2,0),lwd=2) xx <- seq(0,1,.01) plot(xx,dbeta(xx,shape1=.3,shape2=2),type="l",las=1,xlab="",ylab="") lines(xx,dbeta(xx,shape1=.7,shape2=1.4)) lines(xx,dbeta(xx,shape1=.3,shape2=1.1))
Exponential-like distribution with support [0,1] The beta distribution will work if and only if $\alpha<1$ and $\beta>1$ (one of the two inequalities can be replaced by $\leq$ and $\geq$ if you don't mind a flat PDF at $x=0$ or $x=1$.) Its PDF is $$
26,991
Exponential-like distribution with support [0,1]
The beta distribution can have $\alpha$ and $\beta$ set such that it is: Monotonically decreasing Supported on $[0, 1]$ Have a look at the example on Wikipedia where $\alpha = 1, \, \beta = 3$, for instance. There are also readily available implementations of beta regression in R (e.g. betareg), if that is what you want to use it for.
Exponential-like distribution with support [0,1]
The beta distribution can have $\alpha$ and $\beta$ set such that it is: Monotonically decreasing Supported on $[0, 1]$ Have a look at the example on Wikipedia where $\alpha = 1, \, \beta = 3$, for
Exponential-like distribution with support [0,1] The beta distribution can have $\alpha$ and $\beta$ set such that it is: Monotonically decreasing Supported on $[0, 1]$ Have a look at the example on Wikipedia where $\alpha = 1, \, \beta = 3$, for instance. There are also readily available implementations of beta regression in R (e.g. betareg), if that is what you want to use it for.
Exponential-like distribution with support [0,1] The beta distribution can have $\alpha$ and $\beta$ set such that it is: Monotonically decreasing Supported on $[0, 1]$ Have a look at the example on Wikipedia where $\alpha = 1, \, \beta = 3$, for
26,992
Exponential-like distribution with support [0,1]
There are infinitely many functions that can generate a distribution that is monotonically decreasing and has a support [0,1] (by integrating a positive function adding an integration constant and properly normalizing) You are looking for a named distribution. That will reduce the options. But you still have many options left and this is a very broad question. (It also becomes unclear because it just depends on how far you go with accepting names, e.g. will "mixture-of-a-triangle-and-a-uniform-distribution" be considered as a 'name'?) The beta distribution is just the tip of the iceberg. For instance, many truncated distributions will work as well (for a subset of the parameters). The 'truncated exponential distribution' came to my mind the first while reading this question. But something less in intuitive, like a truncated normal distribution (with $\mu<0$), also follows the conditions. This question is very similar to Common Continuous Distributions with [0,1] support . You could take a look at this list of probability distributions with supported on a bounded interval on Wikipedia. Not all of those distributions will work, but quite some will work with suitable limits of the parameters. Since there are many options. If you are looking for some distribution to use in a particular problem, then you will need additional conditions/context/requirements in order to be able to make a choice.
Exponential-like distribution with support [0,1]
There are infinitely many functions that can generate a distribution that is monotonically decreasing and has a support [0,1] (by integrating a positive function adding an integration constant and pro
Exponential-like distribution with support [0,1] There are infinitely many functions that can generate a distribution that is monotonically decreasing and has a support [0,1] (by integrating a positive function adding an integration constant and properly normalizing) You are looking for a named distribution. That will reduce the options. But you still have many options left and this is a very broad question. (It also becomes unclear because it just depends on how far you go with accepting names, e.g. will "mixture-of-a-triangle-and-a-uniform-distribution" be considered as a 'name'?) The beta distribution is just the tip of the iceberg. For instance, many truncated distributions will work as well (for a subset of the parameters). The 'truncated exponential distribution' came to my mind the first while reading this question. But something less in intuitive, like a truncated normal distribution (with $\mu<0$), also follows the conditions. This question is very similar to Common Continuous Distributions with [0,1] support . You could take a look at this list of probability distributions with supported on a bounded interval on Wikipedia. Not all of those distributions will work, but quite some will work with suitable limits of the parameters. Since there are many options. If you are looking for some distribution to use in a particular problem, then you will need additional conditions/context/requirements in order to be able to make a choice.
Exponential-like distribution with support [0,1] There are infinitely many functions that can generate a distribution that is monotonically decreasing and has a support [0,1] (by integrating a positive function adding an integration constant and pro
26,993
Practical (not theoretical) examples of where a 1 sided test would be valid?
I would disagree that one-sided tests are academic and claim that they are more often used in industrial applications. Based on personal experience with journal referees, I would even go so far as to say that there is some bias against one-sided tests in (social science) academia. Most modern textbooks devote very little attention to them. There is some opposition in tech as well. There is a good list of pro and against examples here, going all the way back to Fisher in the 1930s. Equivalentce and non-inferiority tests in medical trials are another example. While there is no firm boundary between science in academia and industry, the distinction is still useful. I suspect that academic science is more concerned with demonstrating the existence/nonexistence of relationships, which needs two sides. But industrial scientists focus more on directional questions, where one-sided makes more sense and is more efficient. Efficient here means allowing for more/shorter experiments, with quicker feedback on ideas. This efficiency comes at the cost of partially unbounded confidence intervals. For practical advice, the question should determine the test: Is A any different from B? $\rightarrow$ two-sided test. Is A any worse/better than B? $\rightarrow$ one-sided tests. Both tests should be combined with pre-registration, ex-ante power calculations, and robustness checks to be safe. Switching to one-sided to get significance after peeking at the data is a bad idea. There is also nothing wrong with running another experiment when you see an effect in the other, unexpected direction. Questions or claims that produce two-sided tests tend to look like this: Is there any relationship between Y and X? (existence) X has no influence on Y whatsoever (nonexistence) X has no relationship with Y (also nonexistence) A is not any different from B (nonexistence again) One-sided tests come from directional questions: Is A better than B? Is doing X worse than doing Y? Is A better than B by at least k? Is the change in Y associated with changing X less than m? Here are two final examples from the business world. You are evaluating a marketing campaign for your company. You need the added revenue from advertising to exceed the cost of showing the ad. For the decision about launching the campaign, you don't care if the ad drives away customers; you would not launch it anyway. Quantifying the uncertainty about just how terrible the effect is wasteful. You are considering reducing the number of photos taken per product to lower photography costs and hosting expenses. You need to make sure that the dip in sales is smaller than the savings from shorter photoshoots.
Practical (not theoretical) examples of where a 1 sided test would be valid?
I would disagree that one-sided tests are academic and claim that they are more often used in industrial applications. Based on personal experience with journal referees, I would even go so far as to
Practical (not theoretical) examples of where a 1 sided test would be valid? I would disagree that one-sided tests are academic and claim that they are more often used in industrial applications. Based on personal experience with journal referees, I would even go so far as to say that there is some bias against one-sided tests in (social science) academia. Most modern textbooks devote very little attention to them. There is some opposition in tech as well. There is a good list of pro and against examples here, going all the way back to Fisher in the 1930s. Equivalentce and non-inferiority tests in medical trials are another example. While there is no firm boundary between science in academia and industry, the distinction is still useful. I suspect that academic science is more concerned with demonstrating the existence/nonexistence of relationships, which needs two sides. But industrial scientists focus more on directional questions, where one-sided makes more sense and is more efficient. Efficient here means allowing for more/shorter experiments, with quicker feedback on ideas. This efficiency comes at the cost of partially unbounded confidence intervals. For practical advice, the question should determine the test: Is A any different from B? $\rightarrow$ two-sided test. Is A any worse/better than B? $\rightarrow$ one-sided tests. Both tests should be combined with pre-registration, ex-ante power calculations, and robustness checks to be safe. Switching to one-sided to get significance after peeking at the data is a bad idea. There is also nothing wrong with running another experiment when you see an effect in the other, unexpected direction. Questions or claims that produce two-sided tests tend to look like this: Is there any relationship between Y and X? (existence) X has no influence on Y whatsoever (nonexistence) X has no relationship with Y (also nonexistence) A is not any different from B (nonexistence again) One-sided tests come from directional questions: Is A better than B? Is doing X worse than doing Y? Is A better than B by at least k? Is the change in Y associated with changing X less than m? Here are two final examples from the business world. You are evaluating a marketing campaign for your company. You need the added revenue from advertising to exceed the cost of showing the ad. For the decision about launching the campaign, you don't care if the ad drives away customers; you would not launch it anyway. Quantifying the uncertainty about just how terrible the effect is wasteful. You are considering reducing the number of photos taken per product to lower photography costs and hosting expenses. You need to make sure that the dip in sales is smaller than the savings from shorter photoshoots.
Practical (not theoretical) examples of where a 1 sided test would be valid? I would disagree that one-sided tests are academic and claim that they are more often used in industrial applications. Based on personal experience with journal referees, I would even go so far as to
26,994
Practical (not theoretical) examples of where a 1 sided test would be valid?
I know its generally accepted that the 2 sided test is the Gold Standard This is highly contextual at best; there are many statistical tests where only one-sided versions of this test are used (e.g., most tests of variance, ANOVA tests, chi-squared tests, etc.). I presume what you have in mind is the one-sided or two-sided test for something like a test of the mean where both variations exist and are in common use (see this related question and answer). Assuming this context, the reason that two-sided tests are generally preferred in this context is that one-sided tests sometimes occur when the analyst has used the data to first formulate a one-sided hypothesis, and this biases the test. Consequently, use of one-sided tests is sometimes viewed with scepticism and raises some immediate questions: Why did you choose to test that one-sided hypothesis instead of the other one? Was your choice of hypothesis affected by the data? One of the curious and somewhat unfortunate properties of a classical hypothesis test is that the p-value cannot be compared rationally across different tests. In particular, when comparing a one-sided and two-sided version of the test, the same evidence in favour of the (one-sided) hypothesis will give a p-value that is half as much in the one-sided test as in the two-sided test. This means that, if you were to compare p-values across the two tests, the evidence appears to be stronger for the narrower hypothesis, which is of course absurd. This means that hypothesis tests do not follow the kinds of desiderata we would like them to when you compare across tests, which means we have to be very careful when choosing and interpreting tests. For this reason, I tend to take a hard line on this issue and require that you should always use the two-sided version of tests of this kind (i.e., tests which have a natural one and two-sided version). Other statisticians are more liberal on this issue and may be satisfied with a one-sided test if they are confidence that the choice of the side was made a priori and was not affected by the data.
Practical (not theoretical) examples of where a 1 sided test would be valid?
I know its generally accepted that the 2 sided test is the Gold Standard This is highly contextual at best; there are many statistical tests where only one-sided versions of this test are used (e.g.,
Practical (not theoretical) examples of where a 1 sided test would be valid? I know its generally accepted that the 2 sided test is the Gold Standard This is highly contextual at best; there are many statistical tests where only one-sided versions of this test are used (e.g., most tests of variance, ANOVA tests, chi-squared tests, etc.). I presume what you have in mind is the one-sided or two-sided test for something like a test of the mean where both variations exist and are in common use (see this related question and answer). Assuming this context, the reason that two-sided tests are generally preferred in this context is that one-sided tests sometimes occur when the analyst has used the data to first formulate a one-sided hypothesis, and this biases the test. Consequently, use of one-sided tests is sometimes viewed with scepticism and raises some immediate questions: Why did you choose to test that one-sided hypothesis instead of the other one? Was your choice of hypothesis affected by the data? One of the curious and somewhat unfortunate properties of a classical hypothesis test is that the p-value cannot be compared rationally across different tests. In particular, when comparing a one-sided and two-sided version of the test, the same evidence in favour of the (one-sided) hypothesis will give a p-value that is half as much in the one-sided test as in the two-sided test. This means that, if you were to compare p-values across the two tests, the evidence appears to be stronger for the narrower hypothesis, which is of course absurd. This means that hypothesis tests do not follow the kinds of desiderata we would like them to when you compare across tests, which means we have to be very careful when choosing and interpreting tests. For this reason, I tend to take a hard line on this issue and require that you should always use the two-sided version of tests of this kind (i.e., tests which have a natural one and two-sided version). Other statisticians are more liberal on this issue and may be satisfied with a one-sided test if they are confidence that the choice of the side was made a priori and was not affected by the data.
Practical (not theoretical) examples of where a 1 sided test would be valid? I know its generally accepted that the 2 sided test is the Gold Standard This is highly contextual at best; there are many statistical tests where only one-sided versions of this test are used (e.g.,
26,995
Practical (not theoretical) examples of where a 1 sided test would be valid?
The F-test in a traditional ANOVA is (and should be) one-sided. (This is not to be confused with using an F-test to compare two group variances, analogous to using a t-test to compare two group means. Such an F-test could be very reasonable.) Loosely speaking, ANOVA assesses if the variance between the group means overwhelms the variance within the data overall. That is, we care if the "between" variance is greater than the "within" variance. If the "between" variance is less than the "within" variance, then that provides no evidence in favor of our alternative hypothesis that "between" variance is greater than "within" variance. Consequently, we only look at one side of the F-distribution to calculate the p-value.
Practical (not theoretical) examples of where a 1 sided test would be valid?
The F-test in a traditional ANOVA is (and should be) one-sided. (This is not to be confused with using an F-test to compare two group variances, analogous to using a t-test to compare two group means.
Practical (not theoretical) examples of where a 1 sided test would be valid? The F-test in a traditional ANOVA is (and should be) one-sided. (This is not to be confused with using an F-test to compare two group variances, analogous to using a t-test to compare two group means. Such an F-test could be very reasonable.) Loosely speaking, ANOVA assesses if the variance between the group means overwhelms the variance within the data overall. That is, we care if the "between" variance is greater than the "within" variance. If the "between" variance is less than the "within" variance, then that provides no evidence in favor of our alternative hypothesis that "between" variance is greater than "within" variance. Consequently, we only look at one side of the F-distribution to calculate the p-value.
Practical (not theoretical) examples of where a 1 sided test would be valid? The F-test in a traditional ANOVA is (and should be) one-sided. (This is not to be confused with using an F-test to compare two group variances, analogous to using a t-test to compare two group means.
26,996
Practical (not theoretical) examples of where a 1 sided test would be valid?
One sided significance tests are useful most of the time that you want an index of the strength of evidence in the data against the null hypothesis according to the statistical model. That is to say, most of the time that a significance test might be used. That means that practical examples abound, even where they mostly illustrate how two-sided testing is used where one-sided is at least as appropriate. People frequently use P-values from two-sided tests because they are expected to do so, not because one sided tests are inappropriate. Standard arguments in favour of two-sided testing are almost exclusively relevant to hypothesis testing, not significance testing. If you are unsure why I would draw a distinction between hypothesis testing and significance testing then you should start reading about that before you try to sort out the number of tails you should be testing against. See this question for a good start: What is the difference between "testing of hypothesis" and "test of significance"? When you are thinking about the evidential meaning of data according to a statistical model it is natural to look at likelihood functions, and indeed there is a one to one relationship between significance test-derived P-values and likelihood functions. Two-sided P-values point to likelihood function that are bimodal whereas the natural interpretation of evidence would yield unimodal likelihood functions from those same data. The one-sided P-value is the index to those unimodal likelihood functions. See here for a full explanation of the relationship between P-values and likelihood functions: https://arxiv.org/pdf/1311.0081.pdf This chapter explains the distinction between significance tests and hypothesis tests and how P-values can be used to support scientific inferences: https://rest.neptune-prod.its.unimelb.edu.au/server/api/core/bitstreams/1d20d0cb-f3d3-5e23-be16-c20b735f8568/content
Practical (not theoretical) examples of where a 1 sided test would be valid?
One sided significance tests are useful most of the time that you want an index of the strength of evidence in the data against the null hypothesis according to the statistical model. That is to say,
Practical (not theoretical) examples of where a 1 sided test would be valid? One sided significance tests are useful most of the time that you want an index of the strength of evidence in the data against the null hypothesis according to the statistical model. That is to say, most of the time that a significance test might be used. That means that practical examples abound, even where they mostly illustrate how two-sided testing is used where one-sided is at least as appropriate. People frequently use P-values from two-sided tests because they are expected to do so, not because one sided tests are inappropriate. Standard arguments in favour of two-sided testing are almost exclusively relevant to hypothesis testing, not significance testing. If you are unsure why I would draw a distinction between hypothesis testing and significance testing then you should start reading about that before you try to sort out the number of tails you should be testing against. See this question for a good start: What is the difference between "testing of hypothesis" and "test of significance"? When you are thinking about the evidential meaning of data according to a statistical model it is natural to look at likelihood functions, and indeed there is a one to one relationship between significance test-derived P-values and likelihood functions. Two-sided P-values point to likelihood function that are bimodal whereas the natural interpretation of evidence would yield unimodal likelihood functions from those same data. The one-sided P-value is the index to those unimodal likelihood functions. See here for a full explanation of the relationship between P-values and likelihood functions: https://arxiv.org/pdf/1311.0081.pdf This chapter explains the distinction between significance tests and hypothesis tests and how P-values can be used to support scientific inferences: https://rest.neptune-prod.its.unimelb.edu.au/server/api/core/bitstreams/1d20d0cb-f3d3-5e23-be16-c20b735f8568/content
Practical (not theoretical) examples of where a 1 sided test would be valid? One sided significance tests are useful most of the time that you want an index of the strength of evidence in the data against the null hypothesis according to the statistical model. That is to say,
26,997
Practical (not theoretical) examples of where a 1 sided test would be valid?
Some Scenarios I wanted to focus on one particular part of your question: I just wanted to see if there are real life, practical applications of the 1 sided test in the real world Here are some practical examples: "Is my company's starting salary larger than a rival company?" "Do students at my school receive less student aid than other schools?" "Are people from my graduating class taller than other classes before me?" These are all questions that can be answered by one-sided tests. However, this is also where hypothesis testing is very important. Using the first example, we may have a litany of informal evidence that seems to suggest salaries are greater at another company (feedback from employees there, bigger offices at their company, etc.). Rather than just asking ourselves "are their salaries different from ours?" an easier question to answer may be the one already posed: are they higher? Knowing this information would be super useful if you decided to change companies down the road. Remember that your chances of rejecting the null hypothesis in one direction increase as a result of how big the tail is compared to a two-tailed test, with the caveat that you can only test one region. Recall that a two-tailed rejection region is larger than a one-tailed region: Having a strong idea of what the outcome should be ensures that this test answers your question in a more direct way than a two-tailed test. Practical Example Using R To simulate this specific scenario, I have created two normally distributed "salary" values for two banks: Bank of America (BOA) and CitiBank. Adjusting their means to only be slightly divergent, we can then test this with a t-test using a one-tail test. #### Simulate Groups #### set.seed(123) group.1 <- rnorm(n = 1000, mean = 100000, sd = 10000) group.2 <- rnorm(n = 1000, mean = 120000, sd = 5000) df <- data.frame(CitiBank = group.1, BOA = group.2) #### Test Groups #### t.test(group.2, group.1, alternative = "greater") And you can see the test is significant: Welch Two Sample t-test data: group.2 and group.1 t = 56.98, df = 1484.2, p-value < 2.2e-16 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: 19471.87 Inf sample estimates: mean of x mean of y 120212.3 100161.3 However, if we plot the critical cutoff zones used for a two-tailed test and compare them to a one-tailed test: #### Plot #### library(tidyverse) library(ggpubr) p1 <- df %>% gather() %>% ggplot(aes(x=value, fill=key))+ geom_density(alpha = .5, linewidth = 1)+ theme_classic()+ scale_fill_manual(values = c("black","white"))+ geom_vline(aes(xintercept = mean(group.1)), color = "red", linetype = "dashed", linewidth = 1)+ geom_vline(aes(xintercept = mean(group.2)), color = "red", linetype = "dashed", linewidth = 1)+ geom_vline(aes(xintercept = mean(group.1) + 1.96*sd(group.1)), color = "blue", linetype = "dashed", linewidth = 1)+ geom_vline(aes(xintercept = mean(group.1) - 1.96*sd(group.1)), color = "blue", linetype = "dashed", linewidth = 1)+ labs(x="Salary", y = "Density", fill = "Group", title = "Salary Comparison with Two-Tailed Test")+ scale_x_continuous(n.breaks = 10) p2 <- df %>% gather() %>% ggplot(aes(x=value, fill=key))+ geom_density(alpha = .5, linewidth = 1)+ theme_classic()+ scale_fill_manual(values = c("black","white"))+ geom_vline(aes(xintercept = mean(group.1)), color = "red", linetype = "dashed", linewidth = 1)+ geom_vline(aes(xintercept = mean(group.2)), color = "red", linetype = "dashed", linewidth = 1)+ geom_vline(aes(xintercept = mean(group.1) + 1.645*sd(group.1)), color = "blue", linetype = "dashed", linewidth = 1)+ labs(x="Salary", y = "Density", fill = "Group", title = "Salary Comparison with One-Tailed Test")+ scale_x_continuous(n.breaks = 10) ggarrange(p1,p2, ncol = 1) You will get these plots: The red dashed lines are the means of each group and the blue dashed lines are the critical regions to reject the null. The plot on top shows cutoffs for the two-tailed test whereas the plot on the bottom shows a one-tailed test. You can see that for the two-tailed test we barely pass the cutoff criterion. However, we have far surpassed it in the one-tailed case. You can see clearly that Bank of America pays more. If you were to make a judgement call about which bank to work for, which would you choose? A two-tailed test may have given you a misfire if the means were slightly different from each other. This should highlight the practicality of the test as well as why strong hypotheses are helpful to answering these questions.
Practical (not theoretical) examples of where a 1 sided test would be valid?
Some Scenarios I wanted to focus on one particular part of your question: I just wanted to see if there are real life, practical applications of the 1 sided test in the real world Here are some prac
Practical (not theoretical) examples of where a 1 sided test would be valid? Some Scenarios I wanted to focus on one particular part of your question: I just wanted to see if there are real life, practical applications of the 1 sided test in the real world Here are some practical examples: "Is my company's starting salary larger than a rival company?" "Do students at my school receive less student aid than other schools?" "Are people from my graduating class taller than other classes before me?" These are all questions that can be answered by one-sided tests. However, this is also where hypothesis testing is very important. Using the first example, we may have a litany of informal evidence that seems to suggest salaries are greater at another company (feedback from employees there, bigger offices at their company, etc.). Rather than just asking ourselves "are their salaries different from ours?" an easier question to answer may be the one already posed: are they higher? Knowing this information would be super useful if you decided to change companies down the road. Remember that your chances of rejecting the null hypothesis in one direction increase as a result of how big the tail is compared to a two-tailed test, with the caveat that you can only test one region. Recall that a two-tailed rejection region is larger than a one-tailed region: Having a strong idea of what the outcome should be ensures that this test answers your question in a more direct way than a two-tailed test. Practical Example Using R To simulate this specific scenario, I have created two normally distributed "salary" values for two banks: Bank of America (BOA) and CitiBank. Adjusting their means to only be slightly divergent, we can then test this with a t-test using a one-tail test. #### Simulate Groups #### set.seed(123) group.1 <- rnorm(n = 1000, mean = 100000, sd = 10000) group.2 <- rnorm(n = 1000, mean = 120000, sd = 5000) df <- data.frame(CitiBank = group.1, BOA = group.2) #### Test Groups #### t.test(group.2, group.1, alternative = "greater") And you can see the test is significant: Welch Two Sample t-test data: group.2 and group.1 t = 56.98, df = 1484.2, p-value < 2.2e-16 alternative hypothesis: true difference in means is greater than 0 95 percent confidence interval: 19471.87 Inf sample estimates: mean of x mean of y 120212.3 100161.3 However, if we plot the critical cutoff zones used for a two-tailed test and compare them to a one-tailed test: #### Plot #### library(tidyverse) library(ggpubr) p1 <- df %>% gather() %>% ggplot(aes(x=value, fill=key))+ geom_density(alpha = .5, linewidth = 1)+ theme_classic()+ scale_fill_manual(values = c("black","white"))+ geom_vline(aes(xintercept = mean(group.1)), color = "red", linetype = "dashed", linewidth = 1)+ geom_vline(aes(xintercept = mean(group.2)), color = "red", linetype = "dashed", linewidth = 1)+ geom_vline(aes(xintercept = mean(group.1) + 1.96*sd(group.1)), color = "blue", linetype = "dashed", linewidth = 1)+ geom_vline(aes(xintercept = mean(group.1) - 1.96*sd(group.1)), color = "blue", linetype = "dashed", linewidth = 1)+ labs(x="Salary", y = "Density", fill = "Group", title = "Salary Comparison with Two-Tailed Test")+ scale_x_continuous(n.breaks = 10) p2 <- df %>% gather() %>% ggplot(aes(x=value, fill=key))+ geom_density(alpha = .5, linewidth = 1)+ theme_classic()+ scale_fill_manual(values = c("black","white"))+ geom_vline(aes(xintercept = mean(group.1)), color = "red", linetype = "dashed", linewidth = 1)+ geom_vline(aes(xintercept = mean(group.2)), color = "red", linetype = "dashed", linewidth = 1)+ geom_vline(aes(xintercept = mean(group.1) + 1.645*sd(group.1)), color = "blue", linetype = "dashed", linewidth = 1)+ labs(x="Salary", y = "Density", fill = "Group", title = "Salary Comparison with One-Tailed Test")+ scale_x_continuous(n.breaks = 10) ggarrange(p1,p2, ncol = 1) You will get these plots: The red dashed lines are the means of each group and the blue dashed lines are the critical regions to reject the null. The plot on top shows cutoffs for the two-tailed test whereas the plot on the bottom shows a one-tailed test. You can see that for the two-tailed test we barely pass the cutoff criterion. However, we have far surpassed it in the one-tailed case. You can see clearly that Bank of America pays more. If you were to make a judgement call about which bank to work for, which would you choose? A two-tailed test may have given you a misfire if the means were slightly different from each other. This should highlight the practicality of the test as well as why strong hypotheses are helpful to answering these questions.
Practical (not theoretical) examples of where a 1 sided test would be valid? Some Scenarios I wanted to focus on one particular part of your question: I just wanted to see if there are real life, practical applications of the 1 sided test in the real world Here are some prac
26,998
What does it mean for a statistical test to have a power of 0.8?
You'll hear "this test has 80% power" as shorthand for a better statement like: "under a bunch of assumptions, including but not limited to this particular sample size and this particular true effect size, this test has an 80% probability of rejecting the null hypothesis with a two-sided alternative at a 5% significance level". Don't try to make sense of a statement like "this test has 80% power" unless there is a lot more detail provided. Any statement about power that is four words long is leaving out so much detail that it's effectively meaningless.
What does it mean for a statistical test to have a power of 0.8?
You'll hear "this test has 80% power" as shorthand for a better statement like: "under a bunch of assumptions, including but not limited to this particular sample size and this particular true effect
What does it mean for a statistical test to have a power of 0.8? You'll hear "this test has 80% power" as shorthand for a better statement like: "under a bunch of assumptions, including but not limited to this particular sample size and this particular true effect size, this test has an 80% probability of rejecting the null hypothesis with a two-sided alternative at a 5% significance level". Don't try to make sense of a statement like "this test has 80% power" unless there is a lot more detail provided. Any statement about power that is four words long is leaving out so much detail that it's effectively meaningless.
What does it mean for a statistical test to have a power of 0.8? You'll hear "this test has 80% power" as shorthand for a better statement like: "under a bunch of assumptions, including but not limited to this particular sample size and this particular true effect
26,999
What does it mean for a statistical test to have a power of 0.8?
Statistical power is a function of statistical test, acceptable type I error rate, sample size, and effect size. It also depends on adherence to assumptions made about the data, such as assumptions of normality, independence of observations, etc, but often in a power analysis these are taken to be as presumed by the test used. It seems like you are asking if the power is the same for all possible differences: no, the effect size has a strong influence on power for a given sample size.
What does it mean for a statistical test to have a power of 0.8?
Statistical power is a function of statistical test, acceptable type I error rate, sample size, and effect size. It also depends on adherence to assumptions made about the data, such as assumptions of
What does it mean for a statistical test to have a power of 0.8? Statistical power is a function of statistical test, acceptable type I error rate, sample size, and effect size. It also depends on adherence to assumptions made about the data, such as assumptions of normality, independence of observations, etc, but often in a power analysis these are taken to be as presumed by the test used. It seems like you are asking if the power is the same for all possible differences: no, the effect size has a strong influence on power for a given sample size.
What does it mean for a statistical test to have a power of 0.8? Statistical power is a function of statistical test, acceptable type I error rate, sample size, and effect size. It also depends on adherence to assumptions made about the data, such as assumptions of
27,000
In an experiment, why can you select your own alpha level for significance testing?
When you conduct a statistical test, basically it outputs a p-value that you do not choose. This p-value ($p$) tells you that if the null hypothesis is true and the test assumptions are met, then you'd see a result at least as extreme as the one you're seeing $p \times 100$% of times, if you were to repeat the experiment a lot of times. The alpha level ($a$) you choose before conducting the test is not the p-value that the test outputs. Your question seems to assume that $p$ and $a$ are the same, but they are two separate things. Alpha is a threshold that you choose, and use to decide if the p-value returned by the test is significant or not. Ideally, this threshold should make sense and be relevant. An alpha level that makes sense depends on the context of the study you're conducting. In particular, you should think about the consequences of choosing an alpha level that is too conservative or too liberal (e.g. would some people get hurt if you incorrectly reject the null hypothesis and then take some decision based on that? Would the study cost too much to conduct if you set a too small alpha level? etc.). Here is a simple example that hopefully should make things clearer if your confusion came from the difference between $p$ and $a$: You decide to use an alpha level of 0.05 before conducting your experiment and statistical analysis, based on your knowledge of the consequences that this alpha level would have in your specific situation. Then, you conduct your experiment, and after that you conduct a statistical test on the data you collected. The statistical test returns a p-value of 0.00001: the result is significant according to the threshold you pre-specified, as $0.00001 < 0.05$. Had the test returned a p-value of 0.3, the result would have not been significant according to the criteria you pre-specified, as $ 0.3 > 0.05$.
In an experiment, why can you select your own alpha level for significance testing?
When you conduct a statistical test, basically it outputs a p-value that you do not choose. This p-value ($p$) tells you that if the null hypothesis is true and the test assumptions are met, then you'
In an experiment, why can you select your own alpha level for significance testing? When you conduct a statistical test, basically it outputs a p-value that you do not choose. This p-value ($p$) tells you that if the null hypothesis is true and the test assumptions are met, then you'd see a result at least as extreme as the one you're seeing $p \times 100$% of times, if you were to repeat the experiment a lot of times. The alpha level ($a$) you choose before conducting the test is not the p-value that the test outputs. Your question seems to assume that $p$ and $a$ are the same, but they are two separate things. Alpha is a threshold that you choose, and use to decide if the p-value returned by the test is significant or not. Ideally, this threshold should make sense and be relevant. An alpha level that makes sense depends on the context of the study you're conducting. In particular, you should think about the consequences of choosing an alpha level that is too conservative or too liberal (e.g. would some people get hurt if you incorrectly reject the null hypothesis and then take some decision based on that? Would the study cost too much to conduct if you set a too small alpha level? etc.). Here is a simple example that hopefully should make things clearer if your confusion came from the difference between $p$ and $a$: You decide to use an alpha level of 0.05 before conducting your experiment and statistical analysis, based on your knowledge of the consequences that this alpha level would have in your specific situation. Then, you conduct your experiment, and after that you conduct a statistical test on the data you collected. The statistical test returns a p-value of 0.00001: the result is significant according to the threshold you pre-specified, as $0.00001 < 0.05$. Had the test returned a p-value of 0.3, the result would have not been significant according to the criteria you pre-specified, as $ 0.3 > 0.05$.
In an experiment, why can you select your own alpha level for significance testing? When you conduct a statistical test, basically it outputs a p-value that you do not choose. This p-value ($p$) tells you that if the null hypothesis is true and the test assumptions are met, then you'