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 |
|---|---|---|---|---|---|---|
20,701 | Compare two survival curves for paired data | If you want to compare the model performance of the two survival models, calculation of the C-statistics (Harrell's C, survival ROC...) might be more reasonable approach. Calculate the C-statistics of the two survival model and compare them (p-value can be obtained).
https://rpubs.com/kaz_yos/survival-auc
The link shows various tool for the C-statistics for survival model. | Compare two survival curves for paired data | If you want to compare the model performance of the two survival models, calculation of the C-statistics (Harrell's C, survival ROC...) might be more reasonable approach. Calculate the C-statistics of | Compare two survival curves for paired data
If you want to compare the model performance of the two survival models, calculation of the C-statistics (Harrell's C, survival ROC...) might be more reasonable approach. Calculate the C-statistics of the two survival model and compare them (p-value can be obtained).
https://rpubs.com/kaz_yos/survival-auc
The link shows various tool for the C-statistics for survival model. | Compare two survival curves for paired data
If you want to compare the model performance of the two survival models, calculation of the C-statistics (Harrell's C, survival ROC...) might be more reasonable approach. Calculate the C-statistics of |
20,702 | Is there an R package for continuous time longitudinal binary responses? | The R package orth may be of some help. Here's a vignette. See also the manual. | Is there an R package for continuous time longitudinal binary responses? | The R package orth may be of some help. Here's a vignette. See also the manual. | Is there an R package for continuous time longitudinal binary responses?
The R package orth may be of some help. Here's a vignette. See also the manual. | Is there an R package for continuous time longitudinal binary responses?
The R package orth may be of some help. Here's a vignette. See also the manual. |
20,703 | Is there an R package for continuous time longitudinal binary responses? | There is the package bild, which stands for "binary longitudinal data analysis." It may help you. | Is there an R package for continuous time longitudinal binary responses? | There is the package bild, which stands for "binary longitudinal data analysis." It may help you. | Is there an R package for continuous time longitudinal binary responses?
There is the package bild, which stands for "binary longitudinal data analysis." It may help you. | Is there an R package for continuous time longitudinal binary responses?
There is the package bild, which stands for "binary longitudinal data analysis." It may help you. |
20,704 | Significance test on the difference of Spearman's correlation coefficient | The paper you cite explains the method in the following terms:
[...] we show the statistical significance of the difference between the
performance of ESA-Wikipedia (March 26, 2006) version) and that of
other algorithms by using Fisher's z-transformation (Press,
Teukolsky,Vetterling, & Flannery, Numerical Recipes in C: The Art of
Scientific Computing. Cambridge University Press, 1997, Section 14.5).
I suggest you follow that reference, or have a look at the Wikipedia page on the Spearman coefficient for details. | Significance test on the difference of Spearman's correlation coefficient | The paper you cite explains the method in the following terms:
[...] we show the statistical significance of the difference between the
performance of ESA-Wikipedia (March 26, 2006) version) and th | Significance test on the difference of Spearman's correlation coefficient
The paper you cite explains the method in the following terms:
[...] we show the statistical significance of the difference between the
performance of ESA-Wikipedia (March 26, 2006) version) and that of
other algorithms by using Fisher's z-transformation (Press,
Teukolsky,Vetterling, & Flannery, Numerical Recipes in C: The Art of
Scientific Computing. Cambridge University Press, 1997, Section 14.5).
I suggest you follow that reference, or have a look at the Wikipedia page on the Spearman coefficient for details. | Significance test on the difference of Spearman's correlation coefficient
The paper you cite explains the method in the following terms:
[...] we show the statistical significance of the difference between the
performance of ESA-Wikipedia (March 26, 2006) version) and th |
20,705 | Are non-square latin hypercubes viable? | I assume by not well defined, they are not arguing from the point of hyper cube versus hyper rectangle, but on the notion of boundaries of the pdfs.
Remember: The basic idea of LHS sampling is to sample with equi-probabilistically. i.e. split a pdf into a equiprobable areas and take a sample from each one. For hyper cubes or rectangles this is quite easy. Just break your $U[a,b]$ uniform distribution into $N$ intervals: $(b-a)/N$.
However if the pdfs are non-square and in high dimensions it can be difficult to define the joint behaviour of the RVs, where some boundaries may end, the shape of equi-probability.
By the way I just realised this question was asked in 2012!!! I must've sorted my question backwards haha. Anyway I hope someone enjoys my answer! :D | Are non-square latin hypercubes viable? | I assume by not well defined, they are not arguing from the point of hyper cube versus hyper rectangle, but on the notion of boundaries of the pdfs.
Remember: The basic idea of LHS sampling is to sam | Are non-square latin hypercubes viable?
I assume by not well defined, they are not arguing from the point of hyper cube versus hyper rectangle, but on the notion of boundaries of the pdfs.
Remember: The basic idea of LHS sampling is to sample with equi-probabilistically. i.e. split a pdf into a equiprobable areas and take a sample from each one. For hyper cubes or rectangles this is quite easy. Just break your $U[a,b]$ uniform distribution into $N$ intervals: $(b-a)/N$.
However if the pdfs are non-square and in high dimensions it can be difficult to define the joint behaviour of the RVs, where some boundaries may end, the shape of equi-probability.
By the way I just realised this question was asked in 2012!!! I must've sorted my question backwards haha. Anyway I hope someone enjoys my answer! :D | Are non-square latin hypercubes viable?
I assume by not well defined, they are not arguing from the point of hyper cube versus hyper rectangle, but on the notion of boundaries of the pdfs.
Remember: The basic idea of LHS sampling is to sam |
20,706 | If p-values are random, why not decide using the test statistic instead? | I think you are almost constructing p-values in the question.
You are correct, you can just set a threshold using $t=T(X)$, but as you point out, you'd like to calculate the error rate associated with that t-value. In order to do so you need to know the null distribution of your test statistic, which is $F$. So in order to find the t-value that has a 5% false positive under the null, you need to find $t$ such that $F(t)=0.05$, i.e. $t=F^{-1}(0.05)$
In many (most?) cases inverting the cdf is harder than evaluating it, hence it is much easier to calculate $p=F(T)$ and then check if $p<0.05$ than to check if $t<F^{-1}(0.05)$ | If p-values are random, why not decide using the test statistic instead? | I think you are almost constructing p-values in the question.
You are correct, you can just set a threshold using $t=T(X)$, but as you point out, you'd like to calculate the error rate associated with | If p-values are random, why not decide using the test statistic instead?
I think you are almost constructing p-values in the question.
You are correct, you can just set a threshold using $t=T(X)$, but as you point out, you'd like to calculate the error rate associated with that t-value. In order to do so you need to know the null distribution of your test statistic, which is $F$. So in order to find the t-value that has a 5% false positive under the null, you need to find $t$ such that $F(t)=0.05$, i.e. $t=F^{-1}(0.05)$
In many (most?) cases inverting the cdf is harder than evaluating it, hence it is much easier to calculate $p=F(T)$ and then check if $p<0.05$ than to check if $t<F^{-1}(0.05)$ | If p-values are random, why not decide using the test statistic instead?
I think you are almost constructing p-values in the question.
You are correct, you can just set a threshold using $t=T(X)$, but as you point out, you'd like to calculate the error rate associated with |
20,707 | If p-values are random, why not decide using the test statistic instead? | $p$-value is a random variable like the test statistic is a random variable, so it's not clear to me what it has to do with the rest of your question. Both are functions of random variables, hence random variables themselves.
Yes, you can use the threshold for the test statistic, but how would you choose it? How would you say that the threshold should be 1.96, 5, or 100? With $p$-values you have a familiar and easily interpretable scale of probabilities, that is not necessarily the case for test statistics. | If p-values are random, why not decide using the test statistic instead? | $p$-value is a random variable like the test statistic is a random variable, so it's not clear to me what it has to do with the rest of your question. Both are functions of random variables, hence ran | If p-values are random, why not decide using the test statistic instead?
$p$-value is a random variable like the test statistic is a random variable, so it's not clear to me what it has to do with the rest of your question. Both are functions of random variables, hence random variables themselves.
Yes, you can use the threshold for the test statistic, but how would you choose it? How would you say that the threshold should be 1.96, 5, or 100? With $p$-values you have a familiar and easily interpretable scale of probabilities, that is not necessarily the case for test statistics. | If p-values are random, why not decide using the test statistic instead?
$p$-value is a random variable like the test statistic is a random variable, so it's not clear to me what it has to do with the rest of your question. Both are functions of random variables, hence ran |
20,708 | If p-values are random, why not decide using the test statistic instead? | I am not sure why we need to compute a p-value in the first place to decide whether or not to reject a null hypothesis.
We do not need to compute a p-value for hypothesis testing. We can do indeed what you suggest and compute a threshold value. An example is a likelihood ratio test as described by Neyman and Pearson. The example below from wikipedia uses a threshold value $\eta$ for the likelihood ratio
Define the rejection region of the null hypothesis for the Neyman–Pearson (NP) test as $$R_{NP} = \left\{ x: \frac{\mathcal{L}(\theta_0|x)}{\mathcal{L}(\theta_1|x)} \leq \eta \right\}$$ where $\eta$ is chosen so that $P( R_{NP} | \theta_0 ) = \alpha$ .
Why still compute the p-values?
Because it is not all about hypothesis testing.
For instance, often you want to provide a more detailed value than just a 'pass' or 'not-pass'. | If p-values are random, why not decide using the test statistic instead? | I am not sure why we need to compute a p-value in the first place to decide whether or not to reject a null hypothesis.
We do not need to compute a p-value for hypothesis testing. We can do indeed wh | If p-values are random, why not decide using the test statistic instead?
I am not sure why we need to compute a p-value in the first place to decide whether or not to reject a null hypothesis.
We do not need to compute a p-value for hypothesis testing. We can do indeed what you suggest and compute a threshold value. An example is a likelihood ratio test as described by Neyman and Pearson. The example below from wikipedia uses a threshold value $\eta$ for the likelihood ratio
Define the rejection region of the null hypothesis for the Neyman–Pearson (NP) test as $$R_{NP} = \left\{ x: \frac{\mathcal{L}(\theta_0|x)}{\mathcal{L}(\theta_1|x)} \leq \eta \right\}$$ where $\eta$ is chosen so that $P( R_{NP} | \theta_0 ) = \alpha$ .
Why still compute the p-values?
Because it is not all about hypothesis testing.
For instance, often you want to provide a more detailed value than just a 'pass' or 'not-pass'. | If p-values are random, why not decide using the test statistic instead?
I am not sure why we need to compute a p-value in the first place to decide whether or not to reject a null hypothesis.
We do not need to compute a p-value for hypothesis testing. We can do indeed wh |
20,709 | If p-values are random, why not decide using the test statistic instead? | You're absolutely right. To perform a test of a fixed size, we don't need p-values at all. We may just define a rejection region of that size in terms of the test-statistic.
Possible advantages of reporting p, though, include that
readers may (if they reader wish) interpret p as a measure of evidence a la Fisher
readers may bring their own error rate, $\alpha$, to compare with your p
it may be computationally easier to compute p and compare it with the desired error rate, than invert the desired error rate to find the boundaries of the critical region of the test-statistic
readers may perform further calculations with p, such as adjusting p for multiple comparisons or converting it to a bound on a Bayes factor etc | If p-values are random, why not decide using the test statistic instead? | You're absolutely right. To perform a test of a fixed size, we don't need p-values at all. We may just define a rejection region of that size in terms of the test-statistic.
Possible advantages of rep | If p-values are random, why not decide using the test statistic instead?
You're absolutely right. To perform a test of a fixed size, we don't need p-values at all. We may just define a rejection region of that size in terms of the test-statistic.
Possible advantages of reporting p, though, include that
readers may (if they reader wish) interpret p as a measure of evidence a la Fisher
readers may bring their own error rate, $\alpha$, to compare with your p
it may be computationally easier to compute p and compare it with the desired error rate, than invert the desired error rate to find the boundaries of the critical region of the test-statistic
readers may perform further calculations with p, such as adjusting p for multiple comparisons or converting it to a bound on a Bayes factor etc | If p-values are random, why not decide using the test statistic instead?
You're absolutely right. To perform a test of a fixed size, we don't need p-values at all. We may just define a rejection region of that size in terms of the test-statistic.
Possible advantages of rep |
20,710 | If p-values are random, why not decide using the test statistic instead? | Yes, it's quite common for a threshold value to be found, and the test statistic be compared to it. It's especially common with the normal distribution; since this distribution is used so much, it's easy to look up what the threshold values for $0.05$ (for a single tailed test with $\alpha = 0.05$) and $0.025$ (for double-tailed $\alpha = 0.05$) are.
Calculating the p-value does give us more information than just finding a binary "Is it larger than the threshold?", which can be an advantage or a disadvantage (for instance, one disadvantage to giving p-values is that is raises the temptation of simply multiplying p-values of individual tests to get a composite p-value, which is fallacious reasoning).
Furthermore, we should be able to compute type I and II error rates just using this threshold value for T(X).
Type I error rate is just the maximum p-value under which we reject the null (at least, for continuous distributions). This is usually chosen directly, and p-value and threshold follow, rather than error rate being calculated from a free choice of threshold. Type II error rate is more complicated, and requires some alternative hypothesis being specified. | If p-values are random, why not decide using the test statistic instead? | Yes, it's quite common for a threshold value to be found, and the test statistic be compared to it. It's especially common with the normal distribution; since this distribution is used so much, it's e | If p-values are random, why not decide using the test statistic instead?
Yes, it's quite common for a threshold value to be found, and the test statistic be compared to it. It's especially common with the normal distribution; since this distribution is used so much, it's easy to look up what the threshold values for $0.05$ (for a single tailed test with $\alpha = 0.05$) and $0.025$ (for double-tailed $\alpha = 0.05$) are.
Calculating the p-value does give us more information than just finding a binary "Is it larger than the threshold?", which can be an advantage or a disadvantage (for instance, one disadvantage to giving p-values is that is raises the temptation of simply multiplying p-values of individual tests to get a composite p-value, which is fallacious reasoning).
Furthermore, we should be able to compute type I and II error rates just using this threshold value for T(X).
Type I error rate is just the maximum p-value under which we reject the null (at least, for continuous distributions). This is usually chosen directly, and p-value and threshold follow, rather than error rate being calculated from a free choice of threshold. Type II error rate is more complicated, and requires some alternative hypothesis being specified. | If p-values are random, why not decide using the test statistic instead?
Yes, it's quite common for a threshold value to be found, and the test statistic be compared to it. It's especially common with the normal distribution; since this distribution is used so much, it's e |
20,711 | If p-values are random, why not decide using the test statistic instead? | One advantage I don't see mentioned yet is that p-values standardize different tests onto the same scale, which is a human-interpretable one.
If you have different tests $1,2,3$ with test statistics $T_1,T_2,T_3$ coming from null CDFs $F_1,F_2,F_3$, you can't just report $T_i$ to someone, you have to tell them $F_i$ so they can interpret it. But if we take $p_i = F_i(T_i)$, then all of $p_1,p_2,p_3$ are on a standardized scale. You can report $p_i$ without additional context and it's meaningful.
Even if you only wanted to report "pass/not pass" rather than the test statistic itself, you probably want to communicate how strict your threshold is. A natural measure of strictness for any test is how often the test would pass under the null hypothesis, but that's a threshold in p-value space (e.g. 0.05). | If p-values are random, why not decide using the test statistic instead? | One advantage I don't see mentioned yet is that p-values standardize different tests onto the same scale, which is a human-interpretable one.
If you have different tests $1,2,3$ with test statistics $ | If p-values are random, why not decide using the test statistic instead?
One advantage I don't see mentioned yet is that p-values standardize different tests onto the same scale, which is a human-interpretable one.
If you have different tests $1,2,3$ with test statistics $T_1,T_2,T_3$ coming from null CDFs $F_1,F_2,F_3$, you can't just report $T_i$ to someone, you have to tell them $F_i$ so they can interpret it. But if we take $p_i = F_i(T_i)$, then all of $p_1,p_2,p_3$ are on a standardized scale. You can report $p_i$ without additional context and it's meaningful.
Even if you only wanted to report "pass/not pass" rather than the test statistic itself, you probably want to communicate how strict your threshold is. A natural measure of strictness for any test is how often the test would pass under the null hypothesis, but that's a threshold in p-value space (e.g. 0.05). | If p-values are random, why not decide using the test statistic instead?
One advantage I don't see mentioned yet is that p-values standardize different tests onto the same scale, which is a human-interpretable one.
If you have different tests $1,2,3$ with test statistics $ |
20,712 | If p-values are random, why not decide using the test statistic instead? | As a counter example to the idea that we can just use the raw test statistics, let's consider the following imaginary report:
We tested whether there were differences across product colors and found $F_{3, 190} = 3.886$. We tested whether was a difference across font designs and found $F_{2, 8} = 8.649$.
Is there a good reason for making the reader go through one more step? | If p-values are random, why not decide using the test statistic instead? | As a counter example to the idea that we can just use the raw test statistics, let's consider the following imaginary report:
We tested whether there were differences across product colors and found | If p-values are random, why not decide using the test statistic instead?
As a counter example to the idea that we can just use the raw test statistics, let's consider the following imaginary report:
We tested whether there were differences across product colors and found $F_{3, 190} = 3.886$. We tested whether was a difference across font designs and found $F_{2, 8} = 8.649$.
Is there a good reason for making the reader go through one more step? | If p-values are random, why not decide using the test statistic instead?
As a counter example to the idea that we can just use the raw test statistics, let's consider the following imaginary report:
We tested whether there were differences across product colors and found |
20,713 | var() is not equal to sd()^2 in R | Please, check
0.4^2 == 0.16
0.4 == 0.16^0.5
It's not a statistical issue. It's a rounding issue in floating point arithmetics in the language.
The same applies to Python
0.4**2 == 0.16
0.4 == 0.16**0.5
None of these floating point numbers is stored in a computer's memory as two- or three-decimal digits, but rather in a binary format.
For instance, 0.16 (8-byte) is stored as 11111111000100011110101110000101000111101011100001010001111011, while 0.4**2 gives us 11111111000100011110101110000101000111101011100001010001111100.
You can play with this decimal to binary conversion using the following Python code:
import struct
bin(struct.unpack('!Q',struct.pack('!d',0.16))[0])
bin(struct.unpack('!Q',struct.pack('!d',0.4**2))[0]) | var() is not equal to sd()^2 in R | Please, check
0.4^2 == 0.16
0.4 == 0.16^0.5
It's not a statistical issue. It's a rounding issue in floating point arithmetics in the language.
The same applies to Python
0.4**2 == 0.16
0.4 == 0.16**0 | var() is not equal to sd()^2 in R
Please, check
0.4^2 == 0.16
0.4 == 0.16^0.5
It's not a statistical issue. It's a rounding issue in floating point arithmetics in the language.
The same applies to Python
0.4**2 == 0.16
0.4 == 0.16**0.5
None of these floating point numbers is stored in a computer's memory as two- or three-decimal digits, but rather in a binary format.
For instance, 0.16 (8-byte) is stored as 11111111000100011110101110000101000111101011100001010001111011, while 0.4**2 gives us 11111111000100011110101110000101000111101011100001010001111100.
You can play with this decimal to binary conversion using the following Python code:
import struct
bin(struct.unpack('!Q',struct.pack('!d',0.16))[0])
bin(struct.unpack('!Q',struct.pack('!d',0.4**2))[0]) | var() is not equal to sd()^2 in R
Please, check
0.4^2 == 0.16
0.4 == 0.16^0.5
It's not a statistical issue. It's a rounding issue in floating point arithmetics in the language.
The same applies to Python
0.4**2 == 0.16
0.4 == 0.16**0 |
20,714 | var() is not equal to sd()^2 in R | Recommended read for you is
Goldberg, D. (1991). What every computer scientist should know about
floating-point arithmetic. ACM computing surveys (CSUR), 23(1),
5-48.
TL;DR you should never use == (or its equivalent in any other programming language) to compare floating point numbers because they represent numbers only approximately. As in your example, two different computations can lead to floating point representations that are different though close enough given the guarantees given by such representation. What you should do instead is to compare them with some precision, e.g. $|x - y| < \epsilon$, but this is also not a perfect solution and there are better ones. Happily, in most cases, they would be already implemented for you in the programming language you are using (like the mentioned all.equal in R). | var() is not equal to sd()^2 in R | Recommended read for you is
Goldberg, D. (1991). What every computer scientist should know about
floating-point arithmetic. ACM computing surveys (CSUR), 23(1),
5-48.
TL;DR you should never use == ( | var() is not equal to sd()^2 in R
Recommended read for you is
Goldberg, D. (1991). What every computer scientist should know about
floating-point arithmetic. ACM computing surveys (CSUR), 23(1),
5-48.
TL;DR you should never use == (or its equivalent in any other programming language) to compare floating point numbers because they represent numbers only approximately. As in your example, two different computations can lead to floating point representations that are different though close enough given the guarantees given by such representation. What you should do instead is to compare them with some precision, e.g. $|x - y| < \epsilon$, but this is also not a perfect solution and there are better ones. Happily, in most cases, they would be already implemented for you in the programming language you are using (like the mentioned all.equal in R). | var() is not equal to sd()^2 in R
Recommended read for you is
Goldberg, D. (1991). What every computer scientist should know about
floating-point arithmetic. ACM computing surveys (CSUR), 23(1),
5-48.
TL;DR you should never use == ( |
20,715 | var() is not equal to sd()^2 in R | Correct to 14 decimal points, it's a floating point number issue:
options(digits = 20)
> var(data)
[1] 27.476190476190474499
sd(data)^2
[1] 27.476190476190470946 | var() is not equal to sd()^2 in R | Correct to 14 decimal points, it's a floating point number issue:
options(digits = 20)
> var(data)
[1] 27.476190476190474499
sd(data)^2
[1] 27.476190476190470946 | var() is not equal to sd()^2 in R
Correct to 14 decimal points, it's a floating point number issue:
options(digits = 20)
> var(data)
[1] 27.476190476190474499
sd(data)^2
[1] 27.476190476190470946 | var() is not equal to sd()^2 in R
Correct to 14 decimal points, it's a floating point number issue:
options(digits = 20)
> var(data)
[1] 27.476190476190474499
sd(data)^2
[1] 27.476190476190470946 |
20,716 | var() is not equal to sd()^2 in R | Check the differences between those quantities. They are likely to be small.
Computers are funky about how they store long decimals. | var() is not equal to sd()^2 in R | Check the differences between those quantities. They are likely to be small.
Computers are funky about how they store long decimals. | var() is not equal to sd()^2 in R
Check the differences between those quantities. They are likely to be small.
Computers are funky about how they store long decimals. | var() is not equal to sd()^2 in R
Check the differences between those quantities. They are likely to be small.
Computers are funky about how they store long decimals. |
20,717 | Why do parameters go untested in Machine Learning? | Is it the case with all machine learning models that, when you find the optimal parameters that minimize your objective function, you are also, almost by definition, finding the same statistically significant coefficients you would otherwise discover if you were to attack the problem from a stats perspective where the focus is on tests of statistical significance?
In some cases, yes. If you're using logistic regression as a classifier, then optimizing the cost is the same as optimizing the log likelihood. Not every model is like this. Deep neural networks do not map nicely onto a statistical counterpart (though there is some active research on their statistical properties I imagine).
As to variable selection via AIC or similar, that would be a form of feature selection. I think that is something to ask about on its own.
As to your titular question, inference is not our main concern; its predictive capability. Besides, most ML problems (most, not all) work with data sets so large that significance becomes a straw man. The sheer size of the data would allow for high precision estimates, and since no effect is truly 0 you would find that all effects are significant. | Why do parameters go untested in Machine Learning? | Is it the case with all machine learning models that, when you find the optimal parameters that minimize your objective function, you are also, almost by definition, finding the same statistically sig | Why do parameters go untested in Machine Learning?
Is it the case with all machine learning models that, when you find the optimal parameters that minimize your objective function, you are also, almost by definition, finding the same statistically significant coefficients you would otherwise discover if you were to attack the problem from a stats perspective where the focus is on tests of statistical significance?
In some cases, yes. If you're using logistic regression as a classifier, then optimizing the cost is the same as optimizing the log likelihood. Not every model is like this. Deep neural networks do not map nicely onto a statistical counterpart (though there is some active research on their statistical properties I imagine).
As to variable selection via AIC or similar, that would be a form of feature selection. I think that is something to ask about on its own.
As to your titular question, inference is not our main concern; its predictive capability. Besides, most ML problems (most, not all) work with data sets so large that significance becomes a straw man. The sheer size of the data would allow for high precision estimates, and since no effect is truly 0 you would find that all effects are significant. | Why do parameters go untested in Machine Learning?
Is it the case with all machine learning models that, when you find the optimal parameters that minimize your objective function, you are also, almost by definition, finding the same statistically sig |
20,718 | Why do parameters go untested in Machine Learning? | tl;dr: Because it's 1) not possible and 2) not necessary.
Long answer: Your question is posed from a statistical perspective, where testing the parameters is a standard thing to do. This makes it sound as if the way Machine Learning does it is in need of justification. But we can equally well pose the question in the opposite direction: "Why are parameters being tested in statistics?"
The answer differs slightly, depending whether you're into inferential or predictive modelling. If you are doing inference, you want to know (understand!) which parameters are relevant to the output. If you're doing prediction, you want to avoid overfitting, and eliminating superfluous parameters helps with that. However, tests make assumptions regarding the probability distribution behind the parameters, and these assumptions may be more or less hard to justify. AIC (and BIC, too) also make assumptions. Your test and parameter elimination strategies work only as good as your assumptions are satisfied.
Machine Learning is not an inferential toolbox. It was, from the beginning, meant to generate automated systems ("machines") which can make decisions ("predictions") without human intervention. Interpretability was never an issue, and this allows the models to be of arbitrary complexity (up to, but not necessarily, billions of parameters, as mentioned in a comment). So, the information which parameters are relevant ("significant") would be only relevant to ensure generalisation. However, machine learning makes much weaker assumptions about the data and, as a rule, we know (almost) nothing about the underlying probability distributions. This makes reasonable statistical tests next to impossible. Instead, generalisation in machine learning is ensured by cross validation and testing on a separate (test) data set. But, in order for that to work half-way reliably, you need much more data then for statistical modelling. | Why do parameters go untested in Machine Learning? | tl;dr: Because it's 1) not possible and 2) not necessary.
Long answer: Your question is posed from a statistical perspective, where testing the parameters is a standard thing to do. This makes it soun | Why do parameters go untested in Machine Learning?
tl;dr: Because it's 1) not possible and 2) not necessary.
Long answer: Your question is posed from a statistical perspective, where testing the parameters is a standard thing to do. This makes it sound as if the way Machine Learning does it is in need of justification. But we can equally well pose the question in the opposite direction: "Why are parameters being tested in statistics?"
The answer differs slightly, depending whether you're into inferential or predictive modelling. If you are doing inference, you want to know (understand!) which parameters are relevant to the output. If you're doing prediction, you want to avoid overfitting, and eliminating superfluous parameters helps with that. However, tests make assumptions regarding the probability distribution behind the parameters, and these assumptions may be more or less hard to justify. AIC (and BIC, too) also make assumptions. Your test and parameter elimination strategies work only as good as your assumptions are satisfied.
Machine Learning is not an inferential toolbox. It was, from the beginning, meant to generate automated systems ("machines") which can make decisions ("predictions") without human intervention. Interpretability was never an issue, and this allows the models to be of arbitrary complexity (up to, but not necessarily, billions of parameters, as mentioned in a comment). So, the information which parameters are relevant ("significant") would be only relevant to ensure generalisation. However, machine learning makes much weaker assumptions about the data and, as a rule, we know (almost) nothing about the underlying probability distributions. This makes reasonable statistical tests next to impossible. Instead, generalisation in machine learning is ensured by cross validation and testing on a separate (test) data set. But, in order for that to work half-way reliably, you need much more data then for statistical modelling. | Why do parameters go untested in Machine Learning?
tl;dr: Because it's 1) not possible and 2) not necessary.
Long answer: Your question is posed from a statistical perspective, where testing the parameters is a standard thing to do. This makes it soun |
20,719 | Why do parameters go untested in Machine Learning? | There are some different mindsets between classical statistics and machine learning, where modern machine learning can have huge amount of data.
And as you said, the whole problem is an "optimization problem", where people put little or no assumptions to the model. And the golden standard is the performance on a large testing set. If we go back and review all the nice properties (confidence interval, p value, etc.) they are coming from strong assumptions about the data and model.
With less data, people are willing to do more work in math (say Gauss–Markov theorem for OLS) to make the results nice and solid. But modern machine learning people are more practical and do not care too much about the assumption and statistically significant, but focusing on the model will "work" on large testing data.
Note deep neural network can have billions of parameters and the number of parameters can even much bigger than number of data points. (which may not really acceptable from classical statistics perspective) So, AIC and BIC also not working there. | Why do parameters go untested in Machine Learning? | There are some different mindsets between classical statistics and machine learning, where modern machine learning can have huge amount of data.
And as you said, the whole problem is an "optimization | Why do parameters go untested in Machine Learning?
There are some different mindsets between classical statistics and machine learning, where modern machine learning can have huge amount of data.
And as you said, the whole problem is an "optimization problem", where people put little or no assumptions to the model. And the golden standard is the performance on a large testing set. If we go back and review all the nice properties (confidence interval, p value, etc.) they are coming from strong assumptions about the data and model.
With less data, people are willing to do more work in math (say Gauss–Markov theorem for OLS) to make the results nice and solid. But modern machine learning people are more practical and do not care too much about the assumption and statistically significant, but focusing on the model will "work" on large testing data.
Note deep neural network can have billions of parameters and the number of parameters can even much bigger than number of data points. (which may not really acceptable from classical statistics perspective) So, AIC and BIC also not working there. | Why do parameters go untested in Machine Learning?
There are some different mindsets between classical statistics and machine learning, where modern machine learning can have huge amount of data.
And as you said, the whole problem is an "optimization |
20,720 | Why do parameters go untested in Machine Learning? | Let's define "stats perspective" as running a model in R and adding or
deleting new variables based on their statistical significance or
degree to which they change AIC.
First of all, "adding or removing variables based on their significance" is not a good practice. As the name suggests, significance testing is about testing a hypothesis, it is not a tool for optimizing anything, and by using it for the variable selection you assume some kind of optimization problem.
Second, ask yourself what exactly does a "statistically significant parameter" means. We can do many different statistical tests, but the most common ones, the out-of-the-box statical tests for regression models test the hypothesis that the parameter differs from zero. If a parameter is equal to zero in the regression model, it has no effect on the results. Let's start with the fact that not every machine learning model has parameters (e.g. $k$-NN, or decision tree don't). But even if it has parameters, why would you care if they are zero or not? If the model makes correct predictions, it can have as many zero parameters as you want, worst case they would make it computationally slower than in the case of a lighter model. More than this, sometimes we intentionally drag the parameters towards zero, like with $L_1$ regularization, as means of feature selection. In such a case we want as many of the parameters to be zeros, as long as they do not worsen the results. | Why do parameters go untested in Machine Learning? | Let's define "stats perspective" as running a model in R and adding or
deleting new variables based on their statistical significance or
degree to which they change AIC.
First of all, "adding or remo | Why do parameters go untested in Machine Learning?
Let's define "stats perspective" as running a model in R and adding or
deleting new variables based on their statistical significance or
degree to which they change AIC.
First of all, "adding or removing variables based on their significance" is not a good practice. As the name suggests, significance testing is about testing a hypothesis, it is not a tool for optimizing anything, and by using it for the variable selection you assume some kind of optimization problem.
Second, ask yourself what exactly does a "statistically significant parameter" means. We can do many different statistical tests, but the most common ones, the out-of-the-box statical tests for regression models test the hypothesis that the parameter differs from zero. If a parameter is equal to zero in the regression model, it has no effect on the results. Let's start with the fact that not every machine learning model has parameters (e.g. $k$-NN, or decision tree don't). But even if it has parameters, why would you care if they are zero or not? If the model makes correct predictions, it can have as many zero parameters as you want, worst case they would make it computationally slower than in the case of a lighter model. More than this, sometimes we intentionally drag the parameters towards zero, like with $L_1$ regularization, as means of feature selection. In such a case we want as many of the parameters to be zeros, as long as they do not worsen the results. | Why do parameters go untested in Machine Learning?
Let's define "stats perspective" as running a model in R and adding or
deleting new variables based on their statistical significance or
degree to which they change AIC.
First of all, "adding or remo |
20,721 | Why do parameters go untested in Machine Learning? | Your descriptions of Statistical Model Building and Machine Learning are imcomplete if not false. Adding and deleting data based on their AIC ist stepwise regression and that is widely discouraged because it leads to overfitting to the data at hand. So that is not what we should do in statistics.
In machine learning you left out the important aspect of splitting you data into training, tuning and test data. Let's take LASSO regression as an example. It usually does not lead to $p$-values but it has a tuning paramater $\lambda$ that decides, how easily the model accepts or rejects additional data. This tuning parameter is usually defined via cross validation so that the model should have no more or no less parameters than are optimal for prediction purposes.
A statistics models gets it's justification from some complicated-to-explain $p$-value that should lie below some completely arbitrarily chosen limit. A machine learning model gets it's justification from cross validation. So machine learning does not have something less, just something different that does not appear in your depiction of ML. | Why do parameters go untested in Machine Learning? | Your descriptions of Statistical Model Building and Machine Learning are imcomplete if not false. Adding and deleting data based on their AIC ist stepwise regression and that is widely discouraged bec | Why do parameters go untested in Machine Learning?
Your descriptions of Statistical Model Building and Machine Learning are imcomplete if not false. Adding and deleting data based on their AIC ist stepwise regression and that is widely discouraged because it leads to overfitting to the data at hand. So that is not what we should do in statistics.
In machine learning you left out the important aspect of splitting you data into training, tuning and test data. Let's take LASSO regression as an example. It usually does not lead to $p$-values but it has a tuning paramater $\lambda$ that decides, how easily the model accepts or rejects additional data. This tuning parameter is usually defined via cross validation so that the model should have no more or no less parameters than are optimal for prediction purposes.
A statistics models gets it's justification from some complicated-to-explain $p$-value that should lie below some completely arbitrarily chosen limit. A machine learning model gets it's justification from cross validation. So machine learning does not have something less, just something different that does not appear in your depiction of ML. | Why do parameters go untested in Machine Learning?
Your descriptions of Statistical Model Building and Machine Learning are imcomplete if not false. Adding and deleting data based on their AIC ist stepwise regression and that is widely discouraged bec |
20,722 | Why do parameters go untested in Machine Learning? | Is it the case with all machine learning models that, when you find the optimal parameters that minimize your objective function, you are also, almost by definition, finding the same statistically significant coefficients you would otherwise discover if you were to attack the problem from a stats perspective where the focus is on tests of statistical significance?
No. Assuming the general aim in machine learning would be to minimize prediction error on future observations. In that, we often accept a little bias in our estimator, as long as its variance is reduced more strongly (through e.g., smoothing, penalization, ensembling).
In statistical significance testing (inference), at least within the frequentist approach, the aim is to obtain unbiased parameter estimates (i.e., on average, we obtain the 'true' parameter values).
Unbiasedness tends to come at the cost of (much) increased variance. Though not always: An OLS linear regression likely provides very good power and predictive accuracy if assumptions are met, the number of predictors is not too large and sample size not too small. Then the aims of prediction and inference coincide to yield the same optimal solution.
Both viewpoints are statistical. There is no real distinction between statistics and machine learning. One should never do ML without taking the sampling aspects of the problem into account (sample size and representativeness, number of possible predictors, distribution of predictors and response, etc.).
What you refer to as a 'stats perspective' is statistically a (very) unsound approach; it is misusing a confirmatory hypothesis-testing approach in an exploratory manner. | Why do parameters go untested in Machine Learning? | Is it the case with all machine learning models that, when you find the optimal parameters that minimize your objective function, you are also, almost by definition, finding the same statistically sig | Why do parameters go untested in Machine Learning?
Is it the case with all machine learning models that, when you find the optimal parameters that minimize your objective function, you are also, almost by definition, finding the same statistically significant coefficients you would otherwise discover if you were to attack the problem from a stats perspective where the focus is on tests of statistical significance?
No. Assuming the general aim in machine learning would be to minimize prediction error on future observations. In that, we often accept a little bias in our estimator, as long as its variance is reduced more strongly (through e.g., smoothing, penalization, ensembling).
In statistical significance testing (inference), at least within the frequentist approach, the aim is to obtain unbiased parameter estimates (i.e., on average, we obtain the 'true' parameter values).
Unbiasedness tends to come at the cost of (much) increased variance. Though not always: An OLS linear regression likely provides very good power and predictive accuracy if assumptions are met, the number of predictors is not too large and sample size not too small. Then the aims of prediction and inference coincide to yield the same optimal solution.
Both viewpoints are statistical. There is no real distinction between statistics and machine learning. One should never do ML without taking the sampling aspects of the problem into account (sample size and representativeness, number of possible predictors, distribution of predictors and response, etc.).
What you refer to as a 'stats perspective' is statistically a (very) unsound approach; it is misusing a confirmatory hypothesis-testing approach in an exploratory manner. | Why do parameters go untested in Machine Learning?
Is it the case with all machine learning models that, when you find the optimal parameters that minimize your objective function, you are also, almost by definition, finding the same statistically sig |
20,723 | Why do parameters go untested in Machine Learning? | Many ML models are not based on a probability distribution with which you can determine statistical significance, and many are not set up to determine statistical significance. In such cases these models ordinarily reach some type of convergence criterion (e.g., the MSE delta between iterations goes below a threshold).
However, you can employ empirical hypothesis testing (p-value testing) for any model by (a) first determining the observed $MSE_{obs}$ via a single run from $k$-fold CV, and (b) then run $B=1000$ iterations (1000 runs) for $k$-fold CV but this time with permuted class labels of test objects (in test folds), each time getting $MSE^{(b)}$. Before each of the $B=1000$ iterations using $k$-fold CV with permuted class labels of test objects, it helps to "re-partition" all objects and assign them to different folds. This merely re-orders all objects before assigning to the folds -- and is a way to have different objects in each fold during each iteration.
When done, an "empirical p-value" will be equal to
$P=\frac{\#\{MSE^{(b)}<MSE_{obs} \} }{B}$
where the p-value is equal to the number of times the MSE from test objects with permuted labels is less than the MSE from test objects of the non-permuted labels, divided by the number of iterations. Looking at the logic of the above equation, if your model is not very predictive of outcome, either during classification analysis or function approximation (regression) the MSE will be high. If your model is junk and the observed $MSE_{obs}$ is very high, like 0.4, then the $MSE^{(b)}$ from prediction when class labels are permuted could be lower during many iterations. If $MSE^{(b)}$ is lower than $MSE_{obs}$ 400 times out of 1000 iterations, then the p-value is 0.4. However, if your model is very predictive, and the number of times $MSE^{(b)}$ is less than $MSE_{obs}$ is 1/1000, then the p-value is 0.001, which is highly significant.
A main problem with empirical p-value testing, however, is that it is sometimes difficult to enforce the null hypothesis for whatever you are doing. But empirical p-value testing is used exclusively in statistical genetics a lot. The only modification done if many genes are involved is that the p-value criterion ($\alpha=0.05$) for significance undergoes a Bonferroni adjustment for the multiple testing problem to become
$P^* = \frac{0.05}{\#tests}$
where $\# tests$ is equal to the number of genes evaluated. A bar graph is then made plotting $-\log(P)$ for each gene with a reference line for significance called "Bonf" which is equal to $-\log(P^*)$. [there are other adjustments for multiple testing such as Benjamini-Hochberg, Storey q-values, Westfall-Young, etc., so it's a matter of stringency for determining the false discovery rate ($FDR$)].
In summary, there are ways to easily navigate around the problems you raise about lack of statistical testing in ML, since empirical p-value testing allows you turn anything into a hypothesis test for significance. | Why do parameters go untested in Machine Learning? | Many ML models are not based on a probability distribution with which you can determine statistical significance, and many are not set up to determine statistical significance. In such cases these mo | Why do parameters go untested in Machine Learning?
Many ML models are not based on a probability distribution with which you can determine statistical significance, and many are not set up to determine statistical significance. In such cases these models ordinarily reach some type of convergence criterion (e.g., the MSE delta between iterations goes below a threshold).
However, you can employ empirical hypothesis testing (p-value testing) for any model by (a) first determining the observed $MSE_{obs}$ via a single run from $k$-fold CV, and (b) then run $B=1000$ iterations (1000 runs) for $k$-fold CV but this time with permuted class labels of test objects (in test folds), each time getting $MSE^{(b)}$. Before each of the $B=1000$ iterations using $k$-fold CV with permuted class labels of test objects, it helps to "re-partition" all objects and assign them to different folds. This merely re-orders all objects before assigning to the folds -- and is a way to have different objects in each fold during each iteration.
When done, an "empirical p-value" will be equal to
$P=\frac{\#\{MSE^{(b)}<MSE_{obs} \} }{B}$
where the p-value is equal to the number of times the MSE from test objects with permuted labels is less than the MSE from test objects of the non-permuted labels, divided by the number of iterations. Looking at the logic of the above equation, if your model is not very predictive of outcome, either during classification analysis or function approximation (regression) the MSE will be high. If your model is junk and the observed $MSE_{obs}$ is very high, like 0.4, then the $MSE^{(b)}$ from prediction when class labels are permuted could be lower during many iterations. If $MSE^{(b)}$ is lower than $MSE_{obs}$ 400 times out of 1000 iterations, then the p-value is 0.4. However, if your model is very predictive, and the number of times $MSE^{(b)}$ is less than $MSE_{obs}$ is 1/1000, then the p-value is 0.001, which is highly significant.
A main problem with empirical p-value testing, however, is that it is sometimes difficult to enforce the null hypothesis for whatever you are doing. But empirical p-value testing is used exclusively in statistical genetics a lot. The only modification done if many genes are involved is that the p-value criterion ($\alpha=0.05$) for significance undergoes a Bonferroni adjustment for the multiple testing problem to become
$P^* = \frac{0.05}{\#tests}$
where $\# tests$ is equal to the number of genes evaluated. A bar graph is then made plotting $-\log(P)$ for each gene with a reference line for significance called "Bonf" which is equal to $-\log(P^*)$. [there are other adjustments for multiple testing such as Benjamini-Hochberg, Storey q-values, Westfall-Young, etc., so it's a matter of stringency for determining the false discovery rate ($FDR$)].
In summary, there are ways to easily navigate around the problems you raise about lack of statistical testing in ML, since empirical p-value testing allows you turn anything into a hypothesis test for significance. | Why do parameters go untested in Machine Learning?
Many ML models are not based on a probability distribution with which you can determine statistical significance, and many are not set up to determine statistical significance. In such cases these mo |
20,724 | Why do parameters go untested in Machine Learning? | Many of the comments/responses by others in the thread give good points.
I'll add 1 practical and 1 theoretical.
Practical: Many ML models are concerned more with prediction than with statistical inference (e.g. hypothesis tests of model parameters). See. e.g. Leo Breiman's paper on the two cultures for good elucidation on this distinction.
Theoretical: In many ML models the parameters you would be doing inference on aren't identified nor estimable so doing hypothesis testing wouldn't make sense. There are exceptions to this of course (e.g. using a GLM to predict probability of loan default) and many ML models do not have a clear likelihood,
e.g. what is the likelihood for a splitting rule on the root node of a decision tree?
In these cases you can't do hypothesis testing unless you do some deep thinking which might take longer than you have to solve the problem. | Why do parameters go untested in Machine Learning? | Many of the comments/responses by others in the thread give good points.
I'll add 1 practical and 1 theoretical.
Practical: Many ML models are concerned more with prediction than with statistical infe | Why do parameters go untested in Machine Learning?
Many of the comments/responses by others in the thread give good points.
I'll add 1 practical and 1 theoretical.
Practical: Many ML models are concerned more with prediction than with statistical inference (e.g. hypothesis tests of model parameters). See. e.g. Leo Breiman's paper on the two cultures for good elucidation on this distinction.
Theoretical: In many ML models the parameters you would be doing inference on aren't identified nor estimable so doing hypothesis testing wouldn't make sense. There are exceptions to this of course (e.g. using a GLM to predict probability of loan default) and many ML models do not have a clear likelihood,
e.g. what is the likelihood for a splitting rule on the root node of a decision tree?
In these cases you can't do hypothesis testing unless you do some deep thinking which might take longer than you have to solve the problem. | Why do parameters go untested in Machine Learning?
Many of the comments/responses by others in the thread give good points.
I'll add 1 practical and 1 theoretical.
Practical: Many ML models are concerned more with prediction than with statistical infe |
20,725 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | The video suggests that $\mu=112$ g and $\sigma=9$ g in this particular normal distribution.
If that is the case, we can find the probability that the weight is in a given interval, in the video described as the area under the graph for that interval. For example, the probability it is between $119.5$ g and $120.5$ g is $$\Phi\left(\tfrac{120.5-112}{9}\right) - \Phi\left(\tfrac{119.5-112}{9}\right) = \Phi\left(\tfrac{17}{18}\right) - \Phi\left(\tfrac{15}{18}\right)\approx 0.82753- 0.79767=0.02986$$ which the video describes as about $0.03$
Similarly we can look at other intervals around $120$ g:
Lower Upper Probability
119 121 0.05969
119.5 120.5 0.02986
119.9 120.1 0.00592
119.99 120.01 0.00059
119.999 120.001 0.00006
and as we cut the width of the interval by a factor of $10$ each time, the probability of the weight being in that narrower also roughly falls by a factor of $10$. So as the interval falls towards zero, the probability of being in that interval also falls towards zero.
In that sense the probability of being exactly $120$ must be smaller than any positive number and so must be $0$. | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | The video suggests that $\mu=112$ g and $\sigma=9$ g in this particular normal distribution.
If that is the case, we can find the probability that the weight is in a given interval, in the video descr | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
The video suggests that $\mu=112$ g and $\sigma=9$ g in this particular normal distribution.
If that is the case, we can find the probability that the weight is in a given interval, in the video described as the area under the graph for that interval. For example, the probability it is between $119.5$ g and $120.5$ g is $$\Phi\left(\tfrac{120.5-112}{9}\right) - \Phi\left(\tfrac{119.5-112}{9}\right) = \Phi\left(\tfrac{17}{18}\right) - \Phi\left(\tfrac{15}{18}\right)\approx 0.82753- 0.79767=0.02986$$ which the video describes as about $0.03$
Similarly we can look at other intervals around $120$ g:
Lower Upper Probability
119 121 0.05969
119.5 120.5 0.02986
119.9 120.1 0.00592
119.99 120.01 0.00059
119.999 120.001 0.00006
and as we cut the width of the interval by a factor of $10$ each time, the probability of the weight being in that narrower also roughly falls by a factor of $10$. So as the interval falls towards zero, the probability of being in that interval also falls towards zero.
In that sense the probability of being exactly $120$ must be smaller than any positive number and so must be $0$. | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
The video suggests that $\mu=112$ g and $\sigma=9$ g in this particular normal distribution.
If that is the case, we can find the probability that the weight is in a given interval, in the video descr |
20,726 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | I guess the statement could be made more precise and then it could be easier to understand. First of all, $f(x) = \tfrac{1}{C}$, where $C$ is a constant so that it integrates to unity, is a probability density of an uniform distribution that assigns the same probability density to each point. A normal distribution does not have the same flat shape so that different probability densities apply to different values. In what follows, $\frac{1}{\infty}$ is just used as an example to show general ideas about probability densities.
But let's stick to the example. $\frac{1}{\infty}$ is not equal to zero (see Quora, or math.stackoverflow.com answers). You cannot divide by infinity, because it is not a number. What you can say is that the limit is zero
$$
\lim_{x\to\infty} \frac{1}{x} = 0
$$
so as $x$ increases, $\tfrac{1}{x}$ gets closer and closer to zero. This is why there is a convention to say that it "is" zero. In the case of continuous random variables, there are infinitely many values on the real line; hence even in the simplest case of a uniform distribution, we cannot calculate the probability. In probability theory, we do not calculate the probabilities for continuous random variables, because they are so infinitesimal, so that we say they are zero.
See also the $P[X=x]=0$ when $X$ is continuous variable thread. | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | I guess the statement could be made more precise and then it could be easier to understand. First of all, $f(x) = \tfrac{1}{C}$, where $C$ is a constant so that it integrates to unity, is a probabilit | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
I guess the statement could be made more precise and then it could be easier to understand. First of all, $f(x) = \tfrac{1}{C}$, where $C$ is a constant so that it integrates to unity, is a probability density of an uniform distribution that assigns the same probability density to each point. A normal distribution does not have the same flat shape so that different probability densities apply to different values. In what follows, $\frac{1}{\infty}$ is just used as an example to show general ideas about probability densities.
But let's stick to the example. $\frac{1}{\infty}$ is not equal to zero (see Quora, or math.stackoverflow.com answers). You cannot divide by infinity, because it is not a number. What you can say is that the limit is zero
$$
\lim_{x\to\infty} \frac{1}{x} = 0
$$
so as $x$ increases, $\tfrac{1}{x}$ gets closer and closer to zero. This is why there is a convention to say that it "is" zero. In the case of continuous random variables, there are infinitely many values on the real line; hence even in the simplest case of a uniform distribution, we cannot calculate the probability. In probability theory, we do not calculate the probabilities for continuous random variables, because they are so infinitesimal, so that we say they are zero.
See also the $P[X=x]=0$ when $X$ is continuous variable thread. | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
I guess the statement could be made more precise and then it could be easier to understand. First of all, $f(x) = \tfrac{1}{C}$, where $C$ is a constant so that it integrates to unity, is a probabilit |
20,727 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | If you take a random person out of a country with a well studied population distribution, what are the odds that they are 30 years old? Surely there's an answer to that question, if you consider that someone born 30 years and 2 months ago to be 30 years old. But what if you are looking for monthly precision? Then only people born 30 years ago would fit your criteria. What if you keep limiting your requirements, second precision, milisecond precision, picosecond precision, planck time precision. Eventually you'll find that no one fits your narrow criteria of 30 years old, but it still will be possible that someone fits that criteria, and you can account for that probability with fractional numbers.
If you keep narrowing your age range so that you only consider people of exactly 30 years old, then you have effectively narrowed your range to its fullest, it's a range comprised of exactly one number, the upper bound is equal to the lower bound, as you can surmise from the progression from broad to narrow time ranges, the probability that someone will be exactly 30 years old tends towards 0.
This happens only if we are considering our domain (time/age) to be continuous value, rather than discrete, so there are infinite intermediate values between one value and any other value.
If we consider time to be discrete, for example by considering a planck time to be the shortest possible time span, then the probability of someone being exactly 30 years old can be expressed in the order of planck-time/year, which albeit being very small, is finite. | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | If you take a random person out of a country with a well studied population distribution, what are the odds that they are 30 years old? Surely there's an answer to that question, if you consider that | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
If you take a random person out of a country with a well studied population distribution, what are the odds that they are 30 years old? Surely there's an answer to that question, if you consider that someone born 30 years and 2 months ago to be 30 years old. But what if you are looking for monthly precision? Then only people born 30 years ago would fit your criteria. What if you keep limiting your requirements, second precision, milisecond precision, picosecond precision, planck time precision. Eventually you'll find that no one fits your narrow criteria of 30 years old, but it still will be possible that someone fits that criteria, and you can account for that probability with fractional numbers.
If you keep narrowing your age range so that you only consider people of exactly 30 years old, then you have effectively narrowed your range to its fullest, it's a range comprised of exactly one number, the upper bound is equal to the lower bound, as you can surmise from the progression from broad to narrow time ranges, the probability that someone will be exactly 30 years old tends towards 0.
This happens only if we are considering our domain (time/age) to be continuous value, rather than discrete, so there are infinite intermediate values between one value and any other value.
If we consider time to be discrete, for example by considering a planck time to be the shortest possible time span, then the probability of someone being exactly 30 years old can be expressed in the order of planck-time/year, which albeit being very small, is finite. | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
If you take a random person out of a country with a well studied population distribution, what are the odds that they are 30 years old? Surely there's an answer to that question, if you consider that |
20,728 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | For continuous distributions, like normal distribution, probability of the random variable being equal to a specific value is $0$. Although it's not mathematically precise, the video is just trying to build some intuition. It's saying that if there was some non-zero probability for $P(X=x)$, the sum $\sum_x P(X=x)$ would go to $\infty$, which violates the axioms of probability because there are uncountably many numbers between 119.9 and 120.1. | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | For continuous distributions, like normal distribution, probability of the random variable being equal to a specific value is $0$. Although it's not mathematically precise, the video is just trying to | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
For continuous distributions, like normal distribution, probability of the random variable being equal to a specific value is $0$. Although it's not mathematically precise, the video is just trying to build some intuition. It's saying that if there was some non-zero probability for $P(X=x)$, the sum $\sum_x P(X=x)$ would go to $\infty$, which violates the axioms of probability because there are uncountably many numbers between 119.9 and 120.1. | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
For continuous distributions, like normal distribution, probability of the random variable being equal to a specific value is $0$. Although it's not mathematically precise, the video is just trying to |
20,729 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | Let's consider a slightly simpler example of generating a random number uniformly between 0 and 1.
Let's start with an even simpler problem of picking a random value that's just either 0 or 1. There are 2 possible values, so the chance of getting exactly 0 is $\frac{1}{2} = 0.5$.
Now consider if you have another point between those 2 so you have 0, 0.5 and 1. There are 3 possible values, so the chance of getting exactly 0 is $\frac{1}{3} = 0.33$.
Now put another point between each of those so you have 0, 0.25, 0.5, 0.75 and 1. There are 5 possible values, so the chance of getting exactly 0 is $\frac{1}{5} = 0.2$.
Now put another point between each of those so you have 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875 and 1. There are 9 possible values, so the chance of getting exactly 0 is $\frac{1}{9} = 0.11$.
We're still between 0 and 1, so all these values would be possible values if we're picking a value between 0 and 1 and you can see that the probability is getting smaller.
Keep going like this and there will be more and more points and the probability of getting a specific one of them gets smaller and smaller, tending towards 0.
The same idea holds with a normal distribution: there are infinitely many points in any given range, so the probability of getting any specific one of them tends towards 0.
Whether it's actually strictly equal to 0 I'll leave for other people to argue about. | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | Let's consider a slightly simpler example of generating a random number uniformly between 0 and 1.
Let's start with an even simpler problem of picking a random value that's just either 0 or 1. There a | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
Let's consider a slightly simpler example of generating a random number uniformly between 0 and 1.
Let's start with an even simpler problem of picking a random value that's just either 0 or 1. There are 2 possible values, so the chance of getting exactly 0 is $\frac{1}{2} = 0.5$.
Now consider if you have another point between those 2 so you have 0, 0.5 and 1. There are 3 possible values, so the chance of getting exactly 0 is $\frac{1}{3} = 0.33$.
Now put another point between each of those so you have 0, 0.25, 0.5, 0.75 and 1. There are 5 possible values, so the chance of getting exactly 0 is $\frac{1}{5} = 0.2$.
Now put another point between each of those so you have 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875 and 1. There are 9 possible values, so the chance of getting exactly 0 is $\frac{1}{9} = 0.11$.
We're still between 0 and 1, so all these values would be possible values if we're picking a value between 0 and 1 and you can see that the probability is getting smaller.
Keep going like this and there will be more and more points and the probability of getting a specific one of them gets smaller and smaller, tending towards 0.
The same idea holds with a normal distribution: there are infinitely many points in any given range, so the probability of getting any specific one of them tends towards 0.
Whether it's actually strictly equal to 0 I'll leave for other people to argue about. | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
Let's consider a slightly simpler example of generating a random number uniformly between 0 and 1.
Let's start with an even simpler problem of picking a random value that's just either 0 or 1. There a |
20,730 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | 1
Let's try this out for a standard normal distribution.
set.seed(1)
x = rnorm(10^4)
Out if these $10^4$ values many will be close to the mean (that is zero). But none of them are equal to zero.
[1] -6.264538e-01 1.836433e-01 -8.356286e-01 1.595281e+00 3.295078e-01
[6] -8.204684e-01 4.874291e-01 7.383247e-01 5.757814e-01 -3.053884e-01
[11] 1.511781e+00 3.898432e-01 -6.212406e-01 -2.214700e+00 1.124931e+00
[16] -4.493361e-02 -1.619026e-02 9.438362e-01 8.212212e-01 5.939013e-01
[21] 9.189774e-01 7.821363e-01 7.456498e-02 -1.989352e+00 6.198257e-01
[26] -5.612874e-02 -1.557955e-01 -1.470752e+00 -4.781501e-01 4.179416e-01
[31] 1.358680e+00 -1.027877e-01 3.876716e-01 -5.380504e-02 -1.377060e+00
[36] -4.149946e-01 -3.942900e-01 -5.931340e-02 1.100025e+00 7.631757e-01
[41] -1.645236e-01 -2.533617e-01 6.969634e-01 5.566632e-01 -6.887557e-01
[46] -7.074952e-01 3.645820e-01 7.685329e-01 -1.123462e-01 8.811077e-01
[51] 3.981059e-01 -6.120264e-01 3.411197e-01 -1.129363e+00 1.433024e+00
[56] 1.980400e+00 -3.672215e-01 -1.044135e+00 5.697196e-01 -1.350546e-01
[61] 2.401618e+00 -3.924000e-02 6.897394e-01 2.800216e-02 -7.432732e-01
[66] 1.887923e-01 -1.804959e+00 1.465555e+00 1.532533e-01 2.172612e+00
[71] 4.755095e-01 -7.099464e-01 6.107264e-01 -9.340976e-01 -1.253633e+00
[76] 2.914462e-01 -4.432919e-01 1.105352e-03 7.434132e-02 -5.895209e-01
[81] -5.686687e-01 -1.351786e-01 1.178087e+00 -1.523567e+00 5.939462e-01
[86] 3.329504e-01 1.063100e+00 -3.041839e-01 3.700188e-01 2.670988e-01
[91] -5.425200e-01 1.207868e+00 1.160403e+00 7.002136e-01 1.586833e+00
[96] 5.584864e-01 -1.276592e+00 -5.732654e-01 -1.224613e+00 -4.734006e-01
[101] -6.203667e-01 4.211587e-02 -9.109216e-01 1.580288e-01 -6.545846e-01
[106] 1.767287e+00 7.167075e-01 9.101742e-01 3.841854e-01 1.682176e+00
[111] -6.357365e-01 -4.616447e-01 1.432282e+00 -6.506964e-01 -2.073807e-01
[116] -3.928079e-01 -3.199929e-01 -2.791133e-01 4.941883e-01 -1.773305e-01
[121] -5.059575e-01 1.343039e+00 -2.145794e-01 -1.795565e-01 -1.001907e-01
[126] 7.126663e-01 -7.356440e-02 -3.763417e-02 -6.816605e-01 -3.242703e-01
[131] 6.016044e-02 -5.888945e-01 5.314962e-01 -1.518394e+00 3.065579e-01
[136] -1.536450e+00 -3.009761e-01 -5.282799e-01 -6.520948e-01 -5.689678e-02
[141] -1.914359e+00 1.176583e+00 -1.664972e+00 -4.635304e-01 -1.115920e+00
[146] -7.508190e-01 2.087167e+00 1.739562e-02 -1.286301e+00 -1.640606e+00
[151] 4.501871e-01 -1.855983e-02 -3.180684e-01 -9.293621e-01 -1.487460e+00
[156] -1.075192e+00 1.000029e+00 -6.212667e-01 -1.384427e+00 1.869291e+00
[161] 4.251004e-01 -2.386471e-01 1.058483e+00 8.864227e-01 -6.192430e-01
[166] 2.206102e+00 -2.550270e-01 -1.424495e+00 -1.443996e-01 2.075383e-01
[171] 2.307978e+00 1.058024e-01 4.569988e-01 -7.715294e-02 -3.340008e-01
[176] -3.472603e-02 7.876396e-01 2.075245e+00 1.027392e+00 1.207908e+00
[181] -1.231323e+00 9.838956e-01 2.199248e-01 -1.467250e+00 5.210227e-01
[186] -1.587546e-01 1.464587e+00 -7.660820e-01 -4.302118e-01 -9.261095e-01
[191] -1.771040e-01 4.020118e-01 -7.317482e-01 8.303732e-01 -1.208083e+00
[196] -1.047984e+00 1.441158e+00 -1.015847e+00 4.119747e-01 -3.810761e-01
[201] 4.094018e-01 1.688873e+00 1.586588e+00 -3.309078e-01 -2.285236e+00
[206] 2.497662e+00 6.670662e-01 5.413273e-01 -1.339952e-02 5.101084e-01
[211] -1.643758e-01 4.206946e-01 -4.002467e-01 -1.370208e+00 9.878383e-01
[216] 1.519745e+00 -3.087406e-01 -1.253290e+00 6.422413e-01 -4.470914e-02
[221] -1.733218e+00 2.131860e-03 -6.303003e-01 -3.409686e-01 -1.156572e+00
[226] 1.803142e+00 -3.311320e-01 -1.605513e+00 1.971934e-01 2.631756e-01
[231] -9.858267e-01 -2.888921e+00 -6.404817e-01 5.705076e-01 -5.972328e-02
[236] -9.817874e-02 5.608207e-01 -1.186459e+00 1.096777e+00 -5.344028e-03
[241] 7.073107e-01 1.034108e+00 2.234804e-01 -8.787076e-01 1.162965e+00
[246] -2.000165e+00 -5.447907e-01 -2.556707e-01 -1.661210e-01 1.020464e+00
[251] 1.362219e-01 4.071676e-01 -6.965481e-02 -2.476643e-01 6.955508e-01
[256] 1.146228e+00 -2.403096e+00 5.727396e-01 3.747244e-01 -4.252677e-01
[261] 9.510128e-01 -3.892372e-01 -2.843307e-01 8.574098e-01 1.719627e+00
[266] 2.700549e-01 -4.221840e-01 -1.189113e+00 -3.310330e-01 -9.398293e-01
[271] -2.589326e-01 3.943792e-01 -8.518571e-01 2.649167e+00 1.560117e-01
[276] 1.130207e+00 -2.289124e+00 7.410012e-01 -1.316245e+00 9.198037e-01
[281] 3.981302e-01 -4.075286e-01 1.324259e+00 -7.012317e-01 -5.806143e-01
[286] -1.001072e+00 -6.681786e-01 9.451850e-01 4.337021e-01 1.005159e+00
[291] -3.901187e-01 3.763703e-01 2.441649e-01 -1.426257e+00 1.778429e+00
[296] 1.344477e-01 7.655990e-01 9.551367e-01 -5.056570e-02 -3.058154e-01
[301] 8.936737e-01 -1.047298e+00 1.971337e+00 -3.836321e-01 1.654145e+00
[306] 1.512213e+00 8.296573e-02 5.672209e-01 -1.024548e+00 3.230065e-01
[311] 1.043612e+00 9.907849e-02 -4.541369e-01 -6.557819e-01 -3.592242e-02
[316] 1.069161e+00 -4.839749e-01 -1.210101e-01 -1.294140e+00 4.943128e-01
[321] 1.307902e+00 1.497041e+00 8.147027e-01 -1.869789e+00 4.820295e-01
[326] 4.561356e-01 -3.534003e-01 1.704895e-01 -8.640360e-01 6.792308e-01
[331] -3.271010e-01 -1.569082e+00 -3.674508e-01 1.364435e+00 -3.342814e-01
[336] 7.327500e-01 9.465856e-01 4.398704e-03 -3.523223e-01 -5.296955e-01
[341] 7.395892e-01 -1.063457e+00 2.462108e-01 -2.894994e-01 -2.264889e+00
[346] -1.408850e+00 9.160193e-01 -1.912790e-01 8.032832e-01 1.887474e+00
[351] 1.473881e+00 6.772685e-01 3.799627e-01 -1.927984e-01 1.577892e+00
[356] 5.962341e-01 -1.173577e+00 -1.556425e-01 -1.918910e+00 -1.952588e-01
[361] -2.592328e+00 1.314002e+00 -6.355430e-01 -4.299788e-01 -1.693183e-01
[366] 6.122182e-01 6.783402e-01 5.679520e-01 -5.725426e-01 -1.363291e+00
[371] -3.887222e-01 2.779141e-01 -8.230811e-01 -6.884093e-02 -1.167662e+00
[376] -8.309014e-03 1.288554e-01 -1.458756e-01 -1.639110e-01 1.763552e+00
[381] 7.625865e-01 1.111431e+00 -9.232070e-01 1.643418e-01 1.154825e+00
[386] -5.652142e-02 -2.129361e+00 3.448458e-01 -1.904955e+00 -8.111702e-01
[391] 1.324004e+00 6.156368e-01 1.091669e+00 3.066049e-01 -1.101588e-01
[396] -9.243128e-01 1.592914e+00 4.501060e-02 -7.151284e-01 8.652231e-01
[401] 1.074441e+00 1.895655e+00 -6.029973e-01 -3.908678e-01 -4.162220e-01
[406] -3.756574e-01 -3.666309e-01 -2.956775e-01 1.441820e+00 -6.975383e-01
[411] -3.881675e-01 6.525365e-01 1.124772e+00 -7.721108e-01 -5.080862e-01
[416] 5.236206e-01 1.017754e+00 -2.511646e-01 -1.429993e+00 1.709121e+00
[421] 1.435070e+00 -7.103711e-01 -6.506757e-02 -1.759469e+00 5.697230e-01
[426] 1.612347e+00 -1.637281e+00 -7.795685e-01 -6.411769e-01 -6.811314e-01
[431] -2.033286e+00 5.009636e-01 -1.531798e+00 -2.499764e-02 5.929847e-01
[436] -1.981954e-01 8.920084e-01 -2.571507e-02 -6.476605e-01 6.463594e-01
...
and so on
(As Ben Bolker mentions in the comments, this exercise actually has a non-zero probability to give exactly a particular number. But that is because computers have a finite or discrete set of numbers. The true normal distribution is a continuous distribution with an infinite possibility of numbers as outcome)
2
If there are an infinite possibilities then the probability of any of them may be zero. To get a non-zero measure you need a range of values. For instance you can speak about the probability of the ice-cream being inbetween 119.9 and 120.1 grams.
3
Intuition, Imagine you want to pick a rational number between 0 and 1 by throwing a dart on a board and wherever the dart ends up will be the number that you pick. Say, the probability where the dart ends will be continuous and uniform. Then the probability for the dart to end up in a certain region can be determined by the size of the interval (the Lebesgue measure).
The probability for the dart to end in a particular interval will be equal to the size of the interval. For instance the probability for the dart to end up between 0 and 0.5 is 0.5, the probability for the dart to end up between 0.211 and 0.235 is 0.024, and so on.
But now imagine the "size" of the region for a single point... it is zero. | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | 1
Let's try this out for a standard normal distribution.
set.seed(1)
x = rnorm(10^4)
Out if these $10^4$ values many will be close to the mean (that is zero). But none of them are equal to zero.
| Why can you not find the probability of a specific value for the normal distribution? [duplicate]
1
Let's try this out for a standard normal distribution.
set.seed(1)
x = rnorm(10^4)
Out if these $10^4$ values many will be close to the mean (that is zero). But none of them are equal to zero.
[1] -6.264538e-01 1.836433e-01 -8.356286e-01 1.595281e+00 3.295078e-01
[6] -8.204684e-01 4.874291e-01 7.383247e-01 5.757814e-01 -3.053884e-01
[11] 1.511781e+00 3.898432e-01 -6.212406e-01 -2.214700e+00 1.124931e+00
[16] -4.493361e-02 -1.619026e-02 9.438362e-01 8.212212e-01 5.939013e-01
[21] 9.189774e-01 7.821363e-01 7.456498e-02 -1.989352e+00 6.198257e-01
[26] -5.612874e-02 -1.557955e-01 -1.470752e+00 -4.781501e-01 4.179416e-01
[31] 1.358680e+00 -1.027877e-01 3.876716e-01 -5.380504e-02 -1.377060e+00
[36] -4.149946e-01 -3.942900e-01 -5.931340e-02 1.100025e+00 7.631757e-01
[41] -1.645236e-01 -2.533617e-01 6.969634e-01 5.566632e-01 -6.887557e-01
[46] -7.074952e-01 3.645820e-01 7.685329e-01 -1.123462e-01 8.811077e-01
[51] 3.981059e-01 -6.120264e-01 3.411197e-01 -1.129363e+00 1.433024e+00
[56] 1.980400e+00 -3.672215e-01 -1.044135e+00 5.697196e-01 -1.350546e-01
[61] 2.401618e+00 -3.924000e-02 6.897394e-01 2.800216e-02 -7.432732e-01
[66] 1.887923e-01 -1.804959e+00 1.465555e+00 1.532533e-01 2.172612e+00
[71] 4.755095e-01 -7.099464e-01 6.107264e-01 -9.340976e-01 -1.253633e+00
[76] 2.914462e-01 -4.432919e-01 1.105352e-03 7.434132e-02 -5.895209e-01
[81] -5.686687e-01 -1.351786e-01 1.178087e+00 -1.523567e+00 5.939462e-01
[86] 3.329504e-01 1.063100e+00 -3.041839e-01 3.700188e-01 2.670988e-01
[91] -5.425200e-01 1.207868e+00 1.160403e+00 7.002136e-01 1.586833e+00
[96] 5.584864e-01 -1.276592e+00 -5.732654e-01 -1.224613e+00 -4.734006e-01
[101] -6.203667e-01 4.211587e-02 -9.109216e-01 1.580288e-01 -6.545846e-01
[106] 1.767287e+00 7.167075e-01 9.101742e-01 3.841854e-01 1.682176e+00
[111] -6.357365e-01 -4.616447e-01 1.432282e+00 -6.506964e-01 -2.073807e-01
[116] -3.928079e-01 -3.199929e-01 -2.791133e-01 4.941883e-01 -1.773305e-01
[121] -5.059575e-01 1.343039e+00 -2.145794e-01 -1.795565e-01 -1.001907e-01
[126] 7.126663e-01 -7.356440e-02 -3.763417e-02 -6.816605e-01 -3.242703e-01
[131] 6.016044e-02 -5.888945e-01 5.314962e-01 -1.518394e+00 3.065579e-01
[136] -1.536450e+00 -3.009761e-01 -5.282799e-01 -6.520948e-01 -5.689678e-02
[141] -1.914359e+00 1.176583e+00 -1.664972e+00 -4.635304e-01 -1.115920e+00
[146] -7.508190e-01 2.087167e+00 1.739562e-02 -1.286301e+00 -1.640606e+00
[151] 4.501871e-01 -1.855983e-02 -3.180684e-01 -9.293621e-01 -1.487460e+00
[156] -1.075192e+00 1.000029e+00 -6.212667e-01 -1.384427e+00 1.869291e+00
[161] 4.251004e-01 -2.386471e-01 1.058483e+00 8.864227e-01 -6.192430e-01
[166] 2.206102e+00 -2.550270e-01 -1.424495e+00 -1.443996e-01 2.075383e-01
[171] 2.307978e+00 1.058024e-01 4.569988e-01 -7.715294e-02 -3.340008e-01
[176] -3.472603e-02 7.876396e-01 2.075245e+00 1.027392e+00 1.207908e+00
[181] -1.231323e+00 9.838956e-01 2.199248e-01 -1.467250e+00 5.210227e-01
[186] -1.587546e-01 1.464587e+00 -7.660820e-01 -4.302118e-01 -9.261095e-01
[191] -1.771040e-01 4.020118e-01 -7.317482e-01 8.303732e-01 -1.208083e+00
[196] -1.047984e+00 1.441158e+00 -1.015847e+00 4.119747e-01 -3.810761e-01
[201] 4.094018e-01 1.688873e+00 1.586588e+00 -3.309078e-01 -2.285236e+00
[206] 2.497662e+00 6.670662e-01 5.413273e-01 -1.339952e-02 5.101084e-01
[211] -1.643758e-01 4.206946e-01 -4.002467e-01 -1.370208e+00 9.878383e-01
[216] 1.519745e+00 -3.087406e-01 -1.253290e+00 6.422413e-01 -4.470914e-02
[221] -1.733218e+00 2.131860e-03 -6.303003e-01 -3.409686e-01 -1.156572e+00
[226] 1.803142e+00 -3.311320e-01 -1.605513e+00 1.971934e-01 2.631756e-01
[231] -9.858267e-01 -2.888921e+00 -6.404817e-01 5.705076e-01 -5.972328e-02
[236] -9.817874e-02 5.608207e-01 -1.186459e+00 1.096777e+00 -5.344028e-03
[241] 7.073107e-01 1.034108e+00 2.234804e-01 -8.787076e-01 1.162965e+00
[246] -2.000165e+00 -5.447907e-01 -2.556707e-01 -1.661210e-01 1.020464e+00
[251] 1.362219e-01 4.071676e-01 -6.965481e-02 -2.476643e-01 6.955508e-01
[256] 1.146228e+00 -2.403096e+00 5.727396e-01 3.747244e-01 -4.252677e-01
[261] 9.510128e-01 -3.892372e-01 -2.843307e-01 8.574098e-01 1.719627e+00
[266] 2.700549e-01 -4.221840e-01 -1.189113e+00 -3.310330e-01 -9.398293e-01
[271] -2.589326e-01 3.943792e-01 -8.518571e-01 2.649167e+00 1.560117e-01
[276] 1.130207e+00 -2.289124e+00 7.410012e-01 -1.316245e+00 9.198037e-01
[281] 3.981302e-01 -4.075286e-01 1.324259e+00 -7.012317e-01 -5.806143e-01
[286] -1.001072e+00 -6.681786e-01 9.451850e-01 4.337021e-01 1.005159e+00
[291] -3.901187e-01 3.763703e-01 2.441649e-01 -1.426257e+00 1.778429e+00
[296] 1.344477e-01 7.655990e-01 9.551367e-01 -5.056570e-02 -3.058154e-01
[301] 8.936737e-01 -1.047298e+00 1.971337e+00 -3.836321e-01 1.654145e+00
[306] 1.512213e+00 8.296573e-02 5.672209e-01 -1.024548e+00 3.230065e-01
[311] 1.043612e+00 9.907849e-02 -4.541369e-01 -6.557819e-01 -3.592242e-02
[316] 1.069161e+00 -4.839749e-01 -1.210101e-01 -1.294140e+00 4.943128e-01
[321] 1.307902e+00 1.497041e+00 8.147027e-01 -1.869789e+00 4.820295e-01
[326] 4.561356e-01 -3.534003e-01 1.704895e-01 -8.640360e-01 6.792308e-01
[331] -3.271010e-01 -1.569082e+00 -3.674508e-01 1.364435e+00 -3.342814e-01
[336] 7.327500e-01 9.465856e-01 4.398704e-03 -3.523223e-01 -5.296955e-01
[341] 7.395892e-01 -1.063457e+00 2.462108e-01 -2.894994e-01 -2.264889e+00
[346] -1.408850e+00 9.160193e-01 -1.912790e-01 8.032832e-01 1.887474e+00
[351] 1.473881e+00 6.772685e-01 3.799627e-01 -1.927984e-01 1.577892e+00
[356] 5.962341e-01 -1.173577e+00 -1.556425e-01 -1.918910e+00 -1.952588e-01
[361] -2.592328e+00 1.314002e+00 -6.355430e-01 -4.299788e-01 -1.693183e-01
[366] 6.122182e-01 6.783402e-01 5.679520e-01 -5.725426e-01 -1.363291e+00
[371] -3.887222e-01 2.779141e-01 -8.230811e-01 -6.884093e-02 -1.167662e+00
[376] -8.309014e-03 1.288554e-01 -1.458756e-01 -1.639110e-01 1.763552e+00
[381] 7.625865e-01 1.111431e+00 -9.232070e-01 1.643418e-01 1.154825e+00
[386] -5.652142e-02 -2.129361e+00 3.448458e-01 -1.904955e+00 -8.111702e-01
[391] 1.324004e+00 6.156368e-01 1.091669e+00 3.066049e-01 -1.101588e-01
[396] -9.243128e-01 1.592914e+00 4.501060e-02 -7.151284e-01 8.652231e-01
[401] 1.074441e+00 1.895655e+00 -6.029973e-01 -3.908678e-01 -4.162220e-01
[406] -3.756574e-01 -3.666309e-01 -2.956775e-01 1.441820e+00 -6.975383e-01
[411] -3.881675e-01 6.525365e-01 1.124772e+00 -7.721108e-01 -5.080862e-01
[416] 5.236206e-01 1.017754e+00 -2.511646e-01 -1.429993e+00 1.709121e+00
[421] 1.435070e+00 -7.103711e-01 -6.506757e-02 -1.759469e+00 5.697230e-01
[426] 1.612347e+00 -1.637281e+00 -7.795685e-01 -6.411769e-01 -6.811314e-01
[431] -2.033286e+00 5.009636e-01 -1.531798e+00 -2.499764e-02 5.929847e-01
[436] -1.981954e-01 8.920084e-01 -2.571507e-02 -6.476605e-01 6.463594e-01
...
and so on
(As Ben Bolker mentions in the comments, this exercise actually has a non-zero probability to give exactly a particular number. But that is because computers have a finite or discrete set of numbers. The true normal distribution is a continuous distribution with an infinite possibility of numbers as outcome)
2
If there are an infinite possibilities then the probability of any of them may be zero. To get a non-zero measure you need a range of values. For instance you can speak about the probability of the ice-cream being inbetween 119.9 and 120.1 grams.
3
Intuition, Imagine you want to pick a rational number between 0 and 1 by throwing a dart on a board and wherever the dart ends up will be the number that you pick. Say, the probability where the dart ends will be continuous and uniform. Then the probability for the dart to end up in a certain region can be determined by the size of the interval (the Lebesgue measure).
The probability for the dart to end in a particular interval will be equal to the size of the interval. For instance the probability for the dart to end up between 0 and 0.5 is 0.5, the probability for the dart to end up between 0.211 and 0.235 is 0.024, and so on.
But now imagine the "size" of the region for a single point... it is zero. | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
1
Let's try this out for a standard normal distribution.
set.seed(1)
x = rnorm(10^4)
Out if these $10^4$ values many will be close to the mean (that is zero). But none of them are equal to zero.
|
20,731 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | For a real-world analogy, imagine throwing a pencil in the air in such a way that it has an equal probability of landing at any angle, measured relative to north. What is the probability that it lands at exactly 120 degrees? It might get really close, and about 1 in 360 times it will be between 120.5 and 119.5 degrees, but it will never be at exactly 120, because if you can measure the angle a bit more precisely you'll find it's actually at 120.002, or 119.99999999999997, and so on, under the assumption that real space is actually continuous and you can measure an angle to an infinite number of digits.
The point is that because this probability distribution is continuous, there are infinitely many numbers right next to any number you can choose. The somewhat strange corollary is that events with probability zero happen all the time: before you throw the pencil, the probability of it landing at any specific angle is zero, but it will land at some specific angle. | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | For a real-world analogy, imagine throwing a pencil in the air in such a way that it has an equal probability of landing at any angle, measured relative to north. What is the probability that it lands | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
For a real-world analogy, imagine throwing a pencil in the air in such a way that it has an equal probability of landing at any angle, measured relative to north. What is the probability that it lands at exactly 120 degrees? It might get really close, and about 1 in 360 times it will be between 120.5 and 119.5 degrees, but it will never be at exactly 120, because if you can measure the angle a bit more precisely you'll find it's actually at 120.002, or 119.99999999999997, and so on, under the assumption that real space is actually continuous and you can measure an angle to an infinite number of digits.
The point is that because this probability distribution is continuous, there are infinitely many numbers right next to any number you can choose. The somewhat strange corollary is that events with probability zero happen all the time: before you throw the pencil, the probability of it landing at any specific angle is zero, but it will land at some specific angle. | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
For a real-world analogy, imagine throwing a pencil in the air in such a way that it has an equal probability of landing at any angle, measured relative to north. What is the probability that it lands |
20,732 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | TL;DR: Don't confuse the probability density with the probability. In the given example, the probability is zero: $\mathrm{Pr}(m=120\,\mathrm{g})=0$, but the probability density is non-zero: $p_M(m=120\,\mathrm{g}) \approx 0.0299\,\mathrm{g^{-1}}$.
There have already been quite a few answers, but I think that visualizing things might help understanding, here.
I agree with Itamar Mushkin's comments to the OP that there probably is some confusion of probability (let's write it as $\mathrm{Pr}(m)$) and probability density (let's write it as $p_M(m)$), which hasn't been properly addressed in any of the answers, yet.
Full answer
In the video a normal distribution with mean $\mu=112\,\mathrm{g}$ and standard deviation $\sigma=9\,\mathrm{g}$ is used as a probability density function (commonly abbreviated by "pdf"). Let's call $p_M(m)$ the pdf of the random variable $M$ (our ice cream mass), such that:
$$
p_M(m) = \mathcal{N}(\mu=112\,\mathrm{g},\sigma=9\,\mathrm{g}) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{\frac{-(m-\mu)^2}{2\sigma^2}}
$$
Note (and this is crucial!), how the probability density $p$ is not dimensionless, but has units of $\mathrm{g^{-1}}$, since it is a density, i.e. it gives the probability per mass interval. Note further, that the probability density is non-zero for any finite mass (probability density $p_M$, not probability $\mathrm{Pr}$!). When we commonly talk about densities, we typically refer to mass per volume, e.g. the density of a diamond is about $3.51\,\mathrm{g/cm^3}$. Here, when talking about probability density, the probability takes the role of the diamond mass and the ice cream mass interval takes the role of the diamond volume, giving units of probability per mass.
Now, to get to an actual probability, we basically need to multiply the probability density with some mass interval $\Delta m = m_2-m_1$ (in the same way that we would need to multiply the diamond density with the diamond volume to get the diamond's mass). I say basically, because the proper way of doing this is by integrating the pdf over that mass interval, giving you the area under the curve (and area under a curve is basically just multiplying x-interval times y-interval in fine strips):
$$
\begin{align}
\mathrm{Pr}(M \in [m_1, m_2])
&= \int_{m_1}^{m_2} p_M(m) \, dm \tag{1}\\
&= P_M(m) |_{m_1}^{m_2} \\
&= P_M(m_2) - P_M(m_1) \tag{2}
\end{align}
$$
In the above formula $P_M(m)$ is the cumulative distribution function (commonly abbreviated to cdf and which Henry called $\Phi$ in his answer), which is the integral of the pdf:
$$
\begin{align}
P_M(m)
&= \int_{-\infty}^m p_M(\tilde{m}) \, d\tilde{m} \\
&= \mathrm{Pr}(M \le m)
\end{align}
$$
Thus, the cdf would directly give you the answer to the question: "What is the probability that the ice cream has a mass of at least mass $m$?" And the answer would be non-zero.
The corresponding picture for $\mathrm{Pr}(M \in [m_1, m_2])$ in terms of the cdf is as follows:
So far so good, this is the starting point for most of the other answers, many of which give examples to intuitively understand why the probability that the mass takes a specific value goes to zero.
To answer that question, here, with the images and equations above: If you want to know the probability that the mass takes on some exact value, e.g. $m_\ast = 120\,\mathrm{g}$, you could take a look at equation (1) and the second image and realise that by looking at $\mathrm{Pr}(M = m_\ast)$ you are effectively sending both of your integration limits to the same mass $m_1, m_2 \rightarrow m_\ast$ which sends the mass interval to zero $\Delta m = m_2 - m_1 \rightarrow 0$, and thus the area under the curve will be zero, too: $\int_{m_1 \rightarrow m_\ast}^{m_2 \rightarrow m_\ast} p_M(m) \, dm \rightarrow 0$. Equivalently, you could look at equation (2) and see directly that: $P_M(m_2 \rightarrow m_\ast) - P_M(m_1 \rightarrow m_\ast) \rightarrow 0$.
Note, the probability that the mass is exactly $m_\ast=120\,\mathrm{g}$ goes to zero: $\mathrm{Pr}(M=120\,\mathrm{g})=0$, the probability density at the mass $m_\ast=120\,\mathrm{g}$ is not zero: $p_M(m=120\,\mathrm{g}) \approx 0.0299\,\mathrm{g^{-1}}$.
Code
For those interested in the python code that generated the above images:
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from scipy.integrate import quad
mu = 112 # mean
sigma = 9 # standard deviation
norm = norm(loc=mu, scale=sigma) # normal distribution
p = norm.pdf # probability density function
P = norm.cdf # cumulative distribution function
m = np.linspace(mu-5*sigma, mu+5*sigma, 10*sigma+1) # ice cream mass range
################################################################################
# plot of probability density function (pdf)
################################################################################
fig = plt.figure()
plt.plot(m, p(m), lw=3)
plt.axvline(mu, color='C1', label="$\mu=%d\,\mathrm{g}$" % mu)
plt.hlines(p(norm.ppf((1-0.6827)/2)), xmin=mu-sigma, xmax=mu+sigma, color='C2',
label="$\sigma=%d\,\mathrm{g}$" % sigma)
plt.legend(bbox_to_anchor=(1, 1), loc='upper left')
plt.xlabel("$m$ $\mathrm{[g]}$ \n ice cream mass ")
plt.ylabel("probability density function \n $p_M(m)$ $[\mathrm{g^{-1}}]$")
plt.show()
################################################################################
# plot showing area under pdf corresponding to Pr(m1 <= m <= m2)
################################################################################
m1 = 115 # lower mass limit
m2 = 125 # upper mass limit
Delta_m = np.linspace(m1, m2, int(m2 - m1)) # mass interval
fig = plt.figure()
plt.plot(m, p(m), lw=3)
plt.fill_between(Delta_m, 0, p(Delta_m), color='C3', alpha=0.7,
label="$\mathrm{Pr}(%d \le m \le %d) "
"= \int_{%d}^{%d} p_M(m) dm$ \n\n"
".$\hphantom{\mathrm{Pr}(.5\le m\le125)} \\approx %.3f$"
% (m1, m2, m1, m2, quad(p, m1, m2)[0]))
plt.legend(bbox_to_anchor=(1, 1), loc='upper left')
plt.xlabel("$m$ $\mathrm{[g]}$ \n ice cream mass ")
plt.ylabel("probability density function \n $p_M(m)$ $[\mathrm{g^{-1}}]$")
plt.show()
################################################################################
# plot of cumulative distribution function and highlighting values for m1 and m2
################################################################################
fig = plt.figure()
plt.plot(m, P(m), lw=3)
plt.hlines(P(m1), min(m), m1, color='C3')
plt.hlines(P(m2), min(m), m2, color='C3')
plt.vlines(m1, 0, P(m1), color='C3')
plt.vlines(m2, 0, P(m2), color='C3',
label="$\mathrm{Pr}(%d \le m \le %d) = P_M(%d) - P_M(%d)$ \n\n"
".$\hphantom{\mathrm{Pr}(.5\le m\le125)} = %.3f - %.3f$ \n\n"
".$\hphantom{\mathrm{Pr}(.5\le m\le125)} \\approx %.3f$"
% (m1, m2, m1, m2, P(m2), P(m1), P(m2) - P(m1)))
plt.legend(bbox_to_anchor=(1, 1), loc='upper left')
plt.xlabel("$m$ $\mathrm{[g]}$ \n ice cream mass ")
plt.ylabel("cumulative distribution function \n $P_M(m)$")
plt.show() | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | TL;DR: Don't confuse the probability density with the probability. In the given example, the probability is zero: $\mathrm{Pr}(m=120\,\mathrm{g})=0$, but the probability density is non-zero: $p_M(m=12 | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
TL;DR: Don't confuse the probability density with the probability. In the given example, the probability is zero: $\mathrm{Pr}(m=120\,\mathrm{g})=0$, but the probability density is non-zero: $p_M(m=120\,\mathrm{g}) \approx 0.0299\,\mathrm{g^{-1}}$.
There have already been quite a few answers, but I think that visualizing things might help understanding, here.
I agree with Itamar Mushkin's comments to the OP that there probably is some confusion of probability (let's write it as $\mathrm{Pr}(m)$) and probability density (let's write it as $p_M(m)$), which hasn't been properly addressed in any of the answers, yet.
Full answer
In the video a normal distribution with mean $\mu=112\,\mathrm{g}$ and standard deviation $\sigma=9\,\mathrm{g}$ is used as a probability density function (commonly abbreviated by "pdf"). Let's call $p_M(m)$ the pdf of the random variable $M$ (our ice cream mass), such that:
$$
p_M(m) = \mathcal{N}(\mu=112\,\mathrm{g},\sigma=9\,\mathrm{g}) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{\frac{-(m-\mu)^2}{2\sigma^2}}
$$
Note (and this is crucial!), how the probability density $p$ is not dimensionless, but has units of $\mathrm{g^{-1}}$, since it is a density, i.e. it gives the probability per mass interval. Note further, that the probability density is non-zero for any finite mass (probability density $p_M$, not probability $\mathrm{Pr}$!). When we commonly talk about densities, we typically refer to mass per volume, e.g. the density of a diamond is about $3.51\,\mathrm{g/cm^3}$. Here, when talking about probability density, the probability takes the role of the diamond mass and the ice cream mass interval takes the role of the diamond volume, giving units of probability per mass.
Now, to get to an actual probability, we basically need to multiply the probability density with some mass interval $\Delta m = m_2-m_1$ (in the same way that we would need to multiply the diamond density with the diamond volume to get the diamond's mass). I say basically, because the proper way of doing this is by integrating the pdf over that mass interval, giving you the area under the curve (and area under a curve is basically just multiplying x-interval times y-interval in fine strips):
$$
\begin{align}
\mathrm{Pr}(M \in [m_1, m_2])
&= \int_{m_1}^{m_2} p_M(m) \, dm \tag{1}\\
&= P_M(m) |_{m_1}^{m_2} \\
&= P_M(m_2) - P_M(m_1) \tag{2}
\end{align}
$$
In the above formula $P_M(m)$ is the cumulative distribution function (commonly abbreviated to cdf and which Henry called $\Phi$ in his answer), which is the integral of the pdf:
$$
\begin{align}
P_M(m)
&= \int_{-\infty}^m p_M(\tilde{m}) \, d\tilde{m} \\
&= \mathrm{Pr}(M \le m)
\end{align}
$$
Thus, the cdf would directly give you the answer to the question: "What is the probability that the ice cream has a mass of at least mass $m$?" And the answer would be non-zero.
The corresponding picture for $\mathrm{Pr}(M \in [m_1, m_2])$ in terms of the cdf is as follows:
So far so good, this is the starting point for most of the other answers, many of which give examples to intuitively understand why the probability that the mass takes a specific value goes to zero.
To answer that question, here, with the images and equations above: If you want to know the probability that the mass takes on some exact value, e.g. $m_\ast = 120\,\mathrm{g}$, you could take a look at equation (1) and the second image and realise that by looking at $\mathrm{Pr}(M = m_\ast)$ you are effectively sending both of your integration limits to the same mass $m_1, m_2 \rightarrow m_\ast$ which sends the mass interval to zero $\Delta m = m_2 - m_1 \rightarrow 0$, and thus the area under the curve will be zero, too: $\int_{m_1 \rightarrow m_\ast}^{m_2 \rightarrow m_\ast} p_M(m) \, dm \rightarrow 0$. Equivalently, you could look at equation (2) and see directly that: $P_M(m_2 \rightarrow m_\ast) - P_M(m_1 \rightarrow m_\ast) \rightarrow 0$.
Note, the probability that the mass is exactly $m_\ast=120\,\mathrm{g}$ goes to zero: $\mathrm{Pr}(M=120\,\mathrm{g})=0$, the probability density at the mass $m_\ast=120\,\mathrm{g}$ is not zero: $p_M(m=120\,\mathrm{g}) \approx 0.0299\,\mathrm{g^{-1}}$.
Code
For those interested in the python code that generated the above images:
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from scipy.integrate import quad
mu = 112 # mean
sigma = 9 # standard deviation
norm = norm(loc=mu, scale=sigma) # normal distribution
p = norm.pdf # probability density function
P = norm.cdf # cumulative distribution function
m = np.linspace(mu-5*sigma, mu+5*sigma, 10*sigma+1) # ice cream mass range
################################################################################
# plot of probability density function (pdf)
################################################################################
fig = plt.figure()
plt.plot(m, p(m), lw=3)
plt.axvline(mu, color='C1', label="$\mu=%d\,\mathrm{g}$" % mu)
plt.hlines(p(norm.ppf((1-0.6827)/2)), xmin=mu-sigma, xmax=mu+sigma, color='C2',
label="$\sigma=%d\,\mathrm{g}$" % sigma)
plt.legend(bbox_to_anchor=(1, 1), loc='upper left')
plt.xlabel("$m$ $\mathrm{[g]}$ \n ice cream mass ")
plt.ylabel("probability density function \n $p_M(m)$ $[\mathrm{g^{-1}}]$")
plt.show()
################################################################################
# plot showing area under pdf corresponding to Pr(m1 <= m <= m2)
################################################################################
m1 = 115 # lower mass limit
m2 = 125 # upper mass limit
Delta_m = np.linspace(m1, m2, int(m2 - m1)) # mass interval
fig = plt.figure()
plt.plot(m, p(m), lw=3)
plt.fill_between(Delta_m, 0, p(Delta_m), color='C3', alpha=0.7,
label="$\mathrm{Pr}(%d \le m \le %d) "
"= \int_{%d}^{%d} p_M(m) dm$ \n\n"
".$\hphantom{\mathrm{Pr}(.5\le m\le125)} \\approx %.3f$"
% (m1, m2, m1, m2, quad(p, m1, m2)[0]))
plt.legend(bbox_to_anchor=(1, 1), loc='upper left')
plt.xlabel("$m$ $\mathrm{[g]}$ \n ice cream mass ")
plt.ylabel("probability density function \n $p_M(m)$ $[\mathrm{g^{-1}}]$")
plt.show()
################################################################################
# plot of cumulative distribution function and highlighting values for m1 and m2
################################################################################
fig = plt.figure()
plt.plot(m, P(m), lw=3)
plt.hlines(P(m1), min(m), m1, color='C3')
plt.hlines(P(m2), min(m), m2, color='C3')
plt.vlines(m1, 0, P(m1), color='C3')
plt.vlines(m2, 0, P(m2), color='C3',
label="$\mathrm{Pr}(%d \le m \le %d) = P_M(%d) - P_M(%d)$ \n\n"
".$\hphantom{\mathrm{Pr}(.5\le m\le125)} = %.3f - %.3f$ \n\n"
".$\hphantom{\mathrm{Pr}(.5\le m\le125)} \\approx %.3f$"
% (m1, m2, m1, m2, P(m2), P(m1), P(m2) - P(m1)))
plt.legend(bbox_to_anchor=(1, 1), loc='upper left')
plt.xlabel("$m$ $\mathrm{[g]}$ \n ice cream mass ")
plt.ylabel("cumulative distribution function \n $P_M(m)$")
plt.show() | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
TL;DR: Don't confuse the probability density with the probability. In the given example, the probability is zero: $\mathrm{Pr}(m=120\,\mathrm{g})=0$, but the probability density is non-zero: $p_M(m=12 |
20,733 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | Normal distribution is a continuous probability distribution and in continuous probability distribution the method of finding probability is by integrating over the range or area under the curve. when you want to find a probability for a single value it will become a line in graph of pdf. We cannot find its area. Or in other words if the lower limit and the upper limit of an integral are the same value, the result of that integral is zero. | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | Normal distribution is a continuous probability distribution and in continuous probability distribution the method of finding probability is by integrating over the range or area under the curve. when | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
Normal distribution is a continuous probability distribution and in continuous probability distribution the method of finding probability is by integrating over the range or area under the curve. when you want to find a probability for a single value it will become a line in graph of pdf. We cannot find its area. Or in other words if the lower limit and the upper limit of an integral are the same value, the result of that integral is zero. | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
Normal distribution is a continuous probability distribution and in continuous probability distribution the method of finding probability is by integrating over the range or area under the curve. when |
20,734 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | What we need is a bit of an intuition of continuous random variables:
Teacher: Let's say we tossed a fair coin 10 times. What outcome would you place your bet on?
(Naive) Student: (5H, 5T), as it is fair coin.
Teacher: So that's what you would expect but may not necessarily get. In fact, the probability of (5H, 5T) is ${10\choose5}*(1/2)^5*(1/2)^5 = 0.25$.
Student: I guess we are tossing too less number of times. A fair coin should give half times Head and half times Tails if we tossed enough times.
Teacher: Fair point. So let's say I give you $100 if you get equal number of heads and tails. And you have to decide whether you tossed the coin 10 times or 100 times. How many times would you toss the coin?
Student: 100 times.
Teacher: Interestingly enough, the probability of getting (50H, 50T) is actually smaller now: ${100\choose50}*(1/2)^{50}*(1/2)^{50} = 0.08$
In fact the highest probability of getting equal number of Heads and Tails will be when you just throw the coin two times.
And if you throw the coin 2 million times, the probability of getting a exactly million each of Heads and Tails is almost zero.
Student But then where is my intuition going wrong?
Teacher: Your intuition about choosing more number of tosses is correct but what your intuition got wrong is exact half is not almost half. As you increase the number of tosses, the probability that the proportion of number of Heads (equivalently, Tails) will be in the neighbourhood of $0.5$ will be greater as we increase tosses. The probability of getting 40% to 60% Heads is about $0.66$ with 10 tosses and $0.96$ in 100 tosses.
So you see as the number of possible events tend to infinity, the probability of getting
an exact outcome (even the expected outcome) shrinks to zero. This captures the essence of continuous random variables. For such cases, when there are just too many possibilities, we (intuitively) think about intervals and not exact outcomes. | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | What we need is a bit of an intuition of continuous random variables:
Teacher: Let's say we tossed a fair coin 10 times. What outcome would you place your bet on?
(Naive) Student: (5H, 5T), as it is f | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
What we need is a bit of an intuition of continuous random variables:
Teacher: Let's say we tossed a fair coin 10 times. What outcome would you place your bet on?
(Naive) Student: (5H, 5T), as it is fair coin.
Teacher: So that's what you would expect but may not necessarily get. In fact, the probability of (5H, 5T) is ${10\choose5}*(1/2)^5*(1/2)^5 = 0.25$.
Student: I guess we are tossing too less number of times. A fair coin should give half times Head and half times Tails if we tossed enough times.
Teacher: Fair point. So let's say I give you $100 if you get equal number of heads and tails. And you have to decide whether you tossed the coin 10 times or 100 times. How many times would you toss the coin?
Student: 100 times.
Teacher: Interestingly enough, the probability of getting (50H, 50T) is actually smaller now: ${100\choose50}*(1/2)^{50}*(1/2)^{50} = 0.08$
In fact the highest probability of getting equal number of Heads and Tails will be when you just throw the coin two times.
And if you throw the coin 2 million times, the probability of getting a exactly million each of Heads and Tails is almost zero.
Student But then where is my intuition going wrong?
Teacher: Your intuition about choosing more number of tosses is correct but what your intuition got wrong is exact half is not almost half. As you increase the number of tosses, the probability that the proportion of number of Heads (equivalently, Tails) will be in the neighbourhood of $0.5$ will be greater as we increase tosses. The probability of getting 40% to 60% Heads is about $0.66$ with 10 tosses and $0.96$ in 100 tosses.
So you see as the number of possible events tend to infinity, the probability of getting
an exact outcome (even the expected outcome) shrinks to zero. This captures the essence of continuous random variables. For such cases, when there are just too many possibilities, we (intuitively) think about intervals and not exact outcomes. | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
What we need is a bit of an intuition of continuous random variables:
Teacher: Let's say we tossed a fair coin 10 times. What outcome would you place your bet on?
(Naive) Student: (5H, 5T), as it is f |
20,735 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | When I was teaching this exact concept, the following picture proved to be very intuitively understandable by the students.
We start from the fact that, as you probably, know, the probability for the random variable $X$ to take a value between $x_0$ and $x_1$ is calculated as the area under your normal bell curve:
$$ P([x_0, x_1]) = \int_{x_0}^{x_1} f(X) dx = P(x_1) - P(x_0)$$
If this formula looks weird, just look at it this way: what should the probability be for X to take any value at all? It will be $1$, so the whole area under the curve is $1$.
Now, if you want to calculate the probability for an ever more specific value, that means you're bringing the limits of integration closer and closer to each other. And when you have them at a value (e.g. 120g ice cream), that's the same as writing
$$ P([120g, 120g]) = \int_{120g}^{120g} f(X) dx = P(120g) - P(120g) = 0$$ | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | When I was teaching this exact concept, the following picture proved to be very intuitively understandable by the students.
We start from the fact that, as you probably, know, the probability for the | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
When I was teaching this exact concept, the following picture proved to be very intuitively understandable by the students.
We start from the fact that, as you probably, know, the probability for the random variable $X$ to take a value between $x_0$ and $x_1$ is calculated as the area under your normal bell curve:
$$ P([x_0, x_1]) = \int_{x_0}^{x_1} f(X) dx = P(x_1) - P(x_0)$$
If this formula looks weird, just look at it this way: what should the probability be for X to take any value at all? It will be $1$, so the whole area under the curve is $1$.
Now, if you want to calculate the probability for an ever more specific value, that means you're bringing the limits of integration closer and closer to each other. And when you have them at a value (e.g. 120g ice cream), that's the same as writing
$$ P([120g, 120g]) = \int_{120g}^{120g} f(X) dx = P(120g) - P(120g) = 0$$ | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
When I was teaching this exact concept, the following picture proved to be very intuitively understandable by the students.
We start from the fact that, as you probably, know, the probability for the |
20,736 | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | Suppose that we have continuous random variable $X$ with distribution $\mathbf{P}_X$, so it can take uncountably many values. We claim that every possible value has positive probability, what is equal to say, that each singleton (set with just one element, in a shape $\{x\}$) has probability bigger than zero. Define family of sets $\{A_n\}$, and establish that some point $x_0\in A_n$ when $\mathbf{P}_X(\{x_0\})> \frac{1}{n}$. Look that in a set $A_n$ we can have at most $n$ values: otherwise the probability would exceed $1$. If probablity $\mathbf{P}_X(\{x_0\})>0$, then there exists some $n_0$, for which $x_0\in A_{n_0}$. If we take the union of these sets over all natural numbers, we obtain countable union of finite sets, so countable set. It provides that only finite singletons could have probability bigger than zero, what is contradiction with our claim. | Why can you not find the probability of a specific value for the normal distribution? [duplicate] | Suppose that we have continuous random variable $X$ with distribution $\mathbf{P}_X$, so it can take uncountably many values. We claim that every possible value has positive probability, what is equal | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
Suppose that we have continuous random variable $X$ with distribution $\mathbf{P}_X$, so it can take uncountably many values. We claim that every possible value has positive probability, what is equal to say, that each singleton (set with just one element, in a shape $\{x\}$) has probability bigger than zero. Define family of sets $\{A_n\}$, and establish that some point $x_0\in A_n$ when $\mathbf{P}_X(\{x_0\})> \frac{1}{n}$. Look that in a set $A_n$ we can have at most $n$ values: otherwise the probability would exceed $1$. If probablity $\mathbf{P}_X(\{x_0\})>0$, then there exists some $n_0$, for which $x_0\in A_{n_0}$. If we take the union of these sets over all natural numbers, we obtain countable union of finite sets, so countable set. It provides that only finite singletons could have probability bigger than zero, what is contradiction with our claim. | Why can you not find the probability of a specific value for the normal distribution? [duplicate]
Suppose that we have continuous random variable $X$ with distribution $\mathbf{P}_X$, so it can take uncountably many values. We claim that every possible value has positive probability, what is equal |
20,737 | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate] | Yes.
Take for example the unit circle coordinates for (x, y). They are uncorrelated, yet if you know x you know that y can only take on 2 values - or 1 exactly (y=0) if x =1 or -1.
More generally marginal independence does not imply conditional indedepedence. That is there might be a third variable z that allows you to predict y from x knowing z.
See Examples of marginal independence, conditional dependence | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate] | Yes.
Take for example the unit circle coordinates for (x, y). They are uncorrelated, yet if you know x you know that y can only take on 2 values - or 1 exactly (y=0) if x =1 or -1.
More generally ma | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate]
Yes.
Take for example the unit circle coordinates for (x, y). They are uncorrelated, yet if you know x you know that y can only take on 2 values - or 1 exactly (y=0) if x =1 or -1.
More generally marginal independence does not imply conditional indedepedence. That is there might be a third variable z that allows you to predict y from x knowing z.
See Examples of marginal independence, conditional dependence | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate]
Yes.
Take for example the unit circle coordinates for (x, y). They are uncorrelated, yet if you know x you know that y can only take on 2 values - or 1 exactly (y=0) if x =1 or -1.
More generally ma |
20,738 | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate] | Let's prove the fact that @whuber gave in a comment to the question:
Let $X$ be symmetrically distributed around $0$ and let $Y=X^2$. The
latter is perfectly predictable from $X$ but the correlation is zero.
We first note that $X$ obviously determines its square $X^2=Y$. The proof of the second part is more interesting:
By definition, a random variable $X$ has a symmetric distribution about $\mu$ if $X-\mu$ has the same distribution as $\mu-X$. For symmetry about $\mu=0$ we get that $X-0=X$ has the same distribution as $0-X=-X$.
Using that $X$ and $-X$ have the same distribution and thus the same moments, the fact that $(-1)^a=-1$ for any odd number $a$, and linearity of expectation, we get
$$\mathbb{E}(X^a)=\mathbb{E}[(-X)^a]=\mathbb{E}(-X^a)=-\mathbb{E}(X^a)$$ and hence $\mathbb{E}(X^a)=0$ for any odd number $a$.
For the covariance between $X$ and $Y$ we have
$$\mathrm{Cov}(X,Y)=\mathbb{E}(XY)-\mathbb{E}(X)\mathbb{E}(Y)=\mathbb{E}(X^3)-\mathbb{E}(X^1)\mathbb{E}(X^2)$$
and using the previous result $\mathbb{E}(X^a)=0$ for $a\in\{1,3\}$ it follows that $\mathrm{Cov}(X,Y)=0$, which is equivalent to $\mathrm{Corr}(X,Y)=0$.
This is not particularly surprising as the covariance and correlation are measures of linear association between two random variables. | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate] | Let's prove the fact that @whuber gave in a comment to the question:
Let $X$ be symmetrically distributed around $0$ and let $Y=X^2$. The
latter is perfectly predictable from $X$ but the correlation | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate]
Let's prove the fact that @whuber gave in a comment to the question:
Let $X$ be symmetrically distributed around $0$ and let $Y=X^2$. The
latter is perfectly predictable from $X$ but the correlation is zero.
We first note that $X$ obviously determines its square $X^2=Y$. The proof of the second part is more interesting:
By definition, a random variable $X$ has a symmetric distribution about $\mu$ if $X-\mu$ has the same distribution as $\mu-X$. For symmetry about $\mu=0$ we get that $X-0=X$ has the same distribution as $0-X=-X$.
Using that $X$ and $-X$ have the same distribution and thus the same moments, the fact that $(-1)^a=-1$ for any odd number $a$, and linearity of expectation, we get
$$\mathbb{E}(X^a)=\mathbb{E}[(-X)^a]=\mathbb{E}(-X^a)=-\mathbb{E}(X^a)$$ and hence $\mathbb{E}(X^a)=0$ for any odd number $a$.
For the covariance between $X$ and $Y$ we have
$$\mathrm{Cov}(X,Y)=\mathbb{E}(XY)-\mathbb{E}(X)\mathbb{E}(Y)=\mathbb{E}(X^3)-\mathbb{E}(X^1)\mathbb{E}(X^2)$$
and using the previous result $\mathbb{E}(X^a)=0$ for $a\in\{1,3\}$ it follows that $\mathrm{Cov}(X,Y)=0$, which is equivalent to $\mathrm{Corr}(X,Y)=0$.
This is not particularly surprising as the covariance and correlation are measures of linear association between two random variables. | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate]
Let's prove the fact that @whuber gave in a comment to the question:
Let $X$ be symmetrically distributed around $0$ and let $Y=X^2$. The
latter is perfectly predictable from $X$ but the correlation |
20,739 | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate] | Correlation measures a certain kind of relation (usually linear) between variables, but other relationships (nonlinear) are possible as well. This is discussed in depth in the Why zero correlation does not necessarily imply independence thread. So it is possible that there’s a non-linear relationship between the two variables, that makes them non-independent, yet it is not measured by correlation. | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate] | Correlation measures a certain kind of relation (usually linear) between variables, but other relationships (nonlinear) are possible as well. This is discussed in depth in the Why zero correlation doe | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate]
Correlation measures a certain kind of relation (usually linear) between variables, but other relationships (nonlinear) are possible as well. This is discussed in depth in the Why zero correlation does not necessarily imply independence thread. So it is possible that there’s a non-linear relationship between the two variables, that makes them non-independent, yet it is not measured by correlation. | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate]
Correlation measures a certain kind of relation (usually linear) between variables, but other relationships (nonlinear) are possible as well. This is discussed in depth in the Why zero correlation doe |
20,740 | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate] | There are a few ways this can happen. Five come to mind. In your case, I suspect the fifth.
1) The relationship between $X$ and $Y$ is nonlinear
As some other answers and comments have discussed, correlation deals with linear relationships. If the relationship is nonlinear, correlation can miss that there is a relationship.
set.seed(2022)
N <- 100
a <- 1
x <- seq(-a, a, 2*a/(N - 1))
y <- x^2
plot(x, y)
cor(x, y)
In this example, $X$ perfectly predicts $Y$. However, the correlation is zero.
The remedy is to consider the quadratic term in a regression, such as L <- lm(y ~ x + I(x^2)). Such a regression gives the expected result of perfect predictability of $Y$.
2) Your WITH and ON functions use different tests
I don't know your software, but there are multiple ways of testing hypotheses. In a theoretical statistics class, such as one taught from the Casella/Berger book Statistical Inference, you will learn about what I call the "big three" hypothesis tests: Wald, likelihood ratio, and score (sometimes called Lagrange multiplier). All of these can give slightly different results. If WITH and ON use different tests of the same null hypothesis, it is possible for one to give a "significant" $p=0.043$ and the other to give an "insignificant" $p = 0.052$.
3) You've included some other variable in the regression
Consider the following picture.
As you might expect, the correlation is zero.
However, I made this by having two groups!
set.seed(2022)
N <- 100
a <- 1
x <- seq(-a, a, 2*a/(N - 1))
g <- rep(c(0, 1), N/2)
y <- x - 2*g*x
plot(x, y)
cor(x, y)
If we consider the group variable g and an interaction between x and g, we get perfect predictability.
L <- lm(y ~ x + g + x*g)
If we know we're dealing with a blue group or a red group, we can make perfect predictions and get perfect correlation.
set.seed(2022)
N <- 100
a <- 1
x <- seq(-a, a, 2*a/(N - 1))
g <- rep(c(0, 1), N/2)
y <- x - 2*g*x
plot(x[g==0], y[g==0], col = 'red')
points(x[g==1], y[g==1], col = 'blue')
plot(x[g==0], y[g==0], col = 'red', main = paste("Red correlation is", cor(x[g==0], y[g==0])))
plot(x[g==1], y[g==1], col = 'blue', main = paste("Blue correlation is", cor(x[g==1], y[g==1])))
4) You have a false positive (type I error)
Hypothesis tests falsely reject true null hypothesis some proportion of the time. Just because you know that, at the population level, $X$ and $Y$ are uncorrelated does not mean that the regression on the sample will reflect that fact.
set.seed(2022)
N <- 250
R <- 1000
ps <- rep(NA, R)
for (i in 1:R){
x <- rnorm(N)
y <- rnorm(N)
L <- lm(y ~ x)
ps[i] <- summary(L)$coef[2, 4] # p-value on the slope coefficient
}
ecdf(ps)(0.05)
Even though we know that $X$ and $Y$ are uncorrelated for each iteration in the above simulation, about $5\%$ of the tests have p-values of $0.05$ or lower, so you have type I errors occur about $5\%$ of the time.
5) You exclude an intercept term, which is what I suspect happened to you
I know one of the common Python regression packages (I forget if it is sklearn or statsmodels) excludes an intercept by default, so Mplus might do the same. Look at the following image of uncorrelated $X$ and $Y$.
If we omit the intercept from the regression, then we force the regression line to go through $(0,0)$.
The regression $\hat y_i = \hat\beta x_i$ has a highly significant $\hat\beta$.
set.seed(2022)
N <- 10000
x <- rnorm(N, 10, 1)
y <- rnorm(N, 10, 1)
plot(x, y)
plot(x, y, xlim = c(0, 14), ylim = c(0, 14))
points(0, 0, col = 'blue')
plot(x, y, xlim = c(0, 14), ylim = c(0, 14))
abline(a = 0, b = 1, col = 'red')
points(0, 0, col = 'blue')
L <- lm(y ~ 0 + x)
summary(L)
cor.test(x, y)
However, when we include the intercept, the slope, correctly, lacks significance.
L <- lm(y ~ x)
summary(L)
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-3.8865 -0.6757 0.0123 0.6770 3.7909
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.093635 0.099646 101.3 <2e-16 ***
x -0.007935 0.009924 -0.8 0.424
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9891 on 9998 degrees of freedom
Multiple R-squared: 6.395e-05, Adjusted R-squared: -3.607e-05
F-statistic: 0.6394 on 1 and 9998 DF, p-value: 0.424
HOWEVER, you are correct in that the usual thinking is that correlation and simple linear regression are the same. That is, if $X$ and $Y$ have a correlation that you test somehow (Wald is the usual) and get some p-value $p$, then when you regress $Y$ on $X$ (with an intercept) and test the slope with the same test (Wald is the usual), you should get the same p-value. | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate] | There are a few ways this can happen. Five come to mind. In your case, I suspect the fifth.
1) The relationship between $X$ and $Y$ is nonlinear
As some other answers and comments have discussed, corr | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate]
There are a few ways this can happen. Five come to mind. In your case, I suspect the fifth.
1) The relationship between $X$ and $Y$ is nonlinear
As some other answers and comments have discussed, correlation deals with linear relationships. If the relationship is nonlinear, correlation can miss that there is a relationship.
set.seed(2022)
N <- 100
a <- 1
x <- seq(-a, a, 2*a/(N - 1))
y <- x^2
plot(x, y)
cor(x, y)
In this example, $X$ perfectly predicts $Y$. However, the correlation is zero.
The remedy is to consider the quadratic term in a regression, such as L <- lm(y ~ x + I(x^2)). Such a regression gives the expected result of perfect predictability of $Y$.
2) Your WITH and ON functions use different tests
I don't know your software, but there are multiple ways of testing hypotheses. In a theoretical statistics class, such as one taught from the Casella/Berger book Statistical Inference, you will learn about what I call the "big three" hypothesis tests: Wald, likelihood ratio, and score (sometimes called Lagrange multiplier). All of these can give slightly different results. If WITH and ON use different tests of the same null hypothesis, it is possible for one to give a "significant" $p=0.043$ and the other to give an "insignificant" $p = 0.052$.
3) You've included some other variable in the regression
Consider the following picture.
As you might expect, the correlation is zero.
However, I made this by having two groups!
set.seed(2022)
N <- 100
a <- 1
x <- seq(-a, a, 2*a/(N - 1))
g <- rep(c(0, 1), N/2)
y <- x - 2*g*x
plot(x, y)
cor(x, y)
If we consider the group variable g and an interaction between x and g, we get perfect predictability.
L <- lm(y ~ x + g + x*g)
If we know we're dealing with a blue group or a red group, we can make perfect predictions and get perfect correlation.
set.seed(2022)
N <- 100
a <- 1
x <- seq(-a, a, 2*a/(N - 1))
g <- rep(c(0, 1), N/2)
y <- x - 2*g*x
plot(x[g==0], y[g==0], col = 'red')
points(x[g==1], y[g==1], col = 'blue')
plot(x[g==0], y[g==0], col = 'red', main = paste("Red correlation is", cor(x[g==0], y[g==0])))
plot(x[g==1], y[g==1], col = 'blue', main = paste("Blue correlation is", cor(x[g==1], y[g==1])))
4) You have a false positive (type I error)
Hypothesis tests falsely reject true null hypothesis some proportion of the time. Just because you know that, at the population level, $X$ and $Y$ are uncorrelated does not mean that the regression on the sample will reflect that fact.
set.seed(2022)
N <- 250
R <- 1000
ps <- rep(NA, R)
for (i in 1:R){
x <- rnorm(N)
y <- rnorm(N)
L <- lm(y ~ x)
ps[i] <- summary(L)$coef[2, 4] # p-value on the slope coefficient
}
ecdf(ps)(0.05)
Even though we know that $X$ and $Y$ are uncorrelated for each iteration in the above simulation, about $5\%$ of the tests have p-values of $0.05$ or lower, so you have type I errors occur about $5\%$ of the time.
5) You exclude an intercept term, which is what I suspect happened to you
I know one of the common Python regression packages (I forget if it is sklearn or statsmodels) excludes an intercept by default, so Mplus might do the same. Look at the following image of uncorrelated $X$ and $Y$.
If we omit the intercept from the regression, then we force the regression line to go through $(0,0)$.
The regression $\hat y_i = \hat\beta x_i$ has a highly significant $\hat\beta$.
set.seed(2022)
N <- 10000
x <- rnorm(N, 10, 1)
y <- rnorm(N, 10, 1)
plot(x, y)
plot(x, y, xlim = c(0, 14), ylim = c(0, 14))
points(0, 0, col = 'blue')
plot(x, y, xlim = c(0, 14), ylim = c(0, 14))
abline(a = 0, b = 1, col = 'red')
points(0, 0, col = 'blue')
L <- lm(y ~ 0 + x)
summary(L)
cor.test(x, y)
However, when we include the intercept, the slope, correctly, lacks significance.
L <- lm(y ~ x)
summary(L)
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-3.8865 -0.6757 0.0123 0.6770 3.7909
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.093635 0.099646 101.3 <2e-16 ***
x -0.007935 0.009924 -0.8 0.424
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9891 on 9998 degrees of freedom
Multiple R-squared: 6.395e-05, Adjusted R-squared: -3.607e-05
F-statistic: 0.6394 on 1 and 9998 DF, p-value: 0.424
HOWEVER, you are correct in that the usual thinking is that correlation and simple linear regression are the same. That is, if $X$ and $Y$ have a correlation that you test somehow (Wald is the usual) and get some p-value $p$, then when you regress $Y$ on $X$ (with an intercept) and test the slope with the same test (Wald is the usual), you should get the same p-value. | Is it possible that X and Y are uncorrelated but X can significantly predict Y? [duplicate]
There are a few ways this can happen. Five come to mind. In your case, I suspect the fifth.
1) The relationship between $X$ and $Y$ is nonlinear
As some other answers and comments have discussed, corr |
20,741 | Practical usefulness of PCA | One important use of PCA is in analysis of electroencephalography (EEG) data. To measure an EEG, dozens of electrodes are attached to your scalp and measure electric currents in your brain, either at rest or while you perform some experimental task.
Of course, the measurements at neighboring electrodes are heavily correlated, because they are generated by activity at a specific region in the brain, which then creates electric currents that will be picked up by all electrodes in the vicinity. It's not easy to learn about what happens deep in your brain if all you have is measurements from your scalp, but for some reason, few people are fine with having deep electrodes driven into their brain.
One thus reduces the dimensionality of the problem using PCA, which in this particular application also has a temporal component. You are completely right that it is hard to actually interpret the principal components. However, over the decades a body of research has developed that lets us expect particular principal components loading on particular electrodes, with peaks at particular points in time, e.g., after being presented with a specific stimulus.
For instance, a long time ago I looked at the P300, an event-related potential that loads over the parietal lobe (there's your PCA) about 300 ms after presentation of a stimulus that requires some kind of decision. In this particular analysis, the experiment was about whether spider phobics and non-phobics reacted differently to drawings that could be interpreted as spiders. The (unconscious) decision whether a particular drawing "was" a spider elicited a P300, and that indeed differed between phobics and nonphobics. Using a PCA and analyzing the parietal principal component - instead of, e.g., a single specific electrode = allows reducing the noise in such a setting, by essentially averaging the signal from multiple electrodes. | Practical usefulness of PCA | One important use of PCA is in analysis of electroencephalography (EEG) data. To measure an EEG, dozens of electrodes are attached to your scalp and measure electric currents in your brain, either at | Practical usefulness of PCA
One important use of PCA is in analysis of electroencephalography (EEG) data. To measure an EEG, dozens of electrodes are attached to your scalp and measure electric currents in your brain, either at rest or while you perform some experimental task.
Of course, the measurements at neighboring electrodes are heavily correlated, because they are generated by activity at a specific region in the brain, which then creates electric currents that will be picked up by all electrodes in the vicinity. It's not easy to learn about what happens deep in your brain if all you have is measurements from your scalp, but for some reason, few people are fine with having deep electrodes driven into their brain.
One thus reduces the dimensionality of the problem using PCA, which in this particular application also has a temporal component. You are completely right that it is hard to actually interpret the principal components. However, over the decades a body of research has developed that lets us expect particular principal components loading on particular electrodes, with peaks at particular points in time, e.g., after being presented with a specific stimulus.
For instance, a long time ago I looked at the P300, an event-related potential that loads over the parietal lobe (there's your PCA) about 300 ms after presentation of a stimulus that requires some kind of decision. In this particular analysis, the experiment was about whether spider phobics and non-phobics reacted differently to drawings that could be interpreted as spiders. The (unconscious) decision whether a particular drawing "was" a spider elicited a P300, and that indeed differed between phobics and nonphobics. Using a PCA and analyzing the parietal principal component - instead of, e.g., a single specific electrode = allows reducing the noise in such a setting, by essentially averaging the signal from multiple electrodes. | Practical usefulness of PCA
One important use of PCA is in analysis of electroencephalography (EEG) data. To measure an EEG, dozens of electrodes are attached to your scalp and measure electric currents in your brain, either at |
20,742 | Practical usefulness of PCA | First, from the perspective of education, PCA is a good entryway to the world of dimension-reduction techniques and associated methods. Whether we're talking ICA, non-negative matrix factorization, confirmatory factor analysis, partial-least squares, canonical correlation analysis... (you get the idea), understanding PCA gets you halfway there.
From a practical standpoint, there are lots of times when PCA can be sensibly used to combine variables - I think the other answers give good examples.
Now, I think what your question is really getting at is - what's the point of a naive application of PCA? What's the point of throwing PCA at a long list of variables and getting back a handful of components? Well, it's quite useful if all you care about is model prediction, and it's also quite handy when you have a lot of highly correlated variables in your data set. PCA is also very useful if you want to understand the structure of your data - for example running PCA on genetic data (millions of variables) tells you about broad trends in ancestry in your data set. | Practical usefulness of PCA | First, from the perspective of education, PCA is a good entryway to the world of dimension-reduction techniques and associated methods. Whether we're talking ICA, non-negative matrix factorization, co | Practical usefulness of PCA
First, from the perspective of education, PCA is a good entryway to the world of dimension-reduction techniques and associated methods. Whether we're talking ICA, non-negative matrix factorization, confirmatory factor analysis, partial-least squares, canonical correlation analysis... (you get the idea), understanding PCA gets you halfway there.
From a practical standpoint, there are lots of times when PCA can be sensibly used to combine variables - I think the other answers give good examples.
Now, I think what your question is really getting at is - what's the point of a naive application of PCA? What's the point of throwing PCA at a long list of variables and getting back a handful of components? Well, it's quite useful if all you care about is model prediction, and it's also quite handy when you have a lot of highly correlated variables in your data set. PCA is also very useful if you want to understand the structure of your data - for example running PCA on genetic data (millions of variables) tells you about broad trends in ancestry in your data set. | Practical usefulness of PCA
First, from the perspective of education, PCA is a good entryway to the world of dimension-reduction techniques and associated methods. Whether we're talking ICA, non-negative matrix factorization, co |
20,743 | Practical usefulness of PCA | I use three examples in my lectures to illustrate what PCA can do (click the links for pointers to the slides). They're chosen to show how useful it is in general data science practice and how powerful it can be (especially given that it's just a linear transformation).
example 1: bone analysis
Imagine you're a paleontologist, and you find a shoulder bone. Because of years of training, you recognize immediately that this is a Hominid bone (which is very rare) and not a Chimp bone (which is common).
How do you report that fact? "It's a Hominid bone because I say so", isn't very scientific.
One way would be to use PCA. You measure a bunch of features on the bone and on some similar bones, and you plot the first two principal components. Here's one example of such a plot [1].
The plot very clearly shows what your trained eyes told you in the first place: the bones of Hominids cluster together, far away from the more common bones of humans, chimps and other apes.
You can even draw a line backwards through the known evolutionary path, to get a hypothesis where humans come from. Turns out chimps and bonobos are a better candidate than gorillas and gibbons.
example 2: DNA
Take about 1300 people in Europe, sequence their DNA, and check about half a million markers. This gives you a dataset with 1300 instances, and 500 thousand features. Apply PCA, and plot it by the first two principal components. Now color the points by where the subject is from. Here's the result [2].
The plot reveals that the first two principal components provide a blurry picture of the geographical distibution.
I admit it's hard to say what this is useful for, but it certainly illustrates the power of the method.
example 3: eigenfaces
Take a set of images of people's faces and flatten then into high-dimensional vectors. Run PCA.
Again, you will see clusters for certain meaningful concepts. But here, we can do something else cool. We can take the n-th principal component, and nudge one of the examples in our data a little in that direction.
Here is the result for the first couple of principal components:
1 Fossil hominin shoulders support an African ape-like last common ancestor of humans and chimpanzees. Nathan M. Young, Terence D. Capellini, Neil T. Roach and Zeresenay Alemseged http://www.pnas.org/content/112/38/11829
2 Novembre, J., Johnson, T., Bryc, K., Kutalik, Z., Boyko, A. R., Auton, A., ... & Bustamante, C. D. (2008). Genes mirror geography within Europe. Nature, 456(7218), 98-101. https://www.nature.com/articles/nature07331 | Practical usefulness of PCA | I use three examples in my lectures to illustrate what PCA can do (click the links for pointers to the slides). They're chosen to show how useful it is in general data science practice and how powerfu | Practical usefulness of PCA
I use three examples in my lectures to illustrate what PCA can do (click the links for pointers to the slides). They're chosen to show how useful it is in general data science practice and how powerful it can be (especially given that it's just a linear transformation).
example 1: bone analysis
Imagine you're a paleontologist, and you find a shoulder bone. Because of years of training, you recognize immediately that this is a Hominid bone (which is very rare) and not a Chimp bone (which is common).
How do you report that fact? "It's a Hominid bone because I say so", isn't very scientific.
One way would be to use PCA. You measure a bunch of features on the bone and on some similar bones, and you plot the first two principal components. Here's one example of such a plot [1].
The plot very clearly shows what your trained eyes told you in the first place: the bones of Hominids cluster together, far away from the more common bones of humans, chimps and other apes.
You can even draw a line backwards through the known evolutionary path, to get a hypothesis where humans come from. Turns out chimps and bonobos are a better candidate than gorillas and gibbons.
example 2: DNA
Take about 1300 people in Europe, sequence their DNA, and check about half a million markers. This gives you a dataset with 1300 instances, and 500 thousand features. Apply PCA, and plot it by the first two principal components. Now color the points by where the subject is from. Here's the result [2].
The plot reveals that the first two principal components provide a blurry picture of the geographical distibution.
I admit it's hard to say what this is useful for, but it certainly illustrates the power of the method.
example 3: eigenfaces
Take a set of images of people's faces and flatten then into high-dimensional vectors. Run PCA.
Again, you will see clusters for certain meaningful concepts. But here, we can do something else cool. We can take the n-th principal component, and nudge one of the examples in our data a little in that direction.
Here is the result for the first couple of principal components:
1 Fossil hominin shoulders support an African ape-like last common ancestor of humans and chimpanzees. Nathan M. Young, Terence D. Capellini, Neil T. Roach and Zeresenay Alemseged http://www.pnas.org/content/112/38/11829
2 Novembre, J., Johnson, T., Bryc, K., Kutalik, Z., Boyko, A. R., Auton, A., ... & Bustamante, C. D. (2008). Genes mirror geography within Europe. Nature, 456(7218), 98-101. https://www.nature.com/articles/nature07331 | Practical usefulness of PCA
I use three examples in my lectures to illustrate what PCA can do (click the links for pointers to the slides). They're chosen to show how useful it is in general data science practice and how powerfu |
20,744 | Practical usefulness of PCA | One application of PCA that I have used a few times is the construction of social indicators. We use the projection of each observation (usually households) over a component axis (usually the first), and use it as an indicator for public policy.
This is possible because the surveys that we use are designed to capture that information. You can look online for "quality of life questionnaires".
Another thing to take into account is that PCA may not be the best method in many applications, but is used for "backward compatibility". If you change the method, you will be unable to compare with past measurements. And the result will not be useful for building public policy.
see:
http://article.sapub.org/10.5923.j.statistics.20221203.03.html | Practical usefulness of PCA | One application of PCA that I have used a few times is the construction of social indicators. We use the projection of each observation (usually households) over a component axis (usually the first), | Practical usefulness of PCA
One application of PCA that I have used a few times is the construction of social indicators. We use the projection of each observation (usually households) over a component axis (usually the first), and use it as an indicator for public policy.
This is possible because the surveys that we use are designed to capture that information. You can look online for "quality of life questionnaires".
Another thing to take into account is that PCA may not be the best method in many applications, but is used for "backward compatibility". If you change the method, you will be unable to compare with past measurements. And the result will not be useful for building public policy.
see:
http://article.sapub.org/10.5923.j.statistics.20221203.03.html | Practical usefulness of PCA
One application of PCA that I have used a few times is the construction of social indicators. We use the projection of each observation (usually households) over a component axis (usually the first), |
20,745 | Practical usefulness of PCA | It is absolutely not clear, obvious, or agreed-upon what "intelligence" is in humans (or, for that matter, in nonhuman animals). What is clear is that people's performance on a variety of tasks involving mental processes (a very general term) is highly correlated. If you speak five languages, then chances are that your performance on standard matrix tests is also above average.
The probably currently best accepted "theory of intelligence" essentially boils down to performing a PCA on the result of multiple tests of mental processes and calling the first principal component the g factor. After you have done this, you start arguing with other psychologists about what precisely you are measuring, whether there truly is an underlying trait "intelligence", and what later principal components are measuring.
This construction gets more interesting and relevant as artificial intelligence (or, cough, not) gets better and better. | Practical usefulness of PCA | It is absolutely not clear, obvious, or agreed-upon what "intelligence" is in humans (or, for that matter, in nonhuman animals). What is clear is that people's performance on a variety of tasks involv | Practical usefulness of PCA
It is absolutely not clear, obvious, or agreed-upon what "intelligence" is in humans (or, for that matter, in nonhuman animals). What is clear is that people's performance on a variety of tasks involving mental processes (a very general term) is highly correlated. If you speak five languages, then chances are that your performance on standard matrix tests is also above average.
The probably currently best accepted "theory of intelligence" essentially boils down to performing a PCA on the result of multiple tests of mental processes and calling the first principal component the g factor. After you have done this, you start arguing with other psychologists about what precisely you are measuring, whether there truly is an underlying trait "intelligence", and what later principal components are measuring.
This construction gets more interesting and relevant as artificial intelligence (or, cough, not) gets better and better. | Practical usefulness of PCA
It is absolutely not clear, obvious, or agreed-upon what "intelligence" is in humans (or, for that matter, in nonhuman animals). What is clear is that people's performance on a variety of tasks involv |
20,746 | Practical usefulness of PCA | I've used PCA in facial motion capture for real time animatronic control of the 'lots of dots on a face' variety.
I was able to find out which dots - which is to say regions of the face - encoded the most information in movement and emotive expression.
It's obvious to some where these may be, and there is a natural correlation between these areas and how much they move, but I wanted to confirm my intuition.
I could only track so many dots so with that information I was able to more efficiently place them around the face, with more density in areas that encoded the most useful 'perpendicular' data and more sparsely in those that only became relevant on their own merits occasionally.
This is grossly simplified, and there was a lot more to it (the eyes... another world going on there) and I'd probably use a NN or similar with no dots this time round, but PCA played an integral part of the learning. | Practical usefulness of PCA | I've used PCA in facial motion capture for real time animatronic control of the 'lots of dots on a face' variety.
I was able to find out which dots - which is to say regions of the face - encoded the | Practical usefulness of PCA
I've used PCA in facial motion capture for real time animatronic control of the 'lots of dots on a face' variety.
I was able to find out which dots - which is to say regions of the face - encoded the most information in movement and emotive expression.
It's obvious to some where these may be, and there is a natural correlation between these areas and how much they move, but I wanted to confirm my intuition.
I could only track so many dots so with that information I was able to more efficiently place them around the face, with more density in areas that encoded the most useful 'perpendicular' data and more sparsely in those that only became relevant on their own merits occasionally.
This is grossly simplified, and there was a lot more to it (the eyes... another world going on there) and I'd probably use a NN or similar with no dots this time round, but PCA played an integral part of the learning. | Practical usefulness of PCA
I've used PCA in facial motion capture for real time animatronic control of the 'lots of dots on a face' variety.
I was able to find out which dots - which is to say regions of the face - encoded the |
20,747 | Practical usefulness of PCA | PCA just comes down to using the eigendecomposition of the (empirical) covariance matrix of the data.
The full eigendecomposition of the covariance matrix results in a set of eigenvectors and corresponding eigenvalues, which can be interpreted as the variance along these eigenvectors.
Because these eigenvectors are orthogonal, they can be used to create a rotation matrix that rotates the data so that the basis aligns with the direction of maximum variance.
For some people, this may be easier to understand with a few lines of code:
import numpy as np
data = np.random.randn(256, 2) # generate some random 2D data
covariance = np.cov(data, rowvar=False) # compute covariance matrix
variances, rotation = np.linalg.eigh(covariance) # eigendecomposition
pcs = (data - data.mean(0)) @ rotation # compute principal components
In other words, principal components are just a rotation version of the (centred) data.
This also means that the (centred) data can simply be reconstructed by rotating back the principal components: pcs @ rotation.T.
As a result, a "full" PCA (not sure if this is the correct term) is perfectly reversible.
This is how PCA is typically used in the context of pre-processing data.
After all, this rotation should typically make it easier to find important features.
Typically, the principal components are additionally whitened (scaled to unit variance) using the eigenvalues of the decomposition (variances in the code).
It is also possible to whiten the data after the rotation and then rotate it back, which gives rise to ZCA pre-processing.
I can highly recommend this answer to a related question for further reading (and some nice figures).
When using PCA for dimensionality reduction, you would only use a subset of the columns in the rotation matrix.
This obviously leads to loss of information.
However, the columns of the rotation matrix can effectively be to transform the data back to the original space.
After all, using only a few columns corresponds to setting principal components to zero (i.e. dropping information).
If the total variance corresponding to these dropped dimensions is low enough, a reasonable reconstruction (of the centred data) is typically possible.
Again, in code:
data = np.random.randn(256, 784) # generate some random high-D data
covariance = np.cov(data, rowvar=False) # compute covariance matrix
_, rotation = np.linalg.eigh(covariance) # eigendecomposition
reduced_pcs = (data - data.mean(0)) @ rotation[:, -70] # dimensionality reduction PCA
reconstruction = reduced_pcs @ rotation[:, -70:].T # reconstruction of (centred) data
Note that the reconstruction of the random data in this snippet of code is not going to work well.
However, you should get some reasonable results if you plug in e.g. some MNIST data.
TL;DR: PCA is often used to pre-process data (make it nicer to work with) and can actually often be transformed back to the original input space (i.e. is not necessarily abstract). | Practical usefulness of PCA | PCA just comes down to using the eigendecomposition of the (empirical) covariance matrix of the data.
The full eigendecomposition of the covariance matrix results in a set of eigenvectors and correspo | Practical usefulness of PCA
PCA just comes down to using the eigendecomposition of the (empirical) covariance matrix of the data.
The full eigendecomposition of the covariance matrix results in a set of eigenvectors and corresponding eigenvalues, which can be interpreted as the variance along these eigenvectors.
Because these eigenvectors are orthogonal, they can be used to create a rotation matrix that rotates the data so that the basis aligns with the direction of maximum variance.
For some people, this may be easier to understand with a few lines of code:
import numpy as np
data = np.random.randn(256, 2) # generate some random 2D data
covariance = np.cov(data, rowvar=False) # compute covariance matrix
variances, rotation = np.linalg.eigh(covariance) # eigendecomposition
pcs = (data - data.mean(0)) @ rotation # compute principal components
In other words, principal components are just a rotation version of the (centred) data.
This also means that the (centred) data can simply be reconstructed by rotating back the principal components: pcs @ rotation.T.
As a result, a "full" PCA (not sure if this is the correct term) is perfectly reversible.
This is how PCA is typically used in the context of pre-processing data.
After all, this rotation should typically make it easier to find important features.
Typically, the principal components are additionally whitened (scaled to unit variance) using the eigenvalues of the decomposition (variances in the code).
It is also possible to whiten the data after the rotation and then rotate it back, which gives rise to ZCA pre-processing.
I can highly recommend this answer to a related question for further reading (and some nice figures).
When using PCA for dimensionality reduction, you would only use a subset of the columns in the rotation matrix.
This obviously leads to loss of information.
However, the columns of the rotation matrix can effectively be to transform the data back to the original space.
After all, using only a few columns corresponds to setting principal components to zero (i.e. dropping information).
If the total variance corresponding to these dropped dimensions is low enough, a reasonable reconstruction (of the centred data) is typically possible.
Again, in code:
data = np.random.randn(256, 784) # generate some random high-D data
covariance = np.cov(data, rowvar=False) # compute covariance matrix
_, rotation = np.linalg.eigh(covariance) # eigendecomposition
reduced_pcs = (data - data.mean(0)) @ rotation[:, -70] # dimensionality reduction PCA
reconstruction = reduced_pcs @ rotation[:, -70:].T # reconstruction of (centred) data
Note that the reconstruction of the random data in this snippet of code is not going to work well.
However, you should get some reasonable results if you plug in e.g. some MNIST data.
TL;DR: PCA is often used to pre-process data (make it nicer to work with) and can actually often be transformed back to the original input space (i.e. is not necessarily abstract). | Practical usefulness of PCA
PCA just comes down to using the eigendecomposition of the (empirical) covariance matrix of the data.
The full eigendecomposition of the covariance matrix results in a set of eigenvectors and correspo |
20,748 | Practical usefulness of PCA | Lots of what we're trying to get at with dimensionality reduction, whether linear or nonlinear, is abstraction of the data away from a raw space and towards a manifold or embedding in which complex phenomena can be described with fewer, more meaningful parameters. PCA is arguably the simplest of these techniques; it will help you reduce correlated variables to a single common dimension. Implicit linear correlations in your dataset aside, lots of things in the real world are expressed as linear combinations of a set of latent variables. For example, you can use SVD (a generalization of PCA) in natural language because documents that contain words like "cat" are also likely to contain words like "pet" in rough proportion. So in a bag-of-words or tf-idf model, the correlation gets called out.
Aside from dimensionality reduction (or rather why it works for dimensionality reduction), PCA/SVD attempt to maximally explain the overall variance of the data using fewer components. You can think of this as "stretching" each component apart from the others as much as possible while keeping the component itself coherent (and this is actually explicitly how more advanced dimensionality reduction techniques such as maximum variance unfolding work). That makes it very useful at teasing apart how important each linear factor is within a dataset. That turns out to be particularly useful in recommendation engines over graphs, like the one that won the Netflix prize.
If PCA isn't useful today, it isn't because it inherently lacks usefulness, but because we have more powerful nonlinear techniques that have supplanted it. | Practical usefulness of PCA | Lots of what we're trying to get at with dimensionality reduction, whether linear or nonlinear, is abstraction of the data away from a raw space and towards a manifold or embedding in which complex ph | Practical usefulness of PCA
Lots of what we're trying to get at with dimensionality reduction, whether linear or nonlinear, is abstraction of the data away from a raw space and towards a manifold or embedding in which complex phenomena can be described with fewer, more meaningful parameters. PCA is arguably the simplest of these techniques; it will help you reduce correlated variables to a single common dimension. Implicit linear correlations in your dataset aside, lots of things in the real world are expressed as linear combinations of a set of latent variables. For example, you can use SVD (a generalization of PCA) in natural language because documents that contain words like "cat" are also likely to contain words like "pet" in rough proportion. So in a bag-of-words or tf-idf model, the correlation gets called out.
Aside from dimensionality reduction (or rather why it works for dimensionality reduction), PCA/SVD attempt to maximally explain the overall variance of the data using fewer components. You can think of this as "stretching" each component apart from the others as much as possible while keeping the component itself coherent (and this is actually explicitly how more advanced dimensionality reduction techniques such as maximum variance unfolding work). That makes it very useful at teasing apart how important each linear factor is within a dataset. That turns out to be particularly useful in recommendation engines over graphs, like the one that won the Netflix prize.
If PCA isn't useful today, it isn't because it inherently lacks usefulness, but because we have more powerful nonlinear techniques that have supplanted it. | Practical usefulness of PCA
Lots of what we're trying to get at with dimensionality reduction, whether linear or nonlinear, is abstraction of the data away from a raw space and towards a manifold or embedding in which complex ph |
20,749 | The mean value of a selected die from an infinite series of rolls | The experiment can also be simulated. This approach is useful when enumeration is difficult (like rolling 3 dice).
# fix the seed for reproducibility
set.seed(123)
# simulate pair of dice
rolls = matrix(sample(1:6, 2000000, replace=T), ncol=2)
# compute expected value
mean(apply(rolls, 1, max))
[1] 4.471531 | The mean value of a selected die from an infinite series of rolls | The experiment can also be simulated. This approach is useful when enumeration is difficult (like rolling 3 dice).
# fix the seed for reproducibility
set.seed(123)
# simulate pair of dice
rolls = ma | The mean value of a selected die from an infinite series of rolls
The experiment can also be simulated. This approach is useful when enumeration is difficult (like rolling 3 dice).
# fix the seed for reproducibility
set.seed(123)
# simulate pair of dice
rolls = matrix(sample(1:6, 2000000, replace=T), ncol=2)
# compute expected value
mean(apply(rolls, 1, max))
[1] 4.471531 | The mean value of a selected die from an infinite series of rolls
The experiment can also be simulated. This approach is useful when enumeration is difficult (like rolling 3 dice).
# fix the seed for reproducibility
set.seed(123)
# simulate pair of dice
rolls = ma |
20,750 | The mean value of a selected die from an infinite series of rolls | There is no need to use simulation for this, the general case is quite easy to analyse. Let $n$ be the number of dice and $X$ be the maximum roll made when rolling the $n$ dice.
It follows that
$$
P(X \leq 1) = \left(\frac{1}{6}\right)^n
$$
and in general
$$
P(X \leq k) = \left(\frac{k}{6}\right)^n
$$
for $k$ between 1 and 6. Therefore we can obtain
$$
P(X = k) = P(x \leq k) - P(x \leq k-1)=\left(\frac{k}{6}\right)^n-\left(\frac{k-1}{6}\right)^n.
$$
So we can write down the probability distribution in closed form. Doing this for $n = 2$ you obtain the expected value 4.472222. | The mean value of a selected die from an infinite series of rolls | There is no need to use simulation for this, the general case is quite easy to analyse. Let $n$ be the number of dice and $X$ be the maximum roll made when rolling the $n$ dice.
It follows that
$$
P(X | The mean value of a selected die from an infinite series of rolls
There is no need to use simulation for this, the general case is quite easy to analyse. Let $n$ be the number of dice and $X$ be the maximum roll made when rolling the $n$ dice.
It follows that
$$
P(X \leq 1) = \left(\frac{1}{6}\right)^n
$$
and in general
$$
P(X \leq k) = \left(\frac{k}{6}\right)^n
$$
for $k$ between 1 and 6. Therefore we can obtain
$$
P(X = k) = P(x \leq k) - P(x \leq k-1)=\left(\frac{k}{6}\right)^n-\left(\frac{k-1}{6}\right)^n.
$$
So we can write down the probability distribution in closed form. Doing this for $n = 2$ you obtain the expected value 4.472222. | The mean value of a selected die from an infinite series of rolls
There is no need to use simulation for this, the general case is quite easy to analyse. Let $n$ be the number of dice and $X$ be the maximum roll made when rolling the $n$ dice.
It follows that
$$
P(X |
20,751 | The mean value of a selected die from an infinite series of rolls | I suggest just working through the trivial case to see the answer.
Possible results from rolling two dice generate a 6x6 matrix: $$\begin{bmatrix} (1,1) & (1,2) & ... \\ (2,1) & (2,2) & ... \\ (3,1) & (3,2) & ... \\ ... \end{bmatrix}$$
The expected value of the sum is 7. This is the case because the rolls are identical independent drawings, so they may be summed. The expectation of rolling a fair cubical die is 3.5.
But you are asking about maximization. Now let us enumerate the maximization from rolling two dice. Again, it is a 6x6 matrix: $$\begin{bmatrix} 1 & 2 & ... \\ 2 & 2 & ... \\ 3 & 3 & ... \\ ... \end{bmatrix}$$
Calculate the expected value, like so: $$E[x] = \Sigma(xP(x)) = 1/36(1) + 1/36(2) + ... + 1/36(6) \approx 4.47$$.
Notice that rolling $n$ dice is (in a probabilistic sense) equivalent to rolling one die $n$ times. So for rolling $n$ dice you can see how the matrix changes and how the resulting expectation changes, too. | The mean value of a selected die from an infinite series of rolls | I suggest just working through the trivial case to see the answer.
Possible results from rolling two dice generate a 6x6 matrix: $$\begin{bmatrix} (1,1) & (1,2) & ... \\ (2,1) & (2,2) & ... \\ (3,1) | The mean value of a selected die from an infinite series of rolls
I suggest just working through the trivial case to see the answer.
Possible results from rolling two dice generate a 6x6 matrix: $$\begin{bmatrix} (1,1) & (1,2) & ... \\ (2,1) & (2,2) & ... \\ (3,1) & (3,2) & ... \\ ... \end{bmatrix}$$
The expected value of the sum is 7. This is the case because the rolls are identical independent drawings, so they may be summed. The expectation of rolling a fair cubical die is 3.5.
But you are asking about maximization. Now let us enumerate the maximization from rolling two dice. Again, it is a 6x6 matrix: $$\begin{bmatrix} 1 & 2 & ... \\ 2 & 2 & ... \\ 3 & 3 & ... \\ ... \end{bmatrix}$$
Calculate the expected value, like so: $$E[x] = \Sigma(xP(x)) = 1/36(1) + 1/36(2) + ... + 1/36(6) \approx 4.47$$.
Notice that rolling $n$ dice is (in a probabilistic sense) equivalent to rolling one die $n$ times. So for rolling $n$ dice you can see how the matrix changes and how the resulting expectation changes, too. | The mean value of a selected die from an infinite series of rolls
I suggest just working through the trivial case to see the answer.
Possible results from rolling two dice generate a 6x6 matrix: $$\begin{bmatrix} (1,1) & (1,2) & ... \\ (2,1) & (2,2) & ... \\ (3,1) |
20,752 | The mean value of a selected die from an infinite series of rolls | Assuming each of the 36 combinations has an equal probability, we just have to add the values of each of the 36 combinations and divide by 36 to get the average:
1 possibility: 11
3 possibilities: 12, 21, 22
5 possibilities: 13, 23, 31, 32, 33
7 possibilities: 14, 24, 34, 41, 42, 43, 44
9 possibilities: 15, 25, 35, 45, 51, 52, 53, 54, 55
11 possibilities: 16, 26, 36, 46, 56, 61, 62, 63, 64, 65, 66
(1*1 + 2*3 + 3*5 + 4*7 + 5*9 + 6*11) / 36 = 4.47222.. | The mean value of a selected die from an infinite series of rolls | Assuming each of the 36 combinations has an equal probability, we just have to add the values of each of the 36 combinations and divide by 36 to get the average:
1 possibility: 11
3 possibilities: 1 | The mean value of a selected die from an infinite series of rolls
Assuming each of the 36 combinations has an equal probability, we just have to add the values of each of the 36 combinations and divide by 36 to get the average:
1 possibility: 11
3 possibilities: 12, 21, 22
5 possibilities: 13, 23, 31, 32, 33
7 possibilities: 14, 24, 34, 41, 42, 43, 44
9 possibilities: 15, 25, 35, 45, 51, 52, 53, 54, 55
11 possibilities: 16, 26, 36, 46, 56, 61, 62, 63, 64, 65, 66
(1*1 + 2*3 + 3*5 + 4*7 + 5*9 + 6*11) / 36 = 4.47222.. | The mean value of a selected die from an infinite series of rolls
Assuming each of the 36 combinations has an equal probability, we just have to add the values of each of the 36 combinations and divide by 36 to get the average:
1 possibility: 11
3 possibilities: 1 |
20,753 | The mean value of a selected die from an infinite series of rolls | Troll Dice Roller is the tool for finding dice probabilities. He has a paper explaining the implementation, but it's pretty academic.
max(2d6) yields
1 - 2.8%
2 - 8.3%
3 - 13.9%
4 - 19.4%
5 - 25%
6 - 30.6%
Average value = 4.47222222222
Spread = 1.40408355068
Mean deviation = 1.1975308642 | The mean value of a selected die from an infinite series of rolls | Troll Dice Roller is the tool for finding dice probabilities. He has a paper explaining the implementation, but it's pretty academic.
max(2d6) yields
1 - 2.8%
2 - 8.3%
3 - 13.9%
4 - 19.4%
5 - 25%
6 | The mean value of a selected die from an infinite series of rolls
Troll Dice Roller is the tool for finding dice probabilities. He has a paper explaining the implementation, but it's pretty academic.
max(2d6) yields
1 - 2.8%
2 - 8.3%
3 - 13.9%
4 - 19.4%
5 - 25%
6 - 30.6%
Average value = 4.47222222222
Spread = 1.40408355068
Mean deviation = 1.1975308642 | The mean value of a selected die from an infinite series of rolls
Troll Dice Roller is the tool for finding dice probabilities. He has a paper explaining the implementation, but it's pretty academic.
max(2d6) yields
1 - 2.8%
2 - 8.3%
3 - 13.9%
4 - 19.4%
5 - 25%
6 |
20,754 | If my histogram shows a bell-shaped curve, can I say my data is normally distributed? | We usually know it's impossible for a variable to be exactly normally distributed...
The normal distribution has infinitely long tails extending out in either direction - it is unlikely for data to lie far out in these extremes, but for a true normal distribution it has to be physically possible. For ages, a normally distributed model will predict there is a non-zero probability of data lying 5 standard deviations above or below the mean - which would correspond to physically impossible ages, such as below 0 or above 150. (Though if you look at a population pyramid, it's not clear why you would expect age to be even approximately normally distributed in the first place.) Similarly if you had heights data, which intuitively might follow a more "normal-like" distribution, it could only be truly normal if there were some chance of heights below 0 cm or above 300 cm.
I've occasionally seen it suggested that we can evade this problem by centering the data to have mean zero. That way both positive and negative "centered ages" are possible. But although this makes both negative values physically plausible and interpretable (negative centered values correspond to actual values lying below the mean), it doesn't get around the issue that the normal model will produce physically impossible predictions with non-zero probability, once you decode the modelled "centered age" back to an "actual age".
...so why bother testing? Even if not exact, normality can still be a useful model
The important question isn't really whether the data are exactly normal - we know a priori that can't be the case, in most situations, even without running a hypothesis test - but whether the approximation is sufficiently close for your needs. See the question is normality testing essentially useless? The normal distribution is a convenient approximation for many purposes. It is seldom "correct" - but it generally doesn't have to be exactly correct to be useful. I'd expect the normal distribution to usually be a reasonable model for people's heights, but it would require a more unusual context for the normal distribution to make sense as a model of people's ages.
If you really do feel the need to perform a normality test, then Kolmogorov-Smirnov probably isn't the best option: as noted in the comments, more powerful tests are available. Shapiro-Wilk has good power against a range of possible alternatives, and has the advantage that you don't need to know the true mean and variance beforehand. But beware that in small samples, potentially quite large deviations from normality may still go undetected, while in large samples, even very small (and for practical purposes, irrelevant) deviations from normality are likely to show up as "highly significant" (low p-value).
"Bell-shaped" isn't necessarily normal
It seems you have been told to think of "bell-shaped" data - symmetric data that peaks in the middle and which has lower probability in the tails - as "normal". But the normal distribution requires a specific shape to its peak and tails. There are other distributions with a similar shape on first glance, which you may also have characterised as "bell-shaped", but which aren't normal. Unless you've got a lot of data, you're unlikely to be able to distinguish that "it looks like this off-the-shelf distribution but not like the others". And if you do have a lot of data, you'll likely find it doesn't look quite like any "off-the-shelf" distribution at all! But in that case for many purposes you'd be just as well to use the empirical CDF.
The normal distribution is the "bell shape" you are used to; the Cauchy has a sharper peak and "heavier" (i.e. containing more probability) tails; the t distribution with 5 degrees of freedom comes somewhere in between (the normal is t with infinite df and the Cauchy is t with 1 df, so that makes sense); the Laplace or double exponential distribution has pdf formed from two rescaled exponential distributions back-to-back, resulting in a sharper peak than the normal distribution; the Beta distribution is quite different - it doesn't have tails that head off to infinity for instance, instead having sharp cut-offs - but it can still have the "hump" shape in the middle. Actually by playing around with the parameters, you can also obtain a sort of "skewed hump", or even a "U" shape - the gallery on the linked Wikipedia page is quite instructive about that distribution's flexibility. Finally, the triangular distribution is another simple distribution on a finite support, often used in risk modelling.
It's likely that none of these distributions exactly describe your data, and very many other distributions with similar shapes exist, but I wanted to address the misconception that "humped in the middle and roughly symmetric means normal". Since there are physical limits on age data, if your age data is "humped" in the middle then it's still possible a distribution with finite support like the Beta or even triangular distribution may prove a better model than one with infinite tails like the normal. Note that even if your data really were normally distributed, your histogram is still unlikely to resemble the classic "bell" unless your sample size is fairly large. Even a sample from a distribution like the Laplace, whose pdf is clearly distinguishable from that of the normal due to its cusp, may produce a histogram that visually appears about as similar to a bell as a genuinely normal sample would.
R code
par(mfrow=c(3,2))
plot(dnorm, -3, 3, ylab="probability density", main="Normal(0,1)")
plot(function(x){dt(x, df=1)}, -3, 3, ylab="probability density", main="Cauchy")
plot(function(x){dt(x, df=5)}, -3, 3, ylab="probability density", main="t with 5 df")
plot(function(x){0.5*exp(-abs(x))}, -3, 3, ylab="probability density", main="Laplace(0,1)")
plot(function(x){dbeta(x, shape1=2, shape2=2)}, ylab="probability density", main="Beta(2,2)")
plot(function(x){1-0.5*abs(x)}, -1, 1, ylab="probability density", main="Triangular")
par(mfrow=c(3,2))
normalhist <- function(n) {hist(rnorm(n), main=paste("Normal sample, n =",n), xlab="x")}
laplacehist <- function(n) {hist(rexp(n)*(1 - 2*rbinom(n, 1, 0.5)), main=paste("Laplace sample, n =",n), xlab="x")}
# No random seed is set
# Re-run the code to see the variability in histograms you might expect from sample to sample
normalhist(50); laplacehist(50)
normalhist(100); laplacehist(100)
normalhist(200); laplacehist(200) | If my histogram shows a bell-shaped curve, can I say my data is normally distributed? | We usually know it's impossible for a variable to be exactly normally distributed...
The normal distribution has infinitely long tails extending out in either direction - it is unlikely for data to li | If my histogram shows a bell-shaped curve, can I say my data is normally distributed?
We usually know it's impossible for a variable to be exactly normally distributed...
The normal distribution has infinitely long tails extending out in either direction - it is unlikely for data to lie far out in these extremes, but for a true normal distribution it has to be physically possible. For ages, a normally distributed model will predict there is a non-zero probability of data lying 5 standard deviations above or below the mean - which would correspond to physically impossible ages, such as below 0 or above 150. (Though if you look at a population pyramid, it's not clear why you would expect age to be even approximately normally distributed in the first place.) Similarly if you had heights data, which intuitively might follow a more "normal-like" distribution, it could only be truly normal if there were some chance of heights below 0 cm or above 300 cm.
I've occasionally seen it suggested that we can evade this problem by centering the data to have mean zero. That way both positive and negative "centered ages" are possible. But although this makes both negative values physically plausible and interpretable (negative centered values correspond to actual values lying below the mean), it doesn't get around the issue that the normal model will produce physically impossible predictions with non-zero probability, once you decode the modelled "centered age" back to an "actual age".
...so why bother testing? Even if not exact, normality can still be a useful model
The important question isn't really whether the data are exactly normal - we know a priori that can't be the case, in most situations, even without running a hypothesis test - but whether the approximation is sufficiently close for your needs. See the question is normality testing essentially useless? The normal distribution is a convenient approximation for many purposes. It is seldom "correct" - but it generally doesn't have to be exactly correct to be useful. I'd expect the normal distribution to usually be a reasonable model for people's heights, but it would require a more unusual context for the normal distribution to make sense as a model of people's ages.
If you really do feel the need to perform a normality test, then Kolmogorov-Smirnov probably isn't the best option: as noted in the comments, more powerful tests are available. Shapiro-Wilk has good power against a range of possible alternatives, and has the advantage that you don't need to know the true mean and variance beforehand. But beware that in small samples, potentially quite large deviations from normality may still go undetected, while in large samples, even very small (and for practical purposes, irrelevant) deviations from normality are likely to show up as "highly significant" (low p-value).
"Bell-shaped" isn't necessarily normal
It seems you have been told to think of "bell-shaped" data - symmetric data that peaks in the middle and which has lower probability in the tails - as "normal". But the normal distribution requires a specific shape to its peak and tails. There are other distributions with a similar shape on first glance, which you may also have characterised as "bell-shaped", but which aren't normal. Unless you've got a lot of data, you're unlikely to be able to distinguish that "it looks like this off-the-shelf distribution but not like the others". And if you do have a lot of data, you'll likely find it doesn't look quite like any "off-the-shelf" distribution at all! But in that case for many purposes you'd be just as well to use the empirical CDF.
The normal distribution is the "bell shape" you are used to; the Cauchy has a sharper peak and "heavier" (i.e. containing more probability) tails; the t distribution with 5 degrees of freedom comes somewhere in between (the normal is t with infinite df and the Cauchy is t with 1 df, so that makes sense); the Laplace or double exponential distribution has pdf formed from two rescaled exponential distributions back-to-back, resulting in a sharper peak than the normal distribution; the Beta distribution is quite different - it doesn't have tails that head off to infinity for instance, instead having sharp cut-offs - but it can still have the "hump" shape in the middle. Actually by playing around with the parameters, you can also obtain a sort of "skewed hump", or even a "U" shape - the gallery on the linked Wikipedia page is quite instructive about that distribution's flexibility. Finally, the triangular distribution is another simple distribution on a finite support, often used in risk modelling.
It's likely that none of these distributions exactly describe your data, and very many other distributions with similar shapes exist, but I wanted to address the misconception that "humped in the middle and roughly symmetric means normal". Since there are physical limits on age data, if your age data is "humped" in the middle then it's still possible a distribution with finite support like the Beta or even triangular distribution may prove a better model than one with infinite tails like the normal. Note that even if your data really were normally distributed, your histogram is still unlikely to resemble the classic "bell" unless your sample size is fairly large. Even a sample from a distribution like the Laplace, whose pdf is clearly distinguishable from that of the normal due to its cusp, may produce a histogram that visually appears about as similar to a bell as a genuinely normal sample would.
R code
par(mfrow=c(3,2))
plot(dnorm, -3, 3, ylab="probability density", main="Normal(0,1)")
plot(function(x){dt(x, df=1)}, -3, 3, ylab="probability density", main="Cauchy")
plot(function(x){dt(x, df=5)}, -3, 3, ylab="probability density", main="t with 5 df")
plot(function(x){0.5*exp(-abs(x))}, -3, 3, ylab="probability density", main="Laplace(0,1)")
plot(function(x){dbeta(x, shape1=2, shape2=2)}, ylab="probability density", main="Beta(2,2)")
plot(function(x){1-0.5*abs(x)}, -1, 1, ylab="probability density", main="Triangular")
par(mfrow=c(3,2))
normalhist <- function(n) {hist(rnorm(n), main=paste("Normal sample, n =",n), xlab="x")}
laplacehist <- function(n) {hist(rexp(n)*(1 - 2*rbinom(n, 1, 0.5)), main=paste("Laplace sample, n =",n), xlab="x")}
# No random seed is set
# Re-run the code to see the variability in histograms you might expect from sample to sample
normalhist(50); laplacehist(50)
normalhist(100); laplacehist(100)
normalhist(200); laplacehist(200) | If my histogram shows a bell-shaped curve, can I say my data is normally distributed?
We usually know it's impossible for a variable to be exactly normally distributed...
The normal distribution has infinitely long tails extending out in either direction - it is unlikely for data to li |
20,755 | If my histogram shows a bell-shaped curve, can I say my data is normally distributed? | Age can not be from normal distribution. Think logically: you cannot have negative age, yet normal distribution allows for negative numbers.
There are many bell-shaped distributions out there. If something looks bell-shaped it doesn't mean that it has to be normal.
There is no way to know for sure anything in statistics, including from which distribution the data comes from. The shape is a clue: bell-shape is one argument for normal distribution. Also, understanding your data is very important. The variable such as age is often skewed, which would rule out normality. As mentioned the normal distribution has no bounds, but it is sometimes used for bounded variables. For instance, if the mean age is 20 years, and the standard deviation is 1, then the probability of age <17 or >23 is less than 0.3%. So, it is possible than normal distribution could be a good approximation.
You can try running a statistical test for normality such as Jarque-Bera, which takes into account skewness and kurtosis of the sample. Kurtosis can be important in some cases. It's very important in finance, because if you model the data with normal distribution, but the data is in fact from a fat-tailed distribution, you may end up underestimating the risks and prices of assets.
It would help of you reported some descriptive statistics or a histogram of your age and height data, such as mean, variance, skewness, kurtosis. | If my histogram shows a bell-shaped curve, can I say my data is normally distributed? | Age can not be from normal distribution. Think logically: you cannot have negative age, yet normal distribution allows for negative numbers.
There are many bell-shaped distributions out there. If some | If my histogram shows a bell-shaped curve, can I say my data is normally distributed?
Age can not be from normal distribution. Think logically: you cannot have negative age, yet normal distribution allows for negative numbers.
There are many bell-shaped distributions out there. If something looks bell-shaped it doesn't mean that it has to be normal.
There is no way to know for sure anything in statistics, including from which distribution the data comes from. The shape is a clue: bell-shape is one argument for normal distribution. Also, understanding your data is very important. The variable such as age is often skewed, which would rule out normality. As mentioned the normal distribution has no bounds, but it is sometimes used for bounded variables. For instance, if the mean age is 20 years, and the standard deviation is 1, then the probability of age <17 or >23 is less than 0.3%. So, it is possible than normal distribution could be a good approximation.
You can try running a statistical test for normality such as Jarque-Bera, which takes into account skewness and kurtosis of the sample. Kurtosis can be important in some cases. It's very important in finance, because if you model the data with normal distribution, but the data is in fact from a fat-tailed distribution, you may end up underestimating the risks and prices of assets.
It would help of you reported some descriptive statistics or a histogram of your age and height data, such as mean, variance, skewness, kurtosis. | If my histogram shows a bell-shaped curve, can I say my data is normally distributed?
Age can not be from normal distribution. Think logically: you cannot have negative age, yet normal distribution allows for negative numbers.
There are many bell-shaped distributions out there. If some |
20,756 | Why is $x + x = 2x$, but $X + X \neq 2X$? | So, let’s address this question first: ''What is the basic difference between an algebraic variable and a Random Variable?''
A random variable $X$ is not at all an algebraic variable. Formally, it is defined as a function from a probability space $\Omega$ to $\mathbb R$.
OK... What that really means is that you perform random experiments (eg throwing a dice, choosing a random human), and you make measures on these experiments (eg number on dice upper face, height, sex, cholesterol level of the human). The set $\Omega$ is the set of all possible experiments. On a particular experiment $\omega\in\Omega$, you make a measure $X(\omega)$: that’s why formally it is a function from $\Omega$ to $\mathbb R$.
Now in general we totally forget about $\Omega$. The random variables are defined in term of their probability law. In the case of a fair dice, you just say
$\mathbb P(X = k) = {1\over 6}$ for $k=1,\dots,6$ (the probability of $X$ equal to $k$ is 1/6 for $k$ from 1 to 6),
instead of
$\mathbb P\left( \bigl\{ \omega \in \Omega \ : \ X(\omega)
= k\bigr\}\right)$ (the set of dice throws on which the measure $X$ — upper face — is $k$ has probability 1/6)...
It’s simpler. You can even totally avoid bothering the students with $\Omega$.
I hope this sheds some kind of light.
Now what this guy means by $X + X \ne 2X$ isn’t that the sum of such a measure with itself is not twice this measure — unfortunately, it is what he writes. What he means is that the sum of two such measures, performed on different experiments, has not the same law than twice a measure. This could be written as $X_1 \sim X_2 \not\Rightarrow X_1 + X_2 \sim 2X_1$ (the fact that $X_1$ and $X_2$ have the same distribution does not imply that $X_1 + X_2$ has the same distribution as $2 X_1$). | Why is $x + x = 2x$, but $X + X \neq 2X$? | So, let’s address this question first: ''What is the basic difference between an algebraic variable and a Random Variable?''
A random variable $X$ is not at all an algebraic variable. Formally, it is | Why is $x + x = 2x$, but $X + X \neq 2X$?
So, let’s address this question first: ''What is the basic difference between an algebraic variable and a Random Variable?''
A random variable $X$ is not at all an algebraic variable. Formally, it is defined as a function from a probability space $\Omega$ to $\mathbb R$.
OK... What that really means is that you perform random experiments (eg throwing a dice, choosing a random human), and you make measures on these experiments (eg number on dice upper face, height, sex, cholesterol level of the human). The set $\Omega$ is the set of all possible experiments. On a particular experiment $\omega\in\Omega$, you make a measure $X(\omega)$: that’s why formally it is a function from $\Omega$ to $\mathbb R$.
Now in general we totally forget about $\Omega$. The random variables are defined in term of their probability law. In the case of a fair dice, you just say
$\mathbb P(X = k) = {1\over 6}$ for $k=1,\dots,6$ (the probability of $X$ equal to $k$ is 1/6 for $k$ from 1 to 6),
instead of
$\mathbb P\left( \bigl\{ \omega \in \Omega \ : \ X(\omega)
= k\bigr\}\right)$ (the set of dice throws on which the measure $X$ — upper face — is $k$ has probability 1/6)...
It’s simpler. You can even totally avoid bothering the students with $\Omega$.
I hope this sheds some kind of light.
Now what this guy means by $X + X \ne 2X$ isn’t that the sum of such a measure with itself is not twice this measure — unfortunately, it is what he writes. What he means is that the sum of two such measures, performed on different experiments, has not the same law than twice a measure. This could be written as $X_1 \sim X_2 \not\Rightarrow X_1 + X_2 \sim 2X_1$ (the fact that $X_1$ and $X_2$ have the same distribution does not imply that $X_1 + X_2$ has the same distribution as $2 X_1$). | Why is $x + x = 2x$, but $X + X \neq 2X$?
So, let’s address this question first: ''What is the basic difference between an algebraic variable and a Random Variable?''
A random variable $X$ is not at all an algebraic variable. Formally, it is |
20,757 | Why is $x + x = 2x$, but $X + X \neq 2X$? | [An earlier version of the question asked for an answer that completely avoided mathematics; this answer was an attempt to give some intuitive motivation, at a similar level to the document being asked about.]
The linked page is wrong when it says that $X+X\neq 2X$.
In the example $X$ is a random variable represents the number showing on the face of a die -- the result of an experiment like "roll a six-sided die once and record at the number on the face of the die."
So you roll a die and write down what you saw. Whatever number you would record is $X$... so $X+X$ represents the result added to itself. If you roll another die, that number you would have written down before doesn't change.
Later on the page it says:
When two dice are rolled, though, the results are different. Call the random variable that represents the outcomes of the two-dice process $T$ (for "two"). We could write $T = X + X$. This equation represents the fact that $T$ is the result of two independent instances of the random variable $T$
The very end of that quote is presumably a typographical error, they mean $X$ not $T$ there (since if it was $T$ they just said $T$ was the result of two instances of itself). But with that replacement it's still incorrect.
If you have two independent instances of the experiment (roll a die, record the number showing) you're dealing with two different random variables.
So imagine I have a red die and a blue die. Then I can say "Let the result on the red die be $X_1$ and the result on the blue die be $X_2$". Then we can follow the example at that linked page by defining $T$ to be the sum of the numbers showing on those two dice, so $T=X_1+X_2$. If the dice and the die-rolling process is fair then the distribution of $X_1$ and $X_2$ are the same, but $X_1$ and $X_2$ -- the random variables -- are distinct.
[There's an excellent discussion by whuber of random variables (and sums of them) here, and the concept of random variables is covered in slightly more detail (if in places more technical) here. I recommend you at least read the answer at the first link.]
This problem has come because the author has confused the random variable with its distribution. You can see that here:
In this case, students do think of the random variable X as representing a single, unknown value, in the same way that they think about algebraic variables. But X really refers to the distribution of possible values and the associated probabilities.
He explicitly conflates the random variable with its distribution.
In fact random variables are in many ways just like other algebraic variables and may often be manipulated in the same manner. In particular, a single univariate random variable doesn't stand for two distinct quantities (like the outcome from two different die rolls) at the same time. $X+X$ really is $2X$. | Why is $x + x = 2x$, but $X + X \neq 2X$? | [An earlier version of the question asked for an answer that completely avoided mathematics; this answer was an attempt to give some intuitive motivation, at a similar level to the document being aske | Why is $x + x = 2x$, but $X + X \neq 2X$?
[An earlier version of the question asked for an answer that completely avoided mathematics; this answer was an attempt to give some intuitive motivation, at a similar level to the document being asked about.]
The linked page is wrong when it says that $X+X\neq 2X$.
In the example $X$ is a random variable represents the number showing on the face of a die -- the result of an experiment like "roll a six-sided die once and record at the number on the face of the die."
So you roll a die and write down what you saw. Whatever number you would record is $X$... so $X+X$ represents the result added to itself. If you roll another die, that number you would have written down before doesn't change.
Later on the page it says:
When two dice are rolled, though, the results are different. Call the random variable that represents the outcomes of the two-dice process $T$ (for "two"). We could write $T = X + X$. This equation represents the fact that $T$ is the result of two independent instances of the random variable $T$
The very end of that quote is presumably a typographical error, they mean $X$ not $T$ there (since if it was $T$ they just said $T$ was the result of two instances of itself). But with that replacement it's still incorrect.
If you have two independent instances of the experiment (roll a die, record the number showing) you're dealing with two different random variables.
So imagine I have a red die and a blue die. Then I can say "Let the result on the red die be $X_1$ and the result on the blue die be $X_2$". Then we can follow the example at that linked page by defining $T$ to be the sum of the numbers showing on those two dice, so $T=X_1+X_2$. If the dice and the die-rolling process is fair then the distribution of $X_1$ and $X_2$ are the same, but $X_1$ and $X_2$ -- the random variables -- are distinct.
[There's an excellent discussion by whuber of random variables (and sums of them) here, and the concept of random variables is covered in slightly more detail (if in places more technical) here. I recommend you at least read the answer at the first link.]
This problem has come because the author has confused the random variable with its distribution. You can see that here:
In this case, students do think of the random variable X as representing a single, unknown value, in the same way that they think about algebraic variables. But X really refers to the distribution of possible values and the associated probabilities.
He explicitly conflates the random variable with its distribution.
In fact random variables are in many ways just like other algebraic variables and may often be manipulated in the same manner. In particular, a single univariate random variable doesn't stand for two distinct quantities (like the outcome from two different die rolls) at the same time. $X+X$ really is $2X$. | Why is $x + x = 2x$, but $X + X \neq 2X$?
[An earlier version of the question asked for an answer that completely avoided mathematics; this answer was an attempt to give some intuitive motivation, at a similar level to the document being aske |
20,758 | Why is $x + x = 2x$, but $X + X \neq 2X$? | The page you linked to is flat out wrong. He writes $T = X + X$ even though he states that he is rolling two seperate independent dice. This means he should write $T = X + Y$ where $X$ and $Y$ are the results of the two dice.
Calling both $X$ is flat out wrong, as the random variable $X$ must be the realization of observing $one$ dice throw, not two or more.
For a random variable it is indeed true that $X+X=2X$ | Why is $x + x = 2x$, but $X + X \neq 2X$? | The page you linked to is flat out wrong. He writes $T = X + X$ even though he states that he is rolling two seperate independent dice. This means he should write $T = X + Y$ where $X$ and $Y$ are the | Why is $x + x = 2x$, but $X + X \neq 2X$?
The page you linked to is flat out wrong. He writes $T = X + X$ even though he states that he is rolling two seperate independent dice. This means he should write $T = X + Y$ where $X$ and $Y$ are the results of the two dice.
Calling both $X$ is flat out wrong, as the random variable $X$ must be the realization of observing $one$ dice throw, not two or more.
For a random variable it is indeed true that $X+X=2X$ | Why is $x + x = 2x$, but $X + X \neq 2X$?
The page you linked to is flat out wrong. He writes $T = X + X$ even though he states that he is rolling two seperate independent dice. This means he should write $T = X + Y$ where $X$ and $Y$ are the |
20,759 | Is it possible that two Random Variables from the same distribution family have the same expectation and variance, but different higher moments? | There is apparently some confusion as to what a family of distributions is and how to count free parameters versus free plus fixed (assigned) parameters. Those questions are an aside that is unrelated to the intent of the OP, and of this answer. I do not use the word family herein because it is confusing. For example, a family according to one source is the result of varying the shape parameter. @whuber states that A "parameterization" of a family is a continuous map from a subset of ℝ$^n$, with its usual topology, into the space of distributions, whose image is that family. I will use the word form which covers both the intended usage of the word family and parameter identification and counting. For example the formula $x^2-2x+4$ has the form of a quadratic formula, i.e., $a_2x^2+a_1x+a_0$ and if $a_1=0$ the formula is still of quadratic form. However, when $a_2=0$ the formula is linear and the form is no longer complete enough to contain a quadratic shape term. Those who wish to use the word family in a proper statistical context are encouraged to contribute to that separate question.
Let us answer the question "Can they have different higher moments?". There are many such examples. We note in passing that the question appears to be about symmetric PDFs, which are the ones that tend to have location and scale in the simple bi-parameter case. The logic: Suppose there are two density functions with different shapes having two identical (location, scale) parameters. Then there is either a shape parameter that adjusts shape, or, the density functions have no common shape parameter and are thus density functions of no common form.
Here, is an example of how the shape parameter figures into it. The generalized error density function and here, is an answer that appears to have a freely selectable kurtosis.
By Skbkekas - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=6057753
The PDF (A.K.A. "probability" density function, note that the word "probability" is superfluous) is $$\dfrac{\beta}{2\alpha\Gamma\Big(\dfrac{1}{\beta}\Big)} \; e^{-\Big(\dfrac{|x-\mu|}{\alpha}\Big)^\beta}$$
The mean and location is $\mu$, the scale is $\alpha$, and $\beta$ is the shape. Note that it is easier to present symmetric PDFs, because those PDFs often have location and scale as the simplest two parameter cases whereas asymmetric PDFs, like the gamma PDF, tend to have shape and scale as their simplest case parameters. Continuing with the error density function, the variance is $\dfrac{\alpha^2\Gamma\Big(\dfrac{3}{\beta}\Big)}{\Gamma\Big(\dfrac{1}{\beta}\Big)}$, the skewness is $0$, and the kurtosis is $\dfrac{\Gamma\Big(\dfrac{5}{\beta}\Big)\Gamma\Big(\dfrac{1}{\beta}\Big)}{\Gamma\Big(\dfrac{3}{\beta}\Big)^2}-3$. Thus, if we set the variance to be 1, then we assign the value of $\alpha$ from $\alpha ^2=\dfrac{\Gamma \left(\dfrac{1}{\beta }\right)}{\Gamma \left(\dfrac{3}{\beta }\right)}$ while varying $\beta>0$, so that the kurtosis is selectable in the range from $-0.601114$ to $\infty$.
That is, if we want to vary higher order moments, and if we want to maintain a mean of zero and a variance of 1, we need to vary the shape. This implies three parameters, which in general are 1) the mean or otherwise the appropriate measure of location, 2) the scale to adjust the variance or other measure of variability, and 3) the shape. IT TAKES at least THREE PARAMETERS TO DO IT.
Note that if we make the substitutions $\beta=2$, $\alpha=\sqrt{2}\sigma$ in the PDF above, we obtain $$\frac{e^{-\frac{(x-\mu )^2}{2 \sigma ^2}}}{\sqrt{2 \pi } \sigma }\;,$$
which is a normal distribution's density function. Thus, the generalized error density function is a generalization of the normal distribution's density function. There are many ways to generalize a normal distribution's density function. Another example, but with the normal distribution's density function only as a limiting value, and not with mid-range substitution values like the generalized error density function, is the Student's$-t$ 's density function. Using the Student's$-t$ density function, we would have a rather more restricted selection of kurtosis, and $\textit{df}\geq2$ is the shape parameter because the second moment does not exist for $\textit{df}<2$. Moreover, df is not actually limited to positive integer values, it is in general real $\geq1$. The Student's$-t$ only becomes normal in the limit as $\textit{df}\rightarrow\infty$, which is why I did not choose it as an example. It is neither a good example nor is it a counter example, and in this I disagree with @Xi'an and @whuber.
Let me explain this further. One can choose two of many arbitrary density functions of two parameters to have, as an example, a mean of zero and a variance of one. However, they will not all be of the same form. The question however, relates to density functions of the SAME form, not different forms. The claim has been made that which density functions have the same form is an arbitrary assignment as this is a matter of definition, and in that my opinion differs. I do not agree that this is arbitrary because one can either make a substitution to convert one density function to be another, or one cannot. In the first case, the density functions are similar, and if by substitution we can show that the density functions are not equivalent, then those density functions are of different form.
Thus, using the example of the Student's$-t$ PDF, the choices are to either consider it to be a generalization of a normal PDF, in which case a normal PDF has a permissible form for a Student's$-t$'s PDF, or not, in which case the Student's$-t$ 's PDF is of a different form from the normal PDF and thus is irrelevant to the question posed.
We can argue this many ways. My opinion is that a normal PDF is a sub-selected form of a Student's$-t$ 's PDF, but that a normal PDF is not a sub-selection of a gamma PDF even though a limiting value of a gamma PDF can be shown to be a normal PDF, and, my reason for this is that in the normal/Student'$-t$ case, the support is the same, but in the normal/gamma case the support is infinite versus semi-infinite, which is the required incompatibility. | Is it possible that two Random Variables from the same distribution family have the same expectation | There is apparently some confusion as to what a family of distributions is and how to count free parameters versus free plus fixed (assigned) parameters. Those questions are an aside that is unrelated | Is it possible that two Random Variables from the same distribution family have the same expectation and variance, but different higher moments?
There is apparently some confusion as to what a family of distributions is and how to count free parameters versus free plus fixed (assigned) parameters. Those questions are an aside that is unrelated to the intent of the OP, and of this answer. I do not use the word family herein because it is confusing. For example, a family according to one source is the result of varying the shape parameter. @whuber states that A "parameterization" of a family is a continuous map from a subset of ℝ$^n$, with its usual topology, into the space of distributions, whose image is that family. I will use the word form which covers both the intended usage of the word family and parameter identification and counting. For example the formula $x^2-2x+4$ has the form of a quadratic formula, i.e., $a_2x^2+a_1x+a_0$ and if $a_1=0$ the formula is still of quadratic form. However, when $a_2=0$ the formula is linear and the form is no longer complete enough to contain a quadratic shape term. Those who wish to use the word family in a proper statistical context are encouraged to contribute to that separate question.
Let us answer the question "Can they have different higher moments?". There are many such examples. We note in passing that the question appears to be about symmetric PDFs, which are the ones that tend to have location and scale in the simple bi-parameter case. The logic: Suppose there are two density functions with different shapes having two identical (location, scale) parameters. Then there is either a shape parameter that adjusts shape, or, the density functions have no common shape parameter and are thus density functions of no common form.
Here, is an example of how the shape parameter figures into it. The generalized error density function and here, is an answer that appears to have a freely selectable kurtosis.
By Skbkekas - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=6057753
The PDF (A.K.A. "probability" density function, note that the word "probability" is superfluous) is $$\dfrac{\beta}{2\alpha\Gamma\Big(\dfrac{1}{\beta}\Big)} \; e^{-\Big(\dfrac{|x-\mu|}{\alpha}\Big)^\beta}$$
The mean and location is $\mu$, the scale is $\alpha$, and $\beta$ is the shape. Note that it is easier to present symmetric PDFs, because those PDFs often have location and scale as the simplest two parameter cases whereas asymmetric PDFs, like the gamma PDF, tend to have shape and scale as their simplest case parameters. Continuing with the error density function, the variance is $\dfrac{\alpha^2\Gamma\Big(\dfrac{3}{\beta}\Big)}{\Gamma\Big(\dfrac{1}{\beta}\Big)}$, the skewness is $0$, and the kurtosis is $\dfrac{\Gamma\Big(\dfrac{5}{\beta}\Big)\Gamma\Big(\dfrac{1}{\beta}\Big)}{\Gamma\Big(\dfrac{3}{\beta}\Big)^2}-3$. Thus, if we set the variance to be 1, then we assign the value of $\alpha$ from $\alpha ^2=\dfrac{\Gamma \left(\dfrac{1}{\beta }\right)}{\Gamma \left(\dfrac{3}{\beta }\right)}$ while varying $\beta>0$, so that the kurtosis is selectable in the range from $-0.601114$ to $\infty$.
That is, if we want to vary higher order moments, and if we want to maintain a mean of zero and a variance of 1, we need to vary the shape. This implies three parameters, which in general are 1) the mean or otherwise the appropriate measure of location, 2) the scale to adjust the variance or other measure of variability, and 3) the shape. IT TAKES at least THREE PARAMETERS TO DO IT.
Note that if we make the substitutions $\beta=2$, $\alpha=\sqrt{2}\sigma$ in the PDF above, we obtain $$\frac{e^{-\frac{(x-\mu )^2}{2 \sigma ^2}}}{\sqrt{2 \pi } \sigma }\;,$$
which is a normal distribution's density function. Thus, the generalized error density function is a generalization of the normal distribution's density function. There are many ways to generalize a normal distribution's density function. Another example, but with the normal distribution's density function only as a limiting value, and not with mid-range substitution values like the generalized error density function, is the Student's$-t$ 's density function. Using the Student's$-t$ density function, we would have a rather more restricted selection of kurtosis, and $\textit{df}\geq2$ is the shape parameter because the second moment does not exist for $\textit{df}<2$. Moreover, df is not actually limited to positive integer values, it is in general real $\geq1$. The Student's$-t$ only becomes normal in the limit as $\textit{df}\rightarrow\infty$, which is why I did not choose it as an example. It is neither a good example nor is it a counter example, and in this I disagree with @Xi'an and @whuber.
Let me explain this further. One can choose two of many arbitrary density functions of two parameters to have, as an example, a mean of zero and a variance of one. However, they will not all be of the same form. The question however, relates to density functions of the SAME form, not different forms. The claim has been made that which density functions have the same form is an arbitrary assignment as this is a matter of definition, and in that my opinion differs. I do not agree that this is arbitrary because one can either make a substitution to convert one density function to be another, or one cannot. In the first case, the density functions are similar, and if by substitution we can show that the density functions are not equivalent, then those density functions are of different form.
Thus, using the example of the Student's$-t$ PDF, the choices are to either consider it to be a generalization of a normal PDF, in which case a normal PDF has a permissible form for a Student's$-t$'s PDF, or not, in which case the Student's$-t$ 's PDF is of a different form from the normal PDF and thus is irrelevant to the question posed.
We can argue this many ways. My opinion is that a normal PDF is a sub-selected form of a Student's$-t$ 's PDF, but that a normal PDF is not a sub-selection of a gamma PDF even though a limiting value of a gamma PDF can be shown to be a normal PDF, and, my reason for this is that in the normal/Student'$-t$ case, the support is the same, but in the normal/gamma case the support is infinite versus semi-infinite, which is the required incompatibility. | Is it possible that two Random Variables from the same distribution family have the same expectation
There is apparently some confusion as to what a family of distributions is and how to count free parameters versus free plus fixed (assigned) parameters. Those questions are an aside that is unrelated |
20,760 | Is it possible that two Random Variables from the same distribution family have the same expectation and variance, but different higher moments? | If you want an example which is an "officially named parameterized distribution family, you can look into the generalized gamma distribution, https://en.wikipedia.org/wiki/Generalized_gamma_distribution. This distribution family has three parameters, so you can fix mean and variance and still have freedom to vary higher moments. From the wiki page, the algebra do not look inviting, I would rather to do it numerically. For statistical applications, search this site for gamlss, which is an extension of gam (generalized additive models, in itself a generalization of glm's) which have parameters for "location, scale and shape".
Another example is the $t$-distributions, extended to be a location-scale family. Then the third parameter will be the degrees of freedom, which will wary the shape for a fixed location and scale. | Is it possible that two Random Variables from the same distribution family have the same expectation | If you want an example which is an "officially named parameterized distribution family, you can look into the generalized gamma distribution, https://en.wikipedia.org/wiki/Generalized_gamma_distributi | Is it possible that two Random Variables from the same distribution family have the same expectation and variance, but different higher moments?
If you want an example which is an "officially named parameterized distribution family, you can look into the generalized gamma distribution, https://en.wikipedia.org/wiki/Generalized_gamma_distribution. This distribution family has three parameters, so you can fix mean and variance and still have freedom to vary higher moments. From the wiki page, the algebra do not look inviting, I would rather to do it numerically. For statistical applications, search this site for gamlss, which is an extension of gam (generalized additive models, in itself a generalization of glm's) which have parameters for "location, scale and shape".
Another example is the $t$-distributions, extended to be a location-scale family. Then the third parameter will be the degrees of freedom, which will wary the shape for a fixed location and scale. | Is it possible that two Random Variables from the same distribution family have the same expectation
If you want an example which is an "officially named parameterized distribution family, you can look into the generalized gamma distribution, https://en.wikipedia.org/wiki/Generalized_gamma_distributi |
20,761 | Is it possible that two Random Variables from the same distribution family have the same expectation and variance, but different higher moments? | There is an infinite number of distributions with mean zero and variance one, hence take $\epsilon_1$ distributed from one of these distributions, say the $\mathcal{N}(0,1)$, and $\epsilon_2$ from another of these distributions, say the Student's $t$ with 54 degrees of freedom rescaled by $\sqrt\frac{1}{3}$ so that its variance is one, then
$$X=\mu+\sigma\epsilon_1\qquad\text{and}\qquad Y=\mu+\sigma\epsilon_2$$
enjoy the properties you mention. The "number" of parameters is irrelevant to the property.
Obviously, if you set further rules to the definition of this family, like stating for instance that there exists a fixed density $f$ such that the density of $X$ is $$\frac{1}{\sigma^d} f(\{x-\mu\}/\sigma)$$ you may end up with a single possible distribution. | Is it possible that two Random Variables from the same distribution family have the same expectation | There is an infinite number of distributions with mean zero and variance one, hence take $\epsilon_1$ distributed from one of these distributions, say the $\mathcal{N}(0,1)$, and $\epsilon_2$ from ano | Is it possible that two Random Variables from the same distribution family have the same expectation and variance, but different higher moments?
There is an infinite number of distributions with mean zero and variance one, hence take $\epsilon_1$ distributed from one of these distributions, say the $\mathcal{N}(0,1)$, and $\epsilon_2$ from another of these distributions, say the Student's $t$ with 54 degrees of freedom rescaled by $\sqrt\frac{1}{3}$ so that its variance is one, then
$$X=\mu+\sigma\epsilon_1\qquad\text{and}\qquad Y=\mu+\sigma\epsilon_2$$
enjoy the properties you mention. The "number" of parameters is irrelevant to the property.
Obviously, if you set further rules to the definition of this family, like stating for instance that there exists a fixed density $f$ such that the density of $X$ is $$\frac{1}{\sigma^d} f(\{x-\mu\}/\sigma)$$ you may end up with a single possible distribution. | Is it possible that two Random Variables from the same distribution family have the same expectation
There is an infinite number of distributions with mean zero and variance one, hence take $\epsilon_1$ distributed from one of these distributions, say the $\mathcal{N}(0,1)$, and $\epsilon_2$ from ano |
20,762 | Is it possible that two Random Variables from the same distribution family have the same expectation and variance, but different higher moments? | I think you are asking whether two random variables coming from the same location-scale family can have the same mean and variance, but at least one different higher moment. The answer is no.
Proof: Let $X_1$ and $X_2$ be two such random variables. Since $X_1$ and $X_2$ are in the same location-scale family, there exist a random variable $X$ and real numbers $a_1>0, a_2>0, b_1, b_2$ such that $X_1 \stackrel{d}{=} a_1 X + b_1$ and $X_2 \stackrel{d}{=} a_2 X + b_2$. Since $X_1$ and $X_2$ have the same mean and variance, we have:
$E[X_1] = E[X_2] \implies a_1 E[X] + b_1 = a_2 E[X] + b_2$.
$\operatorname{Var}[X_1] = \operatorname{Var}[X_2] \implies a_1^2 \operatorname{Var}[X] = a_2^2 \operatorname{Var}[X]$.
If $\operatorname{Var}[X] = 0$, then $X_1=E[X_1]=X_2=E[X_2]$ with probability $1$, and hence the higher moments of $X_1$ and $X_2$ are all equal. So we may assume that $\operatorname{Var}[X] \neq 0$. Using this, (2) implies that $|a_1|=|a_2|$. Since $a_1>0$ and $a_2>0$, we have in fact that $a_1=a_2$. In turn, (1) above now implies that $b_1=b_2$. We therefore have that:
$$
E[X_1^k] = E[(a_1X+b_1)^k] = E[(a_2X+b_2)^k] = E[X_2^k],
$$
for any $k$, i.e., all moments of $X_1$ and $X_2$ are all equal. | Is it possible that two Random Variables from the same distribution family have the same expectation | I think you are asking whether two random variables coming from the same location-scale family can have the same mean and variance, but at least one different higher moment. The answer is no.
Proof: L | Is it possible that two Random Variables from the same distribution family have the same expectation and variance, but different higher moments?
I think you are asking whether two random variables coming from the same location-scale family can have the same mean and variance, but at least one different higher moment. The answer is no.
Proof: Let $X_1$ and $X_2$ be two such random variables. Since $X_1$ and $X_2$ are in the same location-scale family, there exist a random variable $X$ and real numbers $a_1>0, a_2>0, b_1, b_2$ such that $X_1 \stackrel{d}{=} a_1 X + b_1$ and $X_2 \stackrel{d}{=} a_2 X + b_2$. Since $X_1$ and $X_2$ have the same mean and variance, we have:
$E[X_1] = E[X_2] \implies a_1 E[X] + b_1 = a_2 E[X] + b_2$.
$\operatorname{Var}[X_1] = \operatorname{Var}[X_2] \implies a_1^2 \operatorname{Var}[X] = a_2^2 \operatorname{Var}[X]$.
If $\operatorname{Var}[X] = 0$, then $X_1=E[X_1]=X_2=E[X_2]$ with probability $1$, and hence the higher moments of $X_1$ and $X_2$ are all equal. So we may assume that $\operatorname{Var}[X] \neq 0$. Using this, (2) implies that $|a_1|=|a_2|$. Since $a_1>0$ and $a_2>0$, we have in fact that $a_1=a_2$. In turn, (1) above now implies that $b_1=b_2$. We therefore have that:
$$
E[X_1^k] = E[(a_1X+b_1)^k] = E[(a_2X+b_2)^k] = E[X_2^k],
$$
for any $k$, i.e., all moments of $X_1$ and $X_2$ are all equal. | Is it possible that two Random Variables from the same distribution family have the same expectation
I think you are asking whether two random variables coming from the same location-scale family can have the same mean and variance, but at least one different higher moment. The answer is no.
Proof: L |
20,763 | Is it possible that two Random Variables from the same distribution family have the same expectation and variance, but different higher moments? | Since the question can be interpreted in multipe ways I will split this answer into two parts.
A: distribution families.
B: location-scale distribution families.
The problem with case A can be easily answered/demonstrated by many families with a shape parameter.
The problem with case B is more difficult since one and a half parameters seem to be sufficient to specify location and scale (location in $\mathbb{R}$ and scale in $\mathbb{R_{>0}}$), and the problem becomes whether two parameters can be used to encode (multiple) shapes in addition as well. This is not so trivial. We can easily come up with specific two parameter location scale families and demonstrate that you do not have different shapes, but it does not proof that this is a fixed rule for any two parameter location scale family.
A: Can two different distributions from the same 2 parameter distribution family have the same mean and variance?
The answer is yes and it can already be shown using one of the explicitly mentioned examples: the normalized Gamma distribution
Family of normalized gamma distributions
Let $Z = \frac{X-\mu}{\sigma}$ with $X$ a Gamma distributed variable. The (cumulative) distribution of $Z$ is as below:
$$F_Z(z;k) = \begin{cases} 0 & \quad \text{if} & z < -\sqrt{k}\\
\frac{1}{\Gamma(k)} \gamma(k, {z\sqrt{k}+k}) & \quad \text{if} & z \geq -\sqrt{k} \end{cases} $$
where $\gamma$ is the incomplete gamma function.
So here it is clearly the case that different $Z_1$ and $Z_2$ (distributions from the family of normalized gamma distributions) can have same mean and variance (namely $\mu=0$ and $\sigma=1$) but differ based on the parameter $k$ (often denoted 'shape' parameter). This is closely linked to the fact that the family of gamma distributions is not a location-scale family.
B: Can two different distributions from the same 2 parameter location-scale distribution family have the same mean and variance?
I believe that the answer is no if we consider only smooth families (smooth: a small change in the parameters will result in a small change of the distribution/function/curve). But that answer is not so trivial and when we would use more general (non-smooth) families then we can say yes, although these families only exist in theory and have no practical relevance.
Generating a location-scale family from a single distribution by translation and scaling
From any particular single distribution we can generate a location-scale family by translation and scaling. If $f(x)$ is the probability density function of the single distribution, then the probability density function for a member of the family will be
$$f(x;\mu,\sigma) = \frac{1}{\sigma}f(\frac{x-\mu}{\sigma})$$
For a location-scale family that can be generated in such way we have:
for any two members $f(x;\mu_1,\sigma_1)$ and $f(x;\mu_2,\sigma_2)$ if their means and variances are equal, then $f(x;\mu_1,\sigma_1) = f(x;\mu_2,\sigma_2)$
Can for all two parameter location-scale families their member distributions be generated from a single member distribution by translation and scaling?
So translation and scaling can convert a single distribution into a location-scale family. The question is whether the reverse is true and whether every two parameter location-scale family (where the parameters $\theta_1$ and $\theta_2$ do not necessarily need to coincide with the location $\mu$ and scale $\sigma$) can be described by a translation and scaling of a single member from that family.
For particular two parameter location-scale families like the family of normal distributions it is not too difficult to show that they can be generated according to the process above (scaling and translating of single example member).
One may wonder whether it is possible for every two parameter location-scale family to be generated out of a single member by translation and scaling. Or a conflicting statement: "Can a two parameter location-scale family contain two different member distributions with the same mean and variance?", for which it would be necessary that the family is a union of multiple subfamilies that are each generated by translation and scaling.
Case 1: Family of generalized Students' t-distributions, parameterized by two variables
A contrived example occurs when we make some mapping from $R^2$ into $R^3$ (cardinality-of-mathbbr-and-mathbbr2) which allows the freedom to use two parameters $\theta_1$ and $\theta_2$ to describe a union of multiple subfamilies that are generated by translation and scaling.
Let's use the (three parameter) generalized Student's t-distribution:
$f(x;\nu,\mu,\sigma) = \frac{\Gamma \left( \frac{\nu + 1}{2} \right) }{\Gamma \left( \frac{\nu}{2} \right) \sqrt{\pi\nu}\sigma} \left(1 + \frac{1}{\nu} \left( \frac{x-\mu}{\sigma} \right)^2 \right)^{-\frac{\nu+1}{2}}$
with the three parameters changed as following
$$\begin{array}{rcl}
\mu &=& \tan (\theta_1)\\
\sigma &=& \theta_2\\
\nu &=& \lfloor 0.5+\theta_1/\pi \rfloor
\end{array}$$
then we have
$f(x;\theta_1,\theta_2) = \frac{\Gamma \left( \frac{\lfloor 0.5+\theta_1/\pi \rfloor + 1}{2} \right) }{\Gamma \left( \frac{\lfloor 0.5+\theta_1/\pi \rfloor}{2} \right) \sqrt{\pi\lfloor 0.5+\theta_1/\pi \rfloor}\theta_2} \left(1 + \frac{1}{\lfloor 0.5+\theta_1/\pi \rfloor} \left( \frac{x-\tan(\theta_1)}{\theta_2} \right)^2 \right)^{-\frac{\lfloor 0.5+\theta_1/\pi \rfloor+1}{2}}$
which may be considered a two parameter location-scale family (albeit not very useful) that can not be generated by translation and scaling of only a single member.
Case 2: Location-scale families generated by negative scaling of a single distribution with nonzero skew
A less contrived example, than using this tan-function, is given by Whuber under the comments of Carl's answer. We can have a family $x \mapsto f(x/b + a)$ where flipping the sign of $b$ keeps the mean and variance unchanged but possibly changing the uneven higher moments. So this gives a bit more easily a two parameter location-scale family where members with the same mean and variance can have different higher order moments. This example from Whuber can be split into two subfamilies each of which can be generated out of a single member by translation and scaling.
Smooth families
If we try to make a single smooth two parameter distribution family (smooth: a small change in the parameters will result in a small change of the distribution/function/curve) by somehow making a composition of two or more families that are generated by translation and scaling, then we get into problems to have the two parameters cover both the variation of 'mean' and 'variance', as well as the third parameter 'shape'. A formal proof will have to go along the same lines as the answer to the question: Is there a smooth surjective function $f:\mathbb{R}^2 \mapsto \mathbb{R}^3$? (where the answer is no in the case of smooth, ie. infinitely differentiable, functions although there are continuous functions that would do the job such as Peano curves).
Intuition: Imagine there would be some parameters $\theta_1$, $\theta_2$ that describe the distributions in some location-scale distribution family and by which we can change the mean and variance as well as some other moments, then we should be able to express $\theta_1$, $\theta_2$, in terms of the mean $\mu$ and variance $\sigma$
$$\begin{array}{rcl} \theta_1 &= &f_{\theta_1}(\mu,\sigma) \\
\theta_2 &=& f_{\theta_2}(\mu,\sigma)\end{array}$$
but these need to be multiple valued functions and these can not make continuous transitions, the different values from $f_{\theta_1}(\mu,\sigma)$ for a particular $\mu$ and $\sigma$ are not continuous, and will not be able to model a continuous shape parameter.
I am actually not so sure about this final part. We could possibly use a space-filling curve (such as the Peano curve, if only we knew how to express coordinates on the curve to coordinates of the hypercube) to have a single parameter $\theta_1$ completely model multiple features like mean and variance, without giving up the property that a small change of the parameter $\theta_1$ is equivalent to a small change of the function $f(x;\theta_1)$ at every $x$ | Is it possible that two Random Variables from the same distribution family have the same expectation | Since the question can be interpreted in multipe ways I will split this answer into two parts.
A: distribution families.
B: location-scale distribution families.
The problem with case A can be easil | Is it possible that two Random Variables from the same distribution family have the same expectation and variance, but different higher moments?
Since the question can be interpreted in multipe ways I will split this answer into two parts.
A: distribution families.
B: location-scale distribution families.
The problem with case A can be easily answered/demonstrated by many families with a shape parameter.
The problem with case B is more difficult since one and a half parameters seem to be sufficient to specify location and scale (location in $\mathbb{R}$ and scale in $\mathbb{R_{>0}}$), and the problem becomes whether two parameters can be used to encode (multiple) shapes in addition as well. This is not so trivial. We can easily come up with specific two parameter location scale families and demonstrate that you do not have different shapes, but it does not proof that this is a fixed rule for any two parameter location scale family.
A: Can two different distributions from the same 2 parameter distribution family have the same mean and variance?
The answer is yes and it can already be shown using one of the explicitly mentioned examples: the normalized Gamma distribution
Family of normalized gamma distributions
Let $Z = \frac{X-\mu}{\sigma}$ with $X$ a Gamma distributed variable. The (cumulative) distribution of $Z$ is as below:
$$F_Z(z;k) = \begin{cases} 0 & \quad \text{if} & z < -\sqrt{k}\\
\frac{1}{\Gamma(k)} \gamma(k, {z\sqrt{k}+k}) & \quad \text{if} & z \geq -\sqrt{k} \end{cases} $$
where $\gamma$ is the incomplete gamma function.
So here it is clearly the case that different $Z_1$ and $Z_2$ (distributions from the family of normalized gamma distributions) can have same mean and variance (namely $\mu=0$ and $\sigma=1$) but differ based on the parameter $k$ (often denoted 'shape' parameter). This is closely linked to the fact that the family of gamma distributions is not a location-scale family.
B: Can two different distributions from the same 2 parameter location-scale distribution family have the same mean and variance?
I believe that the answer is no if we consider only smooth families (smooth: a small change in the parameters will result in a small change of the distribution/function/curve). But that answer is not so trivial and when we would use more general (non-smooth) families then we can say yes, although these families only exist in theory and have no practical relevance.
Generating a location-scale family from a single distribution by translation and scaling
From any particular single distribution we can generate a location-scale family by translation and scaling. If $f(x)$ is the probability density function of the single distribution, then the probability density function for a member of the family will be
$$f(x;\mu,\sigma) = \frac{1}{\sigma}f(\frac{x-\mu}{\sigma})$$
For a location-scale family that can be generated in such way we have:
for any two members $f(x;\mu_1,\sigma_1)$ and $f(x;\mu_2,\sigma_2)$ if their means and variances are equal, then $f(x;\mu_1,\sigma_1) = f(x;\mu_2,\sigma_2)$
Can for all two parameter location-scale families their member distributions be generated from a single member distribution by translation and scaling?
So translation and scaling can convert a single distribution into a location-scale family. The question is whether the reverse is true and whether every two parameter location-scale family (where the parameters $\theta_1$ and $\theta_2$ do not necessarily need to coincide with the location $\mu$ and scale $\sigma$) can be described by a translation and scaling of a single member from that family.
For particular two parameter location-scale families like the family of normal distributions it is not too difficult to show that they can be generated according to the process above (scaling and translating of single example member).
One may wonder whether it is possible for every two parameter location-scale family to be generated out of a single member by translation and scaling. Or a conflicting statement: "Can a two parameter location-scale family contain two different member distributions with the same mean and variance?", for which it would be necessary that the family is a union of multiple subfamilies that are each generated by translation and scaling.
Case 1: Family of generalized Students' t-distributions, parameterized by two variables
A contrived example occurs when we make some mapping from $R^2$ into $R^3$ (cardinality-of-mathbbr-and-mathbbr2) which allows the freedom to use two parameters $\theta_1$ and $\theta_2$ to describe a union of multiple subfamilies that are generated by translation and scaling.
Let's use the (three parameter) generalized Student's t-distribution:
$f(x;\nu,\mu,\sigma) = \frac{\Gamma \left( \frac{\nu + 1}{2} \right) }{\Gamma \left( \frac{\nu}{2} \right) \sqrt{\pi\nu}\sigma} \left(1 + \frac{1}{\nu} \left( \frac{x-\mu}{\sigma} \right)^2 \right)^{-\frac{\nu+1}{2}}$
with the three parameters changed as following
$$\begin{array}{rcl}
\mu &=& \tan (\theta_1)\\
\sigma &=& \theta_2\\
\nu &=& \lfloor 0.5+\theta_1/\pi \rfloor
\end{array}$$
then we have
$f(x;\theta_1,\theta_2) = \frac{\Gamma \left( \frac{\lfloor 0.5+\theta_1/\pi \rfloor + 1}{2} \right) }{\Gamma \left( \frac{\lfloor 0.5+\theta_1/\pi \rfloor}{2} \right) \sqrt{\pi\lfloor 0.5+\theta_1/\pi \rfloor}\theta_2} \left(1 + \frac{1}{\lfloor 0.5+\theta_1/\pi \rfloor} \left( \frac{x-\tan(\theta_1)}{\theta_2} \right)^2 \right)^{-\frac{\lfloor 0.5+\theta_1/\pi \rfloor+1}{2}}$
which may be considered a two parameter location-scale family (albeit not very useful) that can not be generated by translation and scaling of only a single member.
Case 2: Location-scale families generated by negative scaling of a single distribution with nonzero skew
A less contrived example, than using this tan-function, is given by Whuber under the comments of Carl's answer. We can have a family $x \mapsto f(x/b + a)$ where flipping the sign of $b$ keeps the mean and variance unchanged but possibly changing the uneven higher moments. So this gives a bit more easily a two parameter location-scale family where members with the same mean and variance can have different higher order moments. This example from Whuber can be split into two subfamilies each of which can be generated out of a single member by translation and scaling.
Smooth families
If we try to make a single smooth two parameter distribution family (smooth: a small change in the parameters will result in a small change of the distribution/function/curve) by somehow making a composition of two or more families that are generated by translation and scaling, then we get into problems to have the two parameters cover both the variation of 'mean' and 'variance', as well as the third parameter 'shape'. A formal proof will have to go along the same lines as the answer to the question: Is there a smooth surjective function $f:\mathbb{R}^2 \mapsto \mathbb{R}^3$? (where the answer is no in the case of smooth, ie. infinitely differentiable, functions although there are continuous functions that would do the job such as Peano curves).
Intuition: Imagine there would be some parameters $\theta_1$, $\theta_2$ that describe the distributions in some location-scale distribution family and by which we can change the mean and variance as well as some other moments, then we should be able to express $\theta_1$, $\theta_2$, in terms of the mean $\mu$ and variance $\sigma$
$$\begin{array}{rcl} \theta_1 &= &f_{\theta_1}(\mu,\sigma) \\
\theta_2 &=& f_{\theta_2}(\mu,\sigma)\end{array}$$
but these need to be multiple valued functions and these can not make continuous transitions, the different values from $f_{\theta_1}(\mu,\sigma)$ for a particular $\mu$ and $\sigma$ are not continuous, and will not be able to model a continuous shape parameter.
I am actually not so sure about this final part. We could possibly use a space-filling curve (such as the Peano curve, if only we knew how to express coordinates on the curve to coordinates of the hypercube) to have a single parameter $\theta_1$ completely model multiple features like mean and variance, without giving up the property that a small change of the parameter $\theta_1$ is equivalent to a small change of the function $f(x;\theta_1)$ at every $x$ | Is it possible that two Random Variables from the same distribution family have the same expectation
Since the question can be interpreted in multipe ways I will split this answer into two parts.
A: distribution families.
B: location-scale distribution families.
The problem with case A can be easil |
20,764 | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof | Let $Y$ be a chi-square random variable with $n$ degrees of freedom. Then the square-root of $Y$, $\sqrt Y\equiv \hat Y$ is distributed as a chi-distribution with $n$ degrees of freedom, which has density
$$ f_{\hat Y}(\hat y) = \frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} \hat y^{n-1} \exp\Big \{{-\frac {\hat y^2}{2}} \Big\} \tag{1}$$
Define $X \equiv \frac {1}{\sqrt n}\hat Y$. Then $ \frac {\partial \hat Y}{\partial X} = \sqrt n$, and by the change-of-variable formula we have that
$$ f_{X}(x) = f_{\hat Y}(\sqrt nx)\Big |\frac {\partial \hat Y}{\partial X} \Big| = \frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} (\sqrt nx)^{n-1} \exp\Big \{{-\frac {(\sqrt nx)^2}{2}} \Big\}\sqrt n $$
$$=\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}x^{n-1} \exp\Big \{{-\frac {n}{2}x^2} \Big\} \tag{2}$$
Let $Z$ be a standard normal random variable, independent from the previous ones, and define the random variable
$$T = \frac{Z}{\sqrt \frac Yn}= \frac ZX $$.
By the standard formula for the density function of the ratio of two independent random variables,
$$f_T(t) = \int_{-\infty}^{\infty} |x|f_Z(xt)f_X(x)dx $$
But $f_X(x) = 0$ for the interval $[-\infty, 0]$ because $X$ is a non-negative r.v. So we can eliminate the absolute value, and reduce the integral to
$$f_T(t) = \int_{0}^{\infty} xf_Z(xt)f_X(x)dx $$
$$ = \int_{0}^{\infty} x \frac{1}{\sqrt{2\pi}}\exp \Big \{{-\frac{(xt)^2}{2}}\Big\}\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}x^{n-1} \exp\Big \{{-\frac {n}{2}x^2} \Big\}dx $$
$$ = \frac{1}{\sqrt{2\pi}}\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}\int_{0}^{\infty} x^n \exp \Big \{-\frac 12 (n+t^2) x^2\Big\} dx \tag{3}$$
The integrand in $(3)$ looks promising to eventually be transformed into a Gamma density function. The limits of integration are correct, so we need to manipulate the integrand into becoming a Gamma density function without changing the limits. Define the variable
$$m \equiv x^2 \Rightarrow dm = 2xdx \Rightarrow dx = \frac {dm}{2x}, \; x = m^{\frac 12}$$
Making the substitution in the integrand we have
$$I_3=\int_{0}^{\infty} x^n \exp \Big \{-\frac 12 (n+t^2) m\Big\} \frac {dm}{2x} \\
= \frac 12\int_{0}^{\infty} m^{\frac {n-1}{2}} \exp \Big \{-\frac 12 (n+t^2) m\Big \} dm \tag{4}$$
The Gamma density can be written
$$ Gamma(m;k,\theta) = \frac {m^{k-1} \exp\Big\{-\frac{m}{\theta}\Big \}}{\theta^k\Gamma(k)}$$
Matching coefficients, we must have
$$k-1 = \frac {n-1}{2} \Rightarrow k^* = \frac {n+1}{2}, \qquad \frac 1\theta =\frac 12 (n+t^2) \Rightarrow \theta^* = \frac 2 {(n+t^2)} $$
For these values of $k^*$ and $\theta^*$ the terms in the integrand involving the variable are the kernel of a gamma density. So if we divide the integrand by $(\theta^*)^{k^*}\Gamma(k^*)$ and multiply outside the integral by the same magnitude, the integral will be the gamma distr. function and will equal unity. Therefore we have arrived at
$$I_3 = \frac12(\theta^*)^{k^*}\Gamma(k^*) = \frac12 \Big (\frac 2 {n+t^2}\Big ) ^{\frac {n+1}{2}}\Gamma\left(\frac {n+1}{2}\right) = 2^ {\frac {n-1}{2}}n^{-\frac {n+1}{2}}\Gamma\left(\frac {n+1}{2}\right)\left(1+\frac {t^2}{n}\right)^{-\frac 12 (n+1)} $$
Inserting the above into eq. $(3)$ we get
$$f_T(t) = \frac{1}{\sqrt{2\pi}}\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}2^ {\frac {n-1}{2}}n^{-\frac {n+1}{2}}\Gamma\left(\frac {n+1}{2}\right)\left(1+\frac {t^2}{n}\right)^{-\frac 12 (n+1)}$$
$$=\frac{\Gamma[(n+1)/2]}{\sqrt{n\pi}\,\Gamma(n/2)}\left(1+\frac {t^2}{n}\right)^{-\frac 12 (n+1)}$$
...which is what is called the (density function of) the Student's t-distribution, with $n$ degrees of freedom. | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof | Let $Y$ be a chi-square random variable with $n$ degrees of freedom. Then the square-root of $Y$, $\sqrt Y\equiv \hat Y$ is distributed as a chi-distribution with $n$ degrees of freedom, which has den | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof
Let $Y$ be a chi-square random variable with $n$ degrees of freedom. Then the square-root of $Y$, $\sqrt Y\equiv \hat Y$ is distributed as a chi-distribution with $n$ degrees of freedom, which has density
$$ f_{\hat Y}(\hat y) = \frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} \hat y^{n-1} \exp\Big \{{-\frac {\hat y^2}{2}} \Big\} \tag{1}$$
Define $X \equiv \frac {1}{\sqrt n}\hat Y$. Then $ \frac {\partial \hat Y}{\partial X} = \sqrt n$, and by the change-of-variable formula we have that
$$ f_{X}(x) = f_{\hat Y}(\sqrt nx)\Big |\frac {\partial \hat Y}{\partial X} \Big| = \frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} (\sqrt nx)^{n-1} \exp\Big \{{-\frac {(\sqrt nx)^2}{2}} \Big\}\sqrt n $$
$$=\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}x^{n-1} \exp\Big \{{-\frac {n}{2}x^2} \Big\} \tag{2}$$
Let $Z$ be a standard normal random variable, independent from the previous ones, and define the random variable
$$T = \frac{Z}{\sqrt \frac Yn}= \frac ZX $$.
By the standard formula for the density function of the ratio of two independent random variables,
$$f_T(t) = \int_{-\infty}^{\infty} |x|f_Z(xt)f_X(x)dx $$
But $f_X(x) = 0$ for the interval $[-\infty, 0]$ because $X$ is a non-negative r.v. So we can eliminate the absolute value, and reduce the integral to
$$f_T(t) = \int_{0}^{\infty} xf_Z(xt)f_X(x)dx $$
$$ = \int_{0}^{\infty} x \frac{1}{\sqrt{2\pi}}\exp \Big \{{-\frac{(xt)^2}{2}}\Big\}\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}x^{n-1} \exp\Big \{{-\frac {n}{2}x^2} \Big\}dx $$
$$ = \frac{1}{\sqrt{2\pi}}\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}\int_{0}^{\infty} x^n \exp \Big \{-\frac 12 (n+t^2) x^2\Big\} dx \tag{3}$$
The integrand in $(3)$ looks promising to eventually be transformed into a Gamma density function. The limits of integration are correct, so we need to manipulate the integrand into becoming a Gamma density function without changing the limits. Define the variable
$$m \equiv x^2 \Rightarrow dm = 2xdx \Rightarrow dx = \frac {dm}{2x}, \; x = m^{\frac 12}$$
Making the substitution in the integrand we have
$$I_3=\int_{0}^{\infty} x^n \exp \Big \{-\frac 12 (n+t^2) m\Big\} \frac {dm}{2x} \\
= \frac 12\int_{0}^{\infty} m^{\frac {n-1}{2}} \exp \Big \{-\frac 12 (n+t^2) m\Big \} dm \tag{4}$$
The Gamma density can be written
$$ Gamma(m;k,\theta) = \frac {m^{k-1} \exp\Big\{-\frac{m}{\theta}\Big \}}{\theta^k\Gamma(k)}$$
Matching coefficients, we must have
$$k-1 = \frac {n-1}{2} \Rightarrow k^* = \frac {n+1}{2}, \qquad \frac 1\theta =\frac 12 (n+t^2) \Rightarrow \theta^* = \frac 2 {(n+t^2)} $$
For these values of $k^*$ and $\theta^*$ the terms in the integrand involving the variable are the kernel of a gamma density. So if we divide the integrand by $(\theta^*)^{k^*}\Gamma(k^*)$ and multiply outside the integral by the same magnitude, the integral will be the gamma distr. function and will equal unity. Therefore we have arrived at
$$I_3 = \frac12(\theta^*)^{k^*}\Gamma(k^*) = \frac12 \Big (\frac 2 {n+t^2}\Big ) ^{\frac {n+1}{2}}\Gamma\left(\frac {n+1}{2}\right) = 2^ {\frac {n-1}{2}}n^{-\frac {n+1}{2}}\Gamma\left(\frac {n+1}{2}\right)\left(1+\frac {t^2}{n}\right)^{-\frac 12 (n+1)} $$
Inserting the above into eq. $(3)$ we get
$$f_T(t) = \frac{1}{\sqrt{2\pi}}\frac {2^{1-\frac n2}}{\Gamma\left(\frac {n}{2}\right)} n^{\frac n2}2^ {\frac {n-1}{2}}n^{-\frac {n+1}{2}}\Gamma\left(\frac {n+1}{2}\right)\left(1+\frac {t^2}{n}\right)^{-\frac 12 (n+1)}$$
$$=\frac{\Gamma[(n+1)/2]}{\sqrt{n\pi}\,\Gamma(n/2)}\left(1+\frac {t^2}{n}\right)^{-\frac 12 (n+1)}$$
...which is what is called the (density function of) the Student's t-distribution, with $n$ degrees of freedom. | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof
Let $Y$ be a chi-square random variable with $n$ degrees of freedom. Then the square-root of $Y$, $\sqrt Y\equiv \hat Y$ is distributed as a chi-distribution with $n$ degrees of freedom, which has den |
20,765 | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof | Although E. S. Pearson didn't like it, Fisher's original argument was geometric, simple, convincing, and rigorous. It relies on a small number of intuitive and easily established facts. They are easily visualized when $s=1$ or $s=2$, where the geometry can be visualized in two or three dimensions. In effect, it amounts to using cylindrical coordinates in $\mathbb{R}^s\times\mathbb{R}$ to analyze $s+1$ iid Normal variables.
$s+1$ independent and identically distributed Normal variates $X_1, \ldots, X_{s+1}$ are spherically symmetrical. This means that the radial projection of the point $(X_1, \ldots, X_{s+1})$ onto the unit sphere $S^s \subset \mathbb{R}^{s+1}$ has a uniform distribution on $S^s$.
A $\chi^2(s)$ distribution is that of the sum of squares of $s$ independent standard Normal variates.
Thus, setting $Z=X_{s+1}$ and $W = X_1^2 + \cdots + X_s^2$, the ratio $Z/\sqrt{W}$ is the tangent of the latitude $\theta$ of the point $(X_1, \ldots, X_s, X_{s+1})$ in $\mathbb{R}^{s+1}$.
$\tan\theta$ is unchanged by radial projection onto $S^s$.
The set determined by all points of latitude $\theta$ on $S^s$ is an $s-1$ dimensional sphere of radius $\cos \theta$. Its $s-1$ dimensional measure therefore is proportional to $$\cos^{s-1}\theta = (1 + \tan^2\theta)^{-(s-1)/2}.$$
The differential element is $\mathrm{d}(\tan\theta) = \cos^{-2}\theta \,\mathrm{d}\theta = (1 + \tan^2\theta) \,\mathrm{d}\theta$.
Writing $t = Z/\sqrt{W/s} = \sqrt{s}\tan\theta$ gives $\tan\theta = t/\sqrt{s}$, whence $$1+t^2/s = 1+\tan^2\theta$$ and $$\mathrm{d}t = \sqrt{s}\,\mathrm{d}\tan\theta = \sqrt{s}(1+\tan^2\theta)\,\mathrm{d}\theta.$$
Together these equations imply $$\mathrm{d}\theta = \frac{1}{\sqrt{s}} \left(1+t^2/s\right)^{-1}\mathrm{d}t.$$ Incorporating the factor of $1/\sqrt{s}$ into a normalizing constant $C(s)$ shows the density of $t$ is proportional to
$$(1 + \tan^2\theta)^{-(s-1)/2}\,\mathrm{d}\theta = (1 + t^2/s)^{-(s-1)/2}\ (1 + t^2/s)^{-1}\,\mathrm{d}t = (1 + t^2/s)^{-(s+1)/2}\,\mathrm{d}t.$$
That is the Student t density.
The figure depicts the upper hemisphere (with $Z \ge 0$) of $S^s$ in $\mathbb{R}^{s+1}$. The crossed axes span the $W$-hyperplane. The black dots are part of a random sample of a $s+1$-variate standard Normal distribution: they are the values projecting to a constant given latitude $\theta$, shown as the yellow band. The density of these dots is proportional to the $s-1$-dimensional volume of that band, which itself is an $S^{s-1}$ of radius $\theta$. The cone over that band is drawn to terminate at a height of $\tan \theta$. Up to a factor of $\sqrt{s}$, the Student t distribution with $s$ degrees of freedom is the distribution of this height as weighted by the measure of the yellow band upon normalizing the area of the unit sphere $S^s$ to unity.
Incidentally, the normalizing constant must be $1/\sqrt{s}$ (as previously mentioned) times the relative volumes of the spheres,
$$\eqalign{
C(s) &= \frac{1}{\sqrt{s}} \frac{|S^{s-1}|}{|S^s|} = \frac{1}{\sqrt{s}} \frac{s \pi^{s/2} \Gamma(\frac{s+1}{2} + 1)}{(s+1)\pi^{(s+1)/2} \Gamma(\frac{s}{2}+1)}
\\ &=\frac{1}{\sqrt{s}} \frac{s \pi^{s/2} (s+1)/2\Gamma(\frac{s+1}{2})}{(s+1)\pi^{(s+1)/2} (s/2)\Gamma(\frac{s}{2})}
\\ &= \frac{\Gamma(\frac{s+1}{2})}{\sqrt{s\pi}\Gamma(\frac{s}{2})}.
}$$
The final expression, although conventional, slightly disguises the beautifully simple initial expression, which clearly reveals the meaning of $C(s)$.
Fisher explained this derivation to W. S. Gosset (the original "Student") in a letter. Gosset attempted to publish it, giving Fisher full credit, but Pearson rejected the paper. Fisher's method, as applied to the substantially similar but more difficult problem of finding the distribution of a sample correlation coefficient, was eventually published.
References
R. A. Fisher, Frequency Distribution of the Values of the Correlation Coefficient in Samples from an Indefinitely Large Population. Biometrika
Vol. 10, No. 4 (May, 1915), pp. 507-521. Available on the Web at https://stat.duke.edu/courses/Spring05/sta215/lec/Fish1915.pdf (and at many other places via searching, once this link disappears).
Joan Fisher Box, Gosset, Fisher, and the t Distribution. The American Statistician, Vol. 35, No. 2 (May, 1981), pp. 61-66. Available on the Web at http://social.rollins.edu/wpsites/bio342spr13/files/2015/03/Studentttest.pdf.
E.L. Lehmann, Fisher, Neyman, and the Creation of Classical Statistics. Springer (2011), Chapter 2. | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof | Although E. S. Pearson didn't like it, Fisher's original argument was geometric, simple, convincing, and rigorous. It relies on a small number of intuitive and easily established facts. They are eas | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof
Although E. S. Pearson didn't like it, Fisher's original argument was geometric, simple, convincing, and rigorous. It relies on a small number of intuitive and easily established facts. They are easily visualized when $s=1$ or $s=2$, where the geometry can be visualized in two or three dimensions. In effect, it amounts to using cylindrical coordinates in $\mathbb{R}^s\times\mathbb{R}$ to analyze $s+1$ iid Normal variables.
$s+1$ independent and identically distributed Normal variates $X_1, \ldots, X_{s+1}$ are spherically symmetrical. This means that the radial projection of the point $(X_1, \ldots, X_{s+1})$ onto the unit sphere $S^s \subset \mathbb{R}^{s+1}$ has a uniform distribution on $S^s$.
A $\chi^2(s)$ distribution is that of the sum of squares of $s$ independent standard Normal variates.
Thus, setting $Z=X_{s+1}$ and $W = X_1^2 + \cdots + X_s^2$, the ratio $Z/\sqrt{W}$ is the tangent of the latitude $\theta$ of the point $(X_1, \ldots, X_s, X_{s+1})$ in $\mathbb{R}^{s+1}$.
$\tan\theta$ is unchanged by radial projection onto $S^s$.
The set determined by all points of latitude $\theta$ on $S^s$ is an $s-1$ dimensional sphere of radius $\cos \theta$. Its $s-1$ dimensional measure therefore is proportional to $$\cos^{s-1}\theta = (1 + \tan^2\theta)^{-(s-1)/2}.$$
The differential element is $\mathrm{d}(\tan\theta) = \cos^{-2}\theta \,\mathrm{d}\theta = (1 + \tan^2\theta) \,\mathrm{d}\theta$.
Writing $t = Z/\sqrt{W/s} = \sqrt{s}\tan\theta$ gives $\tan\theta = t/\sqrt{s}$, whence $$1+t^2/s = 1+\tan^2\theta$$ and $$\mathrm{d}t = \sqrt{s}\,\mathrm{d}\tan\theta = \sqrt{s}(1+\tan^2\theta)\,\mathrm{d}\theta.$$
Together these equations imply $$\mathrm{d}\theta = \frac{1}{\sqrt{s}} \left(1+t^2/s\right)^{-1}\mathrm{d}t.$$ Incorporating the factor of $1/\sqrt{s}$ into a normalizing constant $C(s)$ shows the density of $t$ is proportional to
$$(1 + \tan^2\theta)^{-(s-1)/2}\,\mathrm{d}\theta = (1 + t^2/s)^{-(s-1)/2}\ (1 + t^2/s)^{-1}\,\mathrm{d}t = (1 + t^2/s)^{-(s+1)/2}\,\mathrm{d}t.$$
That is the Student t density.
The figure depicts the upper hemisphere (with $Z \ge 0$) of $S^s$ in $\mathbb{R}^{s+1}$. The crossed axes span the $W$-hyperplane. The black dots are part of a random sample of a $s+1$-variate standard Normal distribution: they are the values projecting to a constant given latitude $\theta$, shown as the yellow band. The density of these dots is proportional to the $s-1$-dimensional volume of that band, which itself is an $S^{s-1}$ of radius $\theta$. The cone over that band is drawn to terminate at a height of $\tan \theta$. Up to a factor of $\sqrt{s}$, the Student t distribution with $s$ degrees of freedom is the distribution of this height as weighted by the measure of the yellow band upon normalizing the area of the unit sphere $S^s$ to unity.
Incidentally, the normalizing constant must be $1/\sqrt{s}$ (as previously mentioned) times the relative volumes of the spheres,
$$\eqalign{
C(s) &= \frac{1}{\sqrt{s}} \frac{|S^{s-1}|}{|S^s|} = \frac{1}{\sqrt{s}} \frac{s \pi^{s/2} \Gamma(\frac{s+1}{2} + 1)}{(s+1)\pi^{(s+1)/2} \Gamma(\frac{s}{2}+1)}
\\ &=\frac{1}{\sqrt{s}} \frac{s \pi^{s/2} (s+1)/2\Gamma(\frac{s+1}{2})}{(s+1)\pi^{(s+1)/2} (s/2)\Gamma(\frac{s}{2})}
\\ &= \frac{\Gamma(\frac{s+1}{2})}{\sqrt{s\pi}\Gamma(\frac{s}{2})}.
}$$
The final expression, although conventional, slightly disguises the beautifully simple initial expression, which clearly reveals the meaning of $C(s)$.
Fisher explained this derivation to W. S. Gosset (the original "Student") in a letter. Gosset attempted to publish it, giving Fisher full credit, but Pearson rejected the paper. Fisher's method, as applied to the substantially similar but more difficult problem of finding the distribution of a sample correlation coefficient, was eventually published.
References
R. A. Fisher, Frequency Distribution of the Values of the Correlation Coefficient in Samples from an Indefinitely Large Population. Biometrika
Vol. 10, No. 4 (May, 1915), pp. 507-521. Available on the Web at https://stat.duke.edu/courses/Spring05/sta215/lec/Fish1915.pdf (and at many other places via searching, once this link disappears).
Joan Fisher Box, Gosset, Fisher, and the t Distribution. The American Statistician, Vol. 35, No. 2 (May, 1981), pp. 61-66. Available on the Web at http://social.rollins.edu/wpsites/bio342spr13/files/2015/03/Studentttest.pdf.
E.L. Lehmann, Fisher, Neyman, and the Creation of Classical Statistics. Springer (2011), Chapter 2. | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof
Although E. S. Pearson didn't like it, Fisher's original argument was geometric, simple, convincing, and rigorous. It relies on a small number of intuitive and easily established facts. They are eas |
20,766 | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof | I would try change of variables. Set $Y=\frac{Z}{\sqrt{\frac{W}{s}}}$ and $X=Z$ for example. So $Z=X$, $W=\frac{sX^2}{Y^2}$. Then $f_{X,Y}(x,y)=f_{Z,W}(x,\frac{sx^2}{y^2})|\det(J)|$. Where $J$ is the Jacobian matrix for the multivariate function of $Z$ and $W$ of $X$ and $Y$. Then you can integrate $x$ out from the joint density. $\frac{\partial Z}{\partial X}=1$, $\frac{\partial Z}{\partial Y}=0$, $\frac{\partial W}{\partial X}=\frac{2sX}{Y^2}$, and $\frac{\partial W}{\partial Y}=\frac{-2sX^2}{Y^3}$.
$$
J=
\begin{pmatrix}
1&0\\
*&\frac{-2sX^2}{Y^3}
\end{pmatrix}
$$
So $|\det(J)|=\frac{2sx^2}{y^3}$. I just took a look at Elements of Distribution Theory by Thomas A. Severini and there, they take $X=W$. Integrating things out becomes easier using properties of a Gaama distribution. If I use $X=Z$, I probably would need to complete squares.
But I don't want to do the calculation. | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof | I would try change of variables. Set $Y=\frac{Z}{\sqrt{\frac{W}{s}}}$ and $X=Z$ for example. So $Z=X$, $W=\frac{sX^2}{Y^2}$. Then $f_{X,Y}(x,y)=f_{Z,W}(x,\frac{sx^2}{y^2})|\det(J)|$. Where $J$ is the | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof
I would try change of variables. Set $Y=\frac{Z}{\sqrt{\frac{W}{s}}}$ and $X=Z$ for example. So $Z=X$, $W=\frac{sX^2}{Y^2}$. Then $f_{X,Y}(x,y)=f_{Z,W}(x,\frac{sx^2}{y^2})|\det(J)|$. Where $J$ is the Jacobian matrix for the multivariate function of $Z$ and $W$ of $X$ and $Y$. Then you can integrate $x$ out from the joint density. $\frac{\partial Z}{\partial X}=1$, $\frac{\partial Z}{\partial Y}=0$, $\frac{\partial W}{\partial X}=\frac{2sX}{Y^2}$, and $\frac{\partial W}{\partial Y}=\frac{-2sX^2}{Y^3}$.
$$
J=
\begin{pmatrix}
1&0\\
*&\frac{-2sX^2}{Y^3}
\end{pmatrix}
$$
So $|\det(J)|=\frac{2sx^2}{y^3}$. I just took a look at Elements of Distribution Theory by Thomas A. Severini and there, they take $X=W$. Integrating things out becomes easier using properties of a Gaama distribution. If I use $X=Z$, I probably would need to complete squares.
But I don't want to do the calculation. | A normal divided by the $\sqrt{\chi^2(s)/s}$ gives you a t-distribution -- proof
I would try change of variables. Set $Y=\frac{Z}{\sqrt{\frac{W}{s}}}$ and $X=Z$ for example. So $Z=X$, $W=\frac{sX^2}{Y^2}$. Then $f_{X,Y}(x,y)=f_{Z,W}(x,\frac{sx^2}{y^2})|\det(J)|$. Where $J$ is the |
20,767 | How to calculate a Gaussian kernel effectively in numpy [closed] | I think the main problem is to get the pairwise distances efficiently. Once you have that the rest is element wise.
To do this, you probably want to use scipy. The function scipy.spatial.distance.pdist does what you need, and scipy.spatial.distance.squareform will possibly ease your life.
So if you want the kernel matrix you do
from scipy.spatial.distance import pdist, squareform
# this is an NxD matrix, where N is number of items and D its dimensionalites
X = loaddata()
pairwise_dists = squareform(pdist(X, 'euclidean'))
K = scip.exp(-pairwise_dists ** 2 / s ** 2)
Documentation can be found here. | How to calculate a Gaussian kernel effectively in numpy [closed] | I think the main problem is to get the pairwise distances efficiently. Once you have that the rest is element wise.
To do this, you probably want to use scipy. The function scipy.spatial.distance.pdis | How to calculate a Gaussian kernel effectively in numpy [closed]
I think the main problem is to get the pairwise distances efficiently. Once you have that the rest is element wise.
To do this, you probably want to use scipy. The function scipy.spatial.distance.pdist does what you need, and scipy.spatial.distance.squareform will possibly ease your life.
So if you want the kernel matrix you do
from scipy.spatial.distance import pdist, squareform
# this is an NxD matrix, where N is number of items and D its dimensionalites
X = loaddata()
pairwise_dists = squareform(pdist(X, 'euclidean'))
K = scip.exp(-pairwise_dists ** 2 / s ** 2)
Documentation can be found here. | How to calculate a Gaussian kernel effectively in numpy [closed]
I think the main problem is to get the pairwise distances efficiently. Once you have that the rest is element wise.
To do this, you probably want to use scipy. The function scipy.spatial.distance.pdis |
20,768 | How to calculate a Gaussian kernel effectively in numpy [closed] | As a small addendum to bayerj's answer, scipy's pdist function can directly compute squared euclidean norms by calling it as pdist(X, 'sqeuclidean'). The full code can then be written more efficiently as
from scipy.spatial.distance import pdist, squareform
# this is an NxD matrix, where N is number of items and D its dimensionalites
X = loaddata()
pairwise_sq_dists = squareform(pdist(X, 'sqeuclidean'))
K = scip.exp(-pairwise_sq_dists / s**2) | How to calculate a Gaussian kernel effectively in numpy [closed] | As a small addendum to bayerj's answer, scipy's pdist function can directly compute squared euclidean norms by calling it as pdist(X, 'sqeuclidean'). The full code can then be written more efficiently | How to calculate a Gaussian kernel effectively in numpy [closed]
As a small addendum to bayerj's answer, scipy's pdist function can directly compute squared euclidean norms by calling it as pdist(X, 'sqeuclidean'). The full code can then be written more efficiently as
from scipy.spatial.distance import pdist, squareform
# this is an NxD matrix, where N is number of items and D its dimensionalites
X = loaddata()
pairwise_sq_dists = squareform(pdist(X, 'sqeuclidean'))
K = scip.exp(-pairwise_sq_dists / s**2) | How to calculate a Gaussian kernel effectively in numpy [closed]
As a small addendum to bayerj's answer, scipy's pdist function can directly compute squared euclidean norms by calling it as pdist(X, 'sqeuclidean'). The full code can then be written more efficiently |
20,769 | How to calculate a Gaussian kernel effectively in numpy [closed] | You can also write square form by hand:
import numpy as np
def vectorized_RBF_kernel(X, sigma):
# % This is equivalent to computing the kernel on every pair of examples
X2 = np.sum(np.multiply(X, X), 1) # sum colums of the matrix
K0 = X2 + X2.T - 2 * X * X.T
K = np.power(np.exp(-1.0 / sigma**2), K0)
return K
PS but this works 30% slower | How to calculate a Gaussian kernel effectively in numpy [closed] | You can also write square form by hand:
import numpy as np
def vectorized_RBF_kernel(X, sigma):
# % This is equivalent to computing the kernel on every pair of examples
X2 = np.sum(np.multiply | How to calculate a Gaussian kernel effectively in numpy [closed]
You can also write square form by hand:
import numpy as np
def vectorized_RBF_kernel(X, sigma):
# % This is equivalent to computing the kernel on every pair of examples
X2 = np.sum(np.multiply(X, X), 1) # sum colums of the matrix
K0 = X2 + X2.T - 2 * X * X.T
K = np.power(np.exp(-1.0 / sigma**2), K0)
return K
PS but this works 30% slower | How to calculate a Gaussian kernel effectively in numpy [closed]
You can also write square form by hand:
import numpy as np
def vectorized_RBF_kernel(X, sigma):
# % This is equivalent to computing the kernel on every pair of examples
X2 = np.sum(np.multiply |
20,770 | How to calculate a Gaussian kernel effectively in numpy [closed] | def my_kernel(X,Y):
K = np.zeros((X.shape[0],Y.shape[0]))
for i,x in enumerate(X):
for j,y in enumerate(Y):
K[i,j] = np.exp(-1*np.linalg.norm(x-y)**2)
return K
clf=SVR(kernel=my_kernel)
which is equal to
clf=SVR(kernel="rbf",gamma=1)
You can effectively calculate the RBF from the above code note that the gamma value is 1, since it is a constant the s you requested is also the same constant. | How to calculate a Gaussian kernel effectively in numpy [closed] | def my_kernel(X,Y):
K = np.zeros((X.shape[0],Y.shape[0]))
for i,x in enumerate(X):
for j,y in enumerate(Y):
K[i,j] = np.exp(-1*np.linalg.norm(x-y)**2)
return K
clf=SVR | How to calculate a Gaussian kernel effectively in numpy [closed]
def my_kernel(X,Y):
K = np.zeros((X.shape[0],Y.shape[0]))
for i,x in enumerate(X):
for j,y in enumerate(Y):
K[i,j] = np.exp(-1*np.linalg.norm(x-y)**2)
return K
clf=SVR(kernel=my_kernel)
which is equal to
clf=SVR(kernel="rbf",gamma=1)
You can effectively calculate the RBF from the above code note that the gamma value is 1, since it is a constant the s you requested is also the same constant. | How to calculate a Gaussian kernel effectively in numpy [closed]
def my_kernel(X,Y):
K = np.zeros((X.shape[0],Y.shape[0]))
for i,x in enumerate(X):
for j,y in enumerate(Y):
K[i,j] = np.exp(-1*np.linalg.norm(x-y)**2)
return K
clf=SVR |
20,771 | How to calculate a Gaussian kernel effectively in numpy [closed] | I think this will help:
def GaussianKernel(v1, v2, sigma):
return exp(-norm(v1-v2, 2)**2/(2.*sigma**2)) | How to calculate a Gaussian kernel effectively in numpy [closed] | I think this will help:
def GaussianKernel(v1, v2, sigma):
return exp(-norm(v1-v2, 2)**2/(2.*sigma**2)) | How to calculate a Gaussian kernel effectively in numpy [closed]
I think this will help:
def GaussianKernel(v1, v2, sigma):
return exp(-norm(v1-v2, 2)**2/(2.*sigma**2)) | How to calculate a Gaussian kernel effectively in numpy [closed]
I think this will help:
def GaussianKernel(v1, v2, sigma):
return exp(-norm(v1-v2, 2)**2/(2.*sigma**2)) |
20,772 | Does PCA preserve linear separability for every linearly separable set? | No, it may be that the discriminative information is in the direction of a principal component that explains a relatively small amount of the total variance, and hence gets discarded.
Consider a two-dimensional dataset where the two classes lie in long parallel cigar-shaped elongated Gaussian clusters with a small gap between them. Most of the variance lies along the long axis of the clusters, so the first PC will be in that direction and the second will be orthogonal to it. The data are indistinguishable from the first component, so if you discard the second component, the data will no longer be separable. | Does PCA preserve linear separability for every linearly separable set? | No, it may be that the discriminative information is in the direction of a principal component that explains a relatively small amount of the total variance, and hence gets discarded.
Consider a two-d | Does PCA preserve linear separability for every linearly separable set?
No, it may be that the discriminative information is in the direction of a principal component that explains a relatively small amount of the total variance, and hence gets discarded.
Consider a two-dimensional dataset where the two classes lie in long parallel cigar-shaped elongated Gaussian clusters with a small gap between them. Most of the variance lies along the long axis of the clusters, so the first PC will be in that direction and the second will be orthogonal to it. The data are indistinguishable from the first component, so if you discard the second component, the data will no longer be separable. | Does PCA preserve linear separability for every linearly separable set?
No, it may be that the discriminative information is in the direction of a principal component that explains a relatively small amount of the total variance, and hence gets discarded.
Consider a two-d |
20,773 | Does PCA preserve linear separability for every linearly separable set? | No, reducing dimensionality with PCA will only maximize variance, which may or may not translate to linear separability.
Here are two visualizations of variance and separability in opposition. In both cases, the discriminative information lies primarily along the low-variance axis, which would get discarded by rote dimensionality reduction.
Minimal example of three data points (adapted from whuber's comment)
Example of parallel, elongated Gaussian clusters (adapted from Dikran's answer)
import numpy as np
from sklearn.decomposition import PCA
# generate gaussian samples (n by 2)
rng = np.random.default_rng(4)
n = 100
X = rng.standard_normal((n, 2)) @ rng.random((2, 2))
# peel classes apart (+1 and -1 vertically)
y = 2 * np.arange(X.shape[0]) // n
X[:, 1] = np.where(y, X[:, 1] - 1, X[:, 1] + 1)
# project X
mu = X.mean(axis=0)
X -= mu
pca = PCA(n_components=2).fit(X) # explained variance ratios: [0.83267962, 0.16732038]
X_pca = pca.transform(X)
# reduce dimensionality via PC1
X_pc1 = X_pca[:, [0]] @ pca.components_[[0], :] + mu
# reduce dimensionality via PC2
X_pc2 = X_pca[:, [1]] @ pca.components_[[1], :] + mu | Does PCA preserve linear separability for every linearly separable set? | No, reducing dimensionality with PCA will only maximize variance, which may or may not translate to linear separability.
Here are two visualizations of variance and separability in opposition. In both | Does PCA preserve linear separability for every linearly separable set?
No, reducing dimensionality with PCA will only maximize variance, which may or may not translate to linear separability.
Here are two visualizations of variance and separability in opposition. In both cases, the discriminative information lies primarily along the low-variance axis, which would get discarded by rote dimensionality reduction.
Minimal example of three data points (adapted from whuber's comment)
Example of parallel, elongated Gaussian clusters (adapted from Dikran's answer)
import numpy as np
from sklearn.decomposition import PCA
# generate gaussian samples (n by 2)
rng = np.random.default_rng(4)
n = 100
X = rng.standard_normal((n, 2)) @ rng.random((2, 2))
# peel classes apart (+1 and -1 vertically)
y = 2 * np.arange(X.shape[0]) // n
X[:, 1] = np.where(y, X[:, 1] - 1, X[:, 1] + 1)
# project X
mu = X.mean(axis=0)
X -= mu
pca = PCA(n_components=2).fit(X) # explained variance ratios: [0.83267962, 0.16732038]
X_pca = pca.transform(X)
# reduce dimensionality via PC1
X_pc1 = X_pca[:, [0]] @ pca.components_[[0], :] + mu
# reduce dimensionality via PC2
X_pc2 = X_pca[:, [1]] @ pca.components_[[1], :] + mu | Does PCA preserve linear separability for every linearly separable set?
No, reducing dimensionality with PCA will only maximize variance, which may or may not translate to linear separability.
Here are two visualizations of variance and separability in opposition. In both |
20,774 | Does PCA preserve linear separability for every linearly separable set? | No. PCA targets different target than Linear discriminant analysis (LDA). Both of them actually provide linear transformation, but (rough an quick explanation follows):
PCA will set the direction of the first axis of the output space in the direction of the maximum variance of the input data (it does not know the concept of classes per se, all samples are treated equally)
LDA will set the direction of the first axis of the output space in the direction which has (roughly) the best ratio of inter-class variance vs intra-class variance. For that, it needs a concept of classes. | Does PCA preserve linear separability for every linearly separable set? | No. PCA targets different target than Linear discriminant analysis (LDA). Both of them actually provide linear transformation, but (rough an quick explanation follows):
PCA will set the direction of | Does PCA preserve linear separability for every linearly separable set?
No. PCA targets different target than Linear discriminant analysis (LDA). Both of them actually provide linear transformation, but (rough an quick explanation follows):
PCA will set the direction of the first axis of the output space in the direction of the maximum variance of the input data (it does not know the concept of classes per se, all samples are treated equally)
LDA will set the direction of the first axis of the output space in the direction which has (roughly) the best ratio of inter-class variance vs intra-class variance. For that, it needs a concept of classes. | Does PCA preserve linear separability for every linearly separable set?
No. PCA targets different target than Linear discriminant analysis (LDA). Both of them actually provide linear transformation, but (rough an quick explanation follows):
PCA will set the direction of |
20,775 | Stepwise logistic regression and sampling | If you're going to use a stepwise procedure, don't resample. Create one random subsample once and for all. Perform your analysis on it. Validate the results against the held-out data. It's likely most of the "significant" variables will turn out not to be significant.
(Edit 12/2015: You can indeed go beyond such a simple approach by resampling, repeating the stepwise procedure, and re-validating: this will lead you into a form of cross-validation. But in such a case more sophisticated methods of variable selection, such as ridge regression, the Lasso, and the Elastic Net are likely preferable to stepwise regression.)
Focus on the variables that make sense, not those that fit the data a little better. If you have more than a handful of variables for 330 records, you're at great risk of overfitting in the first place. Consider using fairly severe entering and leaving criteria for the stepwise regression. Base it on AIC or $C_p$ instead of thresholds for $F$ tests or $t$ tests.
(I presume you have already carried out the analysis and exploration to identify appropriate re-expressions of the independent variables, that you have identified likely interactions, and that you have established that there really is an approximately linear relationship between the logit of the dependent variable and the regressors. If not, do this essential preliminary work and only then return to the stepwise regression.)
Be cautious about following generic advice like I just gave, by the way :-). Your approach should depend on the purpose of the analysis (prediction? extrapolation? scientific understanding? decision making?) as well as the nature of the data, the number of variables, etc. | Stepwise logistic regression and sampling | If you're going to use a stepwise procedure, don't resample. Create one random subsample once and for all. Perform your analysis on it. Validate the results against the held-out data. It's likely | Stepwise logistic regression and sampling
If you're going to use a stepwise procedure, don't resample. Create one random subsample once and for all. Perform your analysis on it. Validate the results against the held-out data. It's likely most of the "significant" variables will turn out not to be significant.
(Edit 12/2015: You can indeed go beyond such a simple approach by resampling, repeating the stepwise procedure, and re-validating: this will lead you into a form of cross-validation. But in such a case more sophisticated methods of variable selection, such as ridge regression, the Lasso, and the Elastic Net are likely preferable to stepwise regression.)
Focus on the variables that make sense, not those that fit the data a little better. If you have more than a handful of variables for 330 records, you're at great risk of overfitting in the first place. Consider using fairly severe entering and leaving criteria for the stepwise regression. Base it on AIC or $C_p$ instead of thresholds for $F$ tests or $t$ tests.
(I presume you have already carried out the analysis and exploration to identify appropriate re-expressions of the independent variables, that you have identified likely interactions, and that you have established that there really is an approximately linear relationship between the logit of the dependent variable and the regressors. If not, do this essential preliminary work and only then return to the stepwise regression.)
Be cautious about following generic advice like I just gave, by the way :-). Your approach should depend on the purpose of the analysis (prediction? extrapolation? scientific understanding? decision making?) as well as the nature of the data, the number of variables, etc. | Stepwise logistic regression and sampling
If you're going to use a stepwise procedure, don't resample. Create one random subsample once and for all. Perform your analysis on it. Validate the results against the held-out data. It's likely |
20,776 | Stepwise logistic regression and sampling | An important question is "why do why do you want a model with as few variables a possible?". If you want to have as few variables as possible to minimize the cost of data collection for the operational use of your model, then the answers given by whuber and mbq are an excellent start.
If predictive performance is what is really important, then you are probably better off not doing any feature selection at all and use regularized logistic regression instead (c.f. ridge regression). In fact if predictive performance was what was of primary importance, I would use bagged regularized logistic regression as a sort of "belt-and-braces" strategy for avoiding over-fitting a small dataset. Millar in his book on subset selection in regression gives pretty much that advice in the appendix, and I have found it to be excellent advice for problems with lots of features and not very many observations.
If understanding the data is important, then there is no need for the model used to understand the data to be the same one used to make predictions. In that case, I would resample the data many times and look at the patterns of selected variables across samples to find which variables were informative (as mbq suggests, if feature selection is unstable, a single sample won't give the full picture), but I would still used the bagged regularized logistic regression model ensemble for predictions. | Stepwise logistic regression and sampling | An important question is "why do why do you want a model with as few variables a possible?". If you want to have as few variables as possible to minimize the cost of data collection for the operation | Stepwise logistic regression and sampling
An important question is "why do why do you want a model with as few variables a possible?". If you want to have as few variables as possible to minimize the cost of data collection for the operational use of your model, then the answers given by whuber and mbq are an excellent start.
If predictive performance is what is really important, then you are probably better off not doing any feature selection at all and use regularized logistic regression instead (c.f. ridge regression). In fact if predictive performance was what was of primary importance, I would use bagged regularized logistic regression as a sort of "belt-and-braces" strategy for avoiding over-fitting a small dataset. Millar in his book on subset selection in regression gives pretty much that advice in the appendix, and I have found it to be excellent advice for problems with lots of features and not very many observations.
If understanding the data is important, then there is no need for the model used to understand the data to be the same one used to make predictions. In that case, I would resample the data many times and look at the patterns of selected variables across samples to find which variables were informative (as mbq suggests, if feature selection is unstable, a single sample won't give the full picture), but I would still used the bagged regularized logistic regression model ensemble for predictions. | Stepwise logistic regression and sampling
An important question is "why do why do you want a model with as few variables a possible?". If you want to have as few variables as possible to minimize the cost of data collection for the operation |
20,777 | Stepwise logistic regression and sampling | In general, there are two problems of feature selection:
minimal optimal, where you seek for smallest set of variables that give you the smallest error
all relevant, where you seek for all variables relevant in a problem
The convergence of predictor selection is in a domain of the all relevant problem, which is hell hard and thus requires much more powerful tools than logistic regression, heavy computations and a very careful treatment.
But it seems you are doing the first problem, so you shouldn't worry about this. I can generally second whuber's answer, but I disagree with the claim that you should drop resampling -- here it won't be a method to stabilize feature selection, but nevertheless it will be a simulation for estimating performance of a coupled feature selection + training, so will give you an insight in confidence of your accuracy. | Stepwise logistic regression and sampling | In general, there are two problems of feature selection:
minimal optimal, where you seek for smallest set of variables that give you the smallest error
all relevant, where you seek for all variables | Stepwise logistic regression and sampling
In general, there are two problems of feature selection:
minimal optimal, where you seek for smallest set of variables that give you the smallest error
all relevant, where you seek for all variables relevant in a problem
The convergence of predictor selection is in a domain of the all relevant problem, which is hell hard and thus requires much more powerful tools than logistic regression, heavy computations and a very careful treatment.
But it seems you are doing the first problem, so you shouldn't worry about this. I can generally second whuber's answer, but I disagree with the claim that you should drop resampling -- here it won't be a method to stabilize feature selection, but nevertheless it will be a simulation for estimating performance of a coupled feature selection + training, so will give you an insight in confidence of your accuracy. | Stepwise logistic regression and sampling
In general, there are two problems of feature selection:
minimal optimal, where you seek for smallest set of variables that give you the smallest error
all relevant, where you seek for all variables |
20,778 | Stepwise logistic regression and sampling | You might glance at the paper Stability Selection by Meinshausen and Buhlmann in J R Statist. Soc B (2010) 72 Part 4, and the discussion after it. They consider what happens when you repeatedly divide your set of data points at random into two halves and look for features in each half. By assuming that what you see in a one half is independent of what you see in the matching other half you can prove bounds on the expected number of falsely selected variables. | Stepwise logistic regression and sampling | You might glance at the paper Stability Selection by Meinshausen and Buhlmann in J R Statist. Soc B (2010) 72 Part 4, and the discussion after it. They consider what happens when you repeatedly divide | Stepwise logistic regression and sampling
You might glance at the paper Stability Selection by Meinshausen and Buhlmann in J R Statist. Soc B (2010) 72 Part 4, and the discussion after it. They consider what happens when you repeatedly divide your set of data points at random into two halves and look for features in each half. By assuming that what you see in a one half is independent of what you see in the matching other half you can prove bounds on the expected number of falsely selected variables. | Stepwise logistic regression and sampling
You might glance at the paper Stability Selection by Meinshausen and Buhlmann in J R Statist. Soc B (2010) 72 Part 4, and the discussion after it. They consider what happens when you repeatedly divide |
20,779 | Stepwise logistic regression and sampling | Don't use stepwise! See my paper | Stepwise logistic regression and sampling | Don't use stepwise! See my paper | Stepwise logistic regression and sampling
Don't use stepwise! See my paper | Stepwise logistic regression and sampling
Don't use stepwise! See my paper |
20,780 | Does Correlation "Sometimes" Imply Causality? [duplicate] | I drew this slide a few years ago that might help
Most of the silly correlations from that website are chance. Statistics is reasonably good at describing what can happen by chance, at least if you specify in advance the correlation you are interested in. The correlation between doctors and life expectancy is fairly robustly not explainable by chance.
The other possibilities on the slide all show correlation that's causal in nature, but only one of them is a simple 'blue causes red'. If you find doctors are correlated with life expectancy it could be
that doctors are actually good for health
increased life expectancy causes an increase in doctors (maybe because old people need them more?)
both the life expectancy and the increase in doctors are caused by something else. For example, maybe rich countries have more doctors (because doctors are expensive) and have better sanitation and nutrition (because sanitation and good nutrition are expensive) and that's the explanation
selection: you've somehow chosen a sample without the low-doctor/good-health and high-doctor/poor-health countries (it's easier to get good examples of this for negative correlation)
Deciding how much of a correlation is due to causation in the way that you're interested in and how much is due to causation in annoying and unhelpful ways is hard. The goal of modern causal inference is at least to render the question precise enough that you can say what you'd need to assume and measure to answer it.
[Update: One other possibility that's not in the slide is that two things are correlated because they're actually one thing, like the radius and area of circles, but that doesn't apply to your question] | Does Correlation "Sometimes" Imply Causality? [duplicate] | I drew this slide a few years ago that might help
Most of the silly correlations from that website are chance. Statistics is reasonably good at describing what can happen by chance, at least if you | Does Correlation "Sometimes" Imply Causality? [duplicate]
I drew this slide a few years ago that might help
Most of the silly correlations from that website are chance. Statistics is reasonably good at describing what can happen by chance, at least if you specify in advance the correlation you are interested in. The correlation between doctors and life expectancy is fairly robustly not explainable by chance.
The other possibilities on the slide all show correlation that's causal in nature, but only one of them is a simple 'blue causes red'. If you find doctors are correlated with life expectancy it could be
that doctors are actually good for health
increased life expectancy causes an increase in doctors (maybe because old people need them more?)
both the life expectancy and the increase in doctors are caused by something else. For example, maybe rich countries have more doctors (because doctors are expensive) and have better sanitation and nutrition (because sanitation and good nutrition are expensive) and that's the explanation
selection: you've somehow chosen a sample without the low-doctor/good-health and high-doctor/poor-health countries (it's easier to get good examples of this for negative correlation)
Deciding how much of a correlation is due to causation in the way that you're interested in and how much is due to causation in annoying and unhelpful ways is hard. The goal of modern causal inference is at least to render the question precise enough that you can say what you'd need to assume and measure to answer it.
[Update: One other possibility that's not in the slide is that two things are correlated because they're actually one thing, like the radius and area of circles, but that doesn't apply to your question] | Does Correlation "Sometimes" Imply Causality? [duplicate]
I drew this slide a few years ago that might help
Most of the silly correlations from that website are chance. Statistics is reasonably good at describing what can happen by chance, at least if you |
20,781 | Does Correlation "Sometimes" Imply Causality? [duplicate] | The problem here is logical. Nobody can deny that causality can lead to correlation, and so there are instances in which you have causality and also correlation. The statement "correlation implies causality" however is a general logical statement; it means that you have causality whenever there is correlation, and the "whenever" doesn't make sense when discussing a single instance. So no, as long as counterexamples exist, correlation does not imply causality, and this statement is not contradicted by the existence of instances where you have both (or even where correlation can be legitimately taken to indicate the possibility of causality).
I add that one might think that even if there is no logical implication, there could be a strong probabilistic indication, i.e., when we see correlation, very often there is causation, and counterexamples are few and far between. This, however, can hardly be made precise (even before investigating this empirically, decisions would need to be made what to count, and it isn't at all obvious how to do that), and my impression is that there are for sure enough counterexamples and enough ways to explain how correlation arises without causation, that one should neither think that this "implication" holds "with high probability". | Does Correlation "Sometimes" Imply Causality? [duplicate] | The problem here is logical. Nobody can deny that causality can lead to correlation, and so there are instances in which you have causality and also correlation. The statement "correlation implies cau | Does Correlation "Sometimes" Imply Causality? [duplicate]
The problem here is logical. Nobody can deny that causality can lead to correlation, and so there are instances in which you have causality and also correlation. The statement "correlation implies causality" however is a general logical statement; it means that you have causality whenever there is correlation, and the "whenever" doesn't make sense when discussing a single instance. So no, as long as counterexamples exist, correlation does not imply causality, and this statement is not contradicted by the existence of instances where you have both (or even where correlation can be legitimately taken to indicate the possibility of causality).
I add that one might think that even if there is no logical implication, there could be a strong probabilistic indication, i.e., when we see correlation, very often there is causation, and counterexamples are few and far between. This, however, can hardly be made precise (even before investigating this empirically, decisions would need to be made what to count, and it isn't at all obvious how to do that), and my impression is that there are for sure enough counterexamples and enough ways to explain how correlation arises without causation, that one should neither think that this "implication" holds "with high probability". | Does Correlation "Sometimes" Imply Causality? [duplicate]
The problem here is logical. Nobody can deny that causality can lead to correlation, and so there are instances in which you have causality and also correlation. The statement "correlation implies cau |
20,782 | Does Correlation "Sometimes" Imply Causality? [duplicate] | To add to the excellent answers already given: the statement helps to create awareness of logical errors regarding correlation.
We all easily and intuitively accept there must be a relationship between causality and correlation. We feel that causality implies correlation. This is correct. Most people, including myself, have subsequent intuition that is logically flawed.
Personally, I have not succeeded in changing my intuition, which means that I constantly need to remind myself that I cannot reverse the argument, so I keep telling others but also mostly myself that correlation does not imply causality. Also, I need to remind myself that causality does not imply that I will be able to observe the correlation that I expected - for many reasons already mentioned in previous answers.
If it hasn’t settled in yet - the real problem is that our observations usually will only tell us if there is a correlation.
I therefore need to remind myself not to turn the argument on its head. I need to remind myself that observing a correlation when evaluating a hypothesis is much stronger than developing a hypothesis from an observed correlation. That does not mean I cannot use open observational studies to develop hypotheses (in fact, these studies can be very powerful for inspiration). it means that I need to test these developed hypotheses in carefully designed experiments, and that these experiments shall not use any of the previous observations that inspired the hypothesis. Most of the time, that implies a lot of work and therefore not a very appealing prospect.
I also need to remind myself to design my experiments such that I maximize the response to the supposed causal factor; or at least ensure that the response I expect is large enough to be observable.
When that goes wrong, it is where it becomes easy for me but maybe not for others: I’m an engineer, so in my application, there is no practical difference between an unmeasurable response vs. no response at all. That means I can abandon the experiments at this point. Whereas more Fundamental scientific work may run into the need to measure even the small causal responses, and/or find some other way to figure out if the supposed causality is or isn’t there. | Does Correlation "Sometimes" Imply Causality? [duplicate] | To add to the excellent answers already given: the statement helps to create awareness of logical errors regarding correlation.
We all easily and intuitively accept there must be a relationship betwee | Does Correlation "Sometimes" Imply Causality? [duplicate]
To add to the excellent answers already given: the statement helps to create awareness of logical errors regarding correlation.
We all easily and intuitively accept there must be a relationship between causality and correlation. We feel that causality implies correlation. This is correct. Most people, including myself, have subsequent intuition that is logically flawed.
Personally, I have not succeeded in changing my intuition, which means that I constantly need to remind myself that I cannot reverse the argument, so I keep telling others but also mostly myself that correlation does not imply causality. Also, I need to remind myself that causality does not imply that I will be able to observe the correlation that I expected - for many reasons already mentioned in previous answers.
If it hasn’t settled in yet - the real problem is that our observations usually will only tell us if there is a correlation.
I therefore need to remind myself not to turn the argument on its head. I need to remind myself that observing a correlation when evaluating a hypothesis is much stronger than developing a hypothesis from an observed correlation. That does not mean I cannot use open observational studies to develop hypotheses (in fact, these studies can be very powerful for inspiration). it means that I need to test these developed hypotheses in carefully designed experiments, and that these experiments shall not use any of the previous observations that inspired the hypothesis. Most of the time, that implies a lot of work and therefore not a very appealing prospect.
I also need to remind myself to design my experiments such that I maximize the response to the supposed causal factor; or at least ensure that the response I expect is large enough to be observable.
When that goes wrong, it is where it becomes easy for me but maybe not for others: I’m an engineer, so in my application, there is no practical difference between an unmeasurable response vs. no response at all. That means I can abandon the experiments at this point. Whereas more Fundamental scientific work may run into the need to measure even the small causal responses, and/or find some other way to figure out if the supposed causality is or isn’t there. | Does Correlation "Sometimes" Imply Causality? [duplicate]
To add to the excellent answers already given: the statement helps to create awareness of logical errors regarding correlation.
We all easily and intuitively accept there must be a relationship betwee |
20,783 | Does Correlation "Sometimes" Imply Causality? [duplicate] | Spurious relationship
"Correlation Does Not Imply Causality" This saying relates in particular to the idea that correlation between two variables does not imply a causal relationship between the two variables. It does not always mean that there is an absence of causality.
A typical example of the 'Correlation Does Not Imply Causality' is the presence of a confounding variable and is explained by the correlation between 'ice cream sales' and 'shark attacks'. The two are correlated, but the one does not cause the other. Yet, there are causal relationships present. Both are caused by hot weather which makes more people buy ice cream and more people go to the beach.
This is your situation with the map of GDP per Capita and Life expectancy. There is most likely some sort of causal relationship present in that situation. The problem is however that the correlation alone does not allow you to determine what type of causal relationship is present. The phrase "Correlation Does Not Imply Causality" or the term spurious relationship relates to the situation where somebody falsely/falliciously concludes that there is a particular causal relationship based on a correlation.
Spurious correlation
Your case of the relationship between scripps and spiders is of a more specific nature and sometimes referred to as spurious correlation (see Misunderstandings of "spurious correlation"?). It means that one falsely assumes that there is a statistical correlation where there is none.
Examples may occur when data are correlated (e.g. time series Why do these time series appear to be dependent?) or when people make multiple comparisons without correcting. | Does Correlation "Sometimes" Imply Causality? [duplicate] | Spurious relationship
"Correlation Does Not Imply Causality" This saying relates in particular to the idea that correlation between two variables does not imply a causal relationship between the two v | Does Correlation "Sometimes" Imply Causality? [duplicate]
Spurious relationship
"Correlation Does Not Imply Causality" This saying relates in particular to the idea that correlation between two variables does not imply a causal relationship between the two variables. It does not always mean that there is an absence of causality.
A typical example of the 'Correlation Does Not Imply Causality' is the presence of a confounding variable and is explained by the correlation between 'ice cream sales' and 'shark attacks'. The two are correlated, but the one does not cause the other. Yet, there are causal relationships present. Both are caused by hot weather which makes more people buy ice cream and more people go to the beach.
This is your situation with the map of GDP per Capita and Life expectancy. There is most likely some sort of causal relationship present in that situation. The problem is however that the correlation alone does not allow you to determine what type of causal relationship is present. The phrase "Correlation Does Not Imply Causality" or the term spurious relationship relates to the situation where somebody falsely/falliciously concludes that there is a particular causal relationship based on a correlation.
Spurious correlation
Your case of the relationship between scripps and spiders is of a more specific nature and sometimes referred to as spurious correlation (see Misunderstandings of "spurious correlation"?). It means that one falsely assumes that there is a statistical correlation where there is none.
Examples may occur when data are correlated (e.g. time series Why do these time series appear to be dependent?) or when people make multiple comparisons without correcting. | Does Correlation "Sometimes" Imply Causality? [duplicate]
Spurious relationship
"Correlation Does Not Imply Causality" This saying relates in particular to the idea that correlation between two variables does not imply a causal relationship between the two v |
20,784 | Does Correlation "Sometimes" Imply Causality? [duplicate] | I think there are possibly two related issues causing confusion.
First, "imply" means to "suggest." And correlation is a clue that 2 things might be causally related. It doesn't prove it, but it hints that a cause might be there. So the statement "Correlation Does Not Imply Causality" is frankly wrong. Correlation does imply ("suggest") possible causation. The statement should be "Correlation Does Not Prove Causality."
Comments from Michael MacAskill and V C pointed out that "imply" in this case refers to logical implication: if p then q. In that context, the statement is definitely not "frankly wrong." However, the meaning is still "Correlation Does Not Prove Causality."
Which brings up the 2nd issue. When learning the difference between correlation and causation, students may get the impression that they are opposites or mutually exclusive. They are not. Correlation certainly does not rule out causation. If confounding variables are eliminated, then all causally related data will be correlated (not necessarily in a linear fashion), but not all correlated data will be causally related:
This is just another example that correlation does suggest (imply) but not prove causation. Or to put it another way, lack of correlation does prove lack of causation. Correlation is necessary but not sufficient to prove causation. (As long as confounding variables are controlled for. I'm being idealistic here for teaching purposes. It may not always be practical to control for confounds. Even if A and B are causally related, a scatterplot of A and B may still appear random if other factors also affect A and/or B.) | Does Correlation "Sometimes" Imply Causality? [duplicate] | I think there are possibly two related issues causing confusion.
First, "imply" means to "suggest." And correlation is a clue that 2 things might be causally related. It doesn't prove it, but it hin | Does Correlation "Sometimes" Imply Causality? [duplicate]
I think there are possibly two related issues causing confusion.
First, "imply" means to "suggest." And correlation is a clue that 2 things might be causally related. It doesn't prove it, but it hints that a cause might be there. So the statement "Correlation Does Not Imply Causality" is frankly wrong. Correlation does imply ("suggest") possible causation. The statement should be "Correlation Does Not Prove Causality."
Comments from Michael MacAskill and V C pointed out that "imply" in this case refers to logical implication: if p then q. In that context, the statement is definitely not "frankly wrong." However, the meaning is still "Correlation Does Not Prove Causality."
Which brings up the 2nd issue. When learning the difference between correlation and causation, students may get the impression that they are opposites or mutually exclusive. They are not. Correlation certainly does not rule out causation. If confounding variables are eliminated, then all causally related data will be correlated (not necessarily in a linear fashion), but not all correlated data will be causally related:
This is just another example that correlation does suggest (imply) but not prove causation. Or to put it another way, lack of correlation does prove lack of causation. Correlation is necessary but not sufficient to prove causation. (As long as confounding variables are controlled for. I'm being idealistic here for teaching purposes. It may not always be practical to control for confounds. Even if A and B are causally related, a scatterplot of A and B may still appear random if other factors also affect A and/or B.) | Does Correlation "Sometimes" Imply Causality? [duplicate]
I think there are possibly two related issues causing confusion.
First, "imply" means to "suggest." And correlation is a clue that 2 things might be causally related. It doesn't prove it, but it hin |
20,785 | Is the difference between two ordinal variables ordinal? | Clearly not, in general. Take a 4-level pain scale for example (none, mild, moderate, severe). Going from moderate to severe pain may be far worse than going from mild to moderate pain. Yet they both have a difference of 1 if pain were coded 0,1,2,3.
Ordinal scale data need to be analyzed in a way that subtraction is not used. This is discussed further here. | Is the difference between two ordinal variables ordinal? | Clearly not, in general. Take a 4-level pain scale for example (none, mild, moderate, severe). Going from moderate to severe pain may be far worse than going from mild to moderate pain. Yet they bo | Is the difference between two ordinal variables ordinal?
Clearly not, in general. Take a 4-level pain scale for example (none, mild, moderate, severe). Going from moderate to severe pain may be far worse than going from mild to moderate pain. Yet they both have a difference of 1 if pain were coded 0,1,2,3.
Ordinal scale data need to be analyzed in a way that subtraction is not used. This is discussed further here. | Is the difference between two ordinal variables ordinal?
Clearly not, in general. Take a 4-level pain scale for example (none, mild, moderate, severe). Going from moderate to severe pain may be far worse than going from mild to moderate pain. Yet they bo |
20,786 | Is the difference between two ordinal variables ordinal? | If you are taking the difference of two ordinal responses, you are not treating the responses as ordinal, but instead treating them as if they were interval.
This isn't always appreciated.
One example is with the Wilcoxon signed rank test. the procedure begins by subtracting the paired response values, so isn't applicable for strictly ordinal data.
My understanding is that aligned ranks transformation anova procedure also begins by subtracting values.
I have seen people argue that data from scales created by summing several Likert-type items should be treated as ordinal. But I would argue that once you are summing values, you are already treating the responses from the Likert-type items as interval.
EDIT: Based on some discussion in the comments, here is an example of using ordinal regression with unstructured thresholds for cut points, with a repeated measures design. In R. (Can also be run at rdrr.io/snippets/.)
if(!require(ordinal)){install.packages("ordinal")}
if(!require(emmeans)){install.packages("emmeans")}
Respondent = factor(c(letters[1:12], letters[1:12]))
Time = factor(rep(c("Before", "After"), each=12),
levels=c("Before", "After"))
Score = as.factor(c(1,2,3,1,2,3,1,2,3,4,4,4,
2,2,2,3,3,3,2,3,4,4,5,5))
xtabs(~ Time + Score)
### Score
### Time 1 2 3 4 5
### Before 3 3 3 3 0
### After 0 4 4 2 2
library(ordinal)
model = clmm(Score ~ Time + (1|Respondent))
summary(model)
### Estimate Std. Error z value Pr(>|z|)
### TimeAfter 2.7262 0.9758 2.794 0.00521 **
library(emmeans)
joint_tests(model)
### model term df1 df2 F.ratio p.value
### Time 1 Inf 7.805 0.0052
wilcox.test(as.numeric(Score) ~ Time, paired=TRUE)
### Wilcoxon signed rank test with continuity correction
### V = 4.5, p-value = 0.02475 | Is the difference between two ordinal variables ordinal? | If you are taking the difference of two ordinal responses, you are not treating the responses as ordinal, but instead treating them as if they were interval.
This isn't always appreciated.
One example | Is the difference between two ordinal variables ordinal?
If you are taking the difference of two ordinal responses, you are not treating the responses as ordinal, but instead treating them as if they were interval.
This isn't always appreciated.
One example is with the Wilcoxon signed rank test. the procedure begins by subtracting the paired response values, so isn't applicable for strictly ordinal data.
My understanding is that aligned ranks transformation anova procedure also begins by subtracting values.
I have seen people argue that data from scales created by summing several Likert-type items should be treated as ordinal. But I would argue that once you are summing values, you are already treating the responses from the Likert-type items as interval.
EDIT: Based on some discussion in the comments, here is an example of using ordinal regression with unstructured thresholds for cut points, with a repeated measures design. In R. (Can also be run at rdrr.io/snippets/.)
if(!require(ordinal)){install.packages("ordinal")}
if(!require(emmeans)){install.packages("emmeans")}
Respondent = factor(c(letters[1:12], letters[1:12]))
Time = factor(rep(c("Before", "After"), each=12),
levels=c("Before", "After"))
Score = as.factor(c(1,2,3,1,2,3,1,2,3,4,4,4,
2,2,2,3,3,3,2,3,4,4,5,5))
xtabs(~ Time + Score)
### Score
### Time 1 2 3 4 5
### Before 3 3 3 3 0
### After 0 4 4 2 2
library(ordinal)
model = clmm(Score ~ Time + (1|Respondent))
summary(model)
### Estimate Std. Error z value Pr(>|z|)
### TimeAfter 2.7262 0.9758 2.794 0.00521 **
library(emmeans)
joint_tests(model)
### model term df1 df2 F.ratio p.value
### Time 1 Inf 7.805 0.0052
wilcox.test(as.numeric(Score) ~ Time, paired=TRUE)
### Wilcoxon signed rank test with continuity correction
### V = 4.5, p-value = 0.02475 | Is the difference between two ordinal variables ordinal?
If you are taking the difference of two ordinal responses, you are not treating the responses as ordinal, but instead treating them as if they were interval.
This isn't always appreciated.
One example |
20,787 | Is the difference between two ordinal variables ordinal? | The only mathematical relations that exists between ordinal data is "greater than", "less than", and "equal". Any other mathematical relation, such as addition, subtraction, multiplication, etc., marks the data as being treated as a more complex data type such as interval or ratio data.
I think this quote from Frank Harrell's answer bears addressing:
Take a 4-level pain scale for example (none, mild, moderate, severe). Going from moderate to severe pain may be far worse than going from mild to moderate pain. Yet they both have a difference of 1 if pain were coded 0,1,2,3.
In ordinal data, the "separation" between different values isn't merely "not necessarily constant", it's not defined. The levels are being treated as having no defined metric. The numbers are merely labels that have a particular order. You could just as easily call the pain levels "banana, orange, apple, pear", as long as it's understood that the labels have that order. Saying "pear minus apple might be larger than apple minus orange" is meaningless. From a CS perspective, the pain level are objects with the methods .lt(), .gt(), and .eq(), .repr()and nothing else. There is no .minus() or .plus() method. Pain level "0" is just an object whose .repr() value is "0". It has no other relation to 0. Is it not the int 0, and you can't apply int operations to it. | Is the difference between two ordinal variables ordinal? | The only mathematical relations that exists between ordinal data is "greater than", "less than", and "equal". Any other mathematical relation, such as addition, subtraction, multiplication, etc., mark | Is the difference between two ordinal variables ordinal?
The only mathematical relations that exists between ordinal data is "greater than", "less than", and "equal". Any other mathematical relation, such as addition, subtraction, multiplication, etc., marks the data as being treated as a more complex data type such as interval or ratio data.
I think this quote from Frank Harrell's answer bears addressing:
Take a 4-level pain scale for example (none, mild, moderate, severe). Going from moderate to severe pain may be far worse than going from mild to moderate pain. Yet they both have a difference of 1 if pain were coded 0,1,2,3.
In ordinal data, the "separation" between different values isn't merely "not necessarily constant", it's not defined. The levels are being treated as having no defined metric. The numbers are merely labels that have a particular order. You could just as easily call the pain levels "banana, orange, apple, pear", as long as it's understood that the labels have that order. Saying "pear minus apple might be larger than apple minus orange" is meaningless. From a CS perspective, the pain level are objects with the methods .lt(), .gt(), and .eq(), .repr()and nothing else. There is no .minus() or .plus() method. Pain level "0" is just an object whose .repr() value is "0". It has no other relation to 0. Is it not the int 0, and you can't apply int operations to it. | Is the difference between two ordinal variables ordinal?
The only mathematical relations that exists between ordinal data is "greater than", "less than", and "equal". Any other mathematical relation, such as addition, subtraction, multiplication, etc., mark |
20,788 | Is the difference between two ordinal variables ordinal? | Ordinal variables are often not even numeric - the difference between ordinal variables isn't even a defined operation, much less an ordinal variable itself.
Consider three hot sauces, mild, spicy, and extra hot. How do you define (spicy - mild) or (extra hot - spicy)? There is no rationale in mapping these ordinal values to numbers and treating them as numeric variables.
If you had a rationale for claiming that the difference between mild and spicy is smaller than the difference between spicy and extra hot, you are now quantifying the differences between levels in a way that defies the definition of an ordinal variable, which indicates that you can only rank the levels but not comment on the "distance" between them. If you can quantify the size of the difference between levels, it's not an ordinal variable in the first place. | Is the difference between two ordinal variables ordinal? | Ordinal variables are often not even numeric - the difference between ordinal variables isn't even a defined operation, much less an ordinal variable itself.
Consider three hot sauces, mild, spicy, an | Is the difference between two ordinal variables ordinal?
Ordinal variables are often not even numeric - the difference between ordinal variables isn't even a defined operation, much less an ordinal variable itself.
Consider three hot sauces, mild, spicy, and extra hot. How do you define (spicy - mild) or (extra hot - spicy)? There is no rationale in mapping these ordinal values to numbers and treating them as numeric variables.
If you had a rationale for claiming that the difference between mild and spicy is smaller than the difference between spicy and extra hot, you are now quantifying the differences between levels in a way that defies the definition of an ordinal variable, which indicates that you can only rank the levels but not comment on the "distance" between them. If you can quantify the size of the difference between levels, it's not an ordinal variable in the first place. | Is the difference between two ordinal variables ordinal?
Ordinal variables are often not even numeric - the difference between ordinal variables isn't even a defined operation, much less an ordinal variable itself.
Consider three hot sauces, mild, spicy, an |
20,789 | An example of a consistent and biased estimator? | The simplest example I can think of is the sample variance that comes intuitively to most of us, namely the sum of squared deviations divided by $n$ instead of $n-1$:
$$S_n^2 = \frac{1}{n} \sum_{i=1}^n \left(X_i-\bar{X} \right)^2$$
It is easy to show that $E\left(S_n^2 \right)=\frac{n-1}{n} \sigma^2$ and so the estimator is biased. But assuming finite variance $\sigma^2$, observe that the bias goes to zero as $n \to \infty$ because
$$E\left(S_n^2 \right)-\sigma^2 = -\frac{1}{n}\sigma^2 $$
It can also be shown that the variance of the estimator tends to zero and so the estimator converges in mean-square. Hence, it is also convergent in probability. | An example of a consistent and biased estimator? | The simplest example I can think of is the sample variance that comes intuitively to most of us, namely the sum of squared deviations divided by $n$ instead of $n-1$:
$$S_n^2 = \frac{1}{n} \sum_{i=1}^ | An example of a consistent and biased estimator?
The simplest example I can think of is the sample variance that comes intuitively to most of us, namely the sum of squared deviations divided by $n$ instead of $n-1$:
$$S_n^2 = \frac{1}{n} \sum_{i=1}^n \left(X_i-\bar{X} \right)^2$$
It is easy to show that $E\left(S_n^2 \right)=\frac{n-1}{n} \sigma^2$ and so the estimator is biased. But assuming finite variance $\sigma^2$, observe that the bias goes to zero as $n \to \infty$ because
$$E\left(S_n^2 \right)-\sigma^2 = -\frac{1}{n}\sigma^2 $$
It can also be shown that the variance of the estimator tends to zero and so the estimator converges in mean-square. Hence, it is also convergent in probability. | An example of a consistent and biased estimator?
The simplest example I can think of is the sample variance that comes intuitively to most of us, namely the sum of squared deviations divided by $n$ instead of $n-1$:
$$S_n^2 = \frac{1}{n} \sum_{i=1}^ |
20,790 | An example of a consistent and biased estimator? | A simple example would be estimating the parameter $\theta > 0$ given $n$ i.i.d. observations $y_i \sim \text{Uniform}\left[0, \,\theta\right]$.
Let $\hat{\theta}_n = \max\left\{y_1, \ldots, y_n\right\}$. For any finite $n$ we have $\mathbb{E}\left[\theta_n\right] < \theta$ (so the estimator is biased), but in the limit it will equal $\theta$ with probability one (so it is consistent). | An example of a consistent and biased estimator? | A simple example would be estimating the parameter $\theta > 0$ given $n$ i.i.d. observations $y_i \sim \text{Uniform}\left[0, \,\theta\right]$.
Let $\hat{\theta}_n = \max\left\{y_1, \ldots, y_n\right | An example of a consistent and biased estimator?
A simple example would be estimating the parameter $\theta > 0$ given $n$ i.i.d. observations $y_i \sim \text{Uniform}\left[0, \,\theta\right]$.
Let $\hat{\theta}_n = \max\left\{y_1, \ldots, y_n\right\}$. For any finite $n$ we have $\mathbb{E}\left[\theta_n\right] < \theta$ (so the estimator is biased), but in the limit it will equal $\theta$ with probability one (so it is consistent). | An example of a consistent and biased estimator?
A simple example would be estimating the parameter $\theta > 0$ given $n$ i.i.d. observations $y_i \sim \text{Uniform}\left[0, \,\theta\right]$.
Let $\hat{\theta}_n = \max\left\{y_1, \ldots, y_n\right |
20,791 | An example of a consistent and biased estimator? | Consider any unbiased and consistent estimator $T_n$ and a sequence $\alpha_n$ converging to 1 ($\alpha_n$ need not to be random) and form $\alpha_nT_n$. It is biased, but consistent since $\alpha_n$ converges to 1.
From wikipedia:
Loosely speaking, an estimator $T_n$ of parameter $\theta$ is said to be consistent, if it converges in probability to the true value of the parameter:
$$\underset{n\to\infty}{\operatorname{plim}}\;T_n = \theta.$$
Now recall that the bias of an estimator is defined as:
$$\operatorname{Bias}_\theta[\,\hat\theta\,] = \operatorname{E}_\theta[\,\hat{\theta}\,]-\theta $$
The bias is indeed non zero, and the convergence in probability remains true. | An example of a consistent and biased estimator? | Consider any unbiased and consistent estimator $T_n$ and a sequence $\alpha_n$ converging to 1 ($\alpha_n$ need not to be random) and form $\alpha_nT_n$. It is biased, but consistent since $\alpha_n$ | An example of a consistent and biased estimator?
Consider any unbiased and consistent estimator $T_n$ and a sequence $\alpha_n$ converging to 1 ($\alpha_n$ need not to be random) and form $\alpha_nT_n$. It is biased, but consistent since $\alpha_n$ converges to 1.
From wikipedia:
Loosely speaking, an estimator $T_n$ of parameter $\theta$ is said to be consistent, if it converges in probability to the true value of the parameter:
$$\underset{n\to\infty}{\operatorname{plim}}\;T_n = \theta.$$
Now recall that the bias of an estimator is defined as:
$$\operatorname{Bias}_\theta[\,\hat\theta\,] = \operatorname{E}_\theta[\,\hat{\theta}\,]-\theta $$
The bias is indeed non zero, and the convergence in probability remains true. | An example of a consistent and biased estimator?
Consider any unbiased and consistent estimator $T_n$ and a sequence $\alpha_n$ converging to 1 ($\alpha_n$ need not to be random) and form $\alpha_nT_n$. It is biased, but consistent since $\alpha_n$ |
20,792 | An example of a consistent and biased estimator? | In a time series setting with a lagged dependent variable included as a regressor, the OLS estimator will be consistent but biased. The reason for this is that in order to show unbiasedness of the OLS estimator we need strict exogeneity, $E\left[\varepsilon_{t}\left|x_{1},\, x_{2,},\,\ldots,\, x_{T}\right.\right]
$, i.e. that the error term, $\varepsilon_{t}
$, in period $t
$ is uncorrelated with all the regressors in all time periods. However, in order to show consistency of the OLS estimator we only need contemporanous exogeneity, $E\left[\varepsilon_{t}\left|x_{t}\right.\right]
$, i.e. that the error term, $\varepsilon_{t}
$, in period $t
$ is uncorrelated with the regressors, $x_{t}
$ in period $t
$. Consider the AR(1) model: $y_{t}=\rho y_{t-1}+\varepsilon_{t},\;\varepsilon_{t}\sim N\left(0,\:\sigma_{\varepsilon}^{2}\right)$
with $x_{t}=y_{t-1}
$ from now on.
First I show that strict exogeneity does not hold in a model with a lagged dependent variable included as a regressor. Let's look at the correlation between $\varepsilon_{t}
$ and $x_{t+1}=y_{t}
$ $$E\left[\varepsilon_{t}x_{t+1}\right]=E\left[\varepsilon_{t}y_{t}\right]=E\left[\varepsilon_{t}\left(\rho y_{t-1}+\varepsilon_{t}\right)\right]
$$
$$=\rho E\left(\varepsilon_{t}y_{t-1}\right)+E\left(\varepsilon_{t}^{2}\right)
$$
$$=E\left(\varepsilon_{t}^{2}\right)=\sigma_{\varepsilon}^{2}>0
\ (Eq. (1)).$$
If we assume sequential exogeneity, $E\left[\varepsilon_{t}\mid y_{1},\: y_{2},\:\ldots\ldots,y_{t-1}\right]=0
$, i.e. that the error term, $\varepsilon_{t}
$, in period $t
$ is uncorrelated with all the regressors in previous time periods and the current then the first term above, $\rho E\left(\varepsilon_{t}y_{t-1}\right)
$, will dissapear. What is clear from above is that unless we have strict exogeneity the expectation $E\left[\varepsilon_{t}x_{t+1}\right]=E\left[\varepsilon_{t}y_{t}\right]\neq0
$. However, it should be clear that contemporaneous exogeneity, $E\left[\varepsilon_{t}\left|x_{t}\right.\right]
$, does hold.
Now let's look at the bias of the OLS estimator when estimating the AR(1) model specified above. The OLS estimator of $\rho
$, $\hat{\rho}
$ is given as:
$$\hat{\rho}=\frac{\frac{1}{T}\sum_{t=1}^{T}y_{t}y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\frac{\frac{1}{T}\sum_{t=1}^{T}\left(\rho y_{t-1}+\varepsilon_{t}\right)y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}\varepsilon_{t}y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}
\ (Eq. (2))$$
Then take conditional expectation on all previous, contemporaneous and future values, $E\left[\varepsilon_{t}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]
$, of $Eq. (2)$:
$$E\left[\hat{\rho}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]=\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}\left[\varepsilon_{t}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}
$$
However, we know from $Eq. (1)$ that $E\left[\varepsilon_{t}y_{t}\right]=E\left(\varepsilon_{t}^{2}\right)
$ such that $\left[\varepsilon_{t}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]\neq0
$ meaning that $\frac{\frac{1}{T}\sum_{t=1}^{T}\left[\varepsilon_{t}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}\neq0
$ and hence $E\left[\hat{\rho}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]\neq\rho
$ but is biased: $E\left[\hat{\rho}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]=\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}\left[\varepsilon_{t}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}E\left(\varepsilon_{t}^{2}\right)y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=$$\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}\sigma_{\varepsilon}^{2}y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}
$.
All I assume to show consistency of the OLS estimator in the AR(1) model is contemporanous exogeneity, $E\left[\varepsilon_{t}\left|x_{t}\right.\right]=E\left[\varepsilon_{t}\left|y_{t-1}\right.\right]=0
$ which leads to the moment condition, $E\left[\varepsilon_{t}x_{t}\right]=0
$ with $x_{t}=y_{t-1}
$. As before, we have that the OLS estimator of $\rho
$, $\hat{\rho}
$ is given as: $$\hat{\rho}=\frac{\frac{1}{T}\sum_{t=1}^{T}y_{t}y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\frac{\frac{1}{T}\sum_{t=1}^{T}\left(\rho y_{t-1}+\varepsilon_{t}\right)y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}\varepsilon_{t}y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}
$$
Now assume that $plim\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}=\sigma_{y}^{2}
$ and $\sigma_{y}^{2}
$ is positive and finite, $0<\sigma_{y}^{2}<\infty
$.
Then, as $T\rightarrow\infty
$ and as long as a law of large numbers (LLN) applies we have that $p\lim\frac{1}{T}\sum_{t=1}^{T}\varepsilon_{t}y_{t-1}=E\left[\varepsilon_{t}y_{t-1}\right]=0
$. Using this result we have: $$\underset{T\rightarrow\infty}{p\lim\hat{\rho}}=\rho+\frac{p\lim\frac{1}{T}\sum_{t=1}^{T}\varepsilon_{t}y_{t-1}}{p\lim\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\rho+\frac{0}{\sigma_{y}^{2}}=\rho
$$
Thereby it has been shown that the OLS estimator of $p
$, $\hat{\rho}
$ in the AR(1) model is biased but consistent. Note that this result holds for all regressions where the lagged dependent variable is included as a regressor. | An example of a consistent and biased estimator? | In a time series setting with a lagged dependent variable included as a regressor, the OLS estimator will be consistent but biased. The reason for this is that in order to show unbiasedness of the OLS | An example of a consistent and biased estimator?
In a time series setting with a lagged dependent variable included as a regressor, the OLS estimator will be consistent but biased. The reason for this is that in order to show unbiasedness of the OLS estimator we need strict exogeneity, $E\left[\varepsilon_{t}\left|x_{1},\, x_{2,},\,\ldots,\, x_{T}\right.\right]
$, i.e. that the error term, $\varepsilon_{t}
$, in period $t
$ is uncorrelated with all the regressors in all time periods. However, in order to show consistency of the OLS estimator we only need contemporanous exogeneity, $E\left[\varepsilon_{t}\left|x_{t}\right.\right]
$, i.e. that the error term, $\varepsilon_{t}
$, in period $t
$ is uncorrelated with the regressors, $x_{t}
$ in period $t
$. Consider the AR(1) model: $y_{t}=\rho y_{t-1}+\varepsilon_{t},\;\varepsilon_{t}\sim N\left(0,\:\sigma_{\varepsilon}^{2}\right)$
with $x_{t}=y_{t-1}
$ from now on.
First I show that strict exogeneity does not hold in a model with a lagged dependent variable included as a regressor. Let's look at the correlation between $\varepsilon_{t}
$ and $x_{t+1}=y_{t}
$ $$E\left[\varepsilon_{t}x_{t+1}\right]=E\left[\varepsilon_{t}y_{t}\right]=E\left[\varepsilon_{t}\left(\rho y_{t-1}+\varepsilon_{t}\right)\right]
$$
$$=\rho E\left(\varepsilon_{t}y_{t-1}\right)+E\left(\varepsilon_{t}^{2}\right)
$$
$$=E\left(\varepsilon_{t}^{2}\right)=\sigma_{\varepsilon}^{2}>0
\ (Eq. (1)).$$
If we assume sequential exogeneity, $E\left[\varepsilon_{t}\mid y_{1},\: y_{2},\:\ldots\ldots,y_{t-1}\right]=0
$, i.e. that the error term, $\varepsilon_{t}
$, in period $t
$ is uncorrelated with all the regressors in previous time periods and the current then the first term above, $\rho E\left(\varepsilon_{t}y_{t-1}\right)
$, will dissapear. What is clear from above is that unless we have strict exogeneity the expectation $E\left[\varepsilon_{t}x_{t+1}\right]=E\left[\varepsilon_{t}y_{t}\right]\neq0
$. However, it should be clear that contemporaneous exogeneity, $E\left[\varepsilon_{t}\left|x_{t}\right.\right]
$, does hold.
Now let's look at the bias of the OLS estimator when estimating the AR(1) model specified above. The OLS estimator of $\rho
$, $\hat{\rho}
$ is given as:
$$\hat{\rho}=\frac{\frac{1}{T}\sum_{t=1}^{T}y_{t}y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\frac{\frac{1}{T}\sum_{t=1}^{T}\left(\rho y_{t-1}+\varepsilon_{t}\right)y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}\varepsilon_{t}y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}
\ (Eq. (2))$$
Then take conditional expectation on all previous, contemporaneous and future values, $E\left[\varepsilon_{t}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]
$, of $Eq. (2)$:
$$E\left[\hat{\rho}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]=\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}\left[\varepsilon_{t}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}
$$
However, we know from $Eq. (1)$ that $E\left[\varepsilon_{t}y_{t}\right]=E\left(\varepsilon_{t}^{2}\right)
$ such that $\left[\varepsilon_{t}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]\neq0
$ meaning that $\frac{\frac{1}{T}\sum_{t=1}^{T}\left[\varepsilon_{t}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}\neq0
$ and hence $E\left[\hat{\rho}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]\neq\rho
$ but is biased: $E\left[\hat{\rho}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]=\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}\left[\varepsilon_{t}\left|y_{1},\, y_{2,},\,\ldots,\, y_{T-1}\right.\right]y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}E\left(\varepsilon_{t}^{2}\right)y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=$$\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}\sigma_{\varepsilon}^{2}y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}
$.
All I assume to show consistency of the OLS estimator in the AR(1) model is contemporanous exogeneity, $E\left[\varepsilon_{t}\left|x_{t}\right.\right]=E\left[\varepsilon_{t}\left|y_{t-1}\right.\right]=0
$ which leads to the moment condition, $E\left[\varepsilon_{t}x_{t}\right]=0
$ with $x_{t}=y_{t-1}
$. As before, we have that the OLS estimator of $\rho
$, $\hat{\rho}
$ is given as: $$\hat{\rho}=\frac{\frac{1}{T}\sum_{t=1}^{T}y_{t}y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\frac{\frac{1}{T}\sum_{t=1}^{T}\left(\rho y_{t-1}+\varepsilon_{t}\right)y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\rho+\frac{\frac{1}{T}\sum_{t=1}^{T}\varepsilon_{t}y_{t-1}}{\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}
$$
Now assume that $plim\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}=\sigma_{y}^{2}
$ and $\sigma_{y}^{2}
$ is positive and finite, $0<\sigma_{y}^{2}<\infty
$.
Then, as $T\rightarrow\infty
$ and as long as a law of large numbers (LLN) applies we have that $p\lim\frac{1}{T}\sum_{t=1}^{T}\varepsilon_{t}y_{t-1}=E\left[\varepsilon_{t}y_{t-1}\right]=0
$. Using this result we have: $$\underset{T\rightarrow\infty}{p\lim\hat{\rho}}=\rho+\frac{p\lim\frac{1}{T}\sum_{t=1}^{T}\varepsilon_{t}y_{t-1}}{p\lim\frac{1}{T}\sum_{t=1}^{T}y_{t}^{2}}=\rho+\frac{0}{\sigma_{y}^{2}}=\rho
$$
Thereby it has been shown that the OLS estimator of $p
$, $\hat{\rho}
$ in the AR(1) model is biased but consistent. Note that this result holds for all regressions where the lagged dependent variable is included as a regressor. | An example of a consistent and biased estimator?
In a time series setting with a lagged dependent variable included as a regressor, the OLS estimator will be consistent but biased. The reason for this is that in order to show unbiasedness of the OLS |
20,793 | What programming language do you recommend to prototype a machine learning problem? | If you want to use something out of box, Weka could be a great starting point. There is no need to program anything. You import your data, visualize it and play around with different models.
Next up in chain would be R. There is some learning curve associated - especially with munging your data to fit into R data structures but once you get over that, you have tons of libraries which offer all the machine learning capabilities without much effort.
Next up would be hand programming the machine learning algorithms. Since you are already using Octave and looking for alternatives, maybe what you want is not to hand code algorithms in some other system but to just use the libraries written by other people.
If you go down the R path, you might find book by Luis Torgo (Data Mining with R: Learning with Case Studies) very useful (disclosure: no affiliation). It describes in depth case studies which you can adapt to your problem. | What programming language do you recommend to prototype a machine learning problem? | If you want to use something out of box, Weka could be a great starting point. There is no need to program anything. You import your data, visualize it and play around with different models.
Next up i | What programming language do you recommend to prototype a machine learning problem?
If you want to use something out of box, Weka could be a great starting point. There is no need to program anything. You import your data, visualize it and play around with different models.
Next up in chain would be R. There is some learning curve associated - especially with munging your data to fit into R data structures but once you get over that, you have tons of libraries which offer all the machine learning capabilities without much effort.
Next up would be hand programming the machine learning algorithms. Since you are already using Octave and looking for alternatives, maybe what you want is not to hand code algorithms in some other system but to just use the libraries written by other people.
If you go down the R path, you might find book by Luis Torgo (Data Mining with R: Learning with Case Studies) very useful (disclosure: no affiliation). It describes in depth case studies which you can adapt to your problem. | What programming language do you recommend to prototype a machine learning problem?
If you want to use something out of box, Weka could be a great starting point. There is no need to program anything. You import your data, visualize it and play around with different models.
Next up i |
20,794 | What programming language do you recommend to prototype a machine learning problem? | You might get better answers if you specify the specific algorithms you're interested in. I use R for this sort of thing (I do time series econometrics, though, not machine learning); you can see the existing functionality here:
http://cran.r-project.org/web/views/MachineLearning.html
and there is R code to implement the analysis in Hastie, Tibshirani and Friedman's Elements of statistical learning:
http://www-stat.stanford.edu/~tibs/ElemStatLearn/
R's packaging system is pretty great and nudges people towards documenting their code, and it's open source so you can always go look at the implementation. I haven't used Matlab in a few years and didn't use it for much machine learning -- their toolboxes are usually well documented but can be pricey, but user-contributed code is going to be as poorly documented as any other. | What programming language do you recommend to prototype a machine learning problem? | You might get better answers if you specify the specific algorithms you're interested in. I use R for this sort of thing (I do time series econometrics, though, not machine learning); you can see the | What programming language do you recommend to prototype a machine learning problem?
You might get better answers if you specify the specific algorithms you're interested in. I use R for this sort of thing (I do time series econometrics, though, not machine learning); you can see the existing functionality here:
http://cran.r-project.org/web/views/MachineLearning.html
and there is R code to implement the analysis in Hastie, Tibshirani and Friedman's Elements of statistical learning:
http://www-stat.stanford.edu/~tibs/ElemStatLearn/
R's packaging system is pretty great and nudges people towards documenting their code, and it's open source so you can always go look at the implementation. I haven't used Matlab in a few years and didn't use it for much machine learning -- their toolboxes are usually well documented but can be pricey, but user-contributed code is going to be as poorly documented as any other. | What programming language do you recommend to prototype a machine learning problem?
You might get better answers if you specify the specific algorithms you're interested in. I use R for this sort of thing (I do time series econometrics, though, not machine learning); you can see the |
20,795 | What programming language do you recommend to prototype a machine learning problem? | In his machine learning online course, Andrew Ng suggests using Octave/Matlab.
I recommend you enroll in the next edition of this course: it is really useful and you will learn many things about Octave and about the different machine learning algorithms.
EDIT 1: I agree with other people who prefer to work in R. However, in solving the problems of machine learning, most of your calculations will be in matrix form, and as pointed out by @Wayne, Matlab or Octave languages are very popular because of their power.
You may want to have a look at the solutions to machine learning course exercises proposed by other students; surely you can learn some things from them:
Gkokaisel Github
Merwan Github | What programming language do you recommend to prototype a machine learning problem? | In his machine learning online course, Andrew Ng suggests using Octave/Matlab.
I recommend you enroll in the next edition of this course: it is really useful and you will learn many things about Octav | What programming language do you recommend to prototype a machine learning problem?
In his machine learning online course, Andrew Ng suggests using Octave/Matlab.
I recommend you enroll in the next edition of this course: it is really useful and you will learn many things about Octave and about the different machine learning algorithms.
EDIT 1: I agree with other people who prefer to work in R. However, in solving the problems of machine learning, most of your calculations will be in matrix form, and as pointed out by @Wayne, Matlab or Octave languages are very popular because of their power.
You may want to have a look at the solutions to machine learning course exercises proposed by other students; surely you can learn some things from them:
Gkokaisel Github
Merwan Github | What programming language do you recommend to prototype a machine learning problem?
In his machine learning online course, Andrew Ng suggests using Octave/Matlab.
I recommend you enroll in the next edition of this course: it is really useful and you will learn many things about Octav |
20,796 | What programming language do you recommend to prototype a machine learning problem? | The scikit-learn (now sklearn) should meet several of the criteria you described (speed, well-designed classes for handling data, models, and results), including targeted applications (L1/L2 penalized regression, SVM, etc.). It comes with a rich documentation set and a lot of examples. See also its description in a paper published in the JMLR.
An alternative framework in Python is Orange, which can be used through a gentle GUI or on the command line directly. For collaborative filtering, pyrsvd might be interesting but I've never tried it. However, Apache Mahout might certainly be used for collaborative filtering. | What programming language do you recommend to prototype a machine learning problem? | The scikit-learn (now sklearn) should meet several of the criteria you described (speed, well-designed classes for handling data, models, and results), including targeted applications (L1/L2 penalized | What programming language do you recommend to prototype a machine learning problem?
The scikit-learn (now sklearn) should meet several of the criteria you described (speed, well-designed classes for handling data, models, and results), including targeted applications (L1/L2 penalized regression, SVM, etc.). It comes with a rich documentation set and a lot of examples. See also its description in a paper published in the JMLR.
An alternative framework in Python is Orange, which can be used through a gentle GUI or on the command line directly. For collaborative filtering, pyrsvd might be interesting but I've never tried it. However, Apache Mahout might certainly be used for collaborative filtering. | What programming language do you recommend to prototype a machine learning problem?
The scikit-learn (now sklearn) should meet several of the criteria you described (speed, well-designed classes for handling data, models, and results), including targeted applications (L1/L2 penalized |
20,797 | What programming language do you recommend to prototype a machine learning problem? | If you refer to an industrial prototype (i.e. something that is done to be used by real people and not for pure research) python is at the moment the only way to go.
If you use Matlab, Octave or R you get an easy to use environment for ML research but it will be a nightmare to put the model at work with an user interface or with a web service.
In python we are lucky to have both an extensive scientific ecosystem (sklearn for ML, pandas for data wragling, matplotlib/seaborn for visualization) and an application ecosystem (think about django and its rest framework).
Python it's an easy language to learn.
In the future I hope the Javascript ecosystem will become scientifically sound as the python one, but despite some great projects I don't see that coming soon.
Don't wrap yourself in a box, use a general language! | What programming language do you recommend to prototype a machine learning problem? | If you refer to an industrial prototype (i.e. something that is done to be used by real people and not for pure research) python is at the moment the only way to go.
If you use Matlab, Octave or R you | What programming language do you recommend to prototype a machine learning problem?
If you refer to an industrial prototype (i.e. something that is done to be used by real people and not for pure research) python is at the moment the only way to go.
If you use Matlab, Octave or R you get an easy to use environment for ML research but it will be a nightmare to put the model at work with an user interface or with a web service.
In python we are lucky to have both an extensive scientific ecosystem (sklearn for ML, pandas for data wragling, matplotlib/seaborn for visualization) and an application ecosystem (think about django and its rest framework).
Python it's an easy language to learn.
In the future I hope the Javascript ecosystem will become scientifically sound as the python one, but despite some great projects I don't see that coming soon.
Don't wrap yourself in a box, use a general language! | What programming language do you recommend to prototype a machine learning problem?
If you refer to an industrial prototype (i.e. something that is done to be used by real people and not for pure research) python is at the moment the only way to go.
If you use Matlab, Octave or R you |
20,798 | How to stop excel from changing a range when you drag a formula down? [closed] | A '$' will lock down the reference to an absolute one versus a relative one. You can lock down the column, row or both. Here is a locked down absolute reference for your example.
(A1-MIN($A$1:$A$30))/(MAX($A$1:$A$30)-MIN($A$1:$A$30)) | How to stop excel from changing a range when you drag a formula down? [closed] | A '$' will lock down the reference to an absolute one versus a relative one. You can lock down the column, row or both. Here is a locked down absolute reference for your example.
(A1-MIN($A$1:$A$30))/ | How to stop excel from changing a range when you drag a formula down? [closed]
A '$' will lock down the reference to an absolute one versus a relative one. You can lock down the column, row or both. Here is a locked down absolute reference for your example.
(A1-MIN($A$1:$A$30))/(MAX($A$1:$A$30)-MIN($A$1:$A$30)) | How to stop excel from changing a range when you drag a formula down? [closed]
A '$' will lock down the reference to an absolute one versus a relative one. You can lock down the column, row or both. Here is a locked down absolute reference for your example.
(A1-MIN($A$1:$A$30))/ |
20,799 | Will two distributions with identical 5-number summaries always have the same shape? | Just because the five-number summary is identical doesn't mean that the distribution is identical. This tells you just how much information is lost when we present data graphically in a box plot!
Perhaps the easiest way to see the problem is that the five number summary tells you nothing about the distribution of the values between the minimum and lower quartile, or between the lower quartile and the median, and so on. You know that the frequency between minimum and lower quartile must match the frequency between lower quartile and median (with the obvious exceptions, e.g. if we have data lying on a quartile, or worse, if two quartiles are tied) but don't know to which values of the variable those frequencies are allocated. We can have a situation like this:
These two distributions have the same five-number summary, so their box plots are identical, but I have chosen $X$ to have a uniform distribution between each quartile whereas $Y$ has a distribution with low frequencies close to the quartiles and high frequencies in the middle of two quartiles. Effectively the distribution of $Y$ has been formed by taking the distribution of $X$ and moving most of the data that is close to a quartile further away from it; my R code actually performs this in reverse, starting with the irregular distribution of $Y$ and levelling out the frequencies by reallocating data from the peaks to fill in the troughs.
EDIT: As @Glen_b says, this becomes even more obvious when you look at the cumulative distributions. I've added gridlines to show the location of the quartiles, which are the same for the two distributions so their empirical CDFs intersect.
R code
yfreq <- 2*rep(c(1:10, 10:1), times=4)
xfreq <- rep(mean(yfreq), times=length(yfreq))
x <- rep(1:length(xfreq), times=xfreq)
y <- rep(1:length(yfreq), times=yfreq)
ecdfX <- ecdf(x)
ecdfY <- ecdf(y)
plot(ecdfX, verticals=TRUE, do.points=FALSE, col="blue", lwd=2, yaxt="n",
main="Empirical CDFs", xlab="", ylab="Relative cumulative frequency")
plot(ecdfY, verticals=TRUE, do.points=FALSE, add=TRUE, col="black",
yaxt="n", lwd=2)
axis(side=2, at=seq(0, 1, by=0.1), las=2)
abline(h=c(0.25,0.5,0.75,1), col="lightgrey", lty="dashed")
abline(v=summary(x), col="lightgrey", lty="dashed")
legend("right", c("x", "y"), col = c("blue", "black"),
lty = "solid", lwd=2, bty="n")
par(mfrow=c(2,2))
hist(x, col="steelblue", breaks=((0:81)-0.5), ylim=c(0,25))
hist(y, col="grey", breaks=((0:81)-0.5), ylim=c(0,25))
boxplot(x, col="steelblue", main="Boxplot of x")
boxplot(y, col="grey", main="Boxplot of y")
summary(x)
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 1.00 20.75 40.50 40.50 60.25 80.00
summary(y)
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 1.00 20.75 40.50 40.50 60.25 80.00 | Will two distributions with identical 5-number summaries always have the same shape? | Just because the five-number summary is identical doesn't mean that the distribution is identical. This tells you just how much information is lost when we present data graphically in a box plot!
Perh | Will two distributions with identical 5-number summaries always have the same shape?
Just because the five-number summary is identical doesn't mean that the distribution is identical. This tells you just how much information is lost when we present data graphically in a box plot!
Perhaps the easiest way to see the problem is that the five number summary tells you nothing about the distribution of the values between the minimum and lower quartile, or between the lower quartile and the median, and so on. You know that the frequency between minimum and lower quartile must match the frequency between lower quartile and median (with the obvious exceptions, e.g. if we have data lying on a quartile, or worse, if two quartiles are tied) but don't know to which values of the variable those frequencies are allocated. We can have a situation like this:
These two distributions have the same five-number summary, so their box plots are identical, but I have chosen $X$ to have a uniform distribution between each quartile whereas $Y$ has a distribution with low frequencies close to the quartiles and high frequencies in the middle of two quartiles. Effectively the distribution of $Y$ has been formed by taking the distribution of $X$ and moving most of the data that is close to a quartile further away from it; my R code actually performs this in reverse, starting with the irregular distribution of $Y$ and levelling out the frequencies by reallocating data from the peaks to fill in the troughs.
EDIT: As @Glen_b says, this becomes even more obvious when you look at the cumulative distributions. I've added gridlines to show the location of the quartiles, which are the same for the two distributions so their empirical CDFs intersect.
R code
yfreq <- 2*rep(c(1:10, 10:1), times=4)
xfreq <- rep(mean(yfreq), times=length(yfreq))
x <- rep(1:length(xfreq), times=xfreq)
y <- rep(1:length(yfreq), times=yfreq)
ecdfX <- ecdf(x)
ecdfY <- ecdf(y)
plot(ecdfX, verticals=TRUE, do.points=FALSE, col="blue", lwd=2, yaxt="n",
main="Empirical CDFs", xlab="", ylab="Relative cumulative frequency")
plot(ecdfY, verticals=TRUE, do.points=FALSE, add=TRUE, col="black",
yaxt="n", lwd=2)
axis(side=2, at=seq(0, 1, by=0.1), las=2)
abline(h=c(0.25,0.5,0.75,1), col="lightgrey", lty="dashed")
abline(v=summary(x), col="lightgrey", lty="dashed")
legend("right", c("x", "y"), col = c("blue", "black"),
lty = "solid", lwd=2, bty="n")
par(mfrow=c(2,2))
hist(x, col="steelblue", breaks=((0:81)-0.5), ylim=c(0,25))
hist(y, col="grey", breaks=((0:81)-0.5), ylim=c(0,25))
boxplot(x, col="steelblue", main="Boxplot of x")
boxplot(y, col="grey", main="Boxplot of y")
summary(x)
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 1.00 20.75 40.50 40.50 60.25 80.00
summary(y)
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 1.00 20.75 40.50 40.50 60.25 80.00 | Will two distributions with identical 5-number summaries always have the same shape?
Just because the five-number summary is identical doesn't mean that the distribution is identical. This tells you just how much information is lost when we present data graphically in a box plot!
Perh |
20,800 | Will two distributions with identical 5-number summaries always have the same shape? | This is most clearly answered by considering the (cumulative) distribution function.
Specifying the minimum, maximum and the three quartiles specifies exactly 5 points on the cdf, but the cdf between those points may be any monotonic nondecreasing function in between that still passes through those points:
In the drawing, both the red and black CDFs share the same minimum, maximum, and quartiles, but are clearly different distributions. Clearly any number of other CDFs could be specified that also pass through the same five points.
In fact, all we've done is restrict our distribution function to lie within four boxes:
$\qquad$
(as long as it also continues to satisfy the other conditions for a CDF). That isn't all that much of a restriction.
The same notion can be applied to sample quantities - two different empirical CDFs may nevertheless have the same five-number summary.
On that subject, see the four examples near the end of this answer, which all have the same five-number summaries, but which have very different looking histograms (which I'll reproduce below):
This again emphasizes that five number summaries don't generally do very much to tell us about shape. | Will two distributions with identical 5-number summaries always have the same shape? | This is most clearly answered by considering the (cumulative) distribution function.
Specifying the minimum, maximum and the three quartiles specifies exactly 5 points on the cdf, but the cdf between | Will two distributions with identical 5-number summaries always have the same shape?
This is most clearly answered by considering the (cumulative) distribution function.
Specifying the minimum, maximum and the three quartiles specifies exactly 5 points on the cdf, but the cdf between those points may be any monotonic nondecreasing function in between that still passes through those points:
In the drawing, both the red and black CDFs share the same minimum, maximum, and quartiles, but are clearly different distributions. Clearly any number of other CDFs could be specified that also pass through the same five points.
In fact, all we've done is restrict our distribution function to lie within four boxes:
$\qquad$
(as long as it also continues to satisfy the other conditions for a CDF). That isn't all that much of a restriction.
The same notion can be applied to sample quantities - two different empirical CDFs may nevertheless have the same five-number summary.
On that subject, see the four examples near the end of this answer, which all have the same five-number summaries, but which have very different looking histograms (which I'll reproduce below):
This again emphasizes that five number summaries don't generally do very much to tell us about shape. | Will two distributions with identical 5-number summaries always have the same shape?
This is most clearly answered by considering the (cumulative) distribution function.
Specifying the minimum, maximum and the three quartiles specifies exactly 5 points on the cdf, but the cdf between |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.