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
|
|---|---|---|---|---|---|---|
9,401
|
Empirical CDF vs CDF
|
Empirical is something you build from data and observations. For instance, suppose you want to know about the distribution of the height of people in a country. You start by measuring people and come up with a histogram that can be approximated to a distribution. Then you calculate the empirical CDF.
If you are using a statistical distribution (a deterministic formula that gives the exact same output with the same parameters) you can calculate its CDF also.
You can say "The height of the people in this country is distributed similar to normal distribution with the mean 1.75 m and the standard deviation 0.1 m. Then you can use CDF of ~$N(\mu=1.75\ \text{m},\sigma=0.1\ \text{m})$ instead of the constructed CDF of the empirical distribution.
|
Empirical CDF vs CDF
|
Empirical is something you build from data and observations. For instance, suppose you want to know about the distribution of the height of people in a country. You start by measuring people and come
|
Empirical CDF vs CDF
Empirical is something you build from data and observations. For instance, suppose you want to know about the distribution of the height of people in a country. You start by measuring people and come up with a histogram that can be approximated to a distribution. Then you calculate the empirical CDF.
If you are using a statistical distribution (a deterministic formula that gives the exact same output with the same parameters) you can calculate its CDF also.
You can say "The height of the people in this country is distributed similar to normal distribution with the mean 1.75 m and the standard deviation 0.1 m. Then you can use CDF of ~$N(\mu=1.75\ \text{m},\sigma=0.1\ \text{m})$ instead of the constructed CDF of the empirical distribution.
|
Empirical CDF vs CDF
Empirical is something you build from data and observations. For instance, suppose you want to know about the distribution of the height of people in a country. You start by measuring people and come
|
9,402
|
Empirical CDF vs CDF
|
According to Dictionary.com, the definitions of "empirical" include:
derived from or guided by experience or experiment.
Hence, the Empirical CDF is the CDF you obtain from your data. This contrasts with the theoretical CDF (often just called "CDF"), which is obtained from a statistical or probabilistic model such as the Normal distribution.
|
Empirical CDF vs CDF
|
According to Dictionary.com, the definitions of "empirical" include:
derived from or guided by experience or experiment.
Hence, the Empirical CDF is the CDF you obtain from your data. This contrasts
|
Empirical CDF vs CDF
According to Dictionary.com, the definitions of "empirical" include:
derived from or guided by experience or experiment.
Hence, the Empirical CDF is the CDF you obtain from your data. This contrasts with the theoretical CDF (often just called "CDF"), which is obtained from a statistical or probabilistic model such as the Normal distribution.
|
Empirical CDF vs CDF
According to Dictionary.com, the definitions of "empirical" include:
derived from or guided by experience or experiment.
Hence, the Empirical CDF is the CDF you obtain from your data. This contrasts
|
9,403
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
|
Broadly speaking (not just in goodness of fit testing, but in many other situations), you simply can't conclude that the null is true, because there are alternatives that are effectively indistinguishable from the null at any given sample size.
Here's two distributions, a standard normal (green solid line), and a similar-looking one (90% standard normal, and 10% standardized beta(2,2), marked with a red dashed line):
The red one is not normal. At say $n=100$, we have little chance of spotting the difference, so we can't assert that data are drawn from a normal distribution -- what if it were from a non-normal distribution like the red one instead?
Smaller fractions of standardized betas with equal but larger parameters would be much harder to see as different from a normal.
But given that real data are almost never from some simple distribution, if we had a perfect oracle (or effectively infinite sample sizes), we would essentially always reject the hypothesis that the data were from some simple distributional form.
As George Box famously put it, "All models are wrong, but some are useful."
Consider, for example, testing normality. It may be that the data actually come from something close to a normal, but will they ever be exactly normal? They probably never are.
Instead, the best you can hope for with that form of testing is the situation you describe. (See, for example, the post Is normality testing essentially useless?, but there are a number of other posts here that make related points)
This is part of the reason I often suggest to people that the question they're actually interested in (which is often something nearer to 'are my data close enough to distribution $F$ that I can make suitable inferences on that basis?') is usually not well-answered by goodness-of-fit testing. In the case of normality, often the inferential procedures they wish to apply (t-tests, regression etc) tend to work quite well in large samples - often even when the original distribution is fairly clearly non-normal -- just when a goodness of fit test will be very likely to reject normality. It's little use having a procedure that is most likely to tell you that your data are non-normal just when the question doesn't matter.
Consider the image above again. The red distribution is non-normal, and with a really large sample we could reject a test of normality based on a sample from it ... but at a much smaller sample size, regressions and two sample t-tests (and many other tests besides) will behave so nicely as to make it pointless to even worry about that non-normality even a little.
Similar considerations extend not only to other distributions, but largely, to a large amount of hypothesis testing more generally (even a two-tailed test of $\mu=\mu_0$ for example). One might as well ask the same kind of question - what is the point of performing such testing if we can't conclude whether or not the mean takes a particular value?
You might be able to specify some particular forms of deviation and look at something like equivalence testing, but it's kind of tricky with goodness of fit because there are so many ways for a distribution to be close to but different from a hypothesized one, and different forms of difference can have different impacts on the analysis. If the alternative is a broader family that includes the null as a special case, equivalence testing makes more sense (testing exponential against gamma, for example) -- and indeed, the "two one-sided test" approach carries through, and that might be a way to formalize "close enough" (or it would be if the gamma model were true, but in fact would itself be virtually certain to be rejected by an ordinary goodness of fit test, if only the sample size were sufficiently large).
Goodness of fit testing (and often more broadly, hypothesis testing) is really only suitable for a fairly limited range of situations. The question people usually want to answer is not so precise, but somewhat more vague and harder to answer -- but as John Tukey said, "Far better an approximate answer to the right question, which is often vague, than an exact answer to the wrong question, which can always be made precise."
Reasonable approaches to answering the more vague question may include simulation and resampling investigations to assess the sensitivity of the desired analysis to the assumption you are considering, compared to other situations that are also reasonably consistent with the available data.
(It's also part of the basis for the approach to robustness via $\varepsilon$-contamination -- essentially by looking at the impact of being within a certain distance in the Kolmogorov-Smirnov sense)
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
|
Broadly speaking (not just in goodness of fit testing, but in many other situations), you simply can't conclude that the null is true, because there are alternatives that are effectively indistinguish
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
Broadly speaking (not just in goodness of fit testing, but in many other situations), you simply can't conclude that the null is true, because there are alternatives that are effectively indistinguishable from the null at any given sample size.
Here's two distributions, a standard normal (green solid line), and a similar-looking one (90% standard normal, and 10% standardized beta(2,2), marked with a red dashed line):
The red one is not normal. At say $n=100$, we have little chance of spotting the difference, so we can't assert that data are drawn from a normal distribution -- what if it were from a non-normal distribution like the red one instead?
Smaller fractions of standardized betas with equal but larger parameters would be much harder to see as different from a normal.
But given that real data are almost never from some simple distribution, if we had a perfect oracle (or effectively infinite sample sizes), we would essentially always reject the hypothesis that the data were from some simple distributional form.
As George Box famously put it, "All models are wrong, but some are useful."
Consider, for example, testing normality. It may be that the data actually come from something close to a normal, but will they ever be exactly normal? They probably never are.
Instead, the best you can hope for with that form of testing is the situation you describe. (See, for example, the post Is normality testing essentially useless?, but there are a number of other posts here that make related points)
This is part of the reason I often suggest to people that the question they're actually interested in (which is often something nearer to 'are my data close enough to distribution $F$ that I can make suitable inferences on that basis?') is usually not well-answered by goodness-of-fit testing. In the case of normality, often the inferential procedures they wish to apply (t-tests, regression etc) tend to work quite well in large samples - often even when the original distribution is fairly clearly non-normal -- just when a goodness of fit test will be very likely to reject normality. It's little use having a procedure that is most likely to tell you that your data are non-normal just when the question doesn't matter.
Consider the image above again. The red distribution is non-normal, and with a really large sample we could reject a test of normality based on a sample from it ... but at a much smaller sample size, regressions and two sample t-tests (and many other tests besides) will behave so nicely as to make it pointless to even worry about that non-normality even a little.
Similar considerations extend not only to other distributions, but largely, to a large amount of hypothesis testing more generally (even a two-tailed test of $\mu=\mu_0$ for example). One might as well ask the same kind of question - what is the point of performing such testing if we can't conclude whether or not the mean takes a particular value?
You might be able to specify some particular forms of deviation and look at something like equivalence testing, but it's kind of tricky with goodness of fit because there are so many ways for a distribution to be close to but different from a hypothesized one, and different forms of difference can have different impacts on the analysis. If the alternative is a broader family that includes the null as a special case, equivalence testing makes more sense (testing exponential against gamma, for example) -- and indeed, the "two one-sided test" approach carries through, and that might be a way to formalize "close enough" (or it would be if the gamma model were true, but in fact would itself be virtually certain to be rejected by an ordinary goodness of fit test, if only the sample size were sufficiently large).
Goodness of fit testing (and often more broadly, hypothesis testing) is really only suitable for a fairly limited range of situations. The question people usually want to answer is not so precise, but somewhat more vague and harder to answer -- but as John Tukey said, "Far better an approximate answer to the right question, which is often vague, than an exact answer to the wrong question, which can always be made precise."
Reasonable approaches to answering the more vague question may include simulation and resampling investigations to assess the sensitivity of the desired analysis to the assumption you are considering, compared to other situations that are also reasonably consistent with the available data.
(It's also part of the basis for the approach to robustness via $\varepsilon$-contamination -- essentially by looking at the impact of being within a certain distance in the Kolmogorov-Smirnov sense)
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
Broadly speaking (not just in goodness of fit testing, but in many other situations), you simply can't conclude that the null is true, because there are alternatives that are effectively indistinguish
|
9,404
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
|
I second @Glen_b's answer and add that in general the "absence of evidence is not evidence for absence" problem makes hypothesis tests and $P$-values less useful than they seem. Estimation is often a better approach even in the goodness-of-fit assessment. One can use the Kolmogorov-Smirnov distance as a measure. It's just hard to use it without a margin of error. A conservative approach would take the upper confidence limit of the K-S distance to guide modeling. This would (properly) lead to a lot of uncertainty, which may lead one to conclude that choosing a robust method in the first place is preferred. With that in mind, and back to the original goal, when one compares the empirical distribution to more than, say, 2 possible parametric forms, the true variance of the final fitted distribution has no better precision than the empirical cumulative distribution function. So if there is no subject matter theory to drive the selection of the distribution, perhaps go with the ECDF.
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
|
I second @Glen_b's answer and add that in general the "absence of evidence is not evidence for absence" problem makes hypothesis tests and $P$-values less useful than they seem. Estimation is often a
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
I second @Glen_b's answer and add that in general the "absence of evidence is not evidence for absence" problem makes hypothesis tests and $P$-values less useful than they seem. Estimation is often a better approach even in the goodness-of-fit assessment. One can use the Kolmogorov-Smirnov distance as a measure. It's just hard to use it without a margin of error. A conservative approach would take the upper confidence limit of the K-S distance to guide modeling. This would (properly) lead to a lot of uncertainty, which may lead one to conclude that choosing a robust method in the first place is preferred. With that in mind, and back to the original goal, when one compares the empirical distribution to more than, say, 2 possible parametric forms, the true variance of the final fitted distribution has no better precision than the empirical cumulative distribution function. So if there is no subject matter theory to drive the selection of the distribution, perhaps go with the ECDF.
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
I second @Glen_b's answer and add that in general the "absence of evidence is not evidence for absence" problem makes hypothesis tests and $P$-values less useful than they seem. Estimation is often a
|
9,405
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
|
A view I think shared by most people is that the hypothesis testing is a probabilistic adaptation of the falsification principle.
If a hypothesis survives continuing and serious attempts to falsify it, then it has "proved its mettle" and can be provisionally accepted, but it can never be established conclusively.
Therefore, a failure to reject $H_0$ by no means implies that $H_0$ is true; it is just that $H_0$ is survived for further scrutiny.
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
|
A view I think shared by most people is that the hypothesis testing is a probabilistic adaptation of the falsification principle.
If a hypothesis survives continuing and serious attempts to falsify
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
A view I think shared by most people is that the hypothesis testing is a probabilistic adaptation of the falsification principle.
If a hypothesis survives continuing and serious attempts to falsify it, then it has "proved its mettle" and can be provisionally accepted, but it can never be established conclusively.
Therefore, a failure to reject $H_0$ by no means implies that $H_0$ is true; it is just that $H_0$ is survived for further scrutiny.
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
A view I think shared by most people is that the hypothesis testing is a probabilistic adaptation of the falsification principle.
If a hypothesis survives continuing and serious attempts to falsify
|
9,406
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
|
The point is that from pure statistical point of view you can't accept, but in practice you do. For instance, if you are estimating the risk of a portfolio using value-at-risk or similar measures, the portfolio return distribution is quite important. That is because the risk is defined by the tail of your distribution.
In the text book cases, the normal distribution is often used for examples. However, if your portfolio returns have fat-tails (which they often do), the normal distribution approximation will underestimate the risks. Therefore, it is important to examine the returns and decide whether you're going to use normal approximation or not. Note, this doesn't necessarily mean running statistical tests, it could be QQ-plots or other means. However, you have to make a decision at some point based on analysis of returns and your return models, and either use normal or not.
Hence, for all practical purposes not reject really means accept albeit not in strict statistical sense. You're going to accept the normal and use it in your calculations, which will be shown to the upper management daily, to your regulators, auditors etc. The not reject in this case has far reaching consequences in every sense, so it is as or more powerful than the silly statistical outcome.
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
|
The point is that from pure statistical point of view you can't accept, but in practice you do. For instance, if you are estimating the risk of a portfolio using value-at-risk or similar measures, the
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
The point is that from pure statistical point of view you can't accept, but in practice you do. For instance, if you are estimating the risk of a portfolio using value-at-risk or similar measures, the portfolio return distribution is quite important. That is because the risk is defined by the tail of your distribution.
In the text book cases, the normal distribution is often used for examples. However, if your portfolio returns have fat-tails (which they often do), the normal distribution approximation will underestimate the risks. Therefore, it is important to examine the returns and decide whether you're going to use normal approximation or not. Note, this doesn't necessarily mean running statistical tests, it could be QQ-plots or other means. However, you have to make a decision at some point based on analysis of returns and your return models, and either use normal or not.
Hence, for all practical purposes not reject really means accept albeit not in strict statistical sense. You're going to accept the normal and use it in your calculations, which will be shown to the upper management daily, to your regulators, auditors etc. The not reject in this case has far reaching consequences in every sense, so it is as or more powerful than the silly statistical outcome.
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
The point is that from pure statistical point of view you can't accept, but in practice you do. For instance, if you are estimating the risk of a portfolio using value-at-risk or similar measures, the
|
9,407
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
|
I think this is a perfect example to illustrate the difference between academic work and practical decision making. In academic settings (where I am), you can argue any way you want to so long as it is deemed reasonable by others. Hence, essentially we end up with having endless, sometimes circular, argy bargy with one another. In that sense, this provides people with something to work on.
However, if you are indeed in a position to actually make decisions, then the answer is a definite yes or no. Indecision will damage your reputation as a decision maker. Of course, making a choice involves not only statistics but also sometimes an element of gamble and leap of faith. In summary, this kind of exercise is to some extent useful for decision making. However, whether to rely your decision solely on this hypothesis test is a completely different story.
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
|
I think this is a perfect example to illustrate the difference between academic work and practical decision making. In academic settings (where I am), you can argue any way you want to so long as it i
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
I think this is a perfect example to illustrate the difference between academic work and practical decision making. In academic settings (where I am), you can argue any way you want to so long as it is deemed reasonable by others. Hence, essentially we end up with having endless, sometimes circular, argy bargy with one another. In that sense, this provides people with something to work on.
However, if you are indeed in a position to actually make decisions, then the answer is a definite yes or no. Indecision will damage your reputation as a decision maker. Of course, making a choice involves not only statistics but also sometimes an element of gamble and leap of faith. In summary, this kind of exercise is to some extent useful for decision making. However, whether to rely your decision solely on this hypothesis test is a completely different story.
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
I think this is a perfect example to illustrate the difference between academic work and practical decision making. In academic settings (where I am), you can argue any way you want to so long as it i
|
9,408
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
|
No defendant in court is ever innocent. They are either guilty (reject null hypothesis of innocent) or not guilty (do not reject presumption of innocence).
Absence of evidence is not evidence of absence.
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
|
No defendant in court is ever innocent. They are either guilty (reject null hypothesis of innocent) or not guilty (do not reject presumption of innocence).
Absence of evidence is not evidence of absen
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
No defendant in court is ever innocent. They are either guilty (reject null hypothesis of innocent) or not guilty (do not reject presumption of innocence).
Absence of evidence is not evidence of absence.
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
No defendant in court is ever innocent. They are either guilty (reject null hypothesis of innocent) or not guilty (do not reject presumption of innocence).
Absence of evidence is not evidence of absen
|
9,409
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
|
Thus, my question is, what is the point of performing such testing if
we can't conclude whether or not the data follow a given distribution?
If you have an alternative distribution (or set of distributions) in mind to compare to then it can be a useful tool.
I would say: I have a set of observations at hand which I think may be
normally distributed. (I think so because I have seen observations of
a similar character that I was satisfied followed sensibly the normal
curve.) I also think they may not follow the normal curve but some
regular non-normal curve. (I think this may be because I have seen
bodies of data like this which do not follow the normal curve but
which were, for instance, skew, etc.)3 I then make an inquiry along
the fol- lowing lines: If the observations come from a normal
distribution, how frequently would such a chi-square as I got occur?
The conclusion is, "Quite rarely-only two times in a hundred." I then
make an inquiry, not stated and not calculated, but I believe
absolutely necessary for the completion of a valid argument, as
follows: If the distribution is non-normal, this experience, judged by
a chi-square difference, would occur quite frequently. (All I have to
do is imagine that the non-normal curve has the observed skew
character of the distribution.) I therefore reject the normal
hypothesis on the principle that I accept that one of alternative
considered hypotheses on which the experienced event would be more
frequent. I say the rejection of the null hypothesis is valid only on
the willingness to accept an alternative ( this alternative not
necessarily defined precisely in all respects).
Now the line of reasoning that I have described, as contrasted with
what I have described as the more usual, would explain why my deci-
sion differs from the routine one in the third and fourth cases.
With regard to the third case, after I have tried the chi-square test,
I have reached the conclusion, that on the hypothesis of no difference
from normality, a distribution with so large a chi-square would occur
rarely. So far we are in exactly the same position as we were at this
point in the second case. But now let me examine the probability that
this experience would occur if the original supply were a regular non-
normal one. Would this experience occur more frequently? There is no
reason to say so. The distribution is perfectly symmetrical, i.e., the
skewness is zero (there were exactly 50 per cent of the cases on each
side of the mean), and a cursory examination of the differences from
expected frequencies in the different classes shows they are not sys-
tematic, i.e., the plus deviations and minus deviations alternate in
random order. Such a distribution is not to be expected frequently
from any plausible non-normal curve. We therefore have no reason at
hand for rejection of the normal curve.
My view is that there is never any valid reason for rejection of the
null hypothesis except on the willingness to emrbrace an alternative
one.
Some Difficulties of Interpretation Encountered in the Application of the Chi-Square Test.
Joseph Berkson. Journal of the American Statistical Association. Vol. 33, No. 203 (Sep., 1938), pp. 526-536
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
|
Thus, my question is, what is the point of performing such testing if
we can't conclude whether or not the data follow a given distribution?
If you have an alternative distribution (or set of distr
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypothesis?
Thus, my question is, what is the point of performing such testing if
we can't conclude whether or not the data follow a given distribution?
If you have an alternative distribution (or set of distributions) in mind to compare to then it can be a useful tool.
I would say: I have a set of observations at hand which I think may be
normally distributed. (I think so because I have seen observations of
a similar character that I was satisfied followed sensibly the normal
curve.) I also think they may not follow the normal curve but some
regular non-normal curve. (I think this may be because I have seen
bodies of data like this which do not follow the normal curve but
which were, for instance, skew, etc.)3 I then make an inquiry along
the fol- lowing lines: If the observations come from a normal
distribution, how frequently would such a chi-square as I got occur?
The conclusion is, "Quite rarely-only two times in a hundred." I then
make an inquiry, not stated and not calculated, but I believe
absolutely necessary for the completion of a valid argument, as
follows: If the distribution is non-normal, this experience, judged by
a chi-square difference, would occur quite frequently. (All I have to
do is imagine that the non-normal curve has the observed skew
character of the distribution.) I therefore reject the normal
hypothesis on the principle that I accept that one of alternative
considered hypotheses on which the experienced event would be more
frequent. I say the rejection of the null hypothesis is valid only on
the willingness to accept an alternative ( this alternative not
necessarily defined precisely in all respects).
Now the line of reasoning that I have described, as contrasted with
what I have described as the more usual, would explain why my deci-
sion differs from the routine one in the third and fourth cases.
With regard to the third case, after I have tried the chi-square test,
I have reached the conclusion, that on the hypothesis of no difference
from normality, a distribution with so large a chi-square would occur
rarely. So far we are in exactly the same position as we were at this
point in the second case. But now let me examine the probability that
this experience would occur if the original supply were a regular non-
normal one. Would this experience occur more frequently? There is no
reason to say so. The distribution is perfectly symmetrical, i.e., the
skewness is zero (there were exactly 50 per cent of the cases on each
side of the mean), and a cursory examination of the differences from
expected frequencies in the different classes shows they are not sys-
tematic, i.e., the plus deviations and minus deviations alternate in
random order. Such a distribution is not to be expected frequently
from any plausible non-normal curve. We therefore have no reason at
hand for rejection of the normal curve.
My view is that there is never any valid reason for rejection of the
null hypothesis except on the willingness to emrbrace an alternative
one.
Some Difficulties of Interpretation Encountered in the Application of the Chi-Square Test.
Joseph Berkson. Journal of the American Statistical Association. Vol. 33, No. 203 (Sep., 1938), pp. 526-536
|
Distribution hypothesis testing - what is the point of doing it if you can't "accept" your null hypo
Thus, my question is, what is the point of performing such testing if
we can't conclude whether or not the data follow a given distribution?
If you have an alternative distribution (or set of distr
|
9,410
|
Distribution of difference between two normal distributions
|
This question can be answered as stated only by assuming the two random variables $X_1$ and $X_2$ governed by these distributions are independent. This makes their difference $X = X_2-X_1$ Normal with mean $\mu = \mu_2-\mu_1$ and variance $\sigma^2=\sigma_1^2 + \sigma_2^2$. (The following solution can easily be generalized to any bivariate Normal distribution of $(X_1, X_2)$.) Thus the variable
$$Z = \frac{X-\mu}{\sigma} = \frac{X_2 - X_1 - (\mu_2 - \mu_1)}{\sqrt{\sigma_1^2 + \sigma_2^2}}$$
has a standard Normal distribution (that is, with zero mean and unit variance) and
$$X = \sigma \left(Z + \frac{\mu}{\sigma}\right).$$
The expression
$$|X_2 - X_1| = |X| = \sqrt{X^2} = \sigma\sqrt{\left(Z + \frac{\mu}{\sigma}\right)^2}$$
exhibits the absolute difference as a scaled version of the square root of a Non-central chi-squared distribution with one degree of freedom and noncentrality parameter $\lambda=(\mu/\sigma)^2$. A Non-central chi-squared distribution with these parameters has probability element
$$f(y)dy = \frac{\sqrt{y}}{\sqrt{2 \pi } } e^{\frac{1}{2} (-\lambda -y)} \cosh \left(\sqrt{\lambda y} \right) \frac{dy}{y},\ y \gt 0.$$
Writing $y=x^2$ for $x \gt 0$ establishes a one-to-one correspondence between $y$ and its square root, resulting in
$$f(y)dy = f(x^2) d(x^2) = \frac{\sqrt{x^2}}{\sqrt{2 \pi } } e^{\frac{1}{2} (-\lambda -x^2)} \cosh \left(\sqrt{\lambda x^2} \right) \frac{dx^2}{x^2}.$$
Simplifying this and then rescaling by $\sigma$ gives the desired density,
$$f_{|X|}(x) = \frac{1}{\sigma}\sqrt{\frac{2}{\pi}} \cosh\left(\frac{x\mu}{\sigma^2}\right) \exp\left(-\frac{x^2 + \mu^2}{2 \sigma^2}\right).$$
This result is supported by simulations, such as this histogram of 100,000 independent draws of $|X|=|X_2-X_1|$ (called "x" in the code) with parameters $\mu_1=-1, \mu_2=5, \sigma_1=4, \sigma_2=1$. On it is plotted the graph of $f_{|X|}$, which neatly coincides with the histogram values.
The R code for this simulation follows.
#
# Specify parameters
#
mu <- c(-1, 5)
sigma <- c(4, 1)
#
# Simulate data
#
n.sim <- 1e5
set.seed(17)
x.sim <- matrix(rnorm(n.sim*2, mu, sigma), nrow=2)
x <- abs(x.sim[2, ] - x.sim[1, ])
#
# Display the results
#
hist(x, freq=FALSE)
f <- function(x, mu, sigma) {
sqrt(2 / pi) / sigma * cosh(x * mu / sigma^2) * exp(-(x^2 + mu^2)/(2*sigma^2))
}
curve(f(x, abs(diff(mu)), sqrt(sum(sigma^2))), lwd=2, col="Red", add=TRUE)
|
Distribution of difference between two normal distributions
|
This question can be answered as stated only by assuming the two random variables $X_1$ and $X_2$ governed by these distributions are independent. This makes their difference $X = X_2-X_1$ Normal wit
|
Distribution of difference between two normal distributions
This question can be answered as stated only by assuming the two random variables $X_1$ and $X_2$ governed by these distributions are independent. This makes their difference $X = X_2-X_1$ Normal with mean $\mu = \mu_2-\mu_1$ and variance $\sigma^2=\sigma_1^2 + \sigma_2^2$. (The following solution can easily be generalized to any bivariate Normal distribution of $(X_1, X_2)$.) Thus the variable
$$Z = \frac{X-\mu}{\sigma} = \frac{X_2 - X_1 - (\mu_2 - \mu_1)}{\sqrt{\sigma_1^2 + \sigma_2^2}}$$
has a standard Normal distribution (that is, with zero mean and unit variance) and
$$X = \sigma \left(Z + \frac{\mu}{\sigma}\right).$$
The expression
$$|X_2 - X_1| = |X| = \sqrt{X^2} = \sigma\sqrt{\left(Z + \frac{\mu}{\sigma}\right)^2}$$
exhibits the absolute difference as a scaled version of the square root of a Non-central chi-squared distribution with one degree of freedom and noncentrality parameter $\lambda=(\mu/\sigma)^2$. A Non-central chi-squared distribution with these parameters has probability element
$$f(y)dy = \frac{\sqrt{y}}{\sqrt{2 \pi } } e^{\frac{1}{2} (-\lambda -y)} \cosh \left(\sqrt{\lambda y} \right) \frac{dy}{y},\ y \gt 0.$$
Writing $y=x^2$ for $x \gt 0$ establishes a one-to-one correspondence between $y$ and its square root, resulting in
$$f(y)dy = f(x^2) d(x^2) = \frac{\sqrt{x^2}}{\sqrt{2 \pi } } e^{\frac{1}{2} (-\lambda -x^2)} \cosh \left(\sqrt{\lambda x^2} \right) \frac{dx^2}{x^2}.$$
Simplifying this and then rescaling by $\sigma$ gives the desired density,
$$f_{|X|}(x) = \frac{1}{\sigma}\sqrt{\frac{2}{\pi}} \cosh\left(\frac{x\mu}{\sigma^2}\right) \exp\left(-\frac{x^2 + \mu^2}{2 \sigma^2}\right).$$
This result is supported by simulations, such as this histogram of 100,000 independent draws of $|X|=|X_2-X_1|$ (called "x" in the code) with parameters $\mu_1=-1, \mu_2=5, \sigma_1=4, \sigma_2=1$. On it is plotted the graph of $f_{|X|}$, which neatly coincides with the histogram values.
The R code for this simulation follows.
#
# Specify parameters
#
mu <- c(-1, 5)
sigma <- c(4, 1)
#
# Simulate data
#
n.sim <- 1e5
set.seed(17)
x.sim <- matrix(rnorm(n.sim*2, mu, sigma), nrow=2)
x <- abs(x.sim[2, ] - x.sim[1, ])
#
# Display the results
#
hist(x, freq=FALSE)
f <- function(x, mu, sigma) {
sqrt(2 / pi) / sigma * cosh(x * mu / sigma^2) * exp(-(x^2 + mu^2)/(2*sigma^2))
}
curve(f(x, abs(diff(mu)), sqrt(sum(sigma^2))), lwd=2, col="Red", add=TRUE)
|
Distribution of difference between two normal distributions
This question can be answered as stated only by assuming the two random variables $X_1$ and $X_2$ governed by these distributions are independent. This makes their difference $X = X_2-X_1$ Normal wit
|
9,411
|
Distribution of difference between two normal distributions
|
I am providing an answer that is complementary to the one by @whuber in the sense of being what a non-statistician (i.e. someone who does not know much about non-central chi-square distributions with
one degree of freedom etc) might write, and that a neophyte could
follow relatively easily.
Borrowing the assumption of independence as well as the notation from whuber's answer, $Z = X_1-X_2 \sim N(\mu, \sigma^2)$ where $\mu = \mu_1-\mu_2$
and $\sigma^2 = \sigma_1^2+\sigma_2^2$. Thus, for $x \geq 0$,
\begin{align}
F_{|Z|}(x) &\triangleq P\{|Z| \leq x\}\\
&= P\{-x \leq Z \leq x\}\\
&= P\{-x < Z \leq x\} &\scriptstyle{\text{since}~Z~\text{is a continuous random variable}}\\
&= F_Z(x) - F_Z(-x),
\end{align}
and of course, $F_{|Z|}(x) = 0$ for $x < 0$.
It follows upon differentiating with respect to $x$ that
\begin{align}f_{|Z|}(x) &\triangleq \frac{\partial}{\partial x}
F_{|Z|}(x)\\
&= [f_Z(x) + f_Z(-x)]\mathbf 1_{(0,\infty)}(x)\\
&= \left[ \frac{\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)}{\sigma\sqrt{2\pi}}
+ \frac{\exp\left(-\frac{(x+\mu)^2}{2\sigma^2}\right)}{\sigma\sqrt{2\pi}}\right]\mathbf 1_{(0,\infty)}(x)\\
&= \frac{\displaystyle\exp\left(-\frac{x^2+\mu^2}{2\sigma^2}\right)}{\sigma\sqrt{2\pi}}\left(\exp\left(\frac{x\mu}{\sigma^2}\right)
+ \exp\left(\frac{-x\mu}{\sigma^2}\right)\right)\mathbf 1_{(0,\infty)}(x)\\
& = \frac{1}{\sigma}\sqrt{\frac{2}{\pi}} \cosh\left(\frac{x\mu}{\sigma^2}\right) \exp\left(-\frac{x^2 + \mu^2}{2 \sigma^2}\right)\mathbf 1_{(0,\infty)}(x)
\end{align}
which is the exact same result as in whuber's answer, but arrived at
more transparently.
NOTE: Missing Neg Sign added to 2nd to Last Line - 2021/04/23
|
Distribution of difference between two normal distributions
|
I am providing an answer that is complementary to the one by @whuber in the sense of being what a non-statistician (i.e. someone who does not know much about non-central chi-square distributions with
|
Distribution of difference between two normal distributions
I am providing an answer that is complementary to the one by @whuber in the sense of being what a non-statistician (i.e. someone who does not know much about non-central chi-square distributions with
one degree of freedom etc) might write, and that a neophyte could
follow relatively easily.
Borrowing the assumption of independence as well as the notation from whuber's answer, $Z = X_1-X_2 \sim N(\mu, \sigma^2)$ where $\mu = \mu_1-\mu_2$
and $\sigma^2 = \sigma_1^2+\sigma_2^2$. Thus, for $x \geq 0$,
\begin{align}
F_{|Z|}(x) &\triangleq P\{|Z| \leq x\}\\
&= P\{-x \leq Z \leq x\}\\
&= P\{-x < Z \leq x\} &\scriptstyle{\text{since}~Z~\text{is a continuous random variable}}\\
&= F_Z(x) - F_Z(-x),
\end{align}
and of course, $F_{|Z|}(x) = 0$ for $x < 0$.
It follows upon differentiating with respect to $x$ that
\begin{align}f_{|Z|}(x) &\triangleq \frac{\partial}{\partial x}
F_{|Z|}(x)\\
&= [f_Z(x) + f_Z(-x)]\mathbf 1_{(0,\infty)}(x)\\
&= \left[ \frac{\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)}{\sigma\sqrt{2\pi}}
+ \frac{\exp\left(-\frac{(x+\mu)^2}{2\sigma^2}\right)}{\sigma\sqrt{2\pi}}\right]\mathbf 1_{(0,\infty)}(x)\\
&= \frac{\displaystyle\exp\left(-\frac{x^2+\mu^2}{2\sigma^2}\right)}{\sigma\sqrt{2\pi}}\left(\exp\left(\frac{x\mu}{\sigma^2}\right)
+ \exp\left(\frac{-x\mu}{\sigma^2}\right)\right)\mathbf 1_{(0,\infty)}(x)\\
& = \frac{1}{\sigma}\sqrt{\frac{2}{\pi}} \cosh\left(\frac{x\mu}{\sigma^2}\right) \exp\left(-\frac{x^2 + \mu^2}{2 \sigma^2}\right)\mathbf 1_{(0,\infty)}(x)
\end{align}
which is the exact same result as in whuber's answer, but arrived at
more transparently.
NOTE: Missing Neg Sign added to 2nd to Last Line - 2021/04/23
|
Distribution of difference between two normal distributions
I am providing an answer that is complementary to the one by @whuber in the sense of being what a non-statistician (i.e. someone who does not know much about non-central chi-square distributions with
|
9,412
|
Distribution of difference between two normal distributions
|
The distribution of a difference of two normally distributed variates X and Y is also a normal distribution, assuming X and Y are independent (thanks Mark for the comment). Here is a derivation:
http://mathworld.wolfram.com/NormalDifferenceDistribution.html
Here you are asking the absolute difference, based on whuber's answer and if we assume the difference in mean of X and Y is zero, it's just a half normal distribution with two times the variance (thanks Dilip for the comment).
|
Distribution of difference between two normal distributions
|
The distribution of a difference of two normally distributed variates X and Y is also a normal distribution, assuming X and Y are independent (thanks Mark for the comment). Here is a derivation:
http:
|
Distribution of difference between two normal distributions
The distribution of a difference of two normally distributed variates X and Y is also a normal distribution, assuming X and Y are independent (thanks Mark for the comment). Here is a derivation:
http://mathworld.wolfram.com/NormalDifferenceDistribution.html
Here you are asking the absolute difference, based on whuber's answer and if we assume the difference in mean of X and Y is zero, it's just a half normal distribution with two times the variance (thanks Dilip for the comment).
|
Distribution of difference between two normal distributions
The distribution of a difference of two normally distributed variates X and Y is also a normal distribution, assuming X and Y are independent (thanks Mark for the comment). Here is a derivation:
http:
|
9,413
|
The abundance of P values in absence of a hypothesis
|
Clearly I don't need to tell you what a p-value is, or why over-reliance on them is a problem; you apparently understand those things quite well enough already.
With publishing, you have two competing pressures.
The first - and one you should push for at every reasonable opportunity - is to do what makes sense.
The second, ultimately, is the need to actually publish. There's little gain if nobody sees your fine efforts at reforming terrible practice.
So instead of avoiding it altogether:
do it as little of such pointless activity as you can get away with that still gets it published
maybe include a mention of this recent Nature methods article[1] if you think it will help, or perhaps better one or more of the other references. It at least should help establish that there's some opposition to the primacy of p-values.
consider other journals, if another would be suitable
Is this the same in other disciplines?
The problem of over-use of p-values occurs in a number of disciplines (this can even be a problem when there is some hypothesis), but is much less common in some than others. Some disciplines do have issues with p-value-itis, and the problems that causes can eventually lead to somewhat overblown reactions[2] (and to a smaller extent, [1], and at least in some places, a few of the others as well).
I think there are a variety of reasons for it, but the over-reliance of p-values seems to acquire a momentum of its own - there's something about saying "significant" and rejecting a null that people seem to find very attractive; various disciplines (e.g. see [3][4][5][6][7][8][9][10][11]) have (with varying degrees of success) been fighting against the problem of over reliance on p-values (especially $\alpha$=0.05) for many years, and have made many different kinds of suggestions - not all of which I agree with, but I include a variety of views to give some sense of the different things people have had to say.
Some of them advocate focusing on confidence intervals, some advocate looking at effect sizes, some advocate Bayesian methods, some smaller p-values, some just on avoiding using p-values in particular ways, and so on. There are many different views on what to do instead, but between them there's a lot of material on problems with relying on p-values, at least the way it's pretty commonly done.
See those references for many further references in turn. This is just a sampling - many dozens more references can be found. A few authors give reasons why they think p-values are prevalent.
Some of these references may be useful if you do want to argue the point with an editor.
[1] Halsey L.G., Curran-Everett D., Vowler S.L. & Drummond G.B. (2015),
"The fickle P value generates irreproducible results,"
Nature Methods 12, 179–185 doi:10.1038/nmeth.3288
http://www.nature.com/nmeth/journal/v12/n3/abs/nmeth.3288.html
[2] David Trafimow, D. and Marks, M. (2015),
Editorial,
Basic and Applied Social Psychology, 37:1–2
http://www.tandfonline.com/loi/hbas20
DOI: 10.1080/01973533.2015.1012991
[3] Cohen, J. (1990),
Things I have learned (so far),
American Psychologist, 45(12), 1304–1312.
[4] Cohen, J. (1994),
The earth is round (p < .05),
American Psychologist, 49(12), 997–1003.
[5] Valen E. Johnson (2013),
Revised standards for statistical evidence
PNAS, vol. 110, no. 48, 19313–19317
http://www.pnas.org/content/110/48/19313.full.pdf
[6] Kruschke J.K. (2010),
What to believe: Bayesian methods for data analysis,
Trends in cognitive sciences 14(7), 293-300
[7] Ioannidis, J. (2005)
Why Most Published Research Findings Are False,
PLoS Med. Aug; 2(8): e124.
doi: 10.1371/journal.pmed.0020124
[8] Gelman, A. (2013),
P Values and Statistical Practice,
EpidemiologyVol.24, No. 1, January, 69-72
[9] Gelman, A. (2013),
"The problem with p-values is how they're used",
(Discussion of “In defense of P-values,” by Paul Murtaugh, for Ecology)
unpublished
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.300.9053
http://www.stat.columbia.edu/~gelman/research/unpublished/murtaugh2.pdf
[10] Nuzzo R. (2014),
Statistical errors: P values, the 'gold standard' of statistical validity, are not as reliable as many scientists assume,
News and Comment,
Nature, Vol. 506 (13), 150-152
[11] Wagenmakers E, (2007)
A practical solution to the pervasive problems of p values,
Psychonomic Bulletin & Review 14(5), 779-804
|
The abundance of P values in absence of a hypothesis
|
Clearly I don't need to tell you what a p-value is, or why over-reliance on them is a problem; you apparently understand those things quite well enough already.
With publishing, you have two competing
|
The abundance of P values in absence of a hypothesis
Clearly I don't need to tell you what a p-value is, or why over-reliance on them is a problem; you apparently understand those things quite well enough already.
With publishing, you have two competing pressures.
The first - and one you should push for at every reasonable opportunity - is to do what makes sense.
The second, ultimately, is the need to actually publish. There's little gain if nobody sees your fine efforts at reforming terrible practice.
So instead of avoiding it altogether:
do it as little of such pointless activity as you can get away with that still gets it published
maybe include a mention of this recent Nature methods article[1] if you think it will help, or perhaps better one or more of the other references. It at least should help establish that there's some opposition to the primacy of p-values.
consider other journals, if another would be suitable
Is this the same in other disciplines?
The problem of over-use of p-values occurs in a number of disciplines (this can even be a problem when there is some hypothesis), but is much less common in some than others. Some disciplines do have issues with p-value-itis, and the problems that causes can eventually lead to somewhat overblown reactions[2] (and to a smaller extent, [1], and at least in some places, a few of the others as well).
I think there are a variety of reasons for it, but the over-reliance of p-values seems to acquire a momentum of its own - there's something about saying "significant" and rejecting a null that people seem to find very attractive; various disciplines (e.g. see [3][4][5][6][7][8][9][10][11]) have (with varying degrees of success) been fighting against the problem of over reliance on p-values (especially $\alpha$=0.05) for many years, and have made many different kinds of suggestions - not all of which I agree with, but I include a variety of views to give some sense of the different things people have had to say.
Some of them advocate focusing on confidence intervals, some advocate looking at effect sizes, some advocate Bayesian methods, some smaller p-values, some just on avoiding using p-values in particular ways, and so on. There are many different views on what to do instead, but between them there's a lot of material on problems with relying on p-values, at least the way it's pretty commonly done.
See those references for many further references in turn. This is just a sampling - many dozens more references can be found. A few authors give reasons why they think p-values are prevalent.
Some of these references may be useful if you do want to argue the point with an editor.
[1] Halsey L.G., Curran-Everett D., Vowler S.L. & Drummond G.B. (2015),
"The fickle P value generates irreproducible results,"
Nature Methods 12, 179–185 doi:10.1038/nmeth.3288
http://www.nature.com/nmeth/journal/v12/n3/abs/nmeth.3288.html
[2] David Trafimow, D. and Marks, M. (2015),
Editorial,
Basic and Applied Social Psychology, 37:1–2
http://www.tandfonline.com/loi/hbas20
DOI: 10.1080/01973533.2015.1012991
[3] Cohen, J. (1990),
Things I have learned (so far),
American Psychologist, 45(12), 1304–1312.
[4] Cohen, J. (1994),
The earth is round (p < .05),
American Psychologist, 49(12), 997–1003.
[5] Valen E. Johnson (2013),
Revised standards for statistical evidence
PNAS, vol. 110, no. 48, 19313–19317
http://www.pnas.org/content/110/48/19313.full.pdf
[6] Kruschke J.K. (2010),
What to believe: Bayesian methods for data analysis,
Trends in cognitive sciences 14(7), 293-300
[7] Ioannidis, J. (2005)
Why Most Published Research Findings Are False,
PLoS Med. Aug; 2(8): e124.
doi: 10.1371/journal.pmed.0020124
[8] Gelman, A. (2013),
P Values and Statistical Practice,
EpidemiologyVol.24, No. 1, January, 69-72
[9] Gelman, A. (2013),
"The problem with p-values is how they're used",
(Discussion of “In defense of P-values,” by Paul Murtaugh, for Ecology)
unpublished
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.300.9053
http://www.stat.columbia.edu/~gelman/research/unpublished/murtaugh2.pdf
[10] Nuzzo R. (2014),
Statistical errors: P values, the 'gold standard' of statistical validity, are not as reliable as many scientists assume,
News and Comment,
Nature, Vol. 506 (13), 150-152
[11] Wagenmakers E, (2007)
A practical solution to the pervasive problems of p values,
Psychonomic Bulletin & Review 14(5), 779-804
|
The abundance of P values in absence of a hypothesis
Clearly I don't need to tell you what a p-value is, or why over-reliance on them is a problem; you apparently understand those things quite well enough already.
With publishing, you have two competing
|
9,414
|
The abundance of P values in absence of a hypothesis
|
The p-value, or more generally, null-hypothesis significance testing (NHST), is slowly holding less and less value. So much so that is has started to get banned in journals.
Most people don't understand what the p-value really tells us and why it tells us this, even though it is used everywhere.
The problem is that the p-value tells us $P(\text{Data}\,\vert\, H_0)$ and not $P(H_0\,\vert\,\text{Data})$, which is the more informative one. The latter involves the use the Bayesian inference, and provides a stronger basis for conclusions of model checking.
The probability of the $H_0$ model being true/significant, given the data we have observed, has stronger implications than the probability of our data fitting the $H_0$ model.
|
The abundance of P values in absence of a hypothesis
|
The p-value, or more generally, null-hypothesis significance testing (NHST), is slowly holding less and less value. So much so that is has started to get banned in journals.
Most people don't understa
|
The abundance of P values in absence of a hypothesis
The p-value, or more generally, null-hypothesis significance testing (NHST), is slowly holding less and less value. So much so that is has started to get banned in journals.
Most people don't understand what the p-value really tells us and why it tells us this, even though it is used everywhere.
The problem is that the p-value tells us $P(\text{Data}\,\vert\, H_0)$ and not $P(H_0\,\vert\,\text{Data})$, which is the more informative one. The latter involves the use the Bayesian inference, and provides a stronger basis for conclusions of model checking.
The probability of the $H_0$ model being true/significant, given the data we have observed, has stronger implications than the probability of our data fitting the $H_0$ model.
|
The abundance of P values in absence of a hypothesis
The p-value, or more generally, null-hypothesis significance testing (NHST), is slowly holding less and less value. So much so that is has started to get banned in journals.
Most people don't understa
|
9,415
|
The abundance of P values in absence of a hypothesis
|
Is this the same in other disciplines? What is the reason for the obsession with p values?
Greenwald et al. (1996) attempt to deal with this question regarding psychology. As to also applying NHST to baseline differences, presumably the editors will (rightly or wrongly) decide that "non-significant" baseline differences cannot explain the results, while "significant" ones may explain the results. This is similar to "Reason 1" offered by Greenwald et al. :
Why Does NHT Remain Popular?
"Why does NHT not succumb to criticism? For lack of a better answer, it
is tempting to credit the persistence of NHT to behavioral scientists'
lack of character. Behavioral scientists' unwillingness to renounce
the guilty pleasure of obtaining possibly spurious null hypothesis
rejections may be like a drinker's unwillingness to renounce the habit
of a pre-dinner cocktail..."
Reason I: HT Provides a Dichotomous Outcome
"Because of widespread adoption of the convention that p < .05
translates to "statistically significant," NHT can be used to yield a
dichotomous answer (reject or don't reject) to a question about a null
hypothesis. This may often be regarded as a useful answer for
theoretical questions that are stated in terms of a direction of
prediction rather than in terms of the expected value of a parameter..."
Reason 2: p Value as a Meaningful Common- Language Translation for Test Statistics
"Unlike anything that can be perceived so directly from t, F, or r
values (with their associated df ), a p value's measure of surprise is
simply captured by the number of consecutive zeros to the right of its
decimal point..."
Reason 3: p Value Provides a Measure of Confidence" in Replicability of Null Hypothesis Rejections
"[U]nlike an effect size (or a confidence interval), a p value resulting
from NHT is monotonically related to an estimate of a non-null
finding's replicability. In this statement, replicability (which is
defined more formally just below) is intended only in its NHT sense of
repeating the reject-nonreject conclusion and not in its estimation
sense of proximity between point or interval estimates."
Effect sizes and p values: What should be reported and what should be replicated? ANTHONY G. GREENWALD, RICHARD GONZALEZ, RICHARD J. HARRIS, AND DONALD GUTHRIE. Psychophysiology, 33 (1996). 175-183. Cambridge University Press. Printed in the USA. Copyright O 1996 Society for Psychophysiological Research
|
The abundance of P values in absence of a hypothesis
|
Is this the same in other disciplines? What is the reason for the obsession with p values?
Greenwald et al. (1996) attempt to deal with this question regarding psychology. As to also applying NHST to
|
The abundance of P values in absence of a hypothesis
Is this the same in other disciplines? What is the reason for the obsession with p values?
Greenwald et al. (1996) attempt to deal with this question regarding psychology. As to also applying NHST to baseline differences, presumably the editors will (rightly or wrongly) decide that "non-significant" baseline differences cannot explain the results, while "significant" ones may explain the results. This is similar to "Reason 1" offered by Greenwald et al. :
Why Does NHT Remain Popular?
"Why does NHT not succumb to criticism? For lack of a better answer, it
is tempting to credit the persistence of NHT to behavioral scientists'
lack of character. Behavioral scientists' unwillingness to renounce
the guilty pleasure of obtaining possibly spurious null hypothesis
rejections may be like a drinker's unwillingness to renounce the habit
of a pre-dinner cocktail..."
Reason I: HT Provides a Dichotomous Outcome
"Because of widespread adoption of the convention that p < .05
translates to "statistically significant," NHT can be used to yield a
dichotomous answer (reject or don't reject) to a question about a null
hypothesis. This may often be regarded as a useful answer for
theoretical questions that are stated in terms of a direction of
prediction rather than in terms of the expected value of a parameter..."
Reason 2: p Value as a Meaningful Common- Language Translation for Test Statistics
"Unlike anything that can be perceived so directly from t, F, or r
values (with their associated df ), a p value's measure of surprise is
simply captured by the number of consecutive zeros to the right of its
decimal point..."
Reason 3: p Value Provides a Measure of Confidence" in Replicability of Null Hypothesis Rejections
"[U]nlike an effect size (or a confidence interval), a p value resulting
from NHT is monotonically related to an estimate of a non-null
finding's replicability. In this statement, replicability (which is
defined more formally just below) is intended only in its NHT sense of
repeating the reject-nonreject conclusion and not in its estimation
sense of proximity between point or interval estimates."
Effect sizes and p values: What should be reported and what should be replicated? ANTHONY G. GREENWALD, RICHARD GONZALEZ, RICHARD J. HARRIS, AND DONALD GUTHRIE. Psychophysiology, 33 (1996). 175-183. Cambridge University Press. Printed in the USA. Copyright O 1996 Society for Psychophysiological Research
|
The abundance of P values in absence of a hypothesis
Is this the same in other disciplines? What is the reason for the obsession with p values?
Greenwald et al. (1996) attempt to deal with this question regarding psychology. As to also applying NHST to
|
9,416
|
The abundance of P values in absence of a hypothesis
|
P-values give information about differences between two groups of results ("treatment" vs "control", "A" vs "B", etc.) that sample from two populations. The nature of the difference is formalized in the statement of hypotheses -- e.g. "mean of A is greater than mean of B". Low p-values suggest that the differences are not due to random variation, while high p-values suggest that differences in the two samples cannot be distinguished from differences that might arise simply from random variation. What is "low" or "high" for a p-value has historically been a matter of convention and taste rather than established by rigorous logic or analysis of evidence.
A prerequisite for using p-values is that the two groups of results are really comparable, namely that the only source of difference between them is related to variable you are evaluating. As a exaggerated example, imagine that you have statistics on two diseases in two time periods -- A: mortality from cholera among men in British prisons 1920-1930, and B: infection by malaria in Nigeria 1960-1970. Computing a p-value from these two sets of data would be rather absurd. Now, if A: mortality from cholera among men in British prisons who are not treated vs. B: mortality from cholera among men in British prisons treated with re-hydration, then you have the basis for a solid statistical hypothesis.
Most often this is accomplished through careful experiment design, or careful survey design, or careful collection of historical data, etc. Also, the differences between the two results must be formalized into hypotheses statements involving sample statistics -- often sample means, but could also be sample variances, or other sample statistics. It's also possible to create hypotheses statements comparing the two sample distributions as a whole, using stochastic dominance. These are rare.
The controversy over p-values centers on "what is really significant" for research? This is where effect sizes come in. Basically, effect size is the magnitude of the difference between the two groups. It's possible to have high statistical significance (low p-value -> not due to random variation) but also low effect size (very little difference in magnitude). When effect sizes are very large, then allowing somewhat high p-values may be OK.
Most disciplines are now moving very strongly toward reporting effect sizes, and reducing or minimizing the role of p-values. They also encourage more descriptive statistics about the sample distributions. Some approaches, including Bayesian Statistics, do away with p-values all together.
My answer is condensed and simplified. There are many articles on this topic you can consult for more details, justifications, and specifics, including these:
Using Effect Size—or Why the P Value Is Not Enough
Effect sizes and p-values: what should be replicated and what should be reported
It's the Effect Size, Stupid
|
The abundance of P values in absence of a hypothesis
|
P-values give information about differences between two groups of results ("treatment" vs "control", "A" vs "B", etc.) that sample from two populations. The nature of the difference is formalized in
|
The abundance of P values in absence of a hypothesis
P-values give information about differences between two groups of results ("treatment" vs "control", "A" vs "B", etc.) that sample from two populations. The nature of the difference is formalized in the statement of hypotheses -- e.g. "mean of A is greater than mean of B". Low p-values suggest that the differences are not due to random variation, while high p-values suggest that differences in the two samples cannot be distinguished from differences that might arise simply from random variation. What is "low" or "high" for a p-value has historically been a matter of convention and taste rather than established by rigorous logic or analysis of evidence.
A prerequisite for using p-values is that the two groups of results are really comparable, namely that the only source of difference between them is related to variable you are evaluating. As a exaggerated example, imagine that you have statistics on two diseases in two time periods -- A: mortality from cholera among men in British prisons 1920-1930, and B: infection by malaria in Nigeria 1960-1970. Computing a p-value from these two sets of data would be rather absurd. Now, if A: mortality from cholera among men in British prisons who are not treated vs. B: mortality from cholera among men in British prisons treated with re-hydration, then you have the basis for a solid statistical hypothesis.
Most often this is accomplished through careful experiment design, or careful survey design, or careful collection of historical data, etc. Also, the differences between the two results must be formalized into hypotheses statements involving sample statistics -- often sample means, but could also be sample variances, or other sample statistics. It's also possible to create hypotheses statements comparing the two sample distributions as a whole, using stochastic dominance. These are rare.
The controversy over p-values centers on "what is really significant" for research? This is where effect sizes come in. Basically, effect size is the magnitude of the difference between the two groups. It's possible to have high statistical significance (low p-value -> not due to random variation) but also low effect size (very little difference in magnitude). When effect sizes are very large, then allowing somewhat high p-values may be OK.
Most disciplines are now moving very strongly toward reporting effect sizes, and reducing or minimizing the role of p-values. They also encourage more descriptive statistics about the sample distributions. Some approaches, including Bayesian Statistics, do away with p-values all together.
My answer is condensed and simplified. There are many articles on this topic you can consult for more details, justifications, and specifics, including these:
Using Effect Size—or Why the P Value Is Not Enough
Effect sizes and p-values: what should be replicated and what should be reported
It's the Effect Size, Stupid
|
The abundance of P values in absence of a hypothesis
P-values give information about differences between two groups of results ("treatment" vs "control", "A" vs "B", etc.) that sample from two populations. The nature of the difference is formalized in
|
9,417
|
The abundance of P values in absence of a hypothesis
|
"So a laymen like myself expects to not find any p values where there are no hypothesis."
Implicitly, the OP says that in the specific Table he presents, there are no hypotheses that accompany the reported p-values. Just to clear away this small confusion, there certainly are null hypotheses, but they are rather... indirectly mentioned (for economy of space, I presume).
The "p-value" is a conditional probability, say, for a "right-tail" test,
$$\text{p-val} \equiv P(T\geq t(S) \mid H_0) = 1-F_{T|H_0}(t(S) \mid H_0)$$
where $T$ is the statistic used, $F_{T|H_0}(t \mid H_0)$ is the cummulative distribution function that characterizes the probabilities related to $T$ conditional on $H_0$ being true, and $t(S)$ is the value of $T$ obtained by the use of the sample at hand. Obviously, for the test to be meaningful, it must be the case that the statistic $T$ is such and the null hypothesis $H_0$ is such that the distribution of $T$ conditional on $H_0$ being true, is different (or differently parametrized, when they both belong to the same family) from its distribution conditional on $H_0$ not being true.
So a p-value cannot even be calculated if there is no null hypothesis, and whenever we see a p-value reported, somewhere there a null hypothesis lurks.
In the Table presented in the question we read
"All tests for differences across WHR tertiles..."
The null-hypothesis is "hidden" in this phrase: it is "No difference between WHR tertiles", (whatever a "WΗR tertile" is) expressed in its mathematical form which here appears to be a difference of two magnitudes being set equal to zero.
|
The abundance of P values in absence of a hypothesis
|
"So a laymen like myself expects to not find any p values where there are no hypothesis."
Implicitly, the OP says that in the specific Table he presents, there are no hypotheses that accompany the re
|
The abundance of P values in absence of a hypothesis
"So a laymen like myself expects to not find any p values where there are no hypothesis."
Implicitly, the OP says that in the specific Table he presents, there are no hypotheses that accompany the reported p-values. Just to clear away this small confusion, there certainly are null hypotheses, but they are rather... indirectly mentioned (for economy of space, I presume).
The "p-value" is a conditional probability, say, for a "right-tail" test,
$$\text{p-val} \equiv P(T\geq t(S) \mid H_0) = 1-F_{T|H_0}(t(S) \mid H_0)$$
where $T$ is the statistic used, $F_{T|H_0}(t \mid H_0)$ is the cummulative distribution function that characterizes the probabilities related to $T$ conditional on $H_0$ being true, and $t(S)$ is the value of $T$ obtained by the use of the sample at hand. Obviously, for the test to be meaningful, it must be the case that the statistic $T$ is such and the null hypothesis $H_0$ is such that the distribution of $T$ conditional on $H_0$ being true, is different (or differently parametrized, when they both belong to the same family) from its distribution conditional on $H_0$ not being true.
So a p-value cannot even be calculated if there is no null hypothesis, and whenever we see a p-value reported, somewhere there a null hypothesis lurks.
In the Table presented in the question we read
"All tests for differences across WHR tertiles..."
The null-hypothesis is "hidden" in this phrase: it is "No difference between WHR tertiles", (whatever a "WΗR tertile" is) expressed in its mathematical form which here appears to be a difference of two magnitudes being set equal to zero.
|
The abundance of P values in absence of a hypothesis
"So a laymen like myself expects to not find any p values where there are no hypothesis."
Implicitly, the OP says that in the specific Table he presents, there are no hypotheses that accompany the re
|
9,418
|
The abundance of P values in absence of a hypothesis
|
I got curious and read the paper that OP gave as an example: Abdominal obesity increases the risk of hip fracture. I am not a medical researcher and normally do not read medicine papers.
I was surprised to see that the ONLY place where this paper uses $p$-values is the caption of Table 1 that OP reproduced in the question body.
To me it does not look like an "abundance" of $p$-values at all! I am used to neuroscience papers, where different groups of subjects (humans, mice, flies, neurons, tissue samples, etc.) get differently treated or measured in different conditions, and papers usually revolve around the differences between groups. These differences are always assessed with $p$-values, so a paper can have dozens and dozens of them reported in the main text. At times, this really does look like "an abundance". This approach is often (sometimes rightly and sometimes wrongly) criticized for various reasons, see an answer by @Glen_b (+1) and further links.
However, this paper does not do anything like that and only reports $p$-values basically in the introduction, when different characteristics of the cohort are reported. I don't understand what the $p$-values are doing there, and so yes, I agree that they are out of place. However, I don't understand what this whole table is doing there either! I find this table rather confusing (why tertiles? why tertiles of WHR? where is the actual variable of interest, the hip fracture rate?) and it does not seem to be used for any actual analysis further on. This whole table could be kicked out of the text without much loss, together with the $p$-values.
As I do not see any abundance of $p$-values in this paper, I am somewhat confused by the question.
It sounds as if the question is specifically referring to such descriptive tables. If so, this is some weird (but mostly harmless?) practice in medical journals, surviving due to tradition.
P.S. By the way, the main analysis of this paper (that does not involve any $p$-values) looks weird to me. The goal of the study is "to examine [...] the relationship between waist circumference (WC), hip circumference (HC), waist/hip ratio (WHR) and BMI to incident hip fracture", while controlling for various possible covariates. Sample size is huge ($n=43000$). What I would do, is to put all predictors into one regression model with an elastic net penalty, select the regularization parameters via cross-validation, and then look at what predictors have non-zero coefficients. Or something similar. The authors, instead, do some ad hoc modeling.
|
The abundance of P values in absence of a hypothesis
|
I got curious and read the paper that OP gave as an example: Abdominal obesity increases the risk of hip fracture. I am not a medical researcher and normally do not read medicine papers.
I was surpris
|
The abundance of P values in absence of a hypothesis
I got curious and read the paper that OP gave as an example: Abdominal obesity increases the risk of hip fracture. I am not a medical researcher and normally do not read medicine papers.
I was surprised to see that the ONLY place where this paper uses $p$-values is the caption of Table 1 that OP reproduced in the question body.
To me it does not look like an "abundance" of $p$-values at all! I am used to neuroscience papers, where different groups of subjects (humans, mice, flies, neurons, tissue samples, etc.) get differently treated or measured in different conditions, and papers usually revolve around the differences between groups. These differences are always assessed with $p$-values, so a paper can have dozens and dozens of them reported in the main text. At times, this really does look like "an abundance". This approach is often (sometimes rightly and sometimes wrongly) criticized for various reasons, see an answer by @Glen_b (+1) and further links.
However, this paper does not do anything like that and only reports $p$-values basically in the introduction, when different characteristics of the cohort are reported. I don't understand what the $p$-values are doing there, and so yes, I agree that they are out of place. However, I don't understand what this whole table is doing there either! I find this table rather confusing (why tertiles? why tertiles of WHR? where is the actual variable of interest, the hip fracture rate?) and it does not seem to be used for any actual analysis further on. This whole table could be kicked out of the text without much loss, together with the $p$-values.
As I do not see any abundance of $p$-values in this paper, I am somewhat confused by the question.
It sounds as if the question is specifically referring to such descriptive tables. If so, this is some weird (but mostly harmless?) practice in medical journals, surviving due to tradition.
P.S. By the way, the main analysis of this paper (that does not involve any $p$-values) looks weird to me. The goal of the study is "to examine [...] the relationship between waist circumference (WC), hip circumference (HC), waist/hip ratio (WHR) and BMI to incident hip fracture", while controlling for various possible covariates. Sample size is huge ($n=43000$). What I would do, is to put all predictors into one regression model with an elastic net penalty, select the regularization parameters via cross-validation, and then look at what predictors have non-zero coefficients. Or something similar. The authors, instead, do some ad hoc modeling.
|
The abundance of P values in absence of a hypothesis
I got curious and read the paper that OP gave as an example: Abdominal obesity increases the risk of hip fracture. I am not a medical researcher and normally do not read medicine papers.
I was surpris
|
9,419
|
The abundance of P values in absence of a hypothesis
|
The level of statistical peer-review is not as high as one would think from my experience. For all applied papers I have worked on, all of the statistical comments came from experts in the applied field and not from statisticians. For "top" journals, although there is greater scrutiny, it is not uncommon to see results that have serious faults. I think this is partly because the field of statistics can be difficult (as can be seen by disagreements between many of its great minds).
Second, readers in a field expect to see things in a certain way. In one recent experience, I plotted probabilities from a model, but this was shot down because my collaborator guessed correctly this his readers would be more comfortable with a barplot of raw data. In sum, many readers expect to see p-values alongside a table of baseline characteristics.
Unrelated to your direct question, but perhaps relevant: p-values are used in almost every text using frequentist or likelihood methods. The authors often have made tremendous contributions and have thought deeply about statistics. Although abused by experimentalists, surely they have a place in statistics.
|
The abundance of P values in absence of a hypothesis
|
The level of statistical peer-review is not as high as one would think from my experience. For all applied papers I have worked on, all of the statistical comments came from experts in the applied fi
|
The abundance of P values in absence of a hypothesis
The level of statistical peer-review is not as high as one would think from my experience. For all applied papers I have worked on, all of the statistical comments came from experts in the applied field and not from statisticians. For "top" journals, although there is greater scrutiny, it is not uncommon to see results that have serious faults. I think this is partly because the field of statistics can be difficult (as can be seen by disagreements between many of its great minds).
Second, readers in a field expect to see things in a certain way. In one recent experience, I plotted probabilities from a model, but this was shot down because my collaborator guessed correctly this his readers would be more comfortable with a barplot of raw data. In sum, many readers expect to see p-values alongside a table of baseline characteristics.
Unrelated to your direct question, but perhaps relevant: p-values are used in almost every text using frequentist or likelihood methods. The authors often have made tremendous contributions and have thought deeply about statistics. Although abused by experimentalists, surely they have a place in statistics.
|
The abundance of P values in absence of a hypothesis
The level of statistical peer-review is not as high as one would think from my experience. For all applied papers I have worked on, all of the statistical comments came from experts in the applied fi
|
9,420
|
The abundance of P values in absence of a hypothesis
|
I have to read medical articles often and I feel that the pendulum seems to be swinging from one extreme to another, rather than staying in the central balanced zone.
Following approach seems to work well. If the P value is small, the observed difference is unlikely to be by chance alone. We should, hence, look at the magnitude of the difference and decide whether it is of any practical significance. Very small P values occur with large sample sizes even with very small differences which may be of no practical relevance.
Not including P values in the table of baseline data may be disadvantageous. So if in a study there are two groups with mean ages are 54 and 59 years, I want to know if this difference can be by chance alone. If P is small then I think whether this 5 year difference in 2 groups can affect the results of the study. If P is not small, I do not have to address this question.
Problem occurs if one relies solely on the P value and not check the magnitude of the difference (for example, simple percent change). Some feel that P values should be totally omitted so that only the difference remains and is seen. A balanced solution would be to emphasize on evaluating both these and not to just throw away the P value, which has a limited but 'significant' meaning. The effect size is also likely to correlate closely with P value (just like confidence intervals) and it is also unlikely to completely displace P values from the statistical landscape. As mentioned in following article, there are many virtues of null hypothesis testing because of which it remains popular:
ANTHONY G. GREENWALD, RICHARD GONZALEZ, RICHARD J. HARRIS, AND DONALD GUTHRIE
Effect sizes and p values: What should be reported and what should be replicated?
Psychophysiology, 33 (1996). 175-183.
|
The abundance of P values in absence of a hypothesis
|
I have to read medical articles often and I feel that the pendulum seems to be swinging from one extreme to another, rather than staying in the central balanced zone.
Following approach seems to work
|
The abundance of P values in absence of a hypothesis
I have to read medical articles often and I feel that the pendulum seems to be swinging from one extreme to another, rather than staying in the central balanced zone.
Following approach seems to work well. If the P value is small, the observed difference is unlikely to be by chance alone. We should, hence, look at the magnitude of the difference and decide whether it is of any practical significance. Very small P values occur with large sample sizes even with very small differences which may be of no practical relevance.
Not including P values in the table of baseline data may be disadvantageous. So if in a study there are two groups with mean ages are 54 and 59 years, I want to know if this difference can be by chance alone. If P is small then I think whether this 5 year difference in 2 groups can affect the results of the study. If P is not small, I do not have to address this question.
Problem occurs if one relies solely on the P value and not check the magnitude of the difference (for example, simple percent change). Some feel that P values should be totally omitted so that only the difference remains and is seen. A balanced solution would be to emphasize on evaluating both these and not to just throw away the P value, which has a limited but 'significant' meaning. The effect size is also likely to correlate closely with P value (just like confidence intervals) and it is also unlikely to completely displace P values from the statistical landscape. As mentioned in following article, there are many virtues of null hypothesis testing because of which it remains popular:
ANTHONY G. GREENWALD, RICHARD GONZALEZ, RICHARD J. HARRIS, AND DONALD GUTHRIE
Effect sizes and p values: What should be reported and what should be replicated?
Psychophysiology, 33 (1996). 175-183.
|
The abundance of P values in absence of a hypothesis
I have to read medical articles often and I feel that the pendulum seems to be swinging from one extreme to another, rather than staying in the central balanced zone.
Following approach seems to work
|
9,421
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
Type III sum of squares for ANOVA are readily available through the Anova() function from the car package.
Contrast coding can be done in several ways, using C(), the contr.* family (as indicated by @nico), or directly the contrasts() function/argument. This is detailed in §6.2 (pp. 144-151) of Modern Applied Statistics with S (Springer, 2002, 4th ed.). Note that aov() is just a wrapper function for the lm() function. It is interesting when one wants to control the error term of the model (like in a within-subject design), but otherwise they both yield the same results (and whatever the way you fit your model, you still can output ANOVA or LM-like summaries with summary.aov or summary.lm).
I don't have SPSS to compare the two outputs, but something like
> library(car)
> sample.data <- data.frame(IV=factor(rep(1:4,each=20)),
DV=rep(c(-3,-3,1,3),each=20)+rnorm(80))
> Anova(lm1 <- lm(DV ~ IV, data=sample.data,
contrasts=list(IV=contr.poly)), type="III")
Anova Table (Type III tests)
Response: DV
Sum Sq Df F value Pr(>F)
(Intercept) 18.08 1 21.815 1.27e-05 ***
IV 567.05 3 228.046 < 2.2e-16 ***
Residuals 62.99 76
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
is worth to try in first instance.
About factor coding in R vs. SAS: R considers the baseline or reference level as the first level in lexicographic order, whereas SAS considers the last one. So, to get comparable results, either you have to use contr.SAS() or to relevel() your R factor.
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
Type III sum of squares for ANOVA are readily available through the Anova() function from the car package.
Contrast coding can be done in several ways, using C(), the contr.* family (as indicated by @
|
How does one do a Type-III SS ANOVA in R with contrast codes?
Type III sum of squares for ANOVA are readily available through the Anova() function from the car package.
Contrast coding can be done in several ways, using C(), the contr.* family (as indicated by @nico), or directly the contrasts() function/argument. This is detailed in §6.2 (pp. 144-151) of Modern Applied Statistics with S (Springer, 2002, 4th ed.). Note that aov() is just a wrapper function for the lm() function. It is interesting when one wants to control the error term of the model (like in a within-subject design), but otherwise they both yield the same results (and whatever the way you fit your model, you still can output ANOVA or LM-like summaries with summary.aov or summary.lm).
I don't have SPSS to compare the two outputs, but something like
> library(car)
> sample.data <- data.frame(IV=factor(rep(1:4,each=20)),
DV=rep(c(-3,-3,1,3),each=20)+rnorm(80))
> Anova(lm1 <- lm(DV ~ IV, data=sample.data,
contrasts=list(IV=contr.poly)), type="III")
Anova Table (Type III tests)
Response: DV
Sum Sq Df F value Pr(>F)
(Intercept) 18.08 1 21.815 1.27e-05 ***
IV 567.05 3 228.046 < 2.2e-16 ***
Residuals 62.99 76
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
is worth to try in first instance.
About factor coding in R vs. SAS: R considers the baseline or reference level as the first level in lexicographic order, whereas SAS considers the last one. So, to get comparable results, either you have to use contr.SAS() or to relevel() your R factor.
|
How does one do a Type-III SS ANOVA in R with contrast codes?
Type III sum of squares for ANOVA are readily available through the Anova() function from the car package.
Contrast coding can be done in several ways, using C(), the contr.* family (as indicated by @
|
9,422
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
This may look like a bit of self-promotion (and I suppose it is). But I developed an lsmeans package for R (available on CRAN) that is designed to handle exactly this sort of situation. Here is how it works for your example:
> sample.data <- data.frame(IV=rep(1:4,each=20),DV=rep(c(-3,-3,1,3),each=20)+rnorm(80))
> sample.aov <- aov(DV ~ factor(IV), data = sample.data)
> library("lsmeans")
> (sample.lsm <- lsmeans(sample.aov, "IV"))
IV lsmean SE df lower.CL upper.CL
1 -3.009669 0.2237448 76 -3.4552957 -2.564043
2 -3.046072 0.2237448 76 -3.4916980 -2.600445
3 1.147080 0.2237448 76 0.7014539 1.592707
4 3.049153 0.2237448 76 2.6035264 3.494779
> contrast(sample.lsm, list(mycon = c(-3,-1,1,3)))
contrast estimate SE df t.ratio p.value
mycon 22.36962 1.000617 76 22.356 <.0001
You could specify additional contrasts in the list if you like. For this example, you'll get the same results with the built-in linear polynomial contrast:
> con <- contrast(sample.lsm, "poly")
> con
contrast estimate SE df t.ratio p.value
linear 22.369618 1.0006172 76 22.356 <.0001
quadratic 1.938475 0.4474896 76 4.332 <.0001
cubic -6.520633 1.0006172 76 -6.517 <.0001
To confirm this, note that the "poly" specification directs it to call poly.lsmc, which produces these results:
> poly.lsmc(1:4)
linear quadratic cubic
1 -3 1 -1
2 -1 -1 3
3 1 -1 -3
4 3 1 1
If you wish to do a joint test of several contrasts, use the test function with joint = TRUE. For example,
> test(con, joint = TRUE)
This will produce a "type III" test. Unlike car::Anova(), it will do it correctly regardless of the contrast coding used in the model-fitting stage. This is because the linear functions being tested are specified directly rather than implicitly via model reduction. An additional feature is that a case where the contrasts being tested are linearly dependent is detected, and the correct test statistic and degrees of freedom are produced.
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
This may look like a bit of self-promotion (and I suppose it is). But I developed an lsmeans package for R (available on CRAN) that is designed to handle exactly this sort of situation. Here is how it
|
How does one do a Type-III SS ANOVA in R with contrast codes?
This may look like a bit of self-promotion (and I suppose it is). But I developed an lsmeans package for R (available on CRAN) that is designed to handle exactly this sort of situation. Here is how it works for your example:
> sample.data <- data.frame(IV=rep(1:4,each=20),DV=rep(c(-3,-3,1,3),each=20)+rnorm(80))
> sample.aov <- aov(DV ~ factor(IV), data = sample.data)
> library("lsmeans")
> (sample.lsm <- lsmeans(sample.aov, "IV"))
IV lsmean SE df lower.CL upper.CL
1 -3.009669 0.2237448 76 -3.4552957 -2.564043
2 -3.046072 0.2237448 76 -3.4916980 -2.600445
3 1.147080 0.2237448 76 0.7014539 1.592707
4 3.049153 0.2237448 76 2.6035264 3.494779
> contrast(sample.lsm, list(mycon = c(-3,-1,1,3)))
contrast estimate SE df t.ratio p.value
mycon 22.36962 1.000617 76 22.356 <.0001
You could specify additional contrasts in the list if you like. For this example, you'll get the same results with the built-in linear polynomial contrast:
> con <- contrast(sample.lsm, "poly")
> con
contrast estimate SE df t.ratio p.value
linear 22.369618 1.0006172 76 22.356 <.0001
quadratic 1.938475 0.4474896 76 4.332 <.0001
cubic -6.520633 1.0006172 76 -6.517 <.0001
To confirm this, note that the "poly" specification directs it to call poly.lsmc, which produces these results:
> poly.lsmc(1:4)
linear quadratic cubic
1 -3 1 -1
2 -1 -1 3
3 1 -1 -3
4 3 1 1
If you wish to do a joint test of several contrasts, use the test function with joint = TRUE. For example,
> test(con, joint = TRUE)
This will produce a "type III" test. Unlike car::Anova(), it will do it correctly regardless of the contrast coding used in the model-fitting stage. This is because the linear functions being tested are specified directly rather than implicitly via model reduction. An additional feature is that a case where the contrasts being tested are linearly dependent is detected, and the correct test statistic and degrees of freedom are produced.
|
How does one do a Type-III SS ANOVA in R with contrast codes?
This may look like a bit of self-promotion (and I suppose it is). But I developed an lsmeans package for R (available on CRAN) that is designed to handle exactly this sort of situation. Here is how it
|
9,423
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
You may want to have a look at this blog post:
Obtaining the same ANOVA results in R as in SPSS - the difficulties with Type II and Type III sums of squares
(Spoiler: add options(contrasts=c("contr.sum", "contr.poly")) at the beginning of your script)
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
You may want to have a look at this blog post:
Obtaining the same ANOVA results in R as in SPSS - the difficulties with Type II and Type III sums of squares
(Spoiler: add options(contrasts=c("contr.su
|
How does one do a Type-III SS ANOVA in R with contrast codes?
You may want to have a look at this blog post:
Obtaining the same ANOVA results in R as in SPSS - the difficulties with Type II and Type III sums of squares
(Spoiler: add options(contrasts=c("contr.sum", "contr.poly")) at the beginning of your script)
|
How does one do a Type-III SS ANOVA in R with contrast codes?
You may want to have a look at this blog post:
Obtaining the same ANOVA results in R as in SPSS - the difficulties with Type II and Type III sums of squares
(Spoiler: add options(contrasts=c("contr.su
|
9,424
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
When you are doing contrasts, you are doing a specific, stated linear combination of cell means within the context of the appropriate error term. As such, the concept of "Type of SS" is not meaningful with contrasts. Each contrast is essentially the first effect using a Type I SS. "Type of SS" has to do with what is partialled out or accounted for by the other terms. For contrasts, nothing is partialled out or accounted for. The contrast stands by itself.
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
When you are doing contrasts, you are doing a specific, stated linear combination of cell means within the context of the appropriate error term. As such, the concept of "Type of SS" is not meaningful
|
How does one do a Type-III SS ANOVA in R with contrast codes?
When you are doing contrasts, you are doing a specific, stated linear combination of cell means within the context of the appropriate error term. As such, the concept of "Type of SS" is not meaningful with contrasts. Each contrast is essentially the first effect using a Type I SS. "Type of SS" has to do with what is partialled out or accounted for by the other terms. For contrasts, nothing is partialled out or accounted for. The contrast stands by itself.
|
How does one do a Type-III SS ANOVA in R with contrast codes?
When you are doing contrasts, you are doing a specific, stated linear combination of cell means within the context of the appropriate error term. As such, the concept of "Type of SS" is not meaningful
|
9,425
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
The fact that type III tests are used in your place of work is the weakest of reasons to keep using them. SAS has done major damage to statistics in this regard. Bill Venables' exegesis, referenced above, is a great resource on this. Just say no to type III; it's based on a faulty notion of balance and has lower power because of silly weighting of cells in the imbalanced case.
A more natural and less error-prone way to get general contrasts, and to be able to describe what you did, is provided by the R rms package contrast.rms function. Contrasts can be very complex but to the user are very simple because they are stated in terms of differences in predictive values. Tests and simultaneous contrasts are supported. This handles nonlinear regression effects, nonlinear interaction effects, partial contrasts, all kinds of things.
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
The fact that type III tests are used in your place of work is the weakest of reasons to keep using them. SAS has done major damage to statistics in this regard. Bill Venables' exegesis, referenced
|
How does one do a Type-III SS ANOVA in R with contrast codes?
The fact that type III tests are used in your place of work is the weakest of reasons to keep using them. SAS has done major damage to statistics in this regard. Bill Venables' exegesis, referenced above, is a great resource on this. Just say no to type III; it's based on a faulty notion of balance and has lower power because of silly weighting of cells in the imbalanced case.
A more natural and less error-prone way to get general contrasts, and to be able to describe what you did, is provided by the R rms package contrast.rms function. Contrasts can be very complex but to the user are very simple because they are stated in terms of differences in predictive values. Tests and simultaneous contrasts are supported. This handles nonlinear regression effects, nonlinear interaction effects, partial contrasts, all kinds of things.
|
How does one do a Type-III SS ANOVA in R with contrast codes?
The fact that type III tests are used in your place of work is the weakest of reasons to keep using them. SAS has done major damage to statistics in this regard. Bill Venables' exegesis, referenced
|
9,426
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
Try the Anova command in the car library. Use the type="III" argument, as it defaults to type II. For example:
library(car)
mod <- lm(conformity ~ fcategory*partner.status, data=Moore, contrasts=list(fcategory=contr.sum, partner.status=contr.sum))
Anova(mod, type="III")
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
Try the Anova command in the car library. Use the type="III" argument, as it defaults to type II. For example:
library(car)
mod <- lm(conformity ~ fcategory*partner.status, data=Moore, contrasts=list
|
How does one do a Type-III SS ANOVA in R with contrast codes?
Try the Anova command in the car library. Use the type="III" argument, as it defaults to type II. For example:
library(car)
mod <- lm(conformity ~ fcategory*partner.status, data=Moore, contrasts=list(fcategory=contr.sum, partner.status=contr.sum))
Anova(mod, type="III")
|
How does one do a Type-III SS ANOVA in R with contrast codes?
Try the Anova command in the car library. Use the type="III" argument, as it defaults to type II. For example:
library(car)
mod <- lm(conformity ~ fcategory*partner.status, data=Moore, contrasts=list
|
9,427
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
Also self-promoting, I wrote a function for exactly this: https://github.com/samuelfranssens/type3anova
Install as follows:
library(devtools)
install_github(samuelfranssens/type3anova)
library(type3anova)
sample.data <- data.frame(IV=rep(1:4,each=20),DV=rep(c(-3,-3,1,3),each=20)+rnorm(80))
type3anova(lm(DV ~ IV, data = sample.data))
You will also need to have the car package installed.
|
How does one do a Type-III SS ANOVA in R with contrast codes?
|
Also self-promoting, I wrote a function for exactly this: https://github.com/samuelfranssens/type3anova
Install as follows:
library(devtools)
install_github(samuelfranssens/type3anova)
library(type3an
|
How does one do a Type-III SS ANOVA in R with contrast codes?
Also self-promoting, I wrote a function for exactly this: https://github.com/samuelfranssens/type3anova
Install as follows:
library(devtools)
install_github(samuelfranssens/type3anova)
library(type3anova)
sample.data <- data.frame(IV=rep(1:4,each=20),DV=rep(c(-3,-3,1,3),each=20)+rnorm(80))
type3anova(lm(DV ~ IV, data = sample.data))
You will also need to have the car package installed.
|
How does one do a Type-III SS ANOVA in R with contrast codes?
Also self-promoting, I wrote a function for exactly this: https://github.com/samuelfranssens/type3anova
Install as follows:
library(devtools)
install_github(samuelfranssens/type3anova)
library(type3an
|
9,428
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
Reasons to prefer zero-one coding of binary variables:
The mean of a zero-one variable represents the proportion in the category represented by the value one (e.g., the percentage of males).
In a simple regression $y = a + bx$ where $x$ is the zero-one variable, the constant has a straightforward interpretation (e.g., $a$ is the mean of $y$ for females).
Any coding of a binary variable where the difference between the two values is one (i.e., zero-one, but also one-two) gives a straightforward interpretation to the regression coefficient (e.g., $b$ is the effect of going from female to male on y).
Assorted points about coding binary variables:
Any coding of a binary variable that preserves the order of the categories (e.g., female = 0, male = 1; female = 1, male = 2; female = 1007, male =2000; etc.) will not affect the correlation of the binary variable with other variables.
Any tables that report a binary variable in this way should make it clear how the variable was coded. It can also be useful to label the variable by the category that represent the value of one: e.g., y = a + b * Male rather than y = a + b * Gender.
For some binary variables, one category more naturally should be coded as one. For example, when looking at the difference between treatment and control, control should be zero, and treatment should be one, because the regression coefficient is best thought of as the effect of the treatment.
Flipping the categories (e.g., making female = 1 and male = 0, rather than female = 0 and male = 1) will flip the sign of correlations and regression coefficients.
In the case of gender, there is typically no natural reason to code the variable female = 0, male = 1, versus male = 0, female = 1. However, convention may suggest one coding is more familiar to a reader; or choosing a coding that makes the regression coefficient positive may ease interpretation. Also, in some contexts, one gender may be thought of as the reference category; for example, if you were studying the effect of being female in a male dominated profession on income, it might make sense to code male = 0, and female = 1, in order to speak of the effect of being female.
Scaling regression coefficients in thoughtful ways can have a powerful effect on the interpretability of regression coefficients. Andrew Gelman discusses this quite a bit; see for example his 2008 paper Scaling regression inputs by dividing by two standard deviations (PDF) in Statistics in Medicine, 27, 2865-2873.
Coding male and female as -1 and +1 is another option that can provide meaningful coefficients (see "what is effect coding").
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
Reasons to prefer zero-one coding of binary variables:
The mean of a zero-one variable represents the proportion in the category represented by the value one (e.g., the percentage of males).
In a sim
|
Why is gender typically coded 0/1 rather than 1/2, for example?
Reasons to prefer zero-one coding of binary variables:
The mean of a zero-one variable represents the proportion in the category represented by the value one (e.g., the percentage of males).
In a simple regression $y = a + bx$ where $x$ is the zero-one variable, the constant has a straightforward interpretation (e.g., $a$ is the mean of $y$ for females).
Any coding of a binary variable where the difference between the two values is one (i.e., zero-one, but also one-two) gives a straightforward interpretation to the regression coefficient (e.g., $b$ is the effect of going from female to male on y).
Assorted points about coding binary variables:
Any coding of a binary variable that preserves the order of the categories (e.g., female = 0, male = 1; female = 1, male = 2; female = 1007, male =2000; etc.) will not affect the correlation of the binary variable with other variables.
Any tables that report a binary variable in this way should make it clear how the variable was coded. It can also be useful to label the variable by the category that represent the value of one: e.g., y = a + b * Male rather than y = a + b * Gender.
For some binary variables, one category more naturally should be coded as one. For example, when looking at the difference between treatment and control, control should be zero, and treatment should be one, because the regression coefficient is best thought of as the effect of the treatment.
Flipping the categories (e.g., making female = 1 and male = 0, rather than female = 0 and male = 1) will flip the sign of correlations and regression coefficients.
In the case of gender, there is typically no natural reason to code the variable female = 0, male = 1, versus male = 0, female = 1. However, convention may suggest one coding is more familiar to a reader; or choosing a coding that makes the regression coefficient positive may ease interpretation. Also, in some contexts, one gender may be thought of as the reference category; for example, if you were studying the effect of being female in a male dominated profession on income, it might make sense to code male = 0, and female = 1, in order to speak of the effect of being female.
Scaling regression coefficients in thoughtful ways can have a powerful effect on the interpretability of regression coefficients. Andrew Gelman discusses this quite a bit; see for example his 2008 paper Scaling regression inputs by dividing by two standard deviations (PDF) in Statistics in Medicine, 27, 2865-2873.
Coding male and female as -1 and +1 is another option that can provide meaningful coefficients (see "what is effect coding").
|
Why is gender typically coded 0/1 rather than 1/2, for example?
Reasons to prefer zero-one coding of binary variables:
The mean of a zero-one variable represents the proportion in the category represented by the value one (e.g., the percentage of males).
In a sim
|
9,429
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
It makes it easier to interpret the results. Suppose you had some height data:
Woman A: 165
Woman B: 170
Woman C: 175
Man D: 170
Man E: 180
Man F: 190
and you took a regression of the form Height = a + b * Gender + Residual.
With the 0,1 dummy variable you would get an estimate of a of 170 being the average height of the women and of b of 10 being the difference between the average heights of the men and the women.
With the 1,2 dummy variable you would get an estimate of a of 160 which is harder to interpret.
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
It makes it easier to interpret the results. Suppose you had some height data:
Woman A: 165
Woman B: 170
Woman C: 175
Man D: 170
Man E: 180
Man F: 190
and you took a regression of the form Height =
|
Why is gender typically coded 0/1 rather than 1/2, for example?
It makes it easier to interpret the results. Suppose you had some height data:
Woman A: 165
Woman B: 170
Woman C: 175
Man D: 170
Man E: 180
Man F: 190
and you took a regression of the form Height = a + b * Gender + Residual.
With the 0,1 dummy variable you would get an estimate of a of 170 being the average height of the women and of b of 10 being the difference between the average heights of the men and the women.
With the 1,2 dummy variable you would get an estimate of a of 160 which is harder to interpret.
|
Why is gender typically coded 0/1 rather than 1/2, for example?
It makes it easier to interpret the results. Suppose you had some height data:
Woman A: 165
Woman B: 170
Woman C: 175
Man D: 170
Man E: 180
Man F: 190
and you took a regression of the form Height =
|
9,430
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
I had a professor suggest that we code "biologically" with women being 0 and men being 1 - to reflect anatomy. I don't think it was the most sensitive, or PC thing to say in a class, but definitely easy to remember when looking at a dataset 5 years later.
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
I had a professor suggest that we code "biologically" with women being 0 and men being 1 - to reflect anatomy. I don't think it was the most sensitive, or PC thing to say in a class, but definitely ea
|
Why is gender typically coded 0/1 rather than 1/2, for example?
I had a professor suggest that we code "biologically" with women being 0 and men being 1 - to reflect anatomy. I don't think it was the most sensitive, or PC thing to say in a class, but definitely easy to remember when looking at a dataset 5 years later.
|
Why is gender typically coded 0/1 rather than 1/2, for example?
I had a professor suggest that we code "biologically" with women being 0 and men being 1 - to reflect anatomy. I don't think it was the most sensitive, or PC thing to say in a class, but definitely ea
|
9,431
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
I had assumed that this was because the field type often used to store gender is a bit field, and bit fields in SQL can only have the values 0 or 1. When you dump out the data, it comes out as 0 or 1, and so that's why you get those particular values.
If you wanted to use 1 and 2, you'd have to use a bigger field type, which would take up more space, and thus make the whole database slightly bigger.
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
I had assumed that this was because the field type often used to store gender is a bit field, and bit fields in SQL can only have the values 0 or 1. When you dump out the data, it comes out as 0 or 1,
|
Why is gender typically coded 0/1 rather than 1/2, for example?
I had assumed that this was because the field type often used to store gender is a bit field, and bit fields in SQL can only have the values 0 or 1. When you dump out the data, it comes out as 0 or 1, and so that's why you get those particular values.
If you wanted to use 1 and 2, you'd have to use a bigger field type, which would take up more space, and thus make the whole database slightly bigger.
|
Why is gender typically coded 0/1 rather than 1/2, for example?
I had assumed that this was because the field type often used to store gender is a bit field, and bit fields in SQL can only have the values 0 or 1. When you dump out the data, it comes out as 0 or 1,
|
9,432
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
Many good reasons posted so far, but it should also be reflexive. Why would you start counting at 1? It makes lots of numerical algorithms far more complicated. Labeling begins at 0, not 1. If you're not yet convinced of this, I have a nice example of why it's important at http://madhadron.com/?p=69
As for why women are 0 and men are 1, let's remember that for much of its history, a statistician was likely to be a straight male. When asked to name a sex, the first one to come to mind was 'woman'. Everything after that was probably historical accident and rationalization.
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
Many good reasons posted so far, but it should also be reflexive. Why would you start counting at 1? It makes lots of numerical algorithms far more complicated. Labeling begins at 0, not 1. If you
|
Why is gender typically coded 0/1 rather than 1/2, for example?
Many good reasons posted so far, but it should also be reflexive. Why would you start counting at 1? It makes lots of numerical algorithms far more complicated. Labeling begins at 0, not 1. If you're not yet convinced of this, I have a nice example of why it's important at http://madhadron.com/?p=69
As for why women are 0 and men are 1, let's remember that for much of its history, a statistician was likely to be a straight male. When asked to name a sex, the first one to come to mind was 'woman'. Everything after that was probably historical accident and rationalization.
|
Why is gender typically coded 0/1 rather than 1/2, for example?
Many good reasons posted so far, but it should also be reflexive. Why would you start counting at 1? It makes lots of numerical algorithms far more complicated. Labeling begins at 0, not 1. If you
|
9,433
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
The ISO/IEC 5218 standard updates this notion with the following map:
0 = not known,
1 = male,
2 = female,
9 = not applicable.
This is particularly useful in languages where 0 coerces to a false value, such as in JavaScript:
if ( !user.gender ) {
promptForGender();
}
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
The ISO/IEC 5218 standard updates this notion with the following map:
0 = not known,
1 = male,
2 = female,
9 = not applicable.
This is particularly useful in languages where 0 coerces to a false valu
|
Why is gender typically coded 0/1 rather than 1/2, for example?
The ISO/IEC 5218 standard updates this notion with the following map:
0 = not known,
1 = male,
2 = female,
9 = not applicable.
This is particularly useful in languages where 0 coerces to a false value, such as in JavaScript:
if ( !user.gender ) {
promptForGender();
}
|
Why is gender typically coded 0/1 rather than 1/2, for example?
The ISO/IEC 5218 standard updates this notion with the following map:
0 = not known,
1 = male,
2 = female,
9 = not applicable.
This is particularly useful in languages where 0 coerces to a false valu
|
9,434
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
The way I see it personally is phallically 0 typically represents female, as it is the shape of the womb, and considered to be feminine...in almost all sciences (i.e. in biology/genetics pedigree charts) circles, or zeros represent females. Where as more straight edge shapes (triangles, squares, or 1s) tend to represent the male gender. This simple understanding has made it easy to always remember which is which for me.
Although at the end of the day if you are the one coding and analyzing the data yourself you can put whatever numbers you want, generally as long as there is a key as to which dummy variable you used for which, it becomes irrelevant.
|
Why is gender typically coded 0/1 rather than 1/2, for example?
|
The way I see it personally is phallically 0 typically represents female, as it is the shape of the womb, and considered to be feminine...in almost all sciences (i.e. in biology/genetics pedigree char
|
Why is gender typically coded 0/1 rather than 1/2, for example?
The way I see it personally is phallically 0 typically represents female, as it is the shape of the womb, and considered to be feminine...in almost all sciences (i.e. in biology/genetics pedigree charts) circles, or zeros represent females. Where as more straight edge shapes (triangles, squares, or 1s) tend to represent the male gender. This simple understanding has made it easy to always remember which is which for me.
Although at the end of the day if you are the one coding and analyzing the data yourself you can put whatever numbers you want, generally as long as there is a key as to which dummy variable you used for which, it becomes irrelevant.
|
Why is gender typically coded 0/1 rather than 1/2, for example?
The way I see it personally is phallically 0 typically represents female, as it is the shape of the womb, and considered to be feminine...in almost all sciences (i.e. in biology/genetics pedigree char
|
9,435
|
In simple linear regression, where does the formula for the variance of the residuals come from?
|
The intuition about the "plus" signs related to the variance (from the fact that even when we calculate the variance of a difference of independent random variables, we add their variances) is correct but fatally incomplete: if the random variables involved are not independent, then covariances are also involved -and covariances may be negative. There exists an expression that is almost like the expression in the question was thought that it "should" be by the OP (and me), and it is the variance of the prediction error, denote it $e^0 = y^0 - \hat y^0$, where $y^0 = \beta_0+\beta_1x^0+u^0$:
$$\text{Var}(e^0) = \sigma^2\cdot \left(1 + \frac 1n + \frac {(x^0-\bar x)^2}{S_{xx}}\right)$$
The critical difference between the variance of the prediction error and the variance of the estimation error (i.e. of the residual), is that the error term of the predicted observation is not correlated with the estimator, since the value $y^0$ was not used in constructing the estimator and calculating the estimates, being an out-of-sample value.
The algebra for both proceeds in exactly the same way up to a point (using $^0$ instead of $_i$), but then diverges. Specifically:
In the simple linear regression $y_i = \beta_0 + \beta_1x_i + u_i$, $\text{Var}(u_i)=\sigma^2$, the variance of the estimator $\hat \beta = (\hat \beta_0, \hat \beta_1)'$ is still
$$\text{Var}(\hat \beta) = \sigma^2 \left(\mathbf X' \mathbf X\right)^{-1}$$
We have
$$\mathbf X' \mathbf X= \left[ \begin{matrix}
n & \sum x_i\\
\sum x_i & \sum x_i^2 \end{matrix}\right]$$
and so
$$\left(\mathbf X' \mathbf X\right)^{-1}= \left[ \begin{matrix}
\sum x_i^2 & -\sum x_i\\
-\sum x_i & n \end{matrix}\right]\cdot \left[n\sum x_i^2-\left(\sum x_i\right)^2\right]^{-1}$$
We have
$$\left[n\sum x_i^2-\left(\sum x_i\right)^2\right] = \left[n\sum x_i^2-n^2\bar x^2\right] = n\left[\sum x_i^2-n\bar x^2\right] \\= n\sum (x_i^2-\bar x^2) \equiv nS_{xx}$$
So
$$\left(\mathbf X' \mathbf X\right)^{-1}= \left[ \begin{matrix}
(1/n)\sum x_i^2 & -\bar x\\
-\bar x & 1 \end{matrix}\right]\cdot (1/S_{xx})$$
which means that
$$\text{Var}(\hat \beta_0) = \sigma^2\left(\frac 1n\sum x_i^2\right)\cdot \ (1/S_{xx}) = \frac {\sigma^2}{n}\frac{S_{xx}+n\bar x^2} {S_{xx}} = \sigma^2\left(\frac 1n + \frac{\bar x^2} {S_{xx}}\right) $$
$$\text{Var}(\hat \beta_1) = \sigma^2(1/S_{xx}) $$
$$\text{Cov}(\hat \beta_0,\hat \beta_1) = -\sigma^2(\bar x/S_{xx}) $$
The $i$-th residual is defined as
$$\hat u_i = y_i - \hat y_i = (\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i +u_i$$
The actual coefficients are treated as constants, the regressor is fixed (or conditional on it), and has zero covariance with the error term, but the estimators are correlated with the error term, because the estimators contain the dependent variable, and the dependent variable contains the error term. So we have
$$\text{Var}(\hat u_i) = \Big[\text{Var}(u_i)+\text{Var}(\hat \beta_0)+x_i^2\text{Var}(\hat \beta_1)+2x_i\text{Cov}(\hat \beta_0,\hat \beta_1)\Big] + 2\text{Cov}([(\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i],u_i) $$
$$=\Big[\sigma^2 + \sigma^2\left(\frac 1n + \frac{\bar x^2} {S_{xx}}\right) + x_i^2\sigma^2(1/S_{xx}) +2\text{Cov}([(\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i],u_i)$$
Pack it up a bit to obtain
$$\text{Var}(\hat u_i)=\left[\sigma^2\cdot \left(1 + \frac 1n + \frac {(x_i-\bar x)^2}{S_{xx}}\right)\right]+ 2\text{Cov}([(\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i],u_i)$$
The term in the big parenthesis has exactly the same structure with the variance of the prediction error, with the only change being that instead of $x_i$ we will have $x^0$ (and the variance will be that of $e^0$ and not of $\hat u_i$). The last covariance term is zero for the prediction error because $y^0$ and hence $u^0$ is not included in the estimators, but not zero for the estimation error because $y_i$ and hence $u_i$ is part of the sample and so it is included in the estimator. We have
$$2\text{Cov}([(\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i],u_i) = 2E\left([(\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i]u_i\right)$$
$$=-2E\left(\hat \beta_0u_i\right)-2x_iE\left(\hat \beta_1u_i\right) = -2E\left([\bar y -\hat \beta_1 \bar x]u_i\right)-2x_iE\left(\hat \beta_1u_i\right)$$
the last substitution from how $\hat \beta_0$ is calculated. Continuing,
$$...=-2E(\bar yu_i) -2(x_i-\bar x)E\left(\hat \beta_1u_i\right) = -2\frac {\sigma^2}{n} -2(x_i-\bar x)E\left[\frac {\sum(x_i-\bar x)(y_i-\bar y)}{S_{xx}}u_i\right]$$
$$=-2\frac {\sigma^2}{n} -2\frac {(x_i-\bar x)}{S_{xx}}\left[ \sum(x_i-\bar x)E(y_iu_i-\bar yu_i)\right]$$
$$=-2\frac {\sigma^2}{n} -2\frac {(x_i-\bar x)}{S_{xx}}\left[ -\frac {\sigma^2}{n}\sum_{j\neq i}(x_j-\bar x) + (x_i-\bar x)\sigma^2(1-\frac 1n)\right]$$
$$=-2\frac {\sigma^2}{n}-2\frac {(x_i-\bar x)}{S_{xx}}\left[ -\frac {\sigma^2}{n}\sum(x_i-\bar x) + (x_i-\bar x)\sigma^2\right]$$
$$=-2\frac {\sigma^2}{n}-2\frac {(x_i-\bar x)}{S_{xx}}\left[ 0 + (x_i-\bar x)\sigma^2\right] = -2\frac {\sigma^2}{n}-2\sigma^2\frac {(x_i-\bar x)^2}{S_{xx}}$$
Inserting this into the expression for the variance of the residual, we obtain
$$\text{Var}(\hat u_i)=\sigma^2\cdot \left(1 - \frac 1n - \frac {(x_i-\bar x)^2}{S_{xx}}\right)$$
So hats off to the text the OP is using.
(I have skipped some algebraic manipulations, no wonder OLS algebra is taught less and less these days...)
SOME INTUITION
So it appears that what works "against" us (larger variance) when predicting, works "for us" (lower variance) when estimating. This is a good starting point for one to ponder why an excellent fit may be a bad sign for the prediction abilities of the model (however counter-intuitive this may sound...).
The fact that we are estimating the expected value of the regressor, decreases the variance by $1/n$. Why? because by estimating, we "close our eyes" to some error-variability existing in the sample,since we essentially estimating an expected value. Moreover, the larger the deviation of an observation of a regressor from the regressor's sample mean, the smaller the variance of the residual associated with this observation will be... the more deviant the observation, the less deviant its residual... It is variability of the regressors that works for us, by "taking the place" of the unknown error-variability.
But that's good for estimation. For prediction, the same things turn against us: now, by not taking into account, however imperfectly, the variability in $y^0$ (since we want to predict it), our imperfect estimators obtained from the sample show their weaknesses: we estimated the sample mean, we don't know the true expected value -the variance increases. We have an $x^0$ that is far away from the sample mean as calculated from the other observations -too bad, our prediction error variance gets another boost, because the predicted $\hat y^0$ will tend to go astray... in more scientific language "optimal predictors in the sense of reduced prediction error variance, represent a shrinkage towards the mean of the variable under prediction". We do not try to replicate the dependent variable's variability -we just try to stay "close to the average".
|
In simple linear regression, where does the formula for the variance of the residuals come from?
|
The intuition about the "plus" signs related to the variance (from the fact that even when we calculate the variance of a difference of independent random variables, we add their variances) is correct
|
In simple linear regression, where does the formula for the variance of the residuals come from?
The intuition about the "plus" signs related to the variance (from the fact that even when we calculate the variance of a difference of independent random variables, we add their variances) is correct but fatally incomplete: if the random variables involved are not independent, then covariances are also involved -and covariances may be negative. There exists an expression that is almost like the expression in the question was thought that it "should" be by the OP (and me), and it is the variance of the prediction error, denote it $e^0 = y^0 - \hat y^0$, where $y^0 = \beta_0+\beta_1x^0+u^0$:
$$\text{Var}(e^0) = \sigma^2\cdot \left(1 + \frac 1n + \frac {(x^0-\bar x)^2}{S_{xx}}\right)$$
The critical difference between the variance of the prediction error and the variance of the estimation error (i.e. of the residual), is that the error term of the predicted observation is not correlated with the estimator, since the value $y^0$ was not used in constructing the estimator and calculating the estimates, being an out-of-sample value.
The algebra for both proceeds in exactly the same way up to a point (using $^0$ instead of $_i$), but then diverges. Specifically:
In the simple linear regression $y_i = \beta_0 + \beta_1x_i + u_i$, $\text{Var}(u_i)=\sigma^2$, the variance of the estimator $\hat \beta = (\hat \beta_0, \hat \beta_1)'$ is still
$$\text{Var}(\hat \beta) = \sigma^2 \left(\mathbf X' \mathbf X\right)^{-1}$$
We have
$$\mathbf X' \mathbf X= \left[ \begin{matrix}
n & \sum x_i\\
\sum x_i & \sum x_i^2 \end{matrix}\right]$$
and so
$$\left(\mathbf X' \mathbf X\right)^{-1}= \left[ \begin{matrix}
\sum x_i^2 & -\sum x_i\\
-\sum x_i & n \end{matrix}\right]\cdot \left[n\sum x_i^2-\left(\sum x_i\right)^2\right]^{-1}$$
We have
$$\left[n\sum x_i^2-\left(\sum x_i\right)^2\right] = \left[n\sum x_i^2-n^2\bar x^2\right] = n\left[\sum x_i^2-n\bar x^2\right] \\= n\sum (x_i^2-\bar x^2) \equiv nS_{xx}$$
So
$$\left(\mathbf X' \mathbf X\right)^{-1}= \left[ \begin{matrix}
(1/n)\sum x_i^2 & -\bar x\\
-\bar x & 1 \end{matrix}\right]\cdot (1/S_{xx})$$
which means that
$$\text{Var}(\hat \beta_0) = \sigma^2\left(\frac 1n\sum x_i^2\right)\cdot \ (1/S_{xx}) = \frac {\sigma^2}{n}\frac{S_{xx}+n\bar x^2} {S_{xx}} = \sigma^2\left(\frac 1n + \frac{\bar x^2} {S_{xx}}\right) $$
$$\text{Var}(\hat \beta_1) = \sigma^2(1/S_{xx}) $$
$$\text{Cov}(\hat \beta_0,\hat \beta_1) = -\sigma^2(\bar x/S_{xx}) $$
The $i$-th residual is defined as
$$\hat u_i = y_i - \hat y_i = (\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i +u_i$$
The actual coefficients are treated as constants, the regressor is fixed (or conditional on it), and has zero covariance with the error term, but the estimators are correlated with the error term, because the estimators contain the dependent variable, and the dependent variable contains the error term. So we have
$$\text{Var}(\hat u_i) = \Big[\text{Var}(u_i)+\text{Var}(\hat \beta_0)+x_i^2\text{Var}(\hat \beta_1)+2x_i\text{Cov}(\hat \beta_0,\hat \beta_1)\Big] + 2\text{Cov}([(\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i],u_i) $$
$$=\Big[\sigma^2 + \sigma^2\left(\frac 1n + \frac{\bar x^2} {S_{xx}}\right) + x_i^2\sigma^2(1/S_{xx}) +2\text{Cov}([(\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i],u_i)$$
Pack it up a bit to obtain
$$\text{Var}(\hat u_i)=\left[\sigma^2\cdot \left(1 + \frac 1n + \frac {(x_i-\bar x)^2}{S_{xx}}\right)\right]+ 2\text{Cov}([(\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i],u_i)$$
The term in the big parenthesis has exactly the same structure with the variance of the prediction error, with the only change being that instead of $x_i$ we will have $x^0$ (and the variance will be that of $e^0$ and not of $\hat u_i$). The last covariance term is zero for the prediction error because $y^0$ and hence $u^0$ is not included in the estimators, but not zero for the estimation error because $y_i$ and hence $u_i$ is part of the sample and so it is included in the estimator. We have
$$2\text{Cov}([(\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i],u_i) = 2E\left([(\beta_0 - \hat \beta_0) + (\beta_1 - \hat \beta_1)x_i]u_i\right)$$
$$=-2E\left(\hat \beta_0u_i\right)-2x_iE\left(\hat \beta_1u_i\right) = -2E\left([\bar y -\hat \beta_1 \bar x]u_i\right)-2x_iE\left(\hat \beta_1u_i\right)$$
the last substitution from how $\hat \beta_0$ is calculated. Continuing,
$$...=-2E(\bar yu_i) -2(x_i-\bar x)E\left(\hat \beta_1u_i\right) = -2\frac {\sigma^2}{n} -2(x_i-\bar x)E\left[\frac {\sum(x_i-\bar x)(y_i-\bar y)}{S_{xx}}u_i\right]$$
$$=-2\frac {\sigma^2}{n} -2\frac {(x_i-\bar x)}{S_{xx}}\left[ \sum(x_i-\bar x)E(y_iu_i-\bar yu_i)\right]$$
$$=-2\frac {\sigma^2}{n} -2\frac {(x_i-\bar x)}{S_{xx}}\left[ -\frac {\sigma^2}{n}\sum_{j\neq i}(x_j-\bar x) + (x_i-\bar x)\sigma^2(1-\frac 1n)\right]$$
$$=-2\frac {\sigma^2}{n}-2\frac {(x_i-\bar x)}{S_{xx}}\left[ -\frac {\sigma^2}{n}\sum(x_i-\bar x) + (x_i-\bar x)\sigma^2\right]$$
$$=-2\frac {\sigma^2}{n}-2\frac {(x_i-\bar x)}{S_{xx}}\left[ 0 + (x_i-\bar x)\sigma^2\right] = -2\frac {\sigma^2}{n}-2\sigma^2\frac {(x_i-\bar x)^2}{S_{xx}}$$
Inserting this into the expression for the variance of the residual, we obtain
$$\text{Var}(\hat u_i)=\sigma^2\cdot \left(1 - \frac 1n - \frac {(x_i-\bar x)^2}{S_{xx}}\right)$$
So hats off to the text the OP is using.
(I have skipped some algebraic manipulations, no wonder OLS algebra is taught less and less these days...)
SOME INTUITION
So it appears that what works "against" us (larger variance) when predicting, works "for us" (lower variance) when estimating. This is a good starting point for one to ponder why an excellent fit may be a bad sign for the prediction abilities of the model (however counter-intuitive this may sound...).
The fact that we are estimating the expected value of the regressor, decreases the variance by $1/n$. Why? because by estimating, we "close our eyes" to some error-variability existing in the sample,since we essentially estimating an expected value. Moreover, the larger the deviation of an observation of a regressor from the regressor's sample mean, the smaller the variance of the residual associated with this observation will be... the more deviant the observation, the less deviant its residual... It is variability of the regressors that works for us, by "taking the place" of the unknown error-variability.
But that's good for estimation. For prediction, the same things turn against us: now, by not taking into account, however imperfectly, the variability in $y^0$ (since we want to predict it), our imperfect estimators obtained from the sample show their weaknesses: we estimated the sample mean, we don't know the true expected value -the variance increases. We have an $x^0$ that is far away from the sample mean as calculated from the other observations -too bad, our prediction error variance gets another boost, because the predicted $\hat y^0$ will tend to go astray... in more scientific language "optimal predictors in the sense of reduced prediction error variance, represent a shrinkage towards the mean of the variable under prediction". We do not try to replicate the dependent variable's variability -we just try to stay "close to the average".
|
In simple linear regression, where does the formula for the variance of the residuals come from?
The intuition about the "plus" signs related to the variance (from the fact that even when we calculate the variance of a difference of independent random variables, we add their variances) is correct
|
9,436
|
In simple linear regression, where does the formula for the variance of the residuals come from?
|
I find this hard to believe since the ith residual is the difference between the ith observed value and the ith fitted value; if one were to compute the variance of the difference, at the very least I would expect some "pluses" in the resulting expression
(i) The two things are dependent (positively correlated), and while there is a + term when you expand it, there's also two - terms that come up, and some cancellation
(ii) The variance of a residual should be smaller than $\sigma^2$, since the fitted line will "pick up" any little linear component that by chance happens to occur in the errors (there's always some). There's a reduction due to the intercept and a reduction due to the slope around the center of the data whose effect is strongest at the ends of the data. You can see both terms in your question.
Algebraically:
Given $H=X(X^TX)^{-1}X^T$,
\begin{eqnarray}
\text{Var}(y-\hat{y})&=&\text{Var}((I-H)y)\\
&=&(I-H)\text{Var}(y)(I-H)^T\\
&=&\sigma^2(I-H)^2\\
&=&\sigma^2(I-H)
\end{eqnarray}
Hence
$$\text{Var}(y_i-\hat{y}_i)=\sigma^2(1-h_{ii})$$
In the case of simple linear regression ... this gives the answer in your question.
This answer also makes sense: since $\hat{y}_i$ is positively correlated with $y_i$, the variance of the difference should be smaller than the sum of the variances.
--
Edit: Explanation of why $(I-H)$ is idempotent.
(i) $H$ is idempotent:
$H^2=X(X^TX)^{-1}X^TX(X^TX)^{-1}X^T $ $= X\ [(X^TX)^{-1}X^TX]\ (X^TX)^{-1}X^T=X(X^TX)^{-1}X^T=H$
(ii) $(I-H)^2= I^2-IH-HI+H^2=I-2H+H=I-H$
|
In simple linear regression, where does the formula for the variance of the residuals come from?
|
I find this hard to believe since the ith residual is the difference between the ith observed value and the ith fitted value; if one were to compute the variance of the difference, at the very least I
|
In simple linear regression, where does the formula for the variance of the residuals come from?
I find this hard to believe since the ith residual is the difference between the ith observed value and the ith fitted value; if one were to compute the variance of the difference, at the very least I would expect some "pluses" in the resulting expression
(i) The two things are dependent (positively correlated), and while there is a + term when you expand it, there's also two - terms that come up, and some cancellation
(ii) The variance of a residual should be smaller than $\sigma^2$, since the fitted line will "pick up" any little linear component that by chance happens to occur in the errors (there's always some). There's a reduction due to the intercept and a reduction due to the slope around the center of the data whose effect is strongest at the ends of the data. You can see both terms in your question.
Algebraically:
Given $H=X(X^TX)^{-1}X^T$,
\begin{eqnarray}
\text{Var}(y-\hat{y})&=&\text{Var}((I-H)y)\\
&=&(I-H)\text{Var}(y)(I-H)^T\\
&=&\sigma^2(I-H)^2\\
&=&\sigma^2(I-H)
\end{eqnarray}
Hence
$$\text{Var}(y_i-\hat{y}_i)=\sigma^2(1-h_{ii})$$
In the case of simple linear regression ... this gives the answer in your question.
This answer also makes sense: since $\hat{y}_i$ is positively correlated with $y_i$, the variance of the difference should be smaller than the sum of the variances.
--
Edit: Explanation of why $(I-H)$ is idempotent.
(i) $H$ is idempotent:
$H^2=X(X^TX)^{-1}X^TX(X^TX)^{-1}X^T $ $= X\ [(X^TX)^{-1}X^TX]\ (X^TX)^{-1}X^T=X(X^TX)^{-1}X^T=H$
(ii) $(I-H)^2= I^2-IH-HI+H^2=I-2H+H=I-H$
|
In simple linear regression, where does the formula for the variance of the residuals come from?
I find this hard to believe since the ith residual is the difference between the ith observed value and the ith fitted value; if one were to compute the variance of the difference, at the very least I
|
9,437
|
In simple linear regression, where does the formula for the variance of the residuals come from?
|
Here's a hybrid of the two previous solutions. The variance of the $i$th residual, by @Glen_b's answer, is $$\operatorname{Var}(y_i-\hat y_i)=\sigma^2(1-h_{ii})$$ where $h_{ii}$ is the $(i,i)$ entry of the hat matrix $H:=X(X^TX)^{-1}X^T$. This entry can be computed as the multiplication
$$h_{ii}=(X)_{i\bullet}\ (X^TX)^{-1}\ (X^T)_{\bullet i}$$ where $(X)_{i\bullet}$ denotes row $i$ of matrix $X$, and $(X^T)_{\bullet i}$ denotes column $i$ of matrix $X^T$ (i.e., row $i$ of $X$ as a column vector). To simplify @AlecosPapadopoulos's calculation of $(X^TX)^{-1}$, the trick is to observe that the residual vector remains unchanged if we switch the regression model to:
$$y_i=\beta_0+\beta_1(x_i-\bar x)+u_i.$$
(In essence we've shifted the $x$ values so that they average to zero.) The design matrix for this model is
$$
X=\begin{pmatrix}1&x_1-\bar x\\ 1&x_2-\bar x\\ \vdots&\vdots\\ 1&x_n-\bar x\end{pmatrix},$$ and it is straightforward to calculate:
$$
X^TX=\begin{pmatrix}n&0\\ 0&S_{xx}\end{pmatrix},\qquad
(X^TX)^{-1}=\begin{pmatrix}\frac1n&0\\0&\frac1{S_{xx}}\end{pmatrix}$$
and finally
$$
h_{ii}=
\begin{pmatrix}1 &x_i-\bar x\end{pmatrix}
\begin{pmatrix}\frac1n&0\\0&\frac1{S_{xx}}\end{pmatrix}
\begin{pmatrix}1 \\x_i-\bar x\end{pmatrix}
=\frac1n +\frac{(x_i-\bar x)^2}{S_{xx}}.
$$
|
In simple linear regression, where does the formula for the variance of the residuals come from?
|
Here's a hybrid of the two previous solutions. The variance of the $i$th residual, by @Glen_b's answer, is $$\operatorname{Var}(y_i-\hat y_i)=\sigma^2(1-h_{ii})$$ where $h_{ii}$ is the $(i,i)$ entry o
|
In simple linear regression, where does the formula for the variance of the residuals come from?
Here's a hybrid of the two previous solutions. The variance of the $i$th residual, by @Glen_b's answer, is $$\operatorname{Var}(y_i-\hat y_i)=\sigma^2(1-h_{ii})$$ where $h_{ii}$ is the $(i,i)$ entry of the hat matrix $H:=X(X^TX)^{-1}X^T$. This entry can be computed as the multiplication
$$h_{ii}=(X)_{i\bullet}\ (X^TX)^{-1}\ (X^T)_{\bullet i}$$ where $(X)_{i\bullet}$ denotes row $i$ of matrix $X$, and $(X^T)_{\bullet i}$ denotes column $i$ of matrix $X^T$ (i.e., row $i$ of $X$ as a column vector). To simplify @AlecosPapadopoulos's calculation of $(X^TX)^{-1}$, the trick is to observe that the residual vector remains unchanged if we switch the regression model to:
$$y_i=\beta_0+\beta_1(x_i-\bar x)+u_i.$$
(In essence we've shifted the $x$ values so that they average to zero.) The design matrix for this model is
$$
X=\begin{pmatrix}1&x_1-\bar x\\ 1&x_2-\bar x\\ \vdots&\vdots\\ 1&x_n-\bar x\end{pmatrix},$$ and it is straightforward to calculate:
$$
X^TX=\begin{pmatrix}n&0\\ 0&S_{xx}\end{pmatrix},\qquad
(X^TX)^{-1}=\begin{pmatrix}\frac1n&0\\0&\frac1{S_{xx}}\end{pmatrix}$$
and finally
$$
h_{ii}=
\begin{pmatrix}1 &x_i-\bar x\end{pmatrix}
\begin{pmatrix}\frac1n&0\\0&\frac1{S_{xx}}\end{pmatrix}
\begin{pmatrix}1 \\x_i-\bar x\end{pmatrix}
=\frac1n +\frac{(x_i-\bar x)^2}{S_{xx}}.
$$
|
In simple linear regression, where does the formula for the variance of the residuals come from?
Here's a hybrid of the two previous solutions. The variance of the $i$th residual, by @Glen_b's answer, is $$\operatorname{Var}(y_i-\hat y_i)=\sigma^2(1-h_{ii})$$ where $h_{ii}$ is the $(i,i)$ entry o
|
9,438
|
What is the difference between a loss function and decision function?
|
A decision function is a function which takes a dataset as input and gives a decision as output. What the decision can be depends on the problem at hand. Examples include:
Estimation problems: the "decision" is the estimate.
Hypothesis testing problems: the decision is to reject or not reject the null hypothesis.
Classification problems: the decision is to classify a new observation (or observations) into a category.
Model selection problems: the decision is to chose one of the candidate models.
Typically, there are an infinite number of decision functions available for a problem. If we for instance are interested in estimating the height of Swedish males based on ten observations $\mathbf{x}=(x_1,x_2,\ldots,x_{10})$, we can use any of the following decision functions $d(\mathbf{x})$:
The sample mean: $d(\mathbf{x})=\frac{1}{10}\sum_{i=1}^{10}x_i$.
The median of the sample: $d(\mathbf{x})=\mbox{median}(\mathbf{x})$
The geometric mean of the sample: $d(\mathbf{x})=\sqrt[10]{x_1\cdots x_{10}}$
The function that always returns 1: $d(\mathbf{x})=1$, regardless of the value of $\mathbf{x}$. Silly, yes, but it is nevertheless a valid decision function.
How then can we determine which of these decision functions to use? One way is to use a loss function, which describes the loss (or cost) associated with all possible decisions. Different decision functions will tend to lead to different types of mistakes. The loss function tells us which type of mistakes we should be more concerned about. The best decision function is the function that yields the lowest expected loss. What is meant by expected loss depends on the setting (in particular, whether we are talking about frequentist or Bayesian statistics).
In summary:
Decision functions are used to make decisions based on data.
Loss functions are used to determine which decision function to use.
|
What is the difference between a loss function and decision function?
|
A decision function is a function which takes a dataset as input and gives a decision as output. What the decision can be depends on the problem at hand. Examples include:
Estimation problems: the "d
|
What is the difference between a loss function and decision function?
A decision function is a function which takes a dataset as input and gives a decision as output. What the decision can be depends on the problem at hand. Examples include:
Estimation problems: the "decision" is the estimate.
Hypothesis testing problems: the decision is to reject or not reject the null hypothesis.
Classification problems: the decision is to classify a new observation (or observations) into a category.
Model selection problems: the decision is to chose one of the candidate models.
Typically, there are an infinite number of decision functions available for a problem. If we for instance are interested in estimating the height of Swedish males based on ten observations $\mathbf{x}=(x_1,x_2,\ldots,x_{10})$, we can use any of the following decision functions $d(\mathbf{x})$:
The sample mean: $d(\mathbf{x})=\frac{1}{10}\sum_{i=1}^{10}x_i$.
The median of the sample: $d(\mathbf{x})=\mbox{median}(\mathbf{x})$
The geometric mean of the sample: $d(\mathbf{x})=\sqrt[10]{x_1\cdots x_{10}}$
The function that always returns 1: $d(\mathbf{x})=1$, regardless of the value of $\mathbf{x}$. Silly, yes, but it is nevertheless a valid decision function.
How then can we determine which of these decision functions to use? One way is to use a loss function, which describes the loss (or cost) associated with all possible decisions. Different decision functions will tend to lead to different types of mistakes. The loss function tells us which type of mistakes we should be more concerned about. The best decision function is the function that yields the lowest expected loss. What is meant by expected loss depends on the setting (in particular, whether we are talking about frequentist or Bayesian statistics).
In summary:
Decision functions are used to make decisions based on data.
Loss functions are used to determine which decision function to use.
|
What is the difference between a loss function and decision function?
A decision function is a function which takes a dataset as input and gives a decision as output. What the decision can be depends on the problem at hand. Examples include:
Estimation problems: the "d
|
9,439
|
What is the difference between a loss function and decision function?
|
The loss function is what is minimized to obtain a model which is optimal in some sense. The model itself has a decision function which is used to predict.
For example, in SVM classifiers:
loss function: minimizes error and squared norm of the separating hyperplane $\mathcal{L}(\mathbf{w}, \xi) =\frac{1}{2}\|\mathbf{w}\|^2 + C\sum_i \xi_i$
decision function: signed distance to the separating hyperplane: $f(\mathbf{x}) = \mathbf{w}^T\mathbf{x} + b$
|
What is the difference between a loss function and decision function?
|
The loss function is what is minimized to obtain a model which is optimal in some sense. The model itself has a decision function which is used to predict.
For example, in SVM classifiers:
loss funct
|
What is the difference between a loss function and decision function?
The loss function is what is minimized to obtain a model which is optimal in some sense. The model itself has a decision function which is used to predict.
For example, in SVM classifiers:
loss function: minimizes error and squared norm of the separating hyperplane $\mathcal{L}(\mathbf{w}, \xi) =\frac{1}{2}\|\mathbf{w}\|^2 + C\sum_i \xi_i$
decision function: signed distance to the separating hyperplane: $f(\mathbf{x}) = \mathbf{w}^T\mathbf{x} + b$
|
What is the difference between a loss function and decision function?
The loss function is what is minimized to obtain a model which is optimal in some sense. The model itself has a decision function which is used to predict.
For example, in SVM classifiers:
loss funct
|
9,440
|
Sample size calculation for mixed models
|
The longpower package implements the sample size calculations in Liu and Liang (1997) and Diggle et al (2002). The documentation has example code. Here's one, using the lmmpower() function:
> require(longpower)
> require(lme4)
> fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
> lmmpower(fm1, pct.change = 0.30, t = seq(0,9,1), power = 0.80)
Power for longitudinal linear model with random slope (Edland, 2009)
n = 68.46972
delta = 3.140186
sig2.s = 35.07153
sig2.e = 654.941
sig.level = 0.05
t = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
power = 0.8
alternative = two.sided
delta.CI = 2.231288, 4.049084
Days = 10.46729
Days CI = 7.437625, 13.496947
n.CI = 41.18089, 135.61202
Also check the liu.liang.linear.power() which "performs the sample size calculation for a linear mixed model"
Liu, G., & Liang, K. Y. (1997). Sample size calculations for studies with correlated observations. Biometrics, 53(3), 937-47.
Diggle PJ, Heagerty PJ, Liang K, Zeger SL. Analysis of longitudinal data. Second Edition. Oxford. Statistical Science Serires. 2002
Edit: Another way is to "correct" for the effect of clustering. In an ordinary linear model each observation is independent, but in the presence of clustering observations are not independent which can be thought of as having fewer independent observations - the effective sample size is smaller. This loss of effectiveness is known as the design effect :
$$ DE = 1 +(m-1)\rho$$
where $m$ is the average cluster size and $\rho$ is the intraclass correlation coefficient (variance partition coefficient). So the sample size obtained through a calculation that ignores clustering is inflated by $DE$ to obtain a sample size that allows for clustering.
|
Sample size calculation for mixed models
|
The longpower package implements the sample size calculations in Liu and Liang (1997) and Diggle et al (2002). The documentation has example code. Here's one, using the lmmpower() function:
> require(
|
Sample size calculation for mixed models
The longpower package implements the sample size calculations in Liu and Liang (1997) and Diggle et al (2002). The documentation has example code. Here's one, using the lmmpower() function:
> require(longpower)
> require(lme4)
> fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
> lmmpower(fm1, pct.change = 0.30, t = seq(0,9,1), power = 0.80)
Power for longitudinal linear model with random slope (Edland, 2009)
n = 68.46972
delta = 3.140186
sig2.s = 35.07153
sig2.e = 654.941
sig.level = 0.05
t = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
power = 0.8
alternative = two.sided
delta.CI = 2.231288, 4.049084
Days = 10.46729
Days CI = 7.437625, 13.496947
n.CI = 41.18089, 135.61202
Also check the liu.liang.linear.power() which "performs the sample size calculation for a linear mixed model"
Liu, G., & Liang, K. Y. (1997). Sample size calculations for studies with correlated observations. Biometrics, 53(3), 937-47.
Diggle PJ, Heagerty PJ, Liang K, Zeger SL. Analysis of longitudinal data. Second Edition. Oxford. Statistical Science Serires. 2002
Edit: Another way is to "correct" for the effect of clustering. In an ordinary linear model each observation is independent, but in the presence of clustering observations are not independent which can be thought of as having fewer independent observations - the effective sample size is smaller. This loss of effectiveness is known as the design effect :
$$ DE = 1 +(m-1)\rho$$
where $m$ is the average cluster size and $\rho$ is the intraclass correlation coefficient (variance partition coefficient). So the sample size obtained through a calculation that ignores clustering is inflated by $DE$ to obtain a sample size that allows for clustering.
|
Sample size calculation for mixed models
The longpower package implements the sample size calculations in Liu and Liang (1997) and Diggle et al (2002). The documentation has example code. Here's one, using the lmmpower() function:
> require(
|
9,441
|
Sample size calculation for mixed models
|
For anything beyond the simple 2 sample tests I prefer to use simulation for sample size or power studies. With prepackaged routines you can sometimes see large differences between the results from the programs based on the assumptions that they are making (and you may not be able to find out what those assumptions are, let alone if they are reasonble for your study). With simulation you control all the assumptions.
Here is a link to an example:
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q1/001790.html
|
Sample size calculation for mixed models
|
For anything beyond the simple 2 sample tests I prefer to use simulation for sample size or power studies. With prepackaged routines you can sometimes see large differences between the results from t
|
Sample size calculation for mixed models
For anything beyond the simple 2 sample tests I prefer to use simulation for sample size or power studies. With prepackaged routines you can sometimes see large differences between the results from the programs based on the assumptions that they are making (and you may not be able to find out what those assumptions are, let alone if they are reasonble for your study). With simulation you control all the assumptions.
Here is a link to an example:
https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q1/001790.html
|
Sample size calculation for mixed models
For anything beyond the simple 2 sample tests I prefer to use simulation for sample size or power studies. With prepackaged routines you can sometimes see large differences between the results from t
|
9,442
|
Sample size calculation for mixed models
|
The simr package uses simulation to estimate power fairly flexibly in linear and generalised linear mixed models.
|
Sample size calculation for mixed models
|
The simr package uses simulation to estimate power fairly flexibly in linear and generalised linear mixed models.
|
Sample size calculation for mixed models
The simr package uses simulation to estimate power fairly flexibly in linear and generalised linear mixed models.
|
Sample size calculation for mixed models
The simr package uses simulation to estimate power fairly flexibly in linear and generalised linear mixed models.
|
9,443
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
|
Note that the case where the number of heads and the number of tails are equal is the same as "exactly half the time you get heads". So let's stick to counting the number of heads to see if it's half the number of tosses or equivalently comparing the proportion of heads with 0.5.
The more you flip, the larger the number of possible counts of heads you can have -- the distribution becomes more spread out (e.g. an interval for the number of heads containing 95% of the probability will grow wider as the number of tosses increases), so the probability of exactly half heads will tend to go down as we toss more.
Correspondingly, the proportion of heads will take more possible values; see here, where we move from 100 tosses to 200 tosses:
With 100 tosses we can observe a proportion of 0.49 heads or 0.50 heads or 0.51 heads (and so on -- but nothing in between those values), but with 200 tosses, we can observe 0.49 or 0.495 or 0.50 or 0.505 or 0.510 - the probability has more values to "cover" and so each will tend to get a smaller share.
Consider than you have $2n$ tosses with some probability $p_i$ of getting $i$ heads (we know these probabilities but it's not critical for this part), and you add two more tosses. In $2n$ tosses, $n$ heads is the most likely outcome ($p_n>p_{n\pm 1}$ and it goes down from there).
What's the chance of having $n+1$ heads in $2n+2$ tosses?
(Label these probabilities with $q$ so we don't confuse them with the previous ones; also let P(HH) be the probability of "Head,Head" in the next two tosses, and so on)
$q_{n+1} = p_{n-1} P(HH) + p_n (P(HT)+P(TH)) + p_{n+1} P(TT)$
$\qquad < p_{n} P(HH) + p_n (P(HT)+P(TH)) + p_{n} P(TT) = p_n$
i.e. if you add two more coin-tosses, the probability of the middle value naturally goes down because it averages the most likely (middle) value with the average of the smaller values either side)
So as long as you're comfortable that the peak will be in the middle (for $2n= 2,4,6,...$), the probability of exactly half heads must decrease as $n$ goes up.
In fact we can show that for large $n$, $p_n$ decreases proportionally with $\frac{1}{\sqrt{n}}$ (unsurprisingly, since the distribution of the standardized number of heads approaches normality and the variance of the proportion of heads decreases with $n$).
As requested, here's R code that produces something close to the above plot:
x1 = 25:75
x2 = 50:150
plot(x1 / 100, dbinom(x1, 100, 0.5), type = "h",
main = "Proportion of heads in 100 and 200 tosses",
xlab = "Proportion of heads",
ylab = "probability")
points(x2 / 200, dbinom(x2, 200, 0.5), type = "h", col = 3)
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
|
Note that the case where the number of heads and the number of tails are equal is the same as "exactly half the time you get heads". So let's stick to counting the number of heads to see if it's half
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
Note that the case where the number of heads and the number of tails are equal is the same as "exactly half the time you get heads". So let's stick to counting the number of heads to see if it's half the number of tosses or equivalently comparing the proportion of heads with 0.5.
The more you flip, the larger the number of possible counts of heads you can have -- the distribution becomes more spread out (e.g. an interval for the number of heads containing 95% of the probability will grow wider as the number of tosses increases), so the probability of exactly half heads will tend to go down as we toss more.
Correspondingly, the proportion of heads will take more possible values; see here, where we move from 100 tosses to 200 tosses:
With 100 tosses we can observe a proportion of 0.49 heads or 0.50 heads or 0.51 heads (and so on -- but nothing in between those values), but with 200 tosses, we can observe 0.49 or 0.495 or 0.50 or 0.505 or 0.510 - the probability has more values to "cover" and so each will tend to get a smaller share.
Consider than you have $2n$ tosses with some probability $p_i$ of getting $i$ heads (we know these probabilities but it's not critical for this part), and you add two more tosses. In $2n$ tosses, $n$ heads is the most likely outcome ($p_n>p_{n\pm 1}$ and it goes down from there).
What's the chance of having $n+1$ heads in $2n+2$ tosses?
(Label these probabilities with $q$ so we don't confuse them with the previous ones; also let P(HH) be the probability of "Head,Head" in the next two tosses, and so on)
$q_{n+1} = p_{n-1} P(HH) + p_n (P(HT)+P(TH)) + p_{n+1} P(TT)$
$\qquad < p_{n} P(HH) + p_n (P(HT)+P(TH)) + p_{n} P(TT) = p_n$
i.e. if you add two more coin-tosses, the probability of the middle value naturally goes down because it averages the most likely (middle) value with the average of the smaller values either side)
So as long as you're comfortable that the peak will be in the middle (for $2n= 2,4,6,...$), the probability of exactly half heads must decrease as $n$ goes up.
In fact we can show that for large $n$, $p_n$ decreases proportionally with $\frac{1}{\sqrt{n}}$ (unsurprisingly, since the distribution of the standardized number of heads approaches normality and the variance of the proportion of heads decreases with $n$).
As requested, here's R code that produces something close to the above plot:
x1 = 25:75
x2 = 50:150
plot(x1 / 100, dbinom(x1, 100, 0.5), type = "h",
main = "Proportion of heads in 100 and 200 tosses",
xlab = "Proportion of heads",
ylab = "probability")
points(x2 / 200, dbinom(x2, 200, 0.5), type = "h", col = 3)
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
Note that the case where the number of heads and the number of tails are equal is the same as "exactly half the time you get heads". So let's stick to counting the number of heads to see if it's half
|
9,444
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
|
Well we know that the Law of Large Numbers is what is guaranteeing the first conclusion of your experiement, namely, that if you flip a fair coin $n$ times, the ratio of heads to tails converges towards 1 as $n$ increases.
So no problems there. However, that about all the Law of Large Numbers tells us in this scenario.
But so now, think about this problem more intuitively. Think about flipping a coin a small number of times, for example: $n=2,4,8,10$.
When you flip a coin twice, i.e. $n=2$, think of the possible scenarios of the two flips. (Here $H$ will denote heads and $T$ will denote tails). On the fist flip you could have gotten $H$ and on the second flip you could have gotten $T$. But that's just one way the two flips could have come up. You could have also gotten on the first flip $T$ and on the second flip $H$, and all other possible combinations. So at the end of the day, when you flip 2 coins, the possible combinations you could see on the two flips are
$$S=\{HH,HT,TH,TT\}$$
and so there are 4 possible scenarios for flipping $n=2$ coins.
If you were to flip 4 coins then the possible number of combinations you could see would be
$$S=\{HHHH,HHHT,HHTH,HTHH,THHH,HHTT,HTTH,TTHH,THHT,THTH,HTHT,HTTT,THTT,TTHT,TTTH,TTTT\}$$
and so there are 16 possible scenarios for flipping $n=4$ coins.
Flipping $n=8$ coins leads to 256 combinations.
Flipping $n=10$ coins leads to 1,024 combinations.
And in particular, flipping any number $n$ coins leads to $2^n$ possible combinations.
Now, let's try and approach this problem probabilistic point of view. Looking back at the case when $n=2$, we know that the probability of getting exactly the same number of Heads and Tails (i.e., as you put it a ratio of exactly 1) is
$$Pr(\text{Ratio of exactly 1})=\frac{2}{4}=0.5$$
When $n=4$, we know that the probability of getting exactly the same number of Heads and Tails is
$$Pr(\text{Ratio of exactly 1})=\frac{6}{16}=0.375$$
And in general, as $n$ tends to grow larger we have that that the probability of getting exactly the same number of Heads and Tails goes to 0.
In other words, as $n\rightarrow\infty$, we have that
$$Pr(\text{Ratio of exactly 1})\rightarrow 0$$
And so, to answer your question. Really what you are observing is just a consequence of the fact that there will be far more combinations of coin flips where the number of heads and tails are not equal as compared to the number of combinations where they are equal.
As @Mark L. Stone suggests, if you are comfortable with the binomial formula and binomial random variables, then you can use that to show the same argument.
Let $X$ be the number of heads recorded when flipping a fair coin $n$ times. we can regard $X$ as a random variable coming from a binomial distribution, i.e., $X\sim Bin(n,p=0.5)$ (here we assume $p=0.5$ because we are dealing with a fair coin) then the probability of getting exactly the same number of heads as the number of tails (i.e., a ratio of exactly 1) is
$$Pr(\text{Ratio of exactly 1})=Pr\left(X=\frac{n}{2}\right)= {n \choose n/2} 0.5^{n/2}(0.5)^{n-n/2}={n \choose n/2} 0.5^{n}$$
Now, once again, as $n$ tends to grow large, the above expression tends towards 0 because ${n \choose n/2}0.5^n\rightarrow 0$ as $n\rightarrow\infty$.
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
|
Well we know that the Law of Large Numbers is what is guaranteeing the first conclusion of your experiement, namely, that if you flip a fair coin $n$ times, the ratio of heads to tails converges towar
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
Well we know that the Law of Large Numbers is what is guaranteeing the first conclusion of your experiement, namely, that if you flip a fair coin $n$ times, the ratio of heads to tails converges towards 1 as $n$ increases.
So no problems there. However, that about all the Law of Large Numbers tells us in this scenario.
But so now, think about this problem more intuitively. Think about flipping a coin a small number of times, for example: $n=2,4,8,10$.
When you flip a coin twice, i.e. $n=2$, think of the possible scenarios of the two flips. (Here $H$ will denote heads and $T$ will denote tails). On the fist flip you could have gotten $H$ and on the second flip you could have gotten $T$. But that's just one way the two flips could have come up. You could have also gotten on the first flip $T$ and on the second flip $H$, and all other possible combinations. So at the end of the day, when you flip 2 coins, the possible combinations you could see on the two flips are
$$S=\{HH,HT,TH,TT\}$$
and so there are 4 possible scenarios for flipping $n=2$ coins.
If you were to flip 4 coins then the possible number of combinations you could see would be
$$S=\{HHHH,HHHT,HHTH,HTHH,THHH,HHTT,HTTH,TTHH,THHT,THTH,HTHT,HTTT,THTT,TTHT,TTTH,TTTT\}$$
and so there are 16 possible scenarios for flipping $n=4$ coins.
Flipping $n=8$ coins leads to 256 combinations.
Flipping $n=10$ coins leads to 1,024 combinations.
And in particular, flipping any number $n$ coins leads to $2^n$ possible combinations.
Now, let's try and approach this problem probabilistic point of view. Looking back at the case when $n=2$, we know that the probability of getting exactly the same number of Heads and Tails (i.e., as you put it a ratio of exactly 1) is
$$Pr(\text{Ratio of exactly 1})=\frac{2}{4}=0.5$$
When $n=4$, we know that the probability of getting exactly the same number of Heads and Tails is
$$Pr(\text{Ratio of exactly 1})=\frac{6}{16}=0.375$$
And in general, as $n$ tends to grow larger we have that that the probability of getting exactly the same number of Heads and Tails goes to 0.
In other words, as $n\rightarrow\infty$, we have that
$$Pr(\text{Ratio of exactly 1})\rightarrow 0$$
And so, to answer your question. Really what you are observing is just a consequence of the fact that there will be far more combinations of coin flips where the number of heads and tails are not equal as compared to the number of combinations where they are equal.
As @Mark L. Stone suggests, if you are comfortable with the binomial formula and binomial random variables, then you can use that to show the same argument.
Let $X$ be the number of heads recorded when flipping a fair coin $n$ times. we can regard $X$ as a random variable coming from a binomial distribution, i.e., $X\sim Bin(n,p=0.5)$ (here we assume $p=0.5$ because we are dealing with a fair coin) then the probability of getting exactly the same number of heads as the number of tails (i.e., a ratio of exactly 1) is
$$Pr(\text{Ratio of exactly 1})=Pr\left(X=\frac{n}{2}\right)= {n \choose n/2} 0.5^{n/2}(0.5)^{n-n/2}={n \choose n/2} 0.5^{n}$$
Now, once again, as $n$ tends to grow large, the above expression tends towards 0 because ${n \choose n/2}0.5^n\rightarrow 0$ as $n\rightarrow\infty$.
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
Well we know that the Law of Large Numbers is what is guaranteeing the first conclusion of your experiement, namely, that if you flip a fair coin $n$ times, the ratio of heads to tails converges towar
|
9,445
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
|
See Pascal's Triangle.
The likelihood of coin flip outcomes is represented by the numbers along the bottom row. The outcome of equal heads and tails is the middle number. As the tree grows larger (i.e., more flips), the middle number becomes a smaller proportion of the sum of the bottom row.
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
|
See Pascal's Triangle.
The likelihood of coin flip outcomes is represented by the numbers along the bottom row. The outcome of equal heads and tails is the middle number. As the tree grows larger (i.e
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
See Pascal's Triangle.
The likelihood of coin flip outcomes is represented by the numbers along the bottom row. The outcome of equal heads and tails is the middle number. As the tree grows larger (i.e., more flips), the middle number becomes a smaller proportion of the sum of the bottom row.
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
See Pascal's Triangle.
The likelihood of coin flip outcomes is represented by the numbers along the bottom row. The outcome of equal heads and tails is the middle number. As the tree grows larger (i.e
|
9,446
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
|
Maybe it helps to outline that this is related to the arcsine law.
It says that for one path of outcomes the probability that the path stays for most the time in the positive or negative domain is much higher than that it is going up and down than you expect from intuition.
Here some links:
http://www.math.unl.edu/~sdunbar1/ProbabilityTheory/Lessons/BernoulliTrials/ExcessHeads/excessheads.shtml
https://en.wikipedia.org/wiki/Arcsine_law
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
|
Maybe it helps to outline that this is related to the arcsine law.
It says that for one path of outcomes the probability that the path stays for most the time in the positive or negative domain is muc
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
Maybe it helps to outline that this is related to the arcsine law.
It says that for one path of outcomes the probability that the path stays for most the time in the positive or negative domain is much higher than that it is going up and down than you expect from intuition.
Here some links:
http://www.math.unl.edu/~sdunbar1/ProbabilityTheory/Lessons/BernoulliTrials/ExcessHeads/excessheads.shtml
https://en.wikipedia.org/wiki/Arcsine_law
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
Maybe it helps to outline that this is related to the arcsine law.
It says that for one path of outcomes the probability that the path stays for most the time in the positive or negative domain is muc
|
9,447
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
|
While the ratio of heads to tails converges to 1, the range of possible numbers becomes wider. (I'm making the numbers up). Say for 100 throws the probability is 90% that you have between 45% and 55% heads. That's 90% that you get 45 to 55 heads. 11 possibilities for the number of heads. About 9% roughly that you get equal numbers of heads and tails.
Say for 10,000 throws the probability is 95% that you get between 49% and 51% heads. So the ratio has come a lot closer to 1. But now you have between 4,900 and 5,100 heads. 201 possibilities. Chance of equal numbers is only roughly about 0.5%.
And with a million throws you are quite sure to have between 49.9% and 50.1% heads. That's a range from 499,000 to 501,000 heads. 2,001 possibilities. The chance is now down to 0.05%.
Ok, the maths was made up. But this should give you an idea about the "why". Even though the ratio comes closer to 1, the number of possibilities becomes greater, so that hitting exactly half head, half tails, becomes less and less likely.
Another practical effect: It is unlikely in practice that you have a coin where the probability of throwing heads is exactly 50%. It might be 49.99371% if you have a really good coin. For small number of throws this doesn't make a difference. For large numbers, the percentage of heads will converge to 49.99371%, not 50%. If the number of throws is large enough, throwing 50% or more heads will become very, very unlikely.
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
|
While the ratio of heads to tails converges to 1, the range of possible numbers becomes wider. (I'm making the numbers up). Say for 100 throws the probability is 90% that you have between 45% and 55%
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
While the ratio of heads to tails converges to 1, the range of possible numbers becomes wider. (I'm making the numbers up). Say for 100 throws the probability is 90% that you have between 45% and 55% heads. That's 90% that you get 45 to 55 heads. 11 possibilities for the number of heads. About 9% roughly that you get equal numbers of heads and tails.
Say for 10,000 throws the probability is 95% that you get between 49% and 51% heads. So the ratio has come a lot closer to 1. But now you have between 4,900 and 5,100 heads. 201 possibilities. Chance of equal numbers is only roughly about 0.5%.
And with a million throws you are quite sure to have between 49.9% and 50.1% heads. That's a range from 499,000 to 501,000 heads. 2,001 possibilities. The chance is now down to 0.05%.
Ok, the maths was made up. But this should give you an idea about the "why". Even though the ratio comes closer to 1, the number of possibilities becomes greater, so that hitting exactly half head, half tails, becomes less and less likely.
Another practical effect: It is unlikely in practice that you have a coin where the probability of throwing heads is exactly 50%. It might be 49.99371% if you have a really good coin. For small number of throws this doesn't make a difference. For large numbers, the percentage of heads will converge to 49.99371%, not 50%. If the number of throws is large enough, throwing 50% or more heads will become very, very unlikely.
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
While the ratio of heads to tails converges to 1, the range of possible numbers becomes wider. (I'm making the numbers up). Say for 100 throws the probability is 90% that you have between 45% and 55%
|
9,448
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
|
Well, one thing to note is that with an even number of flips (otherwise the probability of equal heads and tails flips is of course exactly zero), the most probable outcome will always be the one with exactly as many heads flips as tails flips.
The distribution of $n$ flips is given by the coefficients of the polynomial $$\bigl(\frac{1+x}2\bigr)^n\qquad .$$
So for even $n$, the probability is
$$p_n = 2^{-n}{n \choose n/2}\qquad .$$
Using Stirling's approximation for $n!$, you arrive at something like
$$p \approx\frac1{\sqrt{\pi n/2}}$$
for the probability of exactly $n/2$ heads (and correspondingly tails) flips for $n$ overall flips. So the absolute probability of this outcome converges to 0 but much slower than most of the other outcomes, with the extreme cases of 0 heads (or alternatively 0 tails) flips being $2^{-n}$.
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
|
Well, one thing to note is that with an even number of flips (otherwise the probability of equal heads and tails flips is of course exactly zero), the most probable outcome will always be the one with
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
Well, one thing to note is that with an even number of flips (otherwise the probability of equal heads and tails flips is of course exactly zero), the most probable outcome will always be the one with exactly as many heads flips as tails flips.
The distribution of $n$ flips is given by the coefficients of the polynomial $$\bigl(\frac{1+x}2\bigr)^n\qquad .$$
So for even $n$, the probability is
$$p_n = 2^{-n}{n \choose n/2}\qquad .$$
Using Stirling's approximation for $n!$, you arrive at something like
$$p \approx\frac1{\sqrt{\pi n/2}}$$
for the probability of exactly $n/2$ heads (and correspondingly tails) flips for $n$ overall flips. So the absolute probability of this outcome converges to 0 but much slower than most of the other outcomes, with the extreme cases of 0 heads (or alternatively 0 tails) flips being $2^{-n}$.
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
Well, one thing to note is that with an even number of flips (otherwise the probability of equal heads and tails flips is of course exactly zero), the most probable outcome will always be the one with
|
9,449
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
|
Suppose you flip a coin twice. There are four possible outcomes: HH, HT, TH, and TT. In two of these, you have an equal number of heads and tails, so there's a 50% chance that you get the same number of heads and tails.
Now suppose you flip a coin 4,306,492,102 times. Do you expect a 50 percent chance that you'll wind up with exactly 2,153,246,051 heads and 2,153,246,051 tails?
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
|
Suppose you flip a coin twice. There are four possible outcomes: HH, HT, TH, and TT. In two of these, you have an equal number of heads and tails, so there's a 50% chance that you get the same numbe
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as the number of flips increases?
Suppose you flip a coin twice. There are four possible outcomes: HH, HT, TH, and TT. In two of these, you have an equal number of heads and tails, so there's a 50% chance that you get the same number of heads and tails.
Now suppose you flip a coin 4,306,492,102 times. Do you expect a 50 percent chance that you'll wind up with exactly 2,153,246,051 heads and 2,153,246,051 tails?
|
Statistics concept to explain why you're less likely to flip the same number of heads as tails, as t
Suppose you flip a coin twice. There are four possible outcomes: HH, HT, TH, and TT. In two of these, you have an equal number of heads and tails, so there's a 50% chance that you get the same numbe
|
9,450
|
What does "all else equal" mean in multiple regression?
|
You are right. Technically, it is any value. However, when I teach this I usually tell people that you are getting the effect of a one unit change in $X_j$ when all other variables are held at their respective means. I believe this is a common way to explain it that is not specific to me.
I usually go on to mention that if you don't have any interactions, $\beta_j$ will be the effect of a one unit change in $X_j$, no matter what the values of your other variables are. But I like to start with the mean formulation. The reason is that there are two effects of including multiple variables in a regression model. First, you get the effect of $X_j$ controlling for the other variables (see my answer here). The second is that the presence of the other variables (typically) reduces the residual variance of the model, making your variables (including $X_j$) 'more significant'. It is hard for people to understand how this works if the other variables have values that are all over the place. That seems like it would increase the variability somehow. If you think of adjusting each data point up or down for the value of each other variable until all the rest of the $X$ variables have been moved to their respective means, it is easier to see that the residual variability has been reduced.
I don't get to interactions until a class or two after I've introduced the basics of multiple regression. However, when I do get to them, I return to this material. The above applies when there are not interactions. When there are interactions, it is more complicated. In that case, the interacting variable[s] is being held constant (very specifically) at $0$, and at no other value.
If you want to see how this plays out algebraically, it is rather straight-forward. We can start with the no-interaction case. Let's determine the change in $\hat Y$ when all other variables are held constant at their respective means. Without loss of generality, let's say that there are three $X$ variables and we are interested in understanding how the change in $\hat Y$ is associated with a one unit change in $X_3$, holding $X_1$ and $X_2$ constant at their respective means:
\begin{align}
\hat Y_i &= \hat\beta_0 + \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 + \hat\beta_3X_{3i} \\
\hat Y_{i'} &= \hat\beta_0 + \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 + \hat\beta_3(X_{3i}\!+\!1) \\
~ \\
&\text{subtracting the first equation from the second:} \\
~ \\
\hat Y_{i'} - \hat Y_i &= \hat\beta_0 - \hat\beta_0 + \hat\beta_1\bar X_1 - \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 - \hat\beta_2\bar X_2 + \hat\beta_3(X_{3i}\!+\!1) - \hat\beta_3X_{3i} \\
\Delta Y &= \hat\beta_3X_{3i} + \hat\beta_3 - \hat\beta_3X_{3i} \\
\Delta Y &= \hat\beta_3
\end{align}
Now it is obvious that we could have put any value in for $X_1$ and $X_2$ in the first two equations, so long as we put the same value for $X_1$ ($X_2$) in both of them. That is, so long as we are holding $X_1$ and $X_2$ constant.
On the other hand, it does not work out this way if you have an interaction. Here I show the case where there is an $X_1X_3$ interaction term:
\begin{align}
\hat Y_i &= \hat\beta_0 + \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 + \hat\beta_3X_{3i} \quad\quad\ \! + \hat\beta_4\bar X_1X_{3i} \\
\hat Y_{i'} &= \hat\beta_0 + \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 + \hat\beta_3(X_{3i}\!+\!1) + \hat\beta_4\bar X_1(X_{3i}\!+\!1) \\
~ \\
&\text{subtracting the first equation from the second:} \\
~ \\
\hat Y_{i'} - \hat Y_i &= \hat\beta_0 - \hat\beta_0 + \hat\beta_1\bar X_1 - \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 - \hat\beta_2\bar X_2 + \hat\beta_3(X_{3i}\!+\!1) - \hat\beta_3X_{3i} + \\
&\quad\ \hat\beta_4\bar X_1(X_{3i}\!+\!1) - \hat\beta_4\bar X_1X_{3i} \\
\Delta Y &= \hat\beta_3X_{3i} + \hat\beta_3 - \hat\beta_3X_{3i} + \hat\beta_4\bar X_1 X_{3i} + \hat\beta_4\bar X_1 - \hat\beta_4\bar X_1X_{3i} \\
\Delta Y &= \hat\beta_3 + \hat\beta_4\bar X_1
\end{align}
In this case, it is not possible to hold all else constant. Because the interaction term is a function of $X_1$ and $X_3$, it is not possible to change $X_3$ without the interaction term changing as well. Thus, $\hat\beta_3$ equals the change in $\hat Y$ associated with a one unit change in $X_3$ only when the interacting variable ($X_1$) is held at $0$ instead of $\bar X_1$ (or any other value but $0$), in which case the last term in the bottom equation drops out.
In this discussion, I have focused on interactions, but more generally, the issue is when there is any variable that is a function of another such that it is not possible to change the value of the first without changing the respective value of the other variable. In such cases, the meaning of $\hat\beta_j$ becomes more complicated. For example, if you had a model with $X_j$ and $X_j^2$, then $\hat\beta_j$ is the derivative $\frac{dY}{dX_j}$ holding all else equal, and holding $X_j=0$ (see my answer here). Other, still more complicated formulations are possible as well.
|
What does "all else equal" mean in multiple regression?
|
You are right. Technically, it is any value. However, when I teach this I usually tell people that you are getting the effect of a one unit change in $X_j$ when all other variables are held at their
|
What does "all else equal" mean in multiple regression?
You are right. Technically, it is any value. However, when I teach this I usually tell people that you are getting the effect of a one unit change in $X_j$ when all other variables are held at their respective means. I believe this is a common way to explain it that is not specific to me.
I usually go on to mention that if you don't have any interactions, $\beta_j$ will be the effect of a one unit change in $X_j$, no matter what the values of your other variables are. But I like to start with the mean formulation. The reason is that there are two effects of including multiple variables in a regression model. First, you get the effect of $X_j$ controlling for the other variables (see my answer here). The second is that the presence of the other variables (typically) reduces the residual variance of the model, making your variables (including $X_j$) 'more significant'. It is hard for people to understand how this works if the other variables have values that are all over the place. That seems like it would increase the variability somehow. If you think of adjusting each data point up or down for the value of each other variable until all the rest of the $X$ variables have been moved to their respective means, it is easier to see that the residual variability has been reduced.
I don't get to interactions until a class or two after I've introduced the basics of multiple regression. However, when I do get to them, I return to this material. The above applies when there are not interactions. When there are interactions, it is more complicated. In that case, the interacting variable[s] is being held constant (very specifically) at $0$, and at no other value.
If you want to see how this plays out algebraically, it is rather straight-forward. We can start with the no-interaction case. Let's determine the change in $\hat Y$ when all other variables are held constant at their respective means. Without loss of generality, let's say that there are three $X$ variables and we are interested in understanding how the change in $\hat Y$ is associated with a one unit change in $X_3$, holding $X_1$ and $X_2$ constant at their respective means:
\begin{align}
\hat Y_i &= \hat\beta_0 + \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 + \hat\beta_3X_{3i} \\
\hat Y_{i'} &= \hat\beta_0 + \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 + \hat\beta_3(X_{3i}\!+\!1) \\
~ \\
&\text{subtracting the first equation from the second:} \\
~ \\
\hat Y_{i'} - \hat Y_i &= \hat\beta_0 - \hat\beta_0 + \hat\beta_1\bar X_1 - \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 - \hat\beta_2\bar X_2 + \hat\beta_3(X_{3i}\!+\!1) - \hat\beta_3X_{3i} \\
\Delta Y &= \hat\beta_3X_{3i} + \hat\beta_3 - \hat\beta_3X_{3i} \\
\Delta Y &= \hat\beta_3
\end{align}
Now it is obvious that we could have put any value in for $X_1$ and $X_2$ in the first two equations, so long as we put the same value for $X_1$ ($X_2$) in both of them. That is, so long as we are holding $X_1$ and $X_2$ constant.
On the other hand, it does not work out this way if you have an interaction. Here I show the case where there is an $X_1X_3$ interaction term:
\begin{align}
\hat Y_i &= \hat\beta_0 + \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 + \hat\beta_3X_{3i} \quad\quad\ \! + \hat\beta_4\bar X_1X_{3i} \\
\hat Y_{i'} &= \hat\beta_0 + \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 + \hat\beta_3(X_{3i}\!+\!1) + \hat\beta_4\bar X_1(X_{3i}\!+\!1) \\
~ \\
&\text{subtracting the first equation from the second:} \\
~ \\
\hat Y_{i'} - \hat Y_i &= \hat\beta_0 - \hat\beta_0 + \hat\beta_1\bar X_1 - \hat\beta_1\bar X_1 + \hat\beta_2\bar X_2 - \hat\beta_2\bar X_2 + \hat\beta_3(X_{3i}\!+\!1) - \hat\beta_3X_{3i} + \\
&\quad\ \hat\beta_4\bar X_1(X_{3i}\!+\!1) - \hat\beta_4\bar X_1X_{3i} \\
\Delta Y &= \hat\beta_3X_{3i} + \hat\beta_3 - \hat\beta_3X_{3i} + \hat\beta_4\bar X_1 X_{3i} + \hat\beta_4\bar X_1 - \hat\beta_4\bar X_1X_{3i} \\
\Delta Y &= \hat\beta_3 + \hat\beta_4\bar X_1
\end{align}
In this case, it is not possible to hold all else constant. Because the interaction term is a function of $X_1$ and $X_3$, it is not possible to change $X_3$ without the interaction term changing as well. Thus, $\hat\beta_3$ equals the change in $\hat Y$ associated with a one unit change in $X_3$ only when the interacting variable ($X_1$) is held at $0$ instead of $\bar X_1$ (or any other value but $0$), in which case the last term in the bottom equation drops out.
In this discussion, I have focused on interactions, but more generally, the issue is when there is any variable that is a function of another such that it is not possible to change the value of the first without changing the respective value of the other variable. In such cases, the meaning of $\hat\beta_j$ becomes more complicated. For example, if you had a model with $X_j$ and $X_j^2$, then $\hat\beta_j$ is the derivative $\frac{dY}{dX_j}$ holding all else equal, and holding $X_j=0$ (see my answer here). Other, still more complicated formulations are possible as well.
|
What does "all else equal" mean in multiple regression?
You are right. Technically, it is any value. However, when I teach this I usually tell people that you are getting the effect of a one unit change in $X_j$ when all other variables are held at their
|
9,451
|
What does "all else equal" mean in multiple regression?
|
The math is simple, just take the difference between 2 models with one of the x variables changed by 1 and you will see that it does not matter what the other variables are (given there are no interactions, polynomial, or other complicating terms).
One example:
$y_{[1]} = b_0 + b_1 \times x_1 + b_2 \times x_2$
$y_{[2]} = b_0 + b_1 \times (x_1 + 1) + b_2 \times x_2$
$y_{[2]} - y_{[1]} = b_0 - b_0 + b_1\times x_1 - b_1\times x_1 + b_1 \times 1 + b_2 \times x_2 - b_2 \times x_2 = b_1$
|
What does "all else equal" mean in multiple regression?
|
The math is simple, just take the difference between 2 models with one of the x variables changed by 1 and you will see that it does not matter what the other variables are (given there are no interac
|
What does "all else equal" mean in multiple regression?
The math is simple, just take the difference between 2 models with one of the x variables changed by 1 and you will see that it does not matter what the other variables are (given there are no interactions, polynomial, or other complicating terms).
One example:
$y_{[1]} = b_0 + b_1 \times x_1 + b_2 \times x_2$
$y_{[2]} = b_0 + b_1 \times (x_1 + 1) + b_2 \times x_2$
$y_{[2]} - y_{[1]} = b_0 - b_0 + b_1\times x_1 - b_1\times x_1 + b_1 \times 1 + b_2 \times x_2 - b_2 \times x_2 = b_1$
|
What does "all else equal" mean in multiple regression?
The math is simple, just take the difference between 2 models with one of the x variables changed by 1 and you will see that it does not matter what the other variables are (given there are no interac
|
9,452
|
What does "all else equal" mean in multiple regression?
|
I believe you are referring to dependence in covariates ($X_i$). So if the model is $$Y=\beta_{0}+\beta_{1}X_1+\beta_{2}X_2$$
the effect of $X_i$ on $Y$ all other things being equal would be $\frac{\Delta{Y}}{\Delta{X_i}}$ for any $\Delta{X_i}$ with all other $X_j$ held constant at any value.
Keep in mind that is possible that $X_1$ and $X_2$ are dependent (e.g. functions of each other) without necessarily showing a significant interaction in the linear model ($\beta_{12}=0$ in $Y=\beta_{0}+\beta_{1}X_1+\beta_{2}X_2+\beta_{12}X_1X_2$).
Just as an interesting tangent here is an example:
Let $X_1\sim N(0,\sigma_1^2)$ and $X_2=X_1^{2}+N(0,\sigma_2^2)$ then clearly any change in $X_1$ will affect $X_2$. However the covariance between the two is zero. $$cov(X_1,X_2)=E(X_1X_2)-E(X_1)E(X_2)$$ $$=E[X_1(X_1^2+a)]-E(X_1).E(X_1^2-a)\,with\,a\sim N(0,\sigma_2^2)$$ $$=E(X_1^3)-E(X_1.a)-0.E(X_1^2-a)=0-0-0=0$$
So in reality a change in $X_1$ would be associated with a change in $X_2$ and that $\frac{\Delta{Y}}{\Delta{X_i}}$ would not cover what really would occur if you alter $X_1$. But $\frac{\Delta{Y}}{\Delta{X_i}}$ would still be described as the effect of $X_i$ on $Y$ all things being equal.
This is comparable to the difference between a full derivative and a partial derivate (the analog of $\frac{\Delta{Y}}{\Delta{X_i}}$) in a differential equation.
|
What does "all else equal" mean in multiple regression?
|
I believe you are referring to dependence in covariates ($X_i$). So if the model is $$Y=\beta_{0}+\beta_{1}X_1+\beta_{2}X_2$$
the effect of $X_i$ on $Y$ all other things being equal would be $\frac{\
|
What does "all else equal" mean in multiple regression?
I believe you are referring to dependence in covariates ($X_i$). So if the model is $$Y=\beta_{0}+\beta_{1}X_1+\beta_{2}X_2$$
the effect of $X_i$ on $Y$ all other things being equal would be $\frac{\Delta{Y}}{\Delta{X_i}}$ for any $\Delta{X_i}$ with all other $X_j$ held constant at any value.
Keep in mind that is possible that $X_1$ and $X_2$ are dependent (e.g. functions of each other) without necessarily showing a significant interaction in the linear model ($\beta_{12}=0$ in $Y=\beta_{0}+\beta_{1}X_1+\beta_{2}X_2+\beta_{12}X_1X_2$).
Just as an interesting tangent here is an example:
Let $X_1\sim N(0,\sigma_1^2)$ and $X_2=X_1^{2}+N(0,\sigma_2^2)$ then clearly any change in $X_1$ will affect $X_2$. However the covariance between the two is zero. $$cov(X_1,X_2)=E(X_1X_2)-E(X_1)E(X_2)$$ $$=E[X_1(X_1^2+a)]-E(X_1).E(X_1^2-a)\,with\,a\sim N(0,\sigma_2^2)$$ $$=E(X_1^3)-E(X_1.a)-0.E(X_1^2-a)=0-0-0=0$$
So in reality a change in $X_1$ would be associated with a change in $X_2$ and that $\frac{\Delta{Y}}{\Delta{X_i}}$ would not cover what really would occur if you alter $X_1$. But $\frac{\Delta{Y}}{\Delta{X_i}}$ would still be described as the effect of $X_i$ on $Y$ all things being equal.
This is comparable to the difference between a full derivative and a partial derivate (the analog of $\frac{\Delta{Y}}{\Delta{X_i}}$) in a differential equation.
|
What does "all else equal" mean in multiple regression?
I believe you are referring to dependence in covariates ($X_i$). So if the model is $$Y=\beta_{0}+\beta_{1}X_1+\beta_{2}X_2$$
the effect of $X_i$ on $Y$ all other things being equal would be $\frac{\
|
9,453
|
What should I check for normality: raw data or residuals?
|
Why must you test for normality?
The standard assumption in linear regression is that the theoretical residuals are independent and normally distributed. The observed residuals are an estimate of the theoretical residuals, but are not independent (there are transforms on the residuals that remove some of the dependence, but still give only an approximation of the true residuals). So a test on the observed residuals does not guarantee that the theoretical residuals match.
If the theoretical residuals are not exactly normally distributed, but the sample size is large enough then the Central Limit Theorem says that the usual inference (tests and confidence intervals, but not necessarily prediction intervals) based on the assumption of normality will still be approximately correct.
Also note that the tests of normality are rule out tests, they can tell you that the data is unlikely to have come from a normal distribution. But if the test is not significant that does not mean that the data came from a normal distribution, it could also mean that you just don't have enough power to see the difference. Larger sample sizes give more power to detect the non-normality, but larger samples and the CLT mean that the non-normality is least important. So for small sample sizes the assumption of normality is important but the tests are meaningless, for large sample sizes the tests may be more accurate, but the question of exact normality becomes meaningless.
So combining all the above, what is more important than a test of exact normality is an understanding of the science behind the data to see if the population is close enough to normal. Graphs like qqplots can be good diagnostics, but understanding of the science is needed as well. If there is concern that there is too much skewness or potential for outliers, then non-parametric methods are available that do not require the normality assumption.
|
What should I check for normality: raw data or residuals?
|
Why must you test for normality?
The standard assumption in linear regression is that the theoretical residuals are independent and normally distributed. The observed residuals are an estimate of the
|
What should I check for normality: raw data or residuals?
Why must you test for normality?
The standard assumption in linear regression is that the theoretical residuals are independent and normally distributed. The observed residuals are an estimate of the theoretical residuals, but are not independent (there are transforms on the residuals that remove some of the dependence, but still give only an approximation of the true residuals). So a test on the observed residuals does not guarantee that the theoretical residuals match.
If the theoretical residuals are not exactly normally distributed, but the sample size is large enough then the Central Limit Theorem says that the usual inference (tests and confidence intervals, but not necessarily prediction intervals) based on the assumption of normality will still be approximately correct.
Also note that the tests of normality are rule out tests, they can tell you that the data is unlikely to have come from a normal distribution. But if the test is not significant that does not mean that the data came from a normal distribution, it could also mean that you just don't have enough power to see the difference. Larger sample sizes give more power to detect the non-normality, but larger samples and the CLT mean that the non-normality is least important. So for small sample sizes the assumption of normality is important but the tests are meaningless, for large sample sizes the tests may be more accurate, but the question of exact normality becomes meaningless.
So combining all the above, what is more important than a test of exact normality is an understanding of the science behind the data to see if the population is close enough to normal. Graphs like qqplots can be good diagnostics, but understanding of the science is needed as well. If there is concern that there is too much skewness or potential for outliers, then non-parametric methods are available that do not require the normality assumption.
|
What should I check for normality: raw data or residuals?
Why must you test for normality?
The standard assumption in linear regression is that the theoretical residuals are independent and normally distributed. The observed residuals are an estimate of the
|
9,454
|
What should I check for normality: raw data or residuals?
|
First you can "eyeball it" using a QQ-plot to get a general sense here is how to generate one in R.
According to the R manual you can feed your data vector directly into the shapiro.test() function.
If you would like to calculate the residuals yourself yes each residual is calculated that way over your set of observations. You can see more about it here.
|
What should I check for normality: raw data or residuals?
|
First you can "eyeball it" using a QQ-plot to get a general sense here is how to generate one in R.
According to the R manual you can feed your data vector directly into the shapiro.test() function.
I
|
What should I check for normality: raw data or residuals?
First you can "eyeball it" using a QQ-plot to get a general sense here is how to generate one in R.
According to the R manual you can feed your data vector directly into the shapiro.test() function.
If you would like to calculate the residuals yourself yes each residual is calculated that way over your set of observations. You can see more about it here.
|
What should I check for normality: raw data or residuals?
First you can "eyeball it" using a QQ-plot to get a general sense here is how to generate one in R.
According to the R manual you can feed your data vector directly into the shapiro.test() function.
I
|
9,455
|
What should I check for normality: raw data or residuals?
|
The Gaussian Asuumptions refer to the residuals from the model. There are no assumptions necessary about the original data. As a case in point the distribution of daily beer sales
.After a reasonable model captured the day-of-the-week, holiday/events effects , level shifts/time trends we get
|
What should I check for normality: raw data or residuals?
|
The Gaussian Asuumptions refer to the residuals from the model. There are no assumptions necessary about the original data. As a case in point the distribution of daily beer sales
.After a reasonabl
|
What should I check for normality: raw data or residuals?
The Gaussian Asuumptions refer to the residuals from the model. There are no assumptions necessary about the original data. As a case in point the distribution of daily beer sales
.After a reasonable model captured the day-of-the-week, holiday/events effects , level shifts/time trends we get
|
What should I check for normality: raw data or residuals?
The Gaussian Asuumptions refer to the residuals from the model. There are no assumptions necessary about the original data. As a case in point the distribution of daily beer sales
.After a reasonabl
|
9,456
|
Do underpowered studies have increased likelihood of false positives?
|
You are correct in that sample size affects power (i.e. 1 - type II error), but not type I error. It's a common misunderstanding that a p-value as such (correctly interpreted) is less reliable or valid when the sample size is small - the very entertaining article by Friston 2012 has a funny take on that [1].
That being said, the issues with underpowered studies are real, and the quote is largely correct I would say, only a bit imprecise in its wording.
The basic problem with underpowered studies in the standard NHST framework is that, although the rate of false positives (type I error) is fixed, the rate of true positives (power) goes down, and thus the relative proportion of true positives in all positives. Hence, if we assume that people tend to publish only positive (= significant) results, a reported positive result is less likely to be a true positive when the study is underpowered. This idea is expressed in the false discovery rate [2], see also [3]. This seems what the quote refers to.
An additional issue often named regarding underpowered studies is that they lead to overestimated effect sizes. The reasons is that a) with lower power, your estimates of the true effects will become more variable (stochastic) around their true value, and b) only the strongest of those effects will pass the significance filter when the power is low. One should add though that this is a reporting problem that could easily be fixed by discussing and reporting all and not only significant effects.
Finally, an important practical issue with underpowered studies is that low power increases statistical issues (e.g. bias of estimators) as well as the temptation for playing around with variables and similar p-hacking tactics. Using these "researcher degrees of freedom" is most effective when the power is low, and THIS can increase type I error after all, see, e.g., [4].
For all these reasons, I would therefore be indeed skeptical about an underpowered study.
[1] Friston, K. (2012) Ten ironic rules for non-statistical reviewers. NeuroImage, 61, 1300-1310.
[2] https://en.wikipedia.org/wiki/False_discovery_rate
[3] Button, K. S.; Ioannidis, J. P. A.; Mokrysz, C.; Nosek, B. A.; Flint, J.; Robinson, E. S. J. & Munafo, M. R. (2013) Power failure: why small sample size undermines the reliability of neuroscience. Nat. Rev. Neurosci., 14, 365-376
[4] Simmons, J. P.; Nelson, L. D. & Simonsohn, U. (2011) False-Positive Psychology: Undisclosed Flexibility in Data Collection and Analysis Allows Presenting Anything as Significant. Psychol Sci., 22, 1359-1366.
|
Do underpowered studies have increased likelihood of false positives?
|
You are correct in that sample size affects power (i.e. 1 - type II error), but not type I error. It's a common misunderstanding that a p-value as such (correctly interpreted) is less reliable or vali
|
Do underpowered studies have increased likelihood of false positives?
You are correct in that sample size affects power (i.e. 1 - type II error), but not type I error. It's a common misunderstanding that a p-value as such (correctly interpreted) is less reliable or valid when the sample size is small - the very entertaining article by Friston 2012 has a funny take on that [1].
That being said, the issues with underpowered studies are real, and the quote is largely correct I would say, only a bit imprecise in its wording.
The basic problem with underpowered studies in the standard NHST framework is that, although the rate of false positives (type I error) is fixed, the rate of true positives (power) goes down, and thus the relative proportion of true positives in all positives. Hence, if we assume that people tend to publish only positive (= significant) results, a reported positive result is less likely to be a true positive when the study is underpowered. This idea is expressed in the false discovery rate [2], see also [3]. This seems what the quote refers to.
An additional issue often named regarding underpowered studies is that they lead to overestimated effect sizes. The reasons is that a) with lower power, your estimates of the true effects will become more variable (stochastic) around their true value, and b) only the strongest of those effects will pass the significance filter when the power is low. One should add though that this is a reporting problem that could easily be fixed by discussing and reporting all and not only significant effects.
Finally, an important practical issue with underpowered studies is that low power increases statistical issues (e.g. bias of estimators) as well as the temptation for playing around with variables and similar p-hacking tactics. Using these "researcher degrees of freedom" is most effective when the power is low, and THIS can increase type I error after all, see, e.g., [4].
For all these reasons, I would therefore be indeed skeptical about an underpowered study.
[1] Friston, K. (2012) Ten ironic rules for non-statistical reviewers. NeuroImage, 61, 1300-1310.
[2] https://en.wikipedia.org/wiki/False_discovery_rate
[3] Button, K. S.; Ioannidis, J. P. A.; Mokrysz, C.; Nosek, B. A.; Flint, J.; Robinson, E. S. J. & Munafo, M. R. (2013) Power failure: why small sample size undermines the reliability of neuroscience. Nat. Rev. Neurosci., 14, 365-376
[4] Simmons, J. P.; Nelson, L. D. & Simonsohn, U. (2011) False-Positive Psychology: Undisclosed Flexibility in Data Collection and Analysis Allows Presenting Anything as Significant. Psychol Sci., 22, 1359-1366.
|
Do underpowered studies have increased likelihood of false positives?
You are correct in that sample size affects power (i.e. 1 - type II error), but not type I error. It's a common misunderstanding that a p-value as such (correctly interpreted) is less reliable or vali
|
9,457
|
Do underpowered studies have increased likelihood of false positives?
|
Depending on how you look at it, low power can increase false positive rates in given scenarios.
Consider the following: a researcher tests a treatment. If the test comes back as insignificant, they abandon it and move onto the next treatment. If the test comes back significant, they publish it. Let's also consider that the researcher will tests some treatments that work and some that don't. If the researcher has high power (of course referring to the case when they are testing a treatment that works), then they are very likely to stop once they test an effective treatment. On the other hand, with low power, they are likely to miss the true treatment effect and move on to other treatments. The more null treatments they test, the more likely they are to make a Type I error (this researcher does not account for multiple comparisons). In the case of low power, they are expected to test many more null treatments, thus greatly increasing the chance that this researcher will make a type I error.
You might say "well, this is just a researcher abusing multiple comparisons!". Well, that may be true, but that is also how a lot of research gets done these days. Because of exactly these reasons, I personally have little faith in published work unless it has a large enough sample size such that the researcher could not afford to repeat the same experiment a large number of times.
|
Do underpowered studies have increased likelihood of false positives?
|
Depending on how you look at it, low power can increase false positive rates in given scenarios.
Consider the following: a researcher tests a treatment. If the test comes back as insignificant, they
|
Do underpowered studies have increased likelihood of false positives?
Depending on how you look at it, low power can increase false positive rates in given scenarios.
Consider the following: a researcher tests a treatment. If the test comes back as insignificant, they abandon it and move onto the next treatment. If the test comes back significant, they publish it. Let's also consider that the researcher will tests some treatments that work and some that don't. If the researcher has high power (of course referring to the case when they are testing a treatment that works), then they are very likely to stop once they test an effective treatment. On the other hand, with low power, they are likely to miss the true treatment effect and move on to other treatments. The more null treatments they test, the more likely they are to make a Type I error (this researcher does not account for multiple comparisons). In the case of low power, they are expected to test many more null treatments, thus greatly increasing the chance that this researcher will make a type I error.
You might say "well, this is just a researcher abusing multiple comparisons!". Well, that may be true, but that is also how a lot of research gets done these days. Because of exactly these reasons, I personally have little faith in published work unless it has a large enough sample size such that the researcher could not afford to repeat the same experiment a large number of times.
|
Do underpowered studies have increased likelihood of false positives?
Depending on how you look at it, low power can increase false positive rates in given scenarios.
Consider the following: a researcher tests a treatment. If the test comes back as insignificant, they
|
9,458
|
Do underpowered studies have increased likelihood of false positives?
|
Low power can't effect the Type-1 error rate, but it could effect the proportion of published results that are type-1 errors.
The reason is that low power reduces the chances of a correct rejection of H0 (Type-2 error) but not the chances of a false rejection of H0 (Type-1 error).
Assume for a second that there are two literatures...one conducted with very low power -- near zero -- and the other conducted with adequate power. In both literatures, you can assume that when H0 is false, you will still get false positives some of the time (e.g., 5% for alpha = .05). Assuming researchers are not always correct in their hypotheses, we can assume both literatures should have a similar NUMBER of Type-1 errors, good power or not. This is because the rate of Type-1 errors is not impacted by power, as other have said.
However, in the literature with LOW power, you would also have a lot of Type-2 errors. In other words, the low-power literature should LACK correct rejections of H0, making the Type-1 errors a larger proportion of the literature. In the high-power literature, you should have a mixture of correct and incorrect rejections of H0.
So, does low power increase Type-1 errors? No. However, it does make it harder to find true effects, making Type-1 errors a larger proportion of published findings.
|
Do underpowered studies have increased likelihood of false positives?
|
Low power can't effect the Type-1 error rate, but it could effect the proportion of published results that are type-1 errors.
The reason is that low power reduces the chances of a correct rejection o
|
Do underpowered studies have increased likelihood of false positives?
Low power can't effect the Type-1 error rate, but it could effect the proportion of published results that are type-1 errors.
The reason is that low power reduces the chances of a correct rejection of H0 (Type-2 error) but not the chances of a false rejection of H0 (Type-1 error).
Assume for a second that there are two literatures...one conducted with very low power -- near zero -- and the other conducted with adequate power. In both literatures, you can assume that when H0 is false, you will still get false positives some of the time (e.g., 5% for alpha = .05). Assuming researchers are not always correct in their hypotheses, we can assume both literatures should have a similar NUMBER of Type-1 errors, good power or not. This is because the rate of Type-1 errors is not impacted by power, as other have said.
However, in the literature with LOW power, you would also have a lot of Type-2 errors. In other words, the low-power literature should LACK correct rejections of H0, making the Type-1 errors a larger proportion of the literature. In the high-power literature, you should have a mixture of correct and incorrect rejections of H0.
So, does low power increase Type-1 errors? No. However, it does make it harder to find true effects, making Type-1 errors a larger proportion of published findings.
|
Do underpowered studies have increased likelihood of false positives?
Low power can't effect the Type-1 error rate, but it could effect the proportion of published results that are type-1 errors.
The reason is that low power reduces the chances of a correct rejection o
|
9,459
|
Do underpowered studies have increased likelihood of false positives?
|
In addition to the others answer, a study is usually underpowered when the sample size is small. There are many tests that are only asymptotically valid, and too optimistic or conservative for small n.
Other tests are only valid for small sample sizes if certain conditions are met, but become more robust with a large sample size (e.g. t-test).
In both these cases small sample size and unmet assumption can lead to an increased type I error rate. Both these situations occur often enough that I consider the real answer to your question to be: not in theory but in practice.
|
Do underpowered studies have increased likelihood of false positives?
|
In addition to the others answer, a study is usually underpowered when the sample size is small. There are many tests that are only asymptotically valid, and too optimistic or conservative for small n
|
Do underpowered studies have increased likelihood of false positives?
In addition to the others answer, a study is usually underpowered when the sample size is small. There are many tests that are only asymptotically valid, and too optimistic or conservative for small n.
Other tests are only valid for small sample sizes if certain conditions are met, but become more robust with a large sample size (e.g. t-test).
In both these cases small sample size and unmet assumption can lead to an increased type I error rate. Both these situations occur often enough that I consider the real answer to your question to be: not in theory but in practice.
|
Do underpowered studies have increased likelihood of false positives?
In addition to the others answer, a study is usually underpowered when the sample size is small. There are many tests that are only asymptotically valid, and too optimistic or conservative for small n
|
9,460
|
What aspects of the "Iris" data set make it so successful as an example/teaching/test data set
|
The Iris dataset is deservedly widely used throughout statistical science, especially for illustrating various problems in statistical graphics, multivariate statistics and machine learning.
Containing 150 observations, it is small but not trivial.
The task it poses of discriminating between three species of Iris from measurements of their petals and sepals is simple but challenging.
The data are real data, but apparently of good quality. In principle and in practice, test datasets could be synthetic and that might be necessary or useful to make a point. Nevertheless, few people object to real data.
The data were used by the celebrated British statistician Ronald Fisher in 1936. (Later he was knighted and became Sir Ronald.) At least some teachers like the idea of a dataset with a link to someone so well known within the field. The data were originally published by the statistically-minded botanist Edgar Anderson, but that earlier origin does not diminish the association.
Using a few famous datasets is one of the traditions we hand down, such as telling each new generation that Student worked for Guinness or that many famous statisticians fell out with each other. That may sound like inertia, but in comparing methods old and new, and in evaluating any method, it is often considered helpful to try them out on known datasets, thus maintaining some continuity in how we assess methods.
Last, but not least, the Iris dataset can be enjoyably coupled with pictures of the flowers concerned, as from e.g. the useful Wikipedia entry on the dataset.
Note. Do your bit for biological correctness in citing the plants concerned carefully. Iris setosa, Iris versicolor and Iris virginica are three species (not varieties, as in some statistical accounts); their binominals should be presented in italic, as here; and Iris as genus name and the other names indicating particular species should begin with upper and lower case respectively.
(EDIT 4 May 2022 In a generally excellent book to hand on machine learning, the Iris data are described in terms of classes, types, kinds and subspecies, but never once correctly from a biological viewpoint. Naturally that sloppiness makes not a jot of difference to the machine learning exposition.)
Stebbins (1978) gave an appreciation of Anderson, a distinguished and
idiosyncratic botanist, and comments on the scientific background to
distinguishing three species of the genus Iris. Kleinman (2002)
surveys Anderson's graphical contributions with statistical flavor. See also Unwin and Kleinman (2021).
Kleinman, K. 2002.
How graphical innovations assisted Edgar Anderson's discoveries in
evolutionary biology.
Chance 15(3): 17-21.
Stebbins, G. L. 1978. Edgar Anderson 1897--1969.
Biographical Memoir. Washington, DC: National Academy of Sciences.
accessible here
Unwin, A. and Kleinman, K. 2021. The iris data set: In search of the source of virginica. Significance 18: 26-29. https://doi.org/10.1111/1740-9713.01589
|
What aspects of the "Iris" data set make it so successful as an example/teaching/test data set
|
The Iris dataset is deservedly widely used throughout statistical science, especially for illustrating various problems in statistical graphics, multivariate statistics and machine learning.
Containi
|
What aspects of the "Iris" data set make it so successful as an example/teaching/test data set
The Iris dataset is deservedly widely used throughout statistical science, especially for illustrating various problems in statistical graphics, multivariate statistics and machine learning.
Containing 150 observations, it is small but not trivial.
The task it poses of discriminating between three species of Iris from measurements of their petals and sepals is simple but challenging.
The data are real data, but apparently of good quality. In principle and in practice, test datasets could be synthetic and that might be necessary or useful to make a point. Nevertheless, few people object to real data.
The data were used by the celebrated British statistician Ronald Fisher in 1936. (Later he was knighted and became Sir Ronald.) At least some teachers like the idea of a dataset with a link to someone so well known within the field. The data were originally published by the statistically-minded botanist Edgar Anderson, but that earlier origin does not diminish the association.
Using a few famous datasets is one of the traditions we hand down, such as telling each new generation that Student worked for Guinness or that many famous statisticians fell out with each other. That may sound like inertia, but in comparing methods old and new, and in evaluating any method, it is often considered helpful to try them out on known datasets, thus maintaining some continuity in how we assess methods.
Last, but not least, the Iris dataset can be enjoyably coupled with pictures of the flowers concerned, as from e.g. the useful Wikipedia entry on the dataset.
Note. Do your bit for biological correctness in citing the plants concerned carefully. Iris setosa, Iris versicolor and Iris virginica are three species (not varieties, as in some statistical accounts); their binominals should be presented in italic, as here; and Iris as genus name and the other names indicating particular species should begin with upper and lower case respectively.
(EDIT 4 May 2022 In a generally excellent book to hand on machine learning, the Iris data are described in terms of classes, types, kinds and subspecies, but never once correctly from a biological viewpoint. Naturally that sloppiness makes not a jot of difference to the machine learning exposition.)
Stebbins (1978) gave an appreciation of Anderson, a distinguished and
idiosyncratic botanist, and comments on the scientific background to
distinguishing three species of the genus Iris. Kleinman (2002)
surveys Anderson's graphical contributions with statistical flavor. See also Unwin and Kleinman (2021).
Kleinman, K. 2002.
How graphical innovations assisted Edgar Anderson's discoveries in
evolutionary biology.
Chance 15(3): 17-21.
Stebbins, G. L. 1978. Edgar Anderson 1897--1969.
Biographical Memoir. Washington, DC: National Academy of Sciences.
accessible here
Unwin, A. and Kleinman, K. 2021. The iris data set: In search of the source of virginica. Significance 18: 26-29. https://doi.org/10.1111/1740-9713.01589
|
What aspects of the "Iris" data set make it so successful as an example/teaching/test data set
The Iris dataset is deservedly widely used throughout statistical science, especially for illustrating various problems in statistical graphics, multivariate statistics and machine learning.
Containi
|
9,461
|
What aspects of the "Iris" data set make it so successful as an example/teaching/test data set
|
The dataset is big and interesting enough to be non-trivial, but small enough to "fit in your pocket", and not slow down experimentation with it.
I think a key aspect is that it also teaches about over-fitting. There are not enough columns to give a perfect score: we see this immediately when we look at the scatterplots, and they overlap and run into each other. So any machine-learning approach that gets a perfect score can be regarded as suspicious.
|
What aspects of the "Iris" data set make it so successful as an example/teaching/test data set
|
The dataset is big and interesting enough to be non-trivial, but small enough to "fit in your pocket", and not slow down experimentation with it.
I think a key aspect is that it also teaches about ove
|
What aspects of the "Iris" data set make it so successful as an example/teaching/test data set
The dataset is big and interesting enough to be non-trivial, but small enough to "fit in your pocket", and not slow down experimentation with it.
I think a key aspect is that it also teaches about over-fitting. There are not enough columns to give a perfect score: we see this immediately when we look at the scatterplots, and they overlap and run into each other. So any machine-learning approach that gets a perfect score can be regarded as suspicious.
|
What aspects of the "Iris" data set make it so successful as an example/teaching/test data set
The dataset is big and interesting enough to be non-trivial, but small enough to "fit in your pocket", and not slow down experimentation with it.
I think a key aspect is that it also teaches about ove
|
9,462
|
What impact does increasing the training data have on the overall system accuracy?
|
In most situations, more data is usually better. Overfitting is essentially learning spurious correlations that occur in your training data, but not the real world. For example, if you considered only my colleagues, you might learn to associate "named Matt" with "has a beard." It's 100% valid ($n=4$, even!) when considering only the small group of people working on floor, but it's obviously not true in general. Increasing the size of your data set (e.g., to the entire building or city) should reduce these spurious correlations and improve the performance of your learner.
That said, one situation where more data does not help---and may even hurt---is if your additional training data is noisy or doesn't match whatever you are trying to predict. I once did an experiment where I plugged different language models[*] into a voice-activated restaurant reservation system. I varied the amount of training data as well as its relevance: at one extreme, I had a small, carefully curated collection of people booking tables, a perfect match for my application. At the other, I had a model estimated from huge collection of classic literature, a more accurate language model, but a much worse match to the application. To my surprise, the small-but-relevant model vastly outperformed the big-but-less-relevant model.
A surprising situation, called **double-descent**, also occurs when size of the training set is close to the number of model parameters. In these cases, the test risk first decreases as the size of the training set increases, transiently *increases* when a bit more training data is added, and finally begins decreasing again as the training set continues to grow. This phenomena was reported 25 years in the neural network literature (see Opper, 1995), but occurs in modern networks too ([Advani and Saxe, 2017][1]). Interestingly, this happens even for a linear regression, albeit one fit by SGD ([Nakkiran, 2019][2]). This phenomenon is not yet totally understood and is largely of theoretical interest: I certainly wouldn't use it as a reason not to collect more data (though I might fiddle with the training set size if n==p and the performance were unexpectedly bad).
[*]A language model is just the probability of seeing a given sequence of words e.g. $P(w_n = \textrm{'quick', } w_{n+1} = \textrm{'brown', } w_{n+2} = \textrm{'fox'})$. They're vital to building halfway decent speech/character recognizers.
|
What impact does increasing the training data have on the overall system accuracy?
|
In most situations, more data is usually better. Overfitting is essentially learning spurious correlations that occur in your training data, but not the real world. For example, if you considered only
|
What impact does increasing the training data have on the overall system accuracy?
In most situations, more data is usually better. Overfitting is essentially learning spurious correlations that occur in your training data, but not the real world. For example, if you considered only my colleagues, you might learn to associate "named Matt" with "has a beard." It's 100% valid ($n=4$, even!) when considering only the small group of people working on floor, but it's obviously not true in general. Increasing the size of your data set (e.g., to the entire building or city) should reduce these spurious correlations and improve the performance of your learner.
That said, one situation where more data does not help---and may even hurt---is if your additional training data is noisy or doesn't match whatever you are trying to predict. I once did an experiment where I plugged different language models[*] into a voice-activated restaurant reservation system. I varied the amount of training data as well as its relevance: at one extreme, I had a small, carefully curated collection of people booking tables, a perfect match for my application. At the other, I had a model estimated from huge collection of classic literature, a more accurate language model, but a much worse match to the application. To my surprise, the small-but-relevant model vastly outperformed the big-but-less-relevant model.
A surprising situation, called **double-descent**, also occurs when size of the training set is close to the number of model parameters. In these cases, the test risk first decreases as the size of the training set increases, transiently *increases* when a bit more training data is added, and finally begins decreasing again as the training set continues to grow. This phenomena was reported 25 years in the neural network literature (see Opper, 1995), but occurs in modern networks too ([Advani and Saxe, 2017][1]). Interestingly, this happens even for a linear regression, albeit one fit by SGD ([Nakkiran, 2019][2]). This phenomenon is not yet totally understood and is largely of theoretical interest: I certainly wouldn't use it as a reason not to collect more data (though I might fiddle with the training set size if n==p and the performance were unexpectedly bad).
[*]A language model is just the probability of seeing a given sequence of words e.g. $P(w_n = \textrm{'quick', } w_{n+1} = \textrm{'brown', } w_{n+2} = \textrm{'fox'})$. They're vital to building halfway decent speech/character recognizers.
|
What impact does increasing the training data have on the overall system accuracy?
In most situations, more data is usually better. Overfitting is essentially learning spurious correlations that occur in your training data, but not the real world. For example, if you considered only
|
9,463
|
What impact does increasing the training data have on the overall system accuracy?
|
One note: by adding more data (rows or examples, not columns or features) your chances of overfitting decrease rather than increase.
The two paragraph summary goes like this:
Adding more examples, adds diversity. It decreases the generalization error because your model becomes more general by virtue of being trained on more examples.
Adding more input features, or columns (to a fixed number of examples) may increase overfitting because more features may be either irrelevant or redundant and there's more opportunity to complicate the model in order to fit the examples at hand.
There are some simplistic criteria to compare quality of models. Take a look for example at AIC or at BIC.
They both show that adding more data always makes models better, while adding parameter complexity beyond the optimum, reduces model quality.
|
What impact does increasing the training data have on the overall system accuracy?
|
One note: by adding more data (rows or examples, not columns or features) your chances of overfitting decrease rather than increase.
The two paragraph summary goes like this:
Adding more examples, ad
|
What impact does increasing the training data have on the overall system accuracy?
One note: by adding more data (rows or examples, not columns or features) your chances of overfitting decrease rather than increase.
The two paragraph summary goes like this:
Adding more examples, adds diversity. It decreases the generalization error because your model becomes more general by virtue of being trained on more examples.
Adding more input features, or columns (to a fixed number of examples) may increase overfitting because more features may be either irrelevant or redundant and there's more opportunity to complicate the model in order to fit the examples at hand.
There are some simplistic criteria to compare quality of models. Take a look for example at AIC or at BIC.
They both show that adding more data always makes models better, while adding parameter complexity beyond the optimum, reduces model quality.
|
What impact does increasing the training data have on the overall system accuracy?
One note: by adding more data (rows or examples, not columns or features) your chances of overfitting decrease rather than increase.
The two paragraph summary goes like this:
Adding more examples, ad
|
9,464
|
What impact does increasing the training data have on the overall system accuracy?
|
Increasing the training data always adds information and should improve the fit. The difficulty comes if you then evaluate the performance of the classifier only on the training data that was used for the fit. This produces optimistically biased assessments and is the reason why leave-one-out cross validation or bootstrap are used instead.
|
What impact does increasing the training data have on the overall system accuracy?
|
Increasing the training data always adds information and should improve the fit. The difficulty comes if you then evaluate the performance of the classifier only on the training data that was used fo
|
What impact does increasing the training data have on the overall system accuracy?
Increasing the training data always adds information and should improve the fit. The difficulty comes if you then evaluate the performance of the classifier only on the training data that was used for the fit. This produces optimistically biased assessments and is the reason why leave-one-out cross validation or bootstrap are used instead.
|
What impact does increasing the training data have on the overall system accuracy?
Increasing the training data always adds information and should improve the fit. The difficulty comes if you then evaluate the performance of the classifier only on the training data that was used fo
|
9,465
|
What impact does increasing the training data have on the overall system accuracy?
|
Ideally, once you have more training examples you’ll have lower test-error (variance of the model decrease, meaning we are less overfitting), but theoretically, more data doesn’t always mean you will have more accurate model since high bias models will not benefit from more training examples.
See here: In Machine Learning, What is Better: More Data or better Algorithms
High-variance – a model that represent training set well, but at risk of overfitting to noisy or unrepresentative training data.
High bias – a simpler model that doesn’t tend to overfit, but may underfit training data, failing to capture important regularities.
|
What impact does increasing the training data have on the overall system accuracy?
|
Ideally, once you have more training examples you’ll have lower test-error (variance of the model decrease, meaning we are less overfitting), but theoretically, more data doesn’t always mean you will
|
What impact does increasing the training data have on the overall system accuracy?
Ideally, once you have more training examples you’ll have lower test-error (variance of the model decrease, meaning we are less overfitting), but theoretically, more data doesn’t always mean you will have more accurate model since high bias models will not benefit from more training examples.
See here: In Machine Learning, What is Better: More Data or better Algorithms
High-variance – a model that represent training set well, but at risk of overfitting to noisy or unrepresentative training data.
High bias – a simpler model that doesn’t tend to overfit, but may underfit training data, failing to capture important regularities.
|
What impact does increasing the training data have on the overall system accuracy?
Ideally, once you have more training examples you’ll have lower test-error (variance of the model decrease, meaning we are less overfitting), but theoretically, more data doesn’t always mean you will
|
9,466
|
What impact does increasing the training data have on the overall system accuracy?
|
I agree with @Serendipity:
The performance of neural networks can continually improve as more and more data is provided to the model, BUT the capacity of the model must be adjusted to support the increases in data.
Let's say that you have a very small object detection model (7.2M parameters), it won't be able to learn all the information that you feed to it as the weights won't be able to accommodate for all the possible distributions found in the data, given that the data is complex enough.
The model will only be able to learn large data variability if its capacity makes it possible
|
What impact does increasing the training data have on the overall system accuracy?
|
I agree with @Serendipity:
The performance of neural networks can continually improve as more and more data is provided to the model, BUT the capacity of the model must be adjusted to support the incr
|
What impact does increasing the training data have on the overall system accuracy?
I agree with @Serendipity:
The performance of neural networks can continually improve as more and more data is provided to the model, BUT the capacity of the model must be adjusted to support the increases in data.
Let's say that you have a very small object detection model (7.2M parameters), it won't be able to learn all the information that you feed to it as the weights won't be able to accommodate for all the possible distributions found in the data, given that the data is complex enough.
The model will only be able to learn large data variability if its capacity makes it possible
|
What impact does increasing the training data have on the overall system accuracy?
I agree with @Serendipity:
The performance of neural networks can continually improve as more and more data is provided to the model, BUT the capacity of the model must be adjusted to support the incr
|
9,467
|
What exactly does the term "inverse probability" mean?
|
"Inverse probability" is a rather old-fashioned way of referring to Bayesian inference; when it's used nowadays it's usually as a nod to history. De Morgan (1838), An Essay on Probabilities, Ch. 3 "On Inverse Probabilities", explains it nicely:
In the preceding chapter, we have calculated the chances of an event,
knowing the circumstances under which it is to happen or fail. We are
now to place ourselves in an inverted position: we know the event, and
ask what is the probability which results from the event in favour of
of any set of circumstances under which the same might have happened.
An example follows using Bayes' Theorem.
I'm not sure that the term mightn't have at some point encompassed putative or proposed non-Bayesian, priorless, methods of getting from $f(y|\theta)$ to $p(\theta|y)$ (in @Christopher Hanck's notation); but at any rate Fisher was clearly distinguishing between "inverse probability" & his methods—maximum likelihood, fiducial inference—by the 1930's. It also strikes me that several early-20th-Century writers seem to view the use of what we now call uninformative/ignorance/reference priors as part & parcel of the "inverse probability" method†, or even of "Bayes' Theorem"‡.
† Fisher (1930), Math. Proc. Camb. Philos. Soc., 26, p 528, "Inverse probability", clearly distinguishes, perhaps for the first time, between Bayesian inference from flat "ignorance" priors ("the inverse argument proper"), the unexceptionable application of Bayes' Theorem when the prior describes aleatory probabilities ("not inverse probability strictly speaking"), & his fiducial argument.
‡ For example, Pearson (1907), Phil. Mag., p365, "On the influence of past experience on future expectation", conflates Bayes' Theorem with the "equal distribution of ignorance".
|
What exactly does the term "inverse probability" mean?
|
"Inverse probability" is a rather old-fashioned way of referring to Bayesian inference; when it's used nowadays it's usually as a nod to history. De Morgan (1838), An Essay on Probabilities, Ch. 3 "On
|
What exactly does the term "inverse probability" mean?
"Inverse probability" is a rather old-fashioned way of referring to Bayesian inference; when it's used nowadays it's usually as a nod to history. De Morgan (1838), An Essay on Probabilities, Ch. 3 "On Inverse Probabilities", explains it nicely:
In the preceding chapter, we have calculated the chances of an event,
knowing the circumstances under which it is to happen or fail. We are
now to place ourselves in an inverted position: we know the event, and
ask what is the probability which results from the event in favour of
of any set of circumstances under which the same might have happened.
An example follows using Bayes' Theorem.
I'm not sure that the term mightn't have at some point encompassed putative or proposed non-Bayesian, priorless, methods of getting from $f(y|\theta)$ to $p(\theta|y)$ (in @Christopher Hanck's notation); but at any rate Fisher was clearly distinguishing between "inverse probability" & his methods—maximum likelihood, fiducial inference—by the 1930's. It also strikes me that several early-20th-Century writers seem to view the use of what we now call uninformative/ignorance/reference priors as part & parcel of the "inverse probability" method†, or even of "Bayes' Theorem"‡.
† Fisher (1930), Math. Proc. Camb. Philos. Soc., 26, p 528, "Inverse probability", clearly distinguishes, perhaps for the first time, between Bayesian inference from flat "ignorance" priors ("the inverse argument proper"), the unexceptionable application of Bayes' Theorem when the prior describes aleatory probabilities ("not inverse probability strictly speaking"), & his fiducial argument.
‡ For example, Pearson (1907), Phil. Mag., p365, "On the influence of past experience on future expectation", conflates Bayes' Theorem with the "equal distribution of ignorance".
|
What exactly does the term "inverse probability" mean?
"Inverse probability" is a rather old-fashioned way of referring to Bayesian inference; when it's used nowadays it's usually as a nod to history. De Morgan (1838), An Essay on Probabilities, Ch. 3 "On
|
9,468
|
What exactly does the term "inverse probability" mean?
|
Probability of 'observations' given the 'model'
Typically 'probability' is expressed as the probability of an outcome given a particular experiment/model/setup.
So the probability is about the frequencies of observations given the model. These types of questions are often not so difficult. For instance, in gambling, we can express the probabilities of certain dice rolls or card sequences (and there are many questions here on CV that ask about probability given some situation, which will receive unambiguous and clear answers).
Inverse: inference about the 'model' given the 'observations'
However, in practice, we do not fully know the model, and we wish to infer some unknown properties of the model based on observations. That is, in the inverse direction as probability normally goes. Now the model is unknown, but the observation is given/known. The situation is inverse.
This is a difficult problem. We can express the probabilities of observations given certain models, and we could express the differences in those probabilities for different models, but these expressions are not the same as probabilities for those given models.
Ronald A Fisher's maximum likelihood = inverse probability?
In his 1921 work 'On the mathematical foundations of theoretical statistics' Ronald A. Fisher mentions the method of the maximum likelihood in relation to 'inverse probability'. But he argues that we should not view this 'inverse probability' as a 'probability' and suggests instead the term likelihood.
I must indeed plead guilty in my original statement of the Method of the Maximum Likelihood (9) to having based my argument upon the principle of inverse probability ; in the same paper, it is true, I emphasised the fact that such inverse probabilities were relative only. That is to say, that while we might speak of one value of as having an inverse probability three times that of another value of $p$, we might on no account introduce the differential element $dp$, so as to be able to say that it was three times as probable that $p$ should lie in one rather than the other of two equal elements. Upon consideration, therefore, I perceive that the word probability is wrongly used in such a connection : probability is a ratio of frequencies, and about the frequencies of such values we can know nothing whatever. We must return to the actual fact that one value of $p$, of the frequency of which we know nothing, would yield the observed result three times as frequently as would another value of $p$. If we need a word to characterise this relative property of different values of $p$, I suggest that we may speak without confusion of the likelihood of one value of $p$ being thrice the likelihood of another, bearing always in mind that likelihood is not here used loosely as a synonym of probability, but simply to express the relative frequencies with which such values of the hypothetical quantity $p$ would in fact yield the observed sample.
Inverse probability = Bayesian probability?
Some might say that inverse probability is equal to the posterior Bayesian probability. And it is quite standard as a synonym. But I like to think that it encompasses more than that. All methods of inference are in a way "inverse probability" and try to infer in the opposite direction as the typical probability statement (probability of an outcome given the model).
Yes indeed: only a Bayesian probability is truly/technically a probability. No indeed: a fiducial distribution is not equal to a probability(*). But fiducial and frequentist inference are still just as well about inverting the direction and making statements about parameters given the observation. (The frequentist distributions/intervals are just not technically probabilities.)
(*)The Bayesian posterior distribution is a density of the probability of the parameter conditional on the observation. The fiducial distribution is the density of the confidence and is not relating to the parameter as a random variable, but considers our inference about the random variable as the random factor
Example:
On StackExchange we see two types of questions:
I have a fair six-sided die; what is the probability that I roll a 6 six times in a row?
I roll a 6 six times in a row with a six-sided die; do I have a fair die?
The first type of question can be answered with a straightforward method and is about expressing the probability of outcomes given a particular situation.
The second type reverses the question. And while the likelihood might be known it does not have the same straightforward answer (it will be a false idea to speak about probability of the die being fair). We could use a Bayesian posterior probability, but still the problem is more general than just applying the Bayesian method.
Wrap up
Inverse probability might relate to Bayesian (posterior) probability, and some might view it in a wider sense (including fiducial "probability" or confidence intervals). But in none of these cases it refers to an actually true probability.
|
What exactly does the term "inverse probability" mean?
|
Probability of 'observations' given the 'model'
Typically 'probability' is expressed as the probability of an outcome given a particular experiment/model/setup.
So the probability is about the frequen
|
What exactly does the term "inverse probability" mean?
Probability of 'observations' given the 'model'
Typically 'probability' is expressed as the probability of an outcome given a particular experiment/model/setup.
So the probability is about the frequencies of observations given the model. These types of questions are often not so difficult. For instance, in gambling, we can express the probabilities of certain dice rolls or card sequences (and there are many questions here on CV that ask about probability given some situation, which will receive unambiguous and clear answers).
Inverse: inference about the 'model' given the 'observations'
However, in practice, we do not fully know the model, and we wish to infer some unknown properties of the model based on observations. That is, in the inverse direction as probability normally goes. Now the model is unknown, but the observation is given/known. The situation is inverse.
This is a difficult problem. We can express the probabilities of observations given certain models, and we could express the differences in those probabilities for different models, but these expressions are not the same as probabilities for those given models.
Ronald A Fisher's maximum likelihood = inverse probability?
In his 1921 work 'On the mathematical foundations of theoretical statistics' Ronald A. Fisher mentions the method of the maximum likelihood in relation to 'inverse probability'. But he argues that we should not view this 'inverse probability' as a 'probability' and suggests instead the term likelihood.
I must indeed plead guilty in my original statement of the Method of the Maximum Likelihood (9) to having based my argument upon the principle of inverse probability ; in the same paper, it is true, I emphasised the fact that such inverse probabilities were relative only. That is to say, that while we might speak of one value of as having an inverse probability three times that of another value of $p$, we might on no account introduce the differential element $dp$, so as to be able to say that it was three times as probable that $p$ should lie in one rather than the other of two equal elements. Upon consideration, therefore, I perceive that the word probability is wrongly used in such a connection : probability is a ratio of frequencies, and about the frequencies of such values we can know nothing whatever. We must return to the actual fact that one value of $p$, of the frequency of which we know nothing, would yield the observed result three times as frequently as would another value of $p$. If we need a word to characterise this relative property of different values of $p$, I suggest that we may speak without confusion of the likelihood of one value of $p$ being thrice the likelihood of another, bearing always in mind that likelihood is not here used loosely as a synonym of probability, but simply to express the relative frequencies with which such values of the hypothetical quantity $p$ would in fact yield the observed sample.
Inverse probability = Bayesian probability?
Some might say that inverse probability is equal to the posterior Bayesian probability. And it is quite standard as a synonym. But I like to think that it encompasses more than that. All methods of inference are in a way "inverse probability" and try to infer in the opposite direction as the typical probability statement (probability of an outcome given the model).
Yes indeed: only a Bayesian probability is truly/technically a probability. No indeed: a fiducial distribution is not equal to a probability(*). But fiducial and frequentist inference are still just as well about inverting the direction and making statements about parameters given the observation. (The frequentist distributions/intervals are just not technically probabilities.)
(*)The Bayesian posterior distribution is a density of the probability of the parameter conditional on the observation. The fiducial distribution is the density of the confidence and is not relating to the parameter as a random variable, but considers our inference about the random variable as the random factor
Example:
On StackExchange we see two types of questions:
I have a fair six-sided die; what is the probability that I roll a 6 six times in a row?
I roll a 6 six times in a row with a six-sided die; do I have a fair die?
The first type of question can be answered with a straightforward method and is about expressing the probability of outcomes given a particular situation.
The second type reverses the question. And while the likelihood might be known it does not have the same straightforward answer (it will be a false idea to speak about probability of the die being fair). We could use a Bayesian posterior probability, but still the problem is more general than just applying the Bayesian method.
Wrap up
Inverse probability might relate to Bayesian (posterior) probability, and some might view it in a wider sense (including fiducial "probability" or confidence intervals). But in none of these cases it refers to an actually true probability.
|
What exactly does the term "inverse probability" mean?
Probability of 'observations' given the 'model'
Typically 'probability' is expressed as the probability of an outcome given a particular experiment/model/setup.
So the probability is about the frequen
|
9,469
|
What exactly does the term "inverse probability" mean?
|
Yes, I believe your thinking is a way to view things in that it points out that the prior is the key ingredient to convert conditional probabilities.
My reading is that it is an interpretation of Bayes' theorem, which, as we know, says
$$
P(B|A)=\frac{P(A|B)P(B)}{P(A)}.
$$
Hence, Bayes' theorem provides the result to convert one conditional probability into another, whence "inverse" probability.
In the context of statistical applications,
$$
p(\theta|y)=\frac{f(y|\theta)p(\theta)}{p(y)},
$$
i.e., we obtain a rule to go from the likelihood $f$ to the posterior $p(\theta|y)$.
|
What exactly does the term "inverse probability" mean?
|
Yes, I believe your thinking is a way to view things in that it points out that the prior is the key ingredient to convert conditional probabilities.
My reading is that it is an interpretation of Baye
|
What exactly does the term "inverse probability" mean?
Yes, I believe your thinking is a way to view things in that it points out that the prior is the key ingredient to convert conditional probabilities.
My reading is that it is an interpretation of Bayes' theorem, which, as we know, says
$$
P(B|A)=\frac{P(A|B)P(B)}{P(A)}.
$$
Hence, Bayes' theorem provides the result to convert one conditional probability into another, whence "inverse" probability.
In the context of statistical applications,
$$
p(\theta|y)=\frac{f(y|\theta)p(\theta)}{p(y)},
$$
i.e., we obtain a rule to go from the likelihood $f$ to the posterior $p(\theta|y)$.
|
What exactly does the term "inverse probability" mean?
Yes, I believe your thinking is a way to view things in that it points out that the prior is the key ingredient to convert conditional probabilities.
My reading is that it is an interpretation of Baye
|
9,470
|
What exactly does the term "inverse probability" mean?
|
There are plenty of great answers already, so I'll add a slightly tangential example that I found intriguing. Hopefully its not too far-off from the topic.
Markov chain Monte Carlo methods are often used for Bayesian posterior inference. In typical encounters of Markov chains in probability theory, we ask questions like whether a chain converges to some stationary distribution in the limit of infinite steps. In Bayesian statistics for example, the inverse question is asked: if we want a chain to converge the posterior distribution of interest, how do we design such a chain? (The standard Metropolis-Hastings (MH) algorithm is one such algorithm.)
This example doesn't directly answering the question, but serves as a fun example of an application of solutions to inverse probability question.
I found this insight from https://www.jstor.org/stable/2684568 which motivates the MH algorithm from the inverse perspective.
|
What exactly does the term "inverse probability" mean?
|
There are plenty of great answers already, so I'll add a slightly tangential example that I found intriguing. Hopefully its not too far-off from the topic.
Markov chain Monte Carlo methods are often u
|
What exactly does the term "inverse probability" mean?
There are plenty of great answers already, so I'll add a slightly tangential example that I found intriguing. Hopefully its not too far-off from the topic.
Markov chain Monte Carlo methods are often used for Bayesian posterior inference. In typical encounters of Markov chains in probability theory, we ask questions like whether a chain converges to some stationary distribution in the limit of infinite steps. In Bayesian statistics for example, the inverse question is asked: if we want a chain to converge the posterior distribution of interest, how do we design such a chain? (The standard Metropolis-Hastings (MH) algorithm is one such algorithm.)
This example doesn't directly answering the question, but serves as a fun example of an application of solutions to inverse probability question.
I found this insight from https://www.jstor.org/stable/2684568 which motivates the MH algorithm from the inverse perspective.
|
What exactly does the term "inverse probability" mean?
There are plenty of great answers already, so I'll add a slightly tangential example that I found intriguing. Hopefully its not too far-off from the topic.
Markov chain Monte Carlo methods are often u
|
9,471
|
Can't deep learning models now be said to be interpretable? Are nodes features?
|
Interpretation of deep models is still challenging.
Your post only mentions CNNs for computer vision applications, but (deep or shallow) feed-forward networks and recurrent networks remain challenging to understand.
Even in the case of CNNs which have obvious "feature detector" structures, such as edges and orientation of pixel patches, it's not completely obvious how these lower-level features are aggregated upwards, or what, precisely, is going on when these vision features are aggregated in a fully-connected layer.
Adversarial examples show how interpretation of the network is difficult. An adversarial example has some tiny modification made to it, but results in a dramatic shift in the decision made by the model. In the context of image classification, a tiny amount of noise added to an image can change an image of a lizard to have a highly confident classification as another animal, like a (species of) dog.
This is related to interpretability in the sense that there is a strong, unpredictable relationship between the (small) amount of noise and the (large) shift in the classification decision. Thinking about how these networks operate, it makes some sense: computations at previous layers are propagated forward, so that a number of errors -- small, unimportant errors to a human -- are magnified and accumulate as more and more computations are performed using the "corrupted" inputs.
On the other hand, the existence of adversarial examples shows that the interpretation of any node as a particular feature or class is difficult, since the fact that the node is activated might have little to do with the actual content of the original image, and that this relationship is not really predictable in terms of the original image. But in the example images below, no humans are deceived about the content of the images: you wouldn't confuse the flag pole for a dog. How can we interpret these decisions, either in aggregate (a small noise pattern "transmutes" a lizard into dog, or a flagpole into a dog) or in smaller pieces (that several feature detectors are more sensitive to the noise pattern than the actual image content)?
HAAM is a promising new method to generate adversarial images using harmonic functions. ("Harmonic Adversarial Attack Method" Wen Heng, Shuchang Zhou, Tingting Jiang.) Images generated using this method can be used to emulate lighting/shadow effects and are generally even more challenging for humans to detect as having been altered.
As an example, see this image, taken from "Universal adversarial perturbations", by
Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. I chose this image just because it was one of the first adversarial images I came across. This image establishes that a particular noise pattern has a strange effect on the image classification decision, specifically that you can make a small modification to an input image and make the classifier think the result is a dog. Note that the underlying, original image is still obvious: in all cases, a human would not be confused into thinking that any of the non-dog images are dogs.
Here's a second example from a more canonical paper, "EXPLAINING AND HARNESSING ADVERSARIAL EXAMPLES" by Ian J. Goodfellow, Jonathon Shlens & Christian Szegedy. The added noise is completely indistinguishable in the resulting image, yet the result is very confidently classified as the wrong result, a gibbon instead of a panda. In this case, at least, there is at least a passing similarity between the two classes, since gibbons and pandas are at least somewhat biologically and aesthetically similar in the broadest sense.
This third example is taken from "Generalizable Adversarial Examples Detection Based on Bi-model Decision Mismatch" by João Monteiro, Zahid Akhtar and Tiago H. Falk. It establishes that the noise pattern can be indistinguishable to a human yet still confuse the classifier.
For reference, a mudpuppy is a dark-colored animal with four limbs and a tail, so it does not really have much resemblance to a goldfish.
I just found this paper today. Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, Rob Fergus. "Intriguing properties of neural networks". The abstract includes this intriguing quotation:
First, we find that there is no distinction between individual high level units and random linear combinations of high level units, according to various methods of unit analysis. It suggests that it is the space, rather than the individual units, that contains of the semantic information in the high layers of neural networks.
So, rather than having 'feature detectors' at the higher levels, the nodes merely represent coordinates in a feature space which the network uses to model the data.
|
Can't deep learning models now be said to be interpretable? Are nodes features?
|
Interpretation of deep models is still challenging.
Your post only mentions CNNs for computer vision applications, but (deep or shallow) feed-forward networks and recurrent networks remain challengi
|
Can't deep learning models now be said to be interpretable? Are nodes features?
Interpretation of deep models is still challenging.
Your post only mentions CNNs for computer vision applications, but (deep or shallow) feed-forward networks and recurrent networks remain challenging to understand.
Even in the case of CNNs which have obvious "feature detector" structures, such as edges and orientation of pixel patches, it's not completely obvious how these lower-level features are aggregated upwards, or what, precisely, is going on when these vision features are aggregated in a fully-connected layer.
Adversarial examples show how interpretation of the network is difficult. An adversarial example has some tiny modification made to it, but results in a dramatic shift in the decision made by the model. In the context of image classification, a tiny amount of noise added to an image can change an image of a lizard to have a highly confident classification as another animal, like a (species of) dog.
This is related to interpretability in the sense that there is a strong, unpredictable relationship between the (small) amount of noise and the (large) shift in the classification decision. Thinking about how these networks operate, it makes some sense: computations at previous layers are propagated forward, so that a number of errors -- small, unimportant errors to a human -- are magnified and accumulate as more and more computations are performed using the "corrupted" inputs.
On the other hand, the existence of adversarial examples shows that the interpretation of any node as a particular feature or class is difficult, since the fact that the node is activated might have little to do with the actual content of the original image, and that this relationship is not really predictable in terms of the original image. But in the example images below, no humans are deceived about the content of the images: you wouldn't confuse the flag pole for a dog. How can we interpret these decisions, either in aggregate (a small noise pattern "transmutes" a lizard into dog, or a flagpole into a dog) or in smaller pieces (that several feature detectors are more sensitive to the noise pattern than the actual image content)?
HAAM is a promising new method to generate adversarial images using harmonic functions. ("Harmonic Adversarial Attack Method" Wen Heng, Shuchang Zhou, Tingting Jiang.) Images generated using this method can be used to emulate lighting/shadow effects and are generally even more challenging for humans to detect as having been altered.
As an example, see this image, taken from "Universal adversarial perturbations", by
Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. I chose this image just because it was one of the first adversarial images I came across. This image establishes that a particular noise pattern has a strange effect on the image classification decision, specifically that you can make a small modification to an input image and make the classifier think the result is a dog. Note that the underlying, original image is still obvious: in all cases, a human would not be confused into thinking that any of the non-dog images are dogs.
Here's a second example from a more canonical paper, "EXPLAINING AND HARNESSING ADVERSARIAL EXAMPLES" by Ian J. Goodfellow, Jonathon Shlens & Christian Szegedy. The added noise is completely indistinguishable in the resulting image, yet the result is very confidently classified as the wrong result, a gibbon instead of a panda. In this case, at least, there is at least a passing similarity between the two classes, since gibbons and pandas are at least somewhat biologically and aesthetically similar in the broadest sense.
This third example is taken from "Generalizable Adversarial Examples Detection Based on Bi-model Decision Mismatch" by João Monteiro, Zahid Akhtar and Tiago H. Falk. It establishes that the noise pattern can be indistinguishable to a human yet still confuse the classifier.
For reference, a mudpuppy is a dark-colored animal with four limbs and a tail, so it does not really have much resemblance to a goldfish.
I just found this paper today. Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, Rob Fergus. "Intriguing properties of neural networks". The abstract includes this intriguing quotation:
First, we find that there is no distinction between individual high level units and random linear combinations of high level units, according to various methods of unit analysis. It suggests that it is the space, rather than the individual units, that contains of the semantic information in the high layers of neural networks.
So, rather than having 'feature detectors' at the higher levels, the nodes merely represent coordinates in a feature space which the network uses to model the data.
|
Can't deep learning models now be said to be interpretable? Are nodes features?
Interpretation of deep models is still challenging.
Your post only mentions CNNs for computer vision applications, but (deep or shallow) feed-forward networks and recurrent networks remain challengi
|
9,472
|
Can't deep learning models now be said to be interpretable? Are nodes features?
|
Layers don't map onto successively more abstract features as cleanly as we'd like. A good way to see this is to compare two very popular architectures.
VGG16 consists of many convolutional layers stacked on top of each other with the occasional pooling layer -- a very traditional architecture.
Since then, people have moved on to designing residual architectures, where each layer is connected to not only the previous layer, but also one (or possibly more) layers farther down in the model. ResNet was one of the first to do this, and has around 100 layers, depending on which variant you use.
While VGG16 and similar networks do have layers act in a more or less interpretable manner -- learning higher and higher level features, ResNets do not do this. Instead, people have proposed that they either keep refining features to make them more accurate or that they're just a bunch of shallow networks in disguise, neither of which matches the "traditional views" on what deep models learn.
While ResNet and similar architectures handily outperform VGG in image classification and object detection, there seem to be some applications for which the simple bottom-up feature hierarchy of VGG is very important. See here for a good discussion.
So given that more modern architectures don't seem to fit into the picture anymore, I would say that we can't quite say CNNs are interpretable yet.
|
Can't deep learning models now be said to be interpretable? Are nodes features?
|
Layers don't map onto successively more abstract features as cleanly as we'd like. A good way to see this is to compare two very popular architectures.
VGG16 consists of many convolutional layers stac
|
Can't deep learning models now be said to be interpretable? Are nodes features?
Layers don't map onto successively more abstract features as cleanly as we'd like. A good way to see this is to compare two very popular architectures.
VGG16 consists of many convolutional layers stacked on top of each other with the occasional pooling layer -- a very traditional architecture.
Since then, people have moved on to designing residual architectures, where each layer is connected to not only the previous layer, but also one (or possibly more) layers farther down in the model. ResNet was one of the first to do this, and has around 100 layers, depending on which variant you use.
While VGG16 and similar networks do have layers act in a more or less interpretable manner -- learning higher and higher level features, ResNets do not do this. Instead, people have proposed that they either keep refining features to make them more accurate or that they're just a bunch of shallow networks in disguise, neither of which matches the "traditional views" on what deep models learn.
While ResNet and similar architectures handily outperform VGG in image classification and object detection, there seem to be some applications for which the simple bottom-up feature hierarchy of VGG is very important. See here for a good discussion.
So given that more modern architectures don't seem to fit into the picture anymore, I would say that we can't quite say CNNs are interpretable yet.
|
Can't deep learning models now be said to be interpretable? Are nodes features?
Layers don't map onto successively more abstract features as cleanly as we'd like. A good way to see this is to compare two very popular architectures.
VGG16 consists of many convolutional layers stac
|
9,473
|
Can't deep learning models now be said to be interpretable? Are nodes features?
|
The subject of my Ph.D dissertation was to reveal the black-box properties of neural networks, specifically feed-forward neural networks, with one or two hidden layers.
I will take up the challenge to explain to everyone what the weights and bias terms mean, in a one-layer feed-forward neural network. Two different perspectives will be addressed: a parametric one and a probabilistic one.
In the following, I assume that the input values provided to each input neuron have all been normalized to the interval (0,1), by linear scaling ($x_{input}=\alpha \cdot x + \beta$), where the two coefficients $\alpha$ and $\beta$ are chosen per input variable, such that $x_{input} \in (0,1)$. I make a distinction between real-numbered variables, and enumerated variables (with a boolean variable as a special case enumerated variable):
A real-numbered variable is provided as a decimal number between $0$ and $1$, after linear scaling.
An enumerated variable, take the days of the week (monday, tuesday, etc.) are represented by $v$ input nodes, with $v$, being the number of enurable outcomes, i.e. $7$ for the number of days in a week.
Such a representation of your input data is required in order to be able to interpret the (absolute value) size of the weights in the input layer.
Parametric meaning:
the larger the absolute value of the weight is between an input
neuron and a hidden neuron, the more important that variable is, for
the 'fireing' of that particular hidden node. Weights close to $0$
indicate that an input value is as good as irelevant.
the weight from a hidden node to an output node indicates that the weighted
amplification of the input variables that are in absolute sense most
amplified by that hidden neuron, that they promote or dampen the
particular output node. The sign of the weight indicates promotion
(positive) or inhibition (negative).
the third part not explicitly represented in the parameters of the neural network is the multivariate distribution of the input variables. That is, how
often does it occur that the value $1$ is provided to input node $3$ - with the really large
weight to hidden node $2$ ?
a bias term is just a translation constant that shifts the average of a hidden (or output) neuron. It acts like the shift $\beta$, presented above.
Reasoning back from an output neuron: which hidden neurons have the highest absolute weight values, on their connections to the output neurons? How often does the activation of each hidden node become close to $1$ (assuming sigmoid activation functions). I'm talking about frequencies, measured over the training set. To be precise: what is the frequency with which the hidden nodes $i$ and $l$, with large weights to the input variables $t$ and $s$, that these hidden nodes $i$ and $l$ are close to $1$? Each hidden node propagates a weighted average of its input values, by definition. Which input variables does each hidden node primarily promote - or inhibit? Also the $\Delta_{j,k}=\mid w_{i,j} - w_{i,k}\mid$ explains much, the absolute difference in weights between the weights that fan out from hidden node $i$ to the two output nodes $j$ and $k$.
The more important hidden nodes are for an output node (talking in frequencies, over the training set), which 'input weights times input frequencies' are most important? Then we close in on the significance of the parameters of feed-forward neural networks.
Probabilistic interpretation:
The probabilistic perspective means to regard a classification neural network as a Bayes classifier (the optimal classifier, with the theoretically defined lowest error-rate). Which input variables have influence on the outcome of the neural network - and how often? Regard this as a probabilistic sensitivithy analysis.
How often can varying one input variable lead to a different classification? How often does input neuron $x_{input}$ have potential influence on which classification outcome becomes the most likely, implying that the corresponding output neuron achieves the highest value?
Individual case - pattern
When varying a real-numbered input neuron $x_{input}$ can cause the most likely classification to change, we say that this variable has potential influence. When varying the outcome of an enumerated variable (changing weekday from monday $[1,0,0,0,0,0,0]$ to tuesday $[0,1,0,0,0,0,0]$, or any other weekday), and the most likely outcome changes, then that enumerated variable has potential influence on the outcome of the classification.
When we now take the likelihood of that change into account, then we talk out expected influence. What is the probability of observing a changing input variable $x_{input}$ such that a the input case changes outcome, given the values of all the other inputs? Expected influence refers to expected value, of $x_{input}$, namely $E(x_{input} \mid {\bf x}_{-input})$. Here ${\bf x}_{-input}$ is the vector of all input values, except from input $x_{input}$. Keep in mind that an enumerated variable is represented by a number of input neurons. These possible outcomes are here regarded as one variable.
Deep leaning - and the meaning of the NN parameters
When applied to computer vision, neural networks have shown remarkable progress in the last decade. The convolutional neural networks introduced by LeCunn in 1989 have turned out to eventually perform really well in terms of image recognition. It has been reported that they can outperform most other computer-based recognition approaches.
Interesting emergent properties appear when convolutional neural networks are being trained for object recognition. The first layer of hidden nodes represents low-level feature detectors, similar to the scale-space operators T. Lindeberg, Feature Detection with Automatic Scale Selection, 1998. These scale-space operators detect
lines,
corners,
T-junctions
and some other basic image features.
Even more interesting is the fact that perceptual neurons in mammal brains have been shown to resemble this way of working in the first steps of (biological) image processing. So with CNNs, the scientific community is closing in on what makes human perception so phenomenal. This makes it very worthwhile to pursue this line of research further.
|
Can't deep learning models now be said to be interpretable? Are nodes features?
|
The subject of my Ph.D dissertation was to reveal the black-box properties of neural networks, specifically feed-forward neural networks, with one or two hidden layers.
I will take up the challenge to
|
Can't deep learning models now be said to be interpretable? Are nodes features?
The subject of my Ph.D dissertation was to reveal the black-box properties of neural networks, specifically feed-forward neural networks, with one or two hidden layers.
I will take up the challenge to explain to everyone what the weights and bias terms mean, in a one-layer feed-forward neural network. Two different perspectives will be addressed: a parametric one and a probabilistic one.
In the following, I assume that the input values provided to each input neuron have all been normalized to the interval (0,1), by linear scaling ($x_{input}=\alpha \cdot x + \beta$), where the two coefficients $\alpha$ and $\beta$ are chosen per input variable, such that $x_{input} \in (0,1)$. I make a distinction between real-numbered variables, and enumerated variables (with a boolean variable as a special case enumerated variable):
A real-numbered variable is provided as a decimal number between $0$ and $1$, after linear scaling.
An enumerated variable, take the days of the week (monday, tuesday, etc.) are represented by $v$ input nodes, with $v$, being the number of enurable outcomes, i.e. $7$ for the number of days in a week.
Such a representation of your input data is required in order to be able to interpret the (absolute value) size of the weights in the input layer.
Parametric meaning:
the larger the absolute value of the weight is between an input
neuron and a hidden neuron, the more important that variable is, for
the 'fireing' of that particular hidden node. Weights close to $0$
indicate that an input value is as good as irelevant.
the weight from a hidden node to an output node indicates that the weighted
amplification of the input variables that are in absolute sense most
amplified by that hidden neuron, that they promote or dampen the
particular output node. The sign of the weight indicates promotion
(positive) or inhibition (negative).
the third part not explicitly represented in the parameters of the neural network is the multivariate distribution of the input variables. That is, how
often does it occur that the value $1$ is provided to input node $3$ - with the really large
weight to hidden node $2$ ?
a bias term is just a translation constant that shifts the average of a hidden (or output) neuron. It acts like the shift $\beta$, presented above.
Reasoning back from an output neuron: which hidden neurons have the highest absolute weight values, on their connections to the output neurons? How often does the activation of each hidden node become close to $1$ (assuming sigmoid activation functions). I'm talking about frequencies, measured over the training set. To be precise: what is the frequency with which the hidden nodes $i$ and $l$, with large weights to the input variables $t$ and $s$, that these hidden nodes $i$ and $l$ are close to $1$? Each hidden node propagates a weighted average of its input values, by definition. Which input variables does each hidden node primarily promote - or inhibit? Also the $\Delta_{j,k}=\mid w_{i,j} - w_{i,k}\mid$ explains much, the absolute difference in weights between the weights that fan out from hidden node $i$ to the two output nodes $j$ and $k$.
The more important hidden nodes are for an output node (talking in frequencies, over the training set), which 'input weights times input frequencies' are most important? Then we close in on the significance of the parameters of feed-forward neural networks.
Probabilistic interpretation:
The probabilistic perspective means to regard a classification neural network as a Bayes classifier (the optimal classifier, with the theoretically defined lowest error-rate). Which input variables have influence on the outcome of the neural network - and how often? Regard this as a probabilistic sensitivithy analysis.
How often can varying one input variable lead to a different classification? How often does input neuron $x_{input}$ have potential influence on which classification outcome becomes the most likely, implying that the corresponding output neuron achieves the highest value?
Individual case - pattern
When varying a real-numbered input neuron $x_{input}$ can cause the most likely classification to change, we say that this variable has potential influence. When varying the outcome of an enumerated variable (changing weekday from monday $[1,0,0,0,0,0,0]$ to tuesday $[0,1,0,0,0,0,0]$, or any other weekday), and the most likely outcome changes, then that enumerated variable has potential influence on the outcome of the classification.
When we now take the likelihood of that change into account, then we talk out expected influence. What is the probability of observing a changing input variable $x_{input}$ such that a the input case changes outcome, given the values of all the other inputs? Expected influence refers to expected value, of $x_{input}$, namely $E(x_{input} \mid {\bf x}_{-input})$. Here ${\bf x}_{-input}$ is the vector of all input values, except from input $x_{input}$. Keep in mind that an enumerated variable is represented by a number of input neurons. These possible outcomes are here regarded as one variable.
Deep leaning - and the meaning of the NN parameters
When applied to computer vision, neural networks have shown remarkable progress in the last decade. The convolutional neural networks introduced by LeCunn in 1989 have turned out to eventually perform really well in terms of image recognition. It has been reported that they can outperform most other computer-based recognition approaches.
Interesting emergent properties appear when convolutional neural networks are being trained for object recognition. The first layer of hidden nodes represents low-level feature detectors, similar to the scale-space operators T. Lindeberg, Feature Detection with Automatic Scale Selection, 1998. These scale-space operators detect
lines,
corners,
T-junctions
and some other basic image features.
Even more interesting is the fact that perceptual neurons in mammal brains have been shown to resemble this way of working in the first steps of (biological) image processing. So with CNNs, the scientific community is closing in on what makes human perception so phenomenal. This makes it very worthwhile to pursue this line of research further.
|
Can't deep learning models now be said to be interpretable? Are nodes features?
The subject of my Ph.D dissertation was to reveal the black-box properties of neural networks, specifically feed-forward neural networks, with one or two hidden layers.
I will take up the challenge to
|
9,474
|
What's the difference between variance scaling initializer and xavier initializer?
|
Historical perspective
Xavier initialization, originally proposed by Xavier Glorot and Yoshua Bengio in "Understanding the difficulty of training deep feedforward neural networks", is the weights initialization technique that tries to make the variance of the outputs of a layer to be equal to the variance of its inputs. This idea turned out to be very useful in practice. Naturally, this initialization depends on the layer activation function. And in their paper, Glorot and Bengio considered logistic sigmoid activation function, which was the default choice at that moment.
Later on, the sigmoid activation was surpassed by ReLu, because it allowed to solve vanishing / exploding gradients problem. Consequently, there appeared a new initialization technique, which applied the same idea (balancing of the variance of the activation) to this new activation function. It was proposed by Kaiming He at al in "Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification", and now it often referred to as He initialization.
In tensorflow, He initialization is implemented in variance_scaling_initializer() function (which is, in fact, a more general initializer, but by default performs He initialization), while Xavier initializer is logically xavier_initializer().
Summary
In summary, the main difference for machine learning practitioners is the following:
He initialization works better for layers with ReLu activation.
Xavier initialization works better for layers with sigmoid activation.
|
What's the difference between variance scaling initializer and xavier initializer?
|
Historical perspective
Xavier initialization, originally proposed by Xavier Glorot and Yoshua Bengio in "Understanding the difficulty of training deep feedforward neural networks", is the weights init
|
What's the difference between variance scaling initializer and xavier initializer?
Historical perspective
Xavier initialization, originally proposed by Xavier Glorot and Yoshua Bengio in "Understanding the difficulty of training deep feedforward neural networks", is the weights initialization technique that tries to make the variance of the outputs of a layer to be equal to the variance of its inputs. This idea turned out to be very useful in practice. Naturally, this initialization depends on the layer activation function. And in their paper, Glorot and Bengio considered logistic sigmoid activation function, which was the default choice at that moment.
Later on, the sigmoid activation was surpassed by ReLu, because it allowed to solve vanishing / exploding gradients problem. Consequently, there appeared a new initialization technique, which applied the same idea (balancing of the variance of the activation) to this new activation function. It was proposed by Kaiming He at al in "Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification", and now it often referred to as He initialization.
In tensorflow, He initialization is implemented in variance_scaling_initializer() function (which is, in fact, a more general initializer, but by default performs He initialization), while Xavier initializer is logically xavier_initializer().
Summary
In summary, the main difference for machine learning practitioners is the following:
He initialization works better for layers with ReLu activation.
Xavier initialization works better for layers with sigmoid activation.
|
What's the difference between variance scaling initializer and xavier initializer?
Historical perspective
Xavier initialization, originally proposed by Xavier Glorot and Yoshua Bengio in "Understanding the difficulty of training deep feedforward neural networks", is the weights init
|
9,475
|
What's the difference between variance scaling initializer and xavier initializer?
|
Variance scaling is just a generalization of Xavier: http://tflearn.org/initializations/. They both operate on the principle that the scale of the gradients should be similar throughout all layers. Xavier is probably safer to use since it's withstood the experimental test of time; trying to pick your own parameters for variance scaling might inhibit training or cause your network to not earn at all.
|
What's the difference between variance scaling initializer and xavier initializer?
|
Variance scaling is just a generalization of Xavier: http://tflearn.org/initializations/. They both operate on the principle that the scale of the gradients should be similar throughout all layers. Xa
|
What's the difference between variance scaling initializer and xavier initializer?
Variance scaling is just a generalization of Xavier: http://tflearn.org/initializations/. They both operate on the principle that the scale of the gradients should be similar throughout all layers. Xavier is probably safer to use since it's withstood the experimental test of time; trying to pick your own parameters for variance scaling might inhibit training or cause your network to not earn at all.
|
What's the difference between variance scaling initializer and xavier initializer?
Variance scaling is just a generalization of Xavier: http://tflearn.org/initializations/. They both operate on the principle that the scale of the gradients should be similar throughout all layers. Xa
|
9,476
|
What is the meaning of super script 2 subscript 2 within the context of norms?
|
You are right about the superscript. The subscript $||.||_p$ specifies the $p$-norm.
Therefore:
$$||x_i||_p=(\sum_i|x_i|^p)^{1/p}$$
And:
$$||x_i||_p^p=\sum_i|x_i|^p$$
|
What is the meaning of super script 2 subscript 2 within the context of norms?
|
You are right about the superscript. The subscript $||.||_p$ specifies the $p$-norm.
Therefore:
$$||x_i||_p=(\sum_i|x_i|^p)^{1/p}$$
And:
$$||x_i||_p^p=\sum_i|x_i|^p$$
|
What is the meaning of super script 2 subscript 2 within the context of norms?
You are right about the superscript. The subscript $||.||_p$ specifies the $p$-norm.
Therefore:
$$||x_i||_p=(\sum_i|x_i|^p)^{1/p}$$
And:
$$||x_i||_p^p=\sum_i|x_i|^p$$
|
What is the meaning of super script 2 subscript 2 within the context of norms?
You are right about the superscript. The subscript $||.||_p$ specifies the $p$-norm.
Therefore:
$$||x_i||_p=(\sum_i|x_i|^p)^{1/p}$$
And:
$$||x_i||_p^p=\sum_i|x_i|^p$$
|
9,477
|
What is the meaning of super script 2 subscript 2 within the context of norms?
|
$\|x\|_2$ is the Euclidean norm of the vector $x$; $\|x\|_2^2$ is the squared Euclidean norm of $x$. Note that as the Euclidean norm is probably the mostly commonly used norm people routinely abbreviated by $\|x\|$. By definition when assuming a Euclidean vector space: $\|x\|_2 := \sqrt{x_1^2 + x_2^2 + \dots + x_n^2}$.
As mentioned in the comments, the subscript $p$ refers to the degree of the norm. Other commonly used norms are for $p = 0$, $p = 1$ and $p = \infty$. For $p=0$ one gets the number of non-zero elements in $x$, for $p=1$ (ie. $\|x\|_1$) one gets the Manhattan norm and for $p = \infty$ one gets the maximum absolute value from the elements in $x$. Both $p = 0$ and $p = 1$ are popular in sparse/compressed application settings where one wants to "urge" some coefficient(s) to be zero.
|
What is the meaning of super script 2 subscript 2 within the context of norms?
|
$\|x\|_2$ is the Euclidean norm of the vector $x$; $\|x\|_2^2$ is the squared Euclidean norm of $x$. Note that as the Euclidean norm is probably the mostly commonly used norm people routinely abbrevia
|
What is the meaning of super script 2 subscript 2 within the context of norms?
$\|x\|_2$ is the Euclidean norm of the vector $x$; $\|x\|_2^2$ is the squared Euclidean norm of $x$. Note that as the Euclidean norm is probably the mostly commonly used norm people routinely abbreviated by $\|x\|$. By definition when assuming a Euclidean vector space: $\|x\|_2 := \sqrt{x_1^2 + x_2^2 + \dots + x_n^2}$.
As mentioned in the comments, the subscript $p$ refers to the degree of the norm. Other commonly used norms are for $p = 0$, $p = 1$ and $p = \infty$. For $p=0$ one gets the number of non-zero elements in $x$, for $p=1$ (ie. $\|x\|_1$) one gets the Manhattan norm and for $p = \infty$ one gets the maximum absolute value from the elements in $x$. Both $p = 0$ and $p = 1$ are popular in sparse/compressed application settings where one wants to "urge" some coefficient(s) to be zero.
|
What is the meaning of super script 2 subscript 2 within the context of norms?
$\|x\|_2$ is the Euclidean norm of the vector $x$; $\|x\|_2^2$ is the squared Euclidean norm of $x$. Note that as the Euclidean norm is probably the mostly commonly used norm people routinely abbrevia
|
9,478
|
How to use R prcomp results for prediction?
|
While I'm unsure as to the nature of your problem, I can tell you that I have used PCA as a means of extracting dominant patterns in a group of predictor variables in the later building of a model. In your example, these would be found in the principle components (PCs), PCAAnalysis$x, and they would be based on the weighting of variables found in PCAAnalysis$rotation. One advantage of this process is that PCs are orthogonal, and so you remove issues of multicollinearity between the model predictors. The second, is that you might be able to identify a smaller subset of PCs that capture the majority of variance in your predictors. This information can be found in summary(PCAAnalysis) or in PCAAnalysis$sdev. Finally, if you are interested in using a subset of the PCs for prediction, then you can set the tol parameter in prcomp to a higher level to remove trailing PCs.
Now, you can "project" new data onto the PCA coordinate basis using the predict.prcomp() function. Since you are calling your data set a "training" data set, this might make sense to then project a validation data set onto your PCA basis for the calculation of their respective PC coordinates. Below is an example of fitting a PCA to 4 biometric measurements of different iris species (which are correlated to some degree). Following this, I project biometric values of a new data set of flowers that have similar combinations of these measurements for each of the three species of iris. You will see from the final graph that their projected PCs lie in a similar area of the plot as the original data set.
An example using the iris data set:
### pca - calculated for the first 4 columns of the data set that correspond to biometric measurements ("Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width")
data(iris)
# split data into 2 parts for pca training (75%) and prediction (25%)
set.seed(1)
samp <- sample(nrow(iris), nrow(iris)*0.75)
iris.train <- iris[samp,]
iris.valid <- iris[-samp,]
# conduct PCA on training dataset
pca <- prcomp(iris.train[,1:4], retx=TRUE, center=TRUE, scale=TRUE)
expl.var <- round(pca$sdev^2/sum(pca$sdev^2)*100) # percent explained variance
# prediction of PCs for validation dataset
pred <- predict(pca, newdata=iris.valid[,1:4])
###Plot result
COLOR <- c(2:4)
PCH <- c(1,16)
pc <- c(1,2) # principal components to plot
png("pca_pred.png", units="in", width=5, height=4, res=200)
op <- par(mar=c(4,4,1,1), ps=10)
plot(pca$x[,pc], col=COLOR[iris.train$Species], cex=PCH[1],
xlab=paste0("PC ", pc[1], " (", expl.var[pc[1]], "%)"),
ylab=paste0("PC ", pc[2], " (", expl.var[pc[2]], "%)")
)
points(pred[,pc], col=COLOR[iris.valid$Species], pch=PCH[2])
legend("topright", legend=levels(iris$Species), fill = COLOR, border=COLOR)
legend("topleft", legend=c("training data", "validation data"), col=1, pch=PCH)
par(op)
dev.off()
|
How to use R prcomp results for prediction?
|
While I'm unsure as to the nature of your problem, I can tell you that I have used PCA as a means of extracting dominant patterns in a group of predictor variables in the later building of a model. In
|
How to use R prcomp results for prediction?
While I'm unsure as to the nature of your problem, I can tell you that I have used PCA as a means of extracting dominant patterns in a group of predictor variables in the later building of a model. In your example, these would be found in the principle components (PCs), PCAAnalysis$x, and they would be based on the weighting of variables found in PCAAnalysis$rotation. One advantage of this process is that PCs are orthogonal, and so you remove issues of multicollinearity between the model predictors. The second, is that you might be able to identify a smaller subset of PCs that capture the majority of variance in your predictors. This information can be found in summary(PCAAnalysis) or in PCAAnalysis$sdev. Finally, if you are interested in using a subset of the PCs for prediction, then you can set the tol parameter in prcomp to a higher level to remove trailing PCs.
Now, you can "project" new data onto the PCA coordinate basis using the predict.prcomp() function. Since you are calling your data set a "training" data set, this might make sense to then project a validation data set onto your PCA basis for the calculation of their respective PC coordinates. Below is an example of fitting a PCA to 4 biometric measurements of different iris species (which are correlated to some degree). Following this, I project biometric values of a new data set of flowers that have similar combinations of these measurements for each of the three species of iris. You will see from the final graph that their projected PCs lie in a similar area of the plot as the original data set.
An example using the iris data set:
### pca - calculated for the first 4 columns of the data set that correspond to biometric measurements ("Sepal.Length" "Sepal.Width" "Petal.Length" "Petal.Width")
data(iris)
# split data into 2 parts for pca training (75%) and prediction (25%)
set.seed(1)
samp <- sample(nrow(iris), nrow(iris)*0.75)
iris.train <- iris[samp,]
iris.valid <- iris[-samp,]
# conduct PCA on training dataset
pca <- prcomp(iris.train[,1:4], retx=TRUE, center=TRUE, scale=TRUE)
expl.var <- round(pca$sdev^2/sum(pca$sdev^2)*100) # percent explained variance
# prediction of PCs for validation dataset
pred <- predict(pca, newdata=iris.valid[,1:4])
###Plot result
COLOR <- c(2:4)
PCH <- c(1,16)
pc <- c(1,2) # principal components to plot
png("pca_pred.png", units="in", width=5, height=4, res=200)
op <- par(mar=c(4,4,1,1), ps=10)
plot(pca$x[,pc], col=COLOR[iris.train$Species], cex=PCH[1],
xlab=paste0("PC ", pc[1], " (", expl.var[pc[1]], "%)"),
ylab=paste0("PC ", pc[2], " (", expl.var[pc[2]], "%)")
)
points(pred[,pc], col=COLOR[iris.valid$Species], pch=PCH[2])
legend("topright", legend=levels(iris$Species), fill = COLOR, border=COLOR)
legend("topleft", legend=c("training data", "validation data"), col=1, pch=PCH)
par(op)
dev.off()
|
How to use R prcomp results for prediction?
While I'm unsure as to the nature of your problem, I can tell you that I have used PCA as a means of extracting dominant patterns in a group of predictor variables in the later building of a model. In
|
9,479
|
How to use R prcomp results for prediction?
|
The information from the summary() command you have attached to the question allows you to see, e.g., the proportion of the variance each principal component captures (Proportion of variance). In addition, the cumulative proportion is computed to output. For example, you need to have 23 PCs to capture 75% of the variance in your data set.
This certainly is not the information you typically use as input to further analyses. Rather, what you usually need is the rotated data, which is saved as 'x' in the object created by prcomp.
Using R code as a short example.
pr<-prcomp(USArrests, scale = TRUE)
summary(pr) # two PCs for cumulative proportion of >80%
newdat<-pr$x[,1:2]
Then you can use the data in the newdat for further analyses, e.g., as input to SVM or some regression model. Also, see, e.g., https://stackoverflow.com/questions/1805149/how-to-fit-a-linear-regression-model-with-two-principal-components-in-r for more information.
|
How to use R prcomp results for prediction?
|
The information from the summary() command you have attached to the question allows you to see, e.g., the proportion of the variance each principal component captures (Proportion of variance). In addi
|
How to use R prcomp results for prediction?
The information from the summary() command you have attached to the question allows you to see, e.g., the proportion of the variance each principal component captures (Proportion of variance). In addition, the cumulative proportion is computed to output. For example, you need to have 23 PCs to capture 75% of the variance in your data set.
This certainly is not the information you typically use as input to further analyses. Rather, what you usually need is the rotated data, which is saved as 'x' in the object created by prcomp.
Using R code as a short example.
pr<-prcomp(USArrests, scale = TRUE)
summary(pr) # two PCs for cumulative proportion of >80%
newdat<-pr$x[,1:2]
Then you can use the data in the newdat for further analyses, e.g., as input to SVM or some regression model. Also, see, e.g., https://stackoverflow.com/questions/1805149/how-to-fit-a-linear-regression-model-with-two-principal-components-in-r for more information.
|
How to use R prcomp results for prediction?
The information from the summary() command you have attached to the question allows you to see, e.g., the proportion of the variance each principal component captures (Proportion of variance). In addi
|
9,480
|
Expected value of a natural logarithm
|
In the paper
Y. W. Teh, D. Newman and M. Welling (2006), A Collapsed Variational
Bayesian Inference Algorithm for Latent Dirichlet
Allocation,
NIPS 2006, 1353–1360.
a second order Taylor expansion around $x_0=\mathbb{E}[x]$ is used to approximate $\mathbb{E}[\log(x)]$:
$$
\mathbb{E}[\log(x)]\approx\log(\mathbb{E}[x])-\frac{\mathbb{V}[x]}{2\mathbb{E}[x]^2} \>.
$$
This approximation seems to work pretty well for their application.
Modifying this slightly to fit the question at hand yields, by linearity of expectation,
$$
\mathbb{E}[\log(1+x)]\approx\log(1+\mathbb{E}[x])-\frac{\mathbb{V}[x]}{2(1+\mathbb{E}[x])^2} \>.
$$
However, it can happen that either the left-hand side or the right-hand side does not exist while the other does, and so some care should be taken when employing this approximation.
|
Expected value of a natural logarithm
|
In the paper
Y. W. Teh, D. Newman and M. Welling (2006), A Collapsed Variational
Bayesian Inference Algorithm for Latent Dirichlet
Allocation,
NIPS 2006, 1353–1360.
a second order Taylor expan
|
Expected value of a natural logarithm
In the paper
Y. W. Teh, D. Newman and M. Welling (2006), A Collapsed Variational
Bayesian Inference Algorithm for Latent Dirichlet
Allocation,
NIPS 2006, 1353–1360.
a second order Taylor expansion around $x_0=\mathbb{E}[x]$ is used to approximate $\mathbb{E}[\log(x)]$:
$$
\mathbb{E}[\log(x)]\approx\log(\mathbb{E}[x])-\frac{\mathbb{V}[x]}{2\mathbb{E}[x]^2} \>.
$$
This approximation seems to work pretty well for their application.
Modifying this slightly to fit the question at hand yields, by linearity of expectation,
$$
\mathbb{E}[\log(1+x)]\approx\log(1+\mathbb{E}[x])-\frac{\mathbb{V}[x]}{2(1+\mathbb{E}[x])^2} \>.
$$
However, it can happen that either the left-hand side or the right-hand side does not exist while the other does, and so some care should be taken when employing this approximation.
|
Expected value of a natural logarithm
In the paper
Y. W. Teh, D. Newman and M. Welling (2006), A Collapsed Variational
Bayesian Inference Algorithm for Latent Dirichlet
Allocation,
NIPS 2006, 1353–1360.
a second order Taylor expan
|
9,481
|
Expected value of a natural logarithm
|
Also, if you don't need an exact expression for $\text{E}[\log(X + 1)]$, oftentimes the bound given by Jensen's inequality is good enough:
$$
\log [\text{E}(X) + 1] \geq\text{E}[\log(X + 1)]
$$
|
Expected value of a natural logarithm
|
Also, if you don't need an exact expression for $\text{E}[\log(X + 1)]$, oftentimes the bound given by Jensen's inequality is good enough:
$$
\log [\text{E}(X) + 1] \geq\text{E}[\log(X + 1)]
$$
|
Expected value of a natural logarithm
Also, if you don't need an exact expression for $\text{E}[\log(X + 1)]$, oftentimes the bound given by Jensen's inequality is good enough:
$$
\log [\text{E}(X) + 1] \geq\text{E}[\log(X + 1)]
$$
|
Expected value of a natural logarithm
Also, if you don't need an exact expression for $\text{E}[\log(X + 1)]$, oftentimes the bound given by Jensen's inequality is good enough:
$$
\log [\text{E}(X) + 1] \geq\text{E}[\log(X + 1)]
$$
|
9,482
|
Expected value of a natural logarithm
|
Suppose that $X$ has probability density $f_X$. Before you start approximating, remember that, for any measurable function $g$, you can prove that
$$
E[g(X)]=\int g(X)\,dP = \int_{-\infty}^\infty g(x)\,f_X(x)\,dx \, ,
$$
in the sense that if the first integral exists, so does the second, and they have the same value.
|
Expected value of a natural logarithm
|
Suppose that $X$ has probability density $f_X$. Before you start approximating, remember that, for any measurable function $g$, you can prove that
$$
E[g(X)]=\int g(X)\,dP = \int_{-\infty}^\infty g
|
Expected value of a natural logarithm
Suppose that $X$ has probability density $f_X$. Before you start approximating, remember that, for any measurable function $g$, you can prove that
$$
E[g(X)]=\int g(X)\,dP = \int_{-\infty}^\infty g(x)\,f_X(x)\,dx \, ,
$$
in the sense that if the first integral exists, so does the second, and they have the same value.
|
Expected value of a natural logarithm
Suppose that $X$ has probability density $f_X$. Before you start approximating, remember that, for any measurable function $g$, you can prove that
$$
E[g(X)]=\int g(X)\,dP = \int_{-\infty}^\infty g
|
9,483
|
Expected value of a natural logarithm
|
There are two usual approaches:
If you know the distribution of $X$, you may be able to find the distribution of $\ln(1+X)$ and from there find its expectation; alternatively you may be able to use the law of the unconscious statistician directly (that is, integrate $\ln(1+x) f_{X}(x)$ over the domain of $x$).
As you suggest, if you know the first few moments you can compute a Taylor approximation.
|
Expected value of a natural logarithm
|
There are two usual approaches:
If you know the distribution of $X$, you may be able to find the distribution of $\ln(1+X)$ and from there find its expectation; alternatively you may be able to use
|
Expected value of a natural logarithm
There are two usual approaches:
If you know the distribution of $X$, you may be able to find the distribution of $\ln(1+X)$ and from there find its expectation; alternatively you may be able to use the law of the unconscious statistician directly (that is, integrate $\ln(1+x) f_{X}(x)$ over the domain of $x$).
As you suggest, if you know the first few moments you can compute a Taylor approximation.
|
Expected value of a natural logarithm
There are two usual approaches:
If you know the distribution of $X$, you may be able to find the distribution of $\ln(1+X)$ and from there find its expectation; alternatively you may be able to use
|
9,484
|
Beta regression of proportion data including 1 and 0
|
You could use zero- and/or one inflated beta regression models which combine the beta distribution with a degenerate distribution to assign some probability to 0 and 1 respectively. For details see the following references:
Ospina, R., & Ferrari, S. L. P. (2010). Inflated beta distributions. Statistical Papers, 51(1), 111-126.
Ospina, R., & Ferrari, S. L. P. (2012). A general class of zero-or-one inflated beta regression models. Computational Statistics and Data Analysis, 56(6), 1609 - 1623.
These models are easy to implement with the gamlss package for R.
|
Beta regression of proportion data including 1 and 0
|
You could use zero- and/or one inflated beta regression models which combine the beta distribution with a degenerate distribution to assign some probability to 0 and 1 respectively. For details see th
|
Beta regression of proportion data including 1 and 0
You could use zero- and/or one inflated beta regression models which combine the beta distribution with a degenerate distribution to assign some probability to 0 and 1 respectively. For details see the following references:
Ospina, R., & Ferrari, S. L. P. (2010). Inflated beta distributions. Statistical Papers, 51(1), 111-126.
Ospina, R., & Ferrari, S. L. P. (2012). A general class of zero-or-one inflated beta regression models. Computational Statistics and Data Analysis, 56(6), 1609 - 1623.
These models are easy to implement with the gamlss package for R.
|
Beta regression of proportion data including 1 and 0
You could use zero- and/or one inflated beta regression models which combine the beta distribution with a degenerate distribution to assign some probability to 0 and 1 respectively. For details see th
|
9,485
|
Beta regression of proportion data including 1 and 0
|
The documentation for the R betareg package mentions that
if y also assumes the extremes 0 and 1, a useful transformation in practice is (y * (n−1) + 0.5) / n where n is the sample size.
http://cran.r-project.org/web/packages/betareg/vignettes/betareg.pdf
They give the reference Smithson M, Verkuilen J (2006). "A Better Lemon Squeezer? Maximum-Likelihood Regression with Beta-Distributed Dependent Variables." Psychological Methods, 11 (1), 54–71.
|
Beta regression of proportion data including 1 and 0
|
The documentation for the R betareg package mentions that
if y also assumes the extremes 0 and 1, a useful transformation in practice is (y * (n−1) + 0.5) / n where n is the sample size.
http://cran
|
Beta regression of proportion data including 1 and 0
The documentation for the R betareg package mentions that
if y also assumes the extremes 0 and 1, a useful transformation in practice is (y * (n−1) + 0.5) / n where n is the sample size.
http://cran.r-project.org/web/packages/betareg/vignettes/betareg.pdf
They give the reference Smithson M, Verkuilen J (2006). "A Better Lemon Squeezer? Maximum-Likelihood Regression with Beta-Distributed Dependent Variables." Psychological Methods, 11 (1), 54–71.
|
Beta regression of proportion data including 1 and 0
The documentation for the R betareg package mentions that
if y also assumes the extremes 0 and 1, a useful transformation in practice is (y * (n−1) + 0.5) / n where n is the sample size.
http://cran
|
9,486
|
Beta regression of proportion data including 1 and 0
|
Came across a current online review piece on 'Zero-One Inflated Beta Models', by Karen Grace-Martin in "The Analysis Factor", outlining the proposed solution (noted above by Matze O in 2013) to address the 0/1 occurrence issue. To quote parts from the non-technical review:
So if a client takes their medication 30 out of 30 days, a beta regression won’t run. You can’t have any 0s or 1s in the data set.
Zero-One Inflated Beta Models
There is, however, a version of beta regression model that can work in this situation. It’s one of those models that has been around in theory for a while, but is only in the past few years become available in (some) mainstream statistical software.
It’s called a Zero-One-Inflated Beta and it works very much like a Zero-Inflated Poisson model.
It’s a type of mixture model that says there are really three processes going on.
One is a process that distinguishes between zeros and non-zeros. The idea is there is something qualitatively different about people who never take their medication than those who do, at least sometimes.
Likewise, there is a process that distinguishes between ones and non-ones. Again, there is something qualitatively different about people who always take their medication than those who do sometimes or never.
And then there is a third process that determines how much someone takes their medication if they do some of the time.
The first and second processes are run through a logistic regression and the third through a beta regression.
These three models are run simultaneously. They can each have their own set of predictors and their own set of coefficients...
Depending on the shape of the distribution, you may not need all three processes. If there are no zeros in the data set, you may only need to accommodate inflation at 1.
It’s highly flexible and adds important options to your data analysis toolbox."
Here is also a more recent December 2015 technical paper source for 'zoib: An R Package for Bayesian Inference for Beta Regression and Zero/One Inflated Beta Regression'. The authors note that the y variable, in a Zero/one inflated beta (ZOIB) regression model(s), can be applied when y takes values from closed unit interval [0, 1]. Apparently, the zoib model assumes that Yij follows a piecewise distribution (see system depicted in (1) on p.36).
|
Beta regression of proportion data including 1 and 0
|
Came across a current online review piece on 'Zero-One Inflated Beta Models', by Karen Grace-Martin in "The Analysis Factor", outlining the proposed solution (noted above by Matze O in 2013) to addres
|
Beta regression of proportion data including 1 and 0
Came across a current online review piece on 'Zero-One Inflated Beta Models', by Karen Grace-Martin in "The Analysis Factor", outlining the proposed solution (noted above by Matze O in 2013) to address the 0/1 occurrence issue. To quote parts from the non-technical review:
So if a client takes their medication 30 out of 30 days, a beta regression won’t run. You can’t have any 0s or 1s in the data set.
Zero-One Inflated Beta Models
There is, however, a version of beta regression model that can work in this situation. It’s one of those models that has been around in theory for a while, but is only in the past few years become available in (some) mainstream statistical software.
It’s called a Zero-One-Inflated Beta and it works very much like a Zero-Inflated Poisson model.
It’s a type of mixture model that says there are really three processes going on.
One is a process that distinguishes between zeros and non-zeros. The idea is there is something qualitatively different about people who never take their medication than those who do, at least sometimes.
Likewise, there is a process that distinguishes between ones and non-ones. Again, there is something qualitatively different about people who always take their medication than those who do sometimes or never.
And then there is a third process that determines how much someone takes their medication if they do some of the time.
The first and second processes are run through a logistic regression and the third through a beta regression.
These three models are run simultaneously. They can each have their own set of predictors and their own set of coefficients...
Depending on the shape of the distribution, you may not need all three processes. If there are no zeros in the data set, you may only need to accommodate inflation at 1.
It’s highly flexible and adds important options to your data analysis toolbox."
Here is also a more recent December 2015 technical paper source for 'zoib: An R Package for Bayesian Inference for Beta Regression and Zero/One Inflated Beta Regression'. The authors note that the y variable, in a Zero/one inflated beta (ZOIB) regression model(s), can be applied when y takes values from closed unit interval [0, 1]. Apparently, the zoib model assumes that Yij follows a piecewise distribution (see system depicted in (1) on p.36).
|
Beta regression of proportion data including 1 and 0
Came across a current online review piece on 'Zero-One Inflated Beta Models', by Karen Grace-Martin in "The Analysis Factor", outlining the proposed solution (noted above by Matze O in 2013) to addres
|
9,487
|
Beta regression of proportion data including 1 and 0
|
Don't you do a logit transform to make the variable ranging from minus infinity to plus infinity? I am not sure if data having 0 and 1 should be a problem. Is that showing any error message? By the way, if you only have proportions your analysis will always come out wrong. You need to use weight=argument to glm with the number of cases.
If nothing works, you can use a median split or a quartile split or whatever cut point you think appropriate to split out the DV into several categories and then run an Ordinal logistic regression instead. That may work. Try these things.
I don't think personally that adding 0.001 to the zeros and taking 0.001 from the ones is a too bad idea, but it has some problems which will be discussed later. Just think, why don't you add and subtract 0.000000001 (or even more of the decimals)? That will better represent 0 and 1!! It may seem to you that it doesn't make much difference. But it actually does.
Let's see the following:
> #odds when 0 is replaced by 0.00000001
> 0.00000001/(1-0.00000001)
[1] 1e-08
> log(0.00000001/(1-0.00000001))
[1] -18.42068
> #odds when 1 is replaced by (1-0.00000001):
> (1-0.00000001)/(1-(1-0.00000001))
[1] 1e+08
> log((1-0.00000001)/(1-(1-0.00000001)))
[1] 18.42068
> #odds when 0 is replaced by 0.001
> 0.001/(1-0.001)
[1] 0.001001001
> log(0.001/(1-0.001))
[1] -6.906755
> #odds when 1 is replaced by (1-0.001):
> (1-0.001)/(1-(1-0.001))
[1] 999
> log((1-0.001)/(1-(1-0.001)))
[1] 6.906755
So, you see, you need to keep the odds as close as (0/1) and (1/0). You expect the log odds ranging from minus infinity to plus infinity. So, to add or subtract, you need to choose up to a really really long decimal place, so that the log odds becomes close to infinity (or very large)!! The extent you will consider large enough, solely depends on you.
|
Beta regression of proportion data including 1 and 0
|
Don't you do a logit transform to make the variable ranging from minus infinity to plus infinity? I am not sure if data having 0 and 1 should be a problem. Is that showing any error message? By the wa
|
Beta regression of proportion data including 1 and 0
Don't you do a logit transform to make the variable ranging from minus infinity to plus infinity? I am not sure if data having 0 and 1 should be a problem. Is that showing any error message? By the way, if you only have proportions your analysis will always come out wrong. You need to use weight=argument to glm with the number of cases.
If nothing works, you can use a median split or a quartile split or whatever cut point you think appropriate to split out the DV into several categories and then run an Ordinal logistic regression instead. That may work. Try these things.
I don't think personally that adding 0.001 to the zeros and taking 0.001 from the ones is a too bad idea, but it has some problems which will be discussed later. Just think, why don't you add and subtract 0.000000001 (or even more of the decimals)? That will better represent 0 and 1!! It may seem to you that it doesn't make much difference. But it actually does.
Let's see the following:
> #odds when 0 is replaced by 0.00000001
> 0.00000001/(1-0.00000001)
[1] 1e-08
> log(0.00000001/(1-0.00000001))
[1] -18.42068
> #odds when 1 is replaced by (1-0.00000001):
> (1-0.00000001)/(1-(1-0.00000001))
[1] 1e+08
> log((1-0.00000001)/(1-(1-0.00000001)))
[1] 18.42068
> #odds when 0 is replaced by 0.001
> 0.001/(1-0.001)
[1] 0.001001001
> log(0.001/(1-0.001))
[1] -6.906755
> #odds when 1 is replaced by (1-0.001):
> (1-0.001)/(1-(1-0.001))
[1] 999
> log((1-0.001)/(1-(1-0.001)))
[1] 6.906755
So, you see, you need to keep the odds as close as (0/1) and (1/0). You expect the log odds ranging from minus infinity to plus infinity. So, to add or subtract, you need to choose up to a really really long decimal place, so that the log odds becomes close to infinity (or very large)!! The extent you will consider large enough, solely depends on you.
|
Beta regression of proportion data including 1 and 0
Don't you do a logit transform to make the variable ranging from minus infinity to plus infinity? I am not sure if data having 0 and 1 should be a problem. Is that showing any error message? By the wa
|
9,488
|
Beta regression of proportion data including 1 and 0
|
Check out the following, where an ad hoc transformation is mentioned maartenbuis.nl/presentations/berlin10.pdf on slide 17. Also you could modeling 0 and 1 with two separate logistic regressions and then use Beta regression for those not at the boundary.
|
Beta regression of proportion data including 1 and 0
|
Check out the following, where an ad hoc transformation is mentioned maartenbuis.nl/presentations/berlin10.pdf on slide 17. Also you could modeling 0 and 1 with two separate logistic regressions and t
|
Beta regression of proportion data including 1 and 0
Check out the following, where an ad hoc transformation is mentioned maartenbuis.nl/presentations/berlin10.pdf on slide 17. Also you could modeling 0 and 1 with two separate logistic regressions and then use Beta regression for those not at the boundary.
|
Beta regression of proportion data including 1 and 0
Check out the following, where an ad hoc transformation is mentioned maartenbuis.nl/presentations/berlin10.pdf on slide 17. Also you could modeling 0 and 1 with two separate logistic regressions and t
|
9,489
|
Beta regression of proportion data including 1 and 0
|
The beta model is for a binary variable that is modeled as Bernoulli-distributed with unknown probability $p$. The beta model calculates a likelihood over $p$, which is beta-distributed.
Your variable is a proportion. You could model the proportion as being beta-distributed with unknown parameters $a, b$. The model you want is the conjugate prior of the beta distribution, which will then calculate a likelihood over $a, b$.
I would have to derive the model again, but if I remember correctly, for proportions $x_1, \dotsc, x_n$ you return three expectation parameters: $n$, the number of points, and if my memory is right $\sum_j[\psi(\sum_i x_i) - \psi(x_j)]$ and $\sum_j[\psi(\sum_i 1-x_i) - \psi(1-x_j)]$. These are the parameters of a distribution over the parameters of your beta distribution, which model your proportions.
|
Beta regression of proportion data including 1 and 0
|
The beta model is for a binary variable that is modeled as Bernoulli-distributed with unknown probability $p$. The beta model calculates a likelihood over $p$, which is beta-distributed.
Your variabl
|
Beta regression of proportion data including 1 and 0
The beta model is for a binary variable that is modeled as Bernoulli-distributed with unknown probability $p$. The beta model calculates a likelihood over $p$, which is beta-distributed.
Your variable is a proportion. You could model the proportion as being beta-distributed with unknown parameters $a, b$. The model you want is the conjugate prior of the beta distribution, which will then calculate a likelihood over $a, b$.
I would have to derive the model again, but if I remember correctly, for proportions $x_1, \dotsc, x_n$ you return three expectation parameters: $n$, the number of points, and if my memory is right $\sum_j[\psi(\sum_i x_i) - \psi(x_j)]$ and $\sum_j[\psi(\sum_i 1-x_i) - \psi(1-x_j)]$. These are the parameters of a distribution over the parameters of your beta distribution, which model your proportions.
|
Beta regression of proportion data including 1 and 0
The beta model is for a binary variable that is modeled as Bernoulli-distributed with unknown probability $p$. The beta model calculates a likelihood over $p$, which is beta-distributed.
Your variabl
|
9,490
|
Bayesian lasso vs ordinary lasso
|
The standard lasso uses an L1 regularisation penalty to achieve sparsity in regression. Note that this is also known as Basis Pursuit (Chen & Donoho, 1994).
In the Bayesian framework, the choice of regulariser is analogous to the choice of prior over the weights. If a Gaussian prior is used, then the Maximum a Posteriori (MAP) solution will be the same as if an L2 penalty was used. Whilst not directly equivalent, the Laplace prior (which is sharply peaked around zero, unlike the Gaussian which is smooth around zero), produces the same shrinkage effect to the L1 penalty. Park & Casella (2008) describes the Bayesian Lasso.
In fact, when you place a Laplace prior over the parameters, the MAP solution should be identical (not merely similar) to regularization with the L1 penalty and the Laplace prior will produce an identical shrinkage effect to the L1 penalty. However, due to either approximations in the Bayesian inference procedure, or other numerical issues, solutions may not actually be identical.
In most cases, the results produced by both methods will be very similar. Depending on the optimisation method and whether approximations are used, the standard lasso will probably be more efficient to compute than the Bayesian version. The Bayesian automatically produces interval estimates for all of the parameters, including the error variance, if these are required.
Chen, S., & Donoho, D. (1994). Basis pursuit. In Proceedings of 1994 28th Asilomar Conference on Signals, Systems and Computers (Vol. 1, pp. 41-44). IEEE. https://doi.org/10.1109/ACSSC.1994.471413
Park, T., & Casella, G. (2008). The bayesian lasso. Journal of the American Statistical Association, 103(482), 681-686. https://doi.org/10.1198/016214508000000337
|
Bayesian lasso vs ordinary lasso
|
The standard lasso uses an L1 regularisation penalty to achieve sparsity in regression. Note that this is also known as Basis Pursuit (Chen & Donoho, 1994).
In the Bayesian framework, the choice of re
|
Bayesian lasso vs ordinary lasso
The standard lasso uses an L1 regularisation penalty to achieve sparsity in regression. Note that this is also known as Basis Pursuit (Chen & Donoho, 1994).
In the Bayesian framework, the choice of regulariser is analogous to the choice of prior over the weights. If a Gaussian prior is used, then the Maximum a Posteriori (MAP) solution will be the same as if an L2 penalty was used. Whilst not directly equivalent, the Laplace prior (which is sharply peaked around zero, unlike the Gaussian which is smooth around zero), produces the same shrinkage effect to the L1 penalty. Park & Casella (2008) describes the Bayesian Lasso.
In fact, when you place a Laplace prior over the parameters, the MAP solution should be identical (not merely similar) to regularization with the L1 penalty and the Laplace prior will produce an identical shrinkage effect to the L1 penalty. However, due to either approximations in the Bayesian inference procedure, or other numerical issues, solutions may not actually be identical.
In most cases, the results produced by both methods will be very similar. Depending on the optimisation method and whether approximations are used, the standard lasso will probably be more efficient to compute than the Bayesian version. The Bayesian automatically produces interval estimates for all of the parameters, including the error variance, if these are required.
Chen, S., & Donoho, D. (1994). Basis pursuit. In Proceedings of 1994 28th Asilomar Conference on Signals, Systems and Computers (Vol. 1, pp. 41-44). IEEE. https://doi.org/10.1109/ACSSC.1994.471413
Park, T., & Casella, G. (2008). The bayesian lasso. Journal of the American Statistical Association, 103(482), 681-686. https://doi.org/10.1198/016214508000000337
|
Bayesian lasso vs ordinary lasso
The standard lasso uses an L1 regularisation penalty to achieve sparsity in regression. Note that this is also known as Basis Pursuit (Chen & Donoho, 1994).
In the Bayesian framework, the choice of re
|
9,491
|
Bayesian lasso vs ordinary lasso
|
"Least squares" means that the overall solution minimizes the sum of the squares of the errors made in the results of every single equation.The most important application is in data fitting. The best fit in the least-squares sense minimizes the sum of squared residuals, a residual being the difference between an observed value and the fitted value provided by a model.Least squares problems fall into two categories: linear or ordinary least squares and non-linear least squares, depending on whether or not the residuals are linear in all unknowns.
Bayesian linear regression is an approach to linear regression in which the statistical analysis is undertaken within the context of Bayesian inference. When the regression model has errors that have a normal distribution, and if a particular form of prior distribution is assumed, explicit results are available for the posterior probability distributions of the model's parameters.
In some contexts a regularized version of the least squares solution may be preferable. Tikhonov regularization (or ridge regression) adds a constraint that $\|\beta\|^2$, the L2-norm of the parameter vector, is not greater than a given value. In a Bayesian context, this is equivalent to placing a zero-mean normally distributed prior on the parameter vector.
An alternative regularized version of least squares is Lasso (least absolute shrinkage and selection operator), which uses the constraint that $\|\beta\|_1$, the L1-norm of the parameter vector, is no greater than a given value. In a Bayesian context, this is equivalent to placing a zero-mean Laplace prior distribution on the parameter vector.
One of the prime differences between Lasso and ridge regression is that in ridge regression, as the penalty is increased, all parameters are reduced while still remaining non-zero, while in Lasso, increasing the penalty will cause more and more of the parameters to be driven to zero.
This paper compares regular lasso with Bayesian lasso and ridge regression (see figure 1).
|
Bayesian lasso vs ordinary lasso
|
"Least squares" means that the overall solution minimizes the sum of the squares of the errors made in the results of every single equation.The most important application is in data fitting. The best
|
Bayesian lasso vs ordinary lasso
"Least squares" means that the overall solution minimizes the sum of the squares of the errors made in the results of every single equation.The most important application is in data fitting. The best fit in the least-squares sense minimizes the sum of squared residuals, a residual being the difference between an observed value and the fitted value provided by a model.Least squares problems fall into two categories: linear or ordinary least squares and non-linear least squares, depending on whether or not the residuals are linear in all unknowns.
Bayesian linear regression is an approach to linear regression in which the statistical analysis is undertaken within the context of Bayesian inference. When the regression model has errors that have a normal distribution, and if a particular form of prior distribution is assumed, explicit results are available for the posterior probability distributions of the model's parameters.
In some contexts a regularized version of the least squares solution may be preferable. Tikhonov regularization (or ridge regression) adds a constraint that $\|\beta\|^2$, the L2-norm of the parameter vector, is not greater than a given value. In a Bayesian context, this is equivalent to placing a zero-mean normally distributed prior on the parameter vector.
An alternative regularized version of least squares is Lasso (least absolute shrinkage and selection operator), which uses the constraint that $\|\beta\|_1$, the L1-norm of the parameter vector, is no greater than a given value. In a Bayesian context, this is equivalent to placing a zero-mean Laplace prior distribution on the parameter vector.
One of the prime differences between Lasso and ridge regression is that in ridge regression, as the penalty is increased, all parameters are reduced while still remaining non-zero, while in Lasso, increasing the penalty will cause more and more of the parameters to be driven to zero.
This paper compares regular lasso with Bayesian lasso and ridge regression (see figure 1).
|
Bayesian lasso vs ordinary lasso
"Least squares" means that the overall solution minimizes the sum of the squares of the errors made in the results of every single equation.The most important application is in data fitting. The best
|
9,492
|
Bayesian lasso vs ordinary lasso
|
I feel the current answers to this question do not really answer the questions,
which were "What are differences or advantages of baysian (sic) lasso vs regular lasso?" and "are they the same?"
First, they are not the same.
The key difference is:
The Bayesian lasso attempts to sample from the full posterior distribution
of the parameters, under a Laplace prior, whereas lasso is attempting to find the posterior mode (also under a Laplace prior). In practice the full posterior distribution from Bayesian lasso is usually summarized by the posterior mean, so in practice this boils down to this:
The Bayesian lasso attempts to find the posterior mean under a Laplace prior whereas the lasso attempts
to find the posterior mode under a Laplace prior
The advantage of the posterior mean vs the posterior mode is that
the posterior mean will produce better prediction accuracy (assuming mean squared loss) if the Laplace prior is actually a true reflection of the distribution
of the regression coefficients. However, this advantage is dubious in practice since in many applications the Laplace prior is not a true reflection of the distribution of the coefficients (and in general this is difficult to check!)
The advantages of the posterior mode include that it is computationally much easier to find (it is a convex optimization problem).
You may notice that I did not answer "when should I go for one or other methods". That is because this is a hard question to answer in general. My answer would
be that generally there are better methods than either of these. But full discussion of this would require a lengthier post.
|
Bayesian lasso vs ordinary lasso
|
I feel the current answers to this question do not really answer the questions,
which were "What are differences or advantages of baysian (sic) lasso vs regular lasso?" and "are they the same?"
First,
|
Bayesian lasso vs ordinary lasso
I feel the current answers to this question do not really answer the questions,
which were "What are differences or advantages of baysian (sic) lasso vs regular lasso?" and "are they the same?"
First, they are not the same.
The key difference is:
The Bayesian lasso attempts to sample from the full posterior distribution
of the parameters, under a Laplace prior, whereas lasso is attempting to find the posterior mode (also under a Laplace prior). In practice the full posterior distribution from Bayesian lasso is usually summarized by the posterior mean, so in practice this boils down to this:
The Bayesian lasso attempts to find the posterior mean under a Laplace prior whereas the lasso attempts
to find the posterior mode under a Laplace prior
The advantage of the posterior mean vs the posterior mode is that
the posterior mean will produce better prediction accuracy (assuming mean squared loss) if the Laplace prior is actually a true reflection of the distribution
of the regression coefficients. However, this advantage is dubious in practice since in many applications the Laplace prior is not a true reflection of the distribution of the coefficients (and in general this is difficult to check!)
The advantages of the posterior mode include that it is computationally much easier to find (it is a convex optimization problem).
You may notice that I did not answer "when should I go for one or other methods". That is because this is a hard question to answer in general. My answer would
be that generally there are better methods than either of these. But full discussion of this would require a lengthier post.
|
Bayesian lasso vs ordinary lasso
I feel the current answers to this question do not really answer the questions,
which were "What are differences or advantages of baysian (sic) lasso vs regular lasso?" and "are they the same?"
First,
|
9,493
|
Connection between Fisher metric and the relative entropy
|
In 1946, geophysicist and Bayesian statistician Harold Jeffreys introduced what we today call the Kullback-Leibler divergence, and discovered that for two distributions that are "infinitely close" (let's hope that Math SE guys don't see this ;-) we can write their Kullback-Leibler divergence as a quadratic form whose coefficients are given by the elements of the Fisher information matrix. He interpreted this quadratic form as the element of length of a Riemannian manifold, with the Fisher information playing the role of the Riemannian metric. From this geometrization of the statistical model, he derived his Jeffreys's prior as the measure naturally induced by the Riemannian metric, and this measure can be interpreted as an intrinsically uniform distribution on the manifold, although, in general, it is not a finite measure.
To write a rigorous proof, you'll need to spot out all the regularity conditions and take care of the order of the error terms in the Taylor expansions. Here is a brief sketch of the argument.
The symmetrized Kullback-Leibler divergence between two densities $f$ and $g$ is defined as
$$
D[f,g] = \int (f(x) - g(x)) \log\left(\frac{f(x)}{g(x)} \right) dx \, .
$$
If we have a family of densities parameterized by $\theta=(\theta_1,\dots,\theta_k)$, then
$${\scriptsize
D[p(\,\cdot\,\mid\theta), p(\,\cdot\,\mid\theta + \Delta\theta)] = \int ( p(x,\mid\theta) - p(x\mid\theta + \Delta\theta)) \log\left( \frac{p(x\mid\theta)}{p(x\mid\theta + \Delta\theta)}\right) \,dx \, },
$$
in which $\Delta\theta=(\Delta\theta_1,\dots,\Delta\theta_k)$. Introducing the notation
$$
\Delta p(x\mid\theta) = p(x\mid\theta) - p(x\mid\theta + \Delta\theta) \, ,
$$
some simple algebra gives
$$
D[p(\;\cdot\,\mid\theta), p(\;\cdot\,\mid\theta + \Delta\theta)] = \int\frac{\Delta p(x\mid\theta)}{p(x\mid\theta)} \log\left(1+\frac{\Delta p(x\mid\theta)}{p(x\mid\theta)}\right)p(x\mid\theta)\,dx \, .
$$
Using the Taylor expansion for the natural logarithm, we have
$$
\log\left(1+\frac{\Delta p(x\mid\theta)}{p(x\mid\theta)}\right) \approx \frac{\Delta p(x\mid\theta)}{p(x\mid\theta)} \, ,
$$
and therefore
$$
D[p(\;\cdot\,\mid\theta), p(\;\cdot\,\mid\theta + \Delta\theta)] \approx \int\left(\frac{\Delta p(x\mid\theta)}{p(x\mid\theta)}\right)^2p(x\mid\theta)\,dx \, .
$$
But
$$
\frac{\Delta p(x\mid\theta)}{p(x\mid\theta)} \approx \frac{1}{p(x\mid\theta)} \sum_{i=1}^k \frac{\partial p(x\mid\theta)}{\partial\theta_i} \, \Delta\theta_i = \sum_{i=1}^k \frac{\partial \log p(x\mid\theta)}{\partial\theta_i} \, \Delta\theta_i \, .
$$
Hence
$$
D[p(\,\cdot\,\mid\theta), p(\,\cdot\,\mid\theta + \Delta\theta)] \approx \sum_{i,j=1}^k g_{ij} \,\Delta\theta_i \, \Delta\theta_j \, ,
$$
in which
$$
g_{ij} = \int \frac{\partial \log p(x\mid\theta)}{\partial\theta_i} \frac{\partial \log p(x\mid\theta)}{\partial\theta_j} p(x\mid\theta) \,dx \, .
$$
This is the original paper:
Jeffreys, H. (1946). An invariant form for the prior probability in estimation problems. Proc. Royal Soc. of London, Series A, 186, 453–461.
|
Connection between Fisher metric and the relative entropy
|
In 1946, geophysicist and Bayesian statistician Harold Jeffreys introduced what we today call the Kullback-Leibler divergence, and discovered that for two distributions that are "infinitely close" (le
|
Connection between Fisher metric and the relative entropy
In 1946, geophysicist and Bayesian statistician Harold Jeffreys introduced what we today call the Kullback-Leibler divergence, and discovered that for two distributions that are "infinitely close" (let's hope that Math SE guys don't see this ;-) we can write their Kullback-Leibler divergence as a quadratic form whose coefficients are given by the elements of the Fisher information matrix. He interpreted this quadratic form as the element of length of a Riemannian manifold, with the Fisher information playing the role of the Riemannian metric. From this geometrization of the statistical model, he derived his Jeffreys's prior as the measure naturally induced by the Riemannian metric, and this measure can be interpreted as an intrinsically uniform distribution on the manifold, although, in general, it is not a finite measure.
To write a rigorous proof, you'll need to spot out all the regularity conditions and take care of the order of the error terms in the Taylor expansions. Here is a brief sketch of the argument.
The symmetrized Kullback-Leibler divergence between two densities $f$ and $g$ is defined as
$$
D[f,g] = \int (f(x) - g(x)) \log\left(\frac{f(x)}{g(x)} \right) dx \, .
$$
If we have a family of densities parameterized by $\theta=(\theta_1,\dots,\theta_k)$, then
$${\scriptsize
D[p(\,\cdot\,\mid\theta), p(\,\cdot\,\mid\theta + \Delta\theta)] = \int ( p(x,\mid\theta) - p(x\mid\theta + \Delta\theta)) \log\left( \frac{p(x\mid\theta)}{p(x\mid\theta + \Delta\theta)}\right) \,dx \, },
$$
in which $\Delta\theta=(\Delta\theta_1,\dots,\Delta\theta_k)$. Introducing the notation
$$
\Delta p(x\mid\theta) = p(x\mid\theta) - p(x\mid\theta + \Delta\theta) \, ,
$$
some simple algebra gives
$$
D[p(\;\cdot\,\mid\theta), p(\;\cdot\,\mid\theta + \Delta\theta)] = \int\frac{\Delta p(x\mid\theta)}{p(x\mid\theta)} \log\left(1+\frac{\Delta p(x\mid\theta)}{p(x\mid\theta)}\right)p(x\mid\theta)\,dx \, .
$$
Using the Taylor expansion for the natural logarithm, we have
$$
\log\left(1+\frac{\Delta p(x\mid\theta)}{p(x\mid\theta)}\right) \approx \frac{\Delta p(x\mid\theta)}{p(x\mid\theta)} \, ,
$$
and therefore
$$
D[p(\;\cdot\,\mid\theta), p(\;\cdot\,\mid\theta + \Delta\theta)] \approx \int\left(\frac{\Delta p(x\mid\theta)}{p(x\mid\theta)}\right)^2p(x\mid\theta)\,dx \, .
$$
But
$$
\frac{\Delta p(x\mid\theta)}{p(x\mid\theta)} \approx \frac{1}{p(x\mid\theta)} \sum_{i=1}^k \frac{\partial p(x\mid\theta)}{\partial\theta_i} \, \Delta\theta_i = \sum_{i=1}^k \frac{\partial \log p(x\mid\theta)}{\partial\theta_i} \, \Delta\theta_i \, .
$$
Hence
$$
D[p(\,\cdot\,\mid\theta), p(\,\cdot\,\mid\theta + \Delta\theta)] \approx \sum_{i,j=1}^k g_{ij} \,\Delta\theta_i \, \Delta\theta_j \, ,
$$
in which
$$
g_{ij} = \int \frac{\partial \log p(x\mid\theta)}{\partial\theta_i} \frac{\partial \log p(x\mid\theta)}{\partial\theta_j} p(x\mid\theta) \,dx \, .
$$
This is the original paper:
Jeffreys, H. (1946). An invariant form for the prior probability in estimation problems. Proc. Royal Soc. of London, Series A, 186, 453–461.
|
Connection between Fisher metric and the relative entropy
In 1946, geophysicist and Bayesian statistician Harold Jeffreys introduced what we today call the Kullback-Leibler divergence, and discovered that for two distributions that are "infinitely close" (le
|
9,494
|
Connection between Fisher metric and the relative entropy
|
Proof for usual (non-symmetric) KL divergence
Zen's answer uses the symmetrized KL divergence, but the result holds for the usual form as well, since it becomes symmetric for infinitesimally close distributions.
Here's a proof for discrete distributions parameterized by a scalar $\theta$ (because I'm lazy), but can be easily re-written for continuous distributions or a vector of parameters:
\begin{equation}
D(p_\theta,p_{\theta+d\theta})=\sum p_\theta \log p_\theta
- \sum p_\theta \log p_{\theta+d\theta}\ .
\end{equation}
Taylor-expanding the last term:
\begin{equation}
= \underbrace{\sum p_\theta \log p_\theta - \sum p_\theta \log p_\theta}_{=\ 0}
- d\theta \underbrace{\sum p_\theta \frac{d}{d\theta}\log p_\theta}_{=\ 0 \ \dagger}
- \frac{1}{2}{d\theta}^2 \underbrace{\sum p_\theta \frac{d^2}{d\theta^2}\log p_\theta}_{= -\sum p_\theta (\frac{d}{d\theta}\log p_\theta)^2 \ \ddagger} + \mathcal{O}({d\theta}^3) \\
= \frac{1}{2}{d\theta}^2 \underbrace{\sum p_\theta (\frac{d}{d\theta}\log p_\theta)^2}_{\textrm{Fisher information}} + \mathcal{O}({d\theta}^3).
\end{equation}
Assuming some regularities, I have used the two results:
\begin{equation}
\dagger: \sum p_\theta \frac{d}{d\theta}\log p_\theta = \sum \frac{d}{d\theta} p_\theta = \frac{d}{d\theta} \sum p_\theta =0,
\end{equation}
\begin{align}
\ddagger: \sum p_\theta \frac{d^2}{d\theta^2}\log p_\theta
&= \sum p_\theta \frac{d}{d\theta}(\frac{1}{p_\theta}\frac{dp_\theta}{d\theta}) \\
&= \sum p_\theta \left[\frac{1}{p_\theta}\frac{d^2p_\theta}{d\theta}-(\frac{1}{p_\theta}\frac{dp_\theta}{d\theta})^2\right] \\
&= \sum \frac{d^2p_\theta}{d\theta^2} - \sum p_\theta (\frac{1}{p_\theta} \frac{dp_\theta}{d\theta})^2 \\
&= \underbrace{\frac{d^2}{d\theta^2} \sum p_\theta}_{=\ 0} - \sum {p_\theta} (\frac{d}{d\theta}\log p_\theta)^2.
\end{align}
|
Connection between Fisher metric and the relative entropy
|
Proof for usual (non-symmetric) KL divergence
Zen's answer uses the symmetrized KL divergence, but the result holds for the usual form as well, since it becomes symmetric for infinitesimally close dis
|
Connection between Fisher metric and the relative entropy
Proof for usual (non-symmetric) KL divergence
Zen's answer uses the symmetrized KL divergence, but the result holds for the usual form as well, since it becomes symmetric for infinitesimally close distributions.
Here's a proof for discrete distributions parameterized by a scalar $\theta$ (because I'm lazy), but can be easily re-written for continuous distributions or a vector of parameters:
\begin{equation}
D(p_\theta,p_{\theta+d\theta})=\sum p_\theta \log p_\theta
- \sum p_\theta \log p_{\theta+d\theta}\ .
\end{equation}
Taylor-expanding the last term:
\begin{equation}
= \underbrace{\sum p_\theta \log p_\theta - \sum p_\theta \log p_\theta}_{=\ 0}
- d\theta \underbrace{\sum p_\theta \frac{d}{d\theta}\log p_\theta}_{=\ 0 \ \dagger}
- \frac{1}{2}{d\theta}^2 \underbrace{\sum p_\theta \frac{d^2}{d\theta^2}\log p_\theta}_{= -\sum p_\theta (\frac{d}{d\theta}\log p_\theta)^2 \ \ddagger} + \mathcal{O}({d\theta}^3) \\
= \frac{1}{2}{d\theta}^2 \underbrace{\sum p_\theta (\frac{d}{d\theta}\log p_\theta)^2}_{\textrm{Fisher information}} + \mathcal{O}({d\theta}^3).
\end{equation}
Assuming some regularities, I have used the two results:
\begin{equation}
\dagger: \sum p_\theta \frac{d}{d\theta}\log p_\theta = \sum \frac{d}{d\theta} p_\theta = \frac{d}{d\theta} \sum p_\theta =0,
\end{equation}
\begin{align}
\ddagger: \sum p_\theta \frac{d^2}{d\theta^2}\log p_\theta
&= \sum p_\theta \frac{d}{d\theta}(\frac{1}{p_\theta}\frac{dp_\theta}{d\theta}) \\
&= \sum p_\theta \left[\frac{1}{p_\theta}\frac{d^2p_\theta}{d\theta}-(\frac{1}{p_\theta}\frac{dp_\theta}{d\theta})^2\right] \\
&= \sum \frac{d^2p_\theta}{d\theta^2} - \sum p_\theta (\frac{1}{p_\theta} \frac{dp_\theta}{d\theta})^2 \\
&= \underbrace{\frac{d^2}{d\theta^2} \sum p_\theta}_{=\ 0} - \sum {p_\theta} (\frac{d}{d\theta}\log p_\theta)^2.
\end{align}
|
Connection between Fisher metric and the relative entropy
Proof for usual (non-symmetric) KL divergence
Zen's answer uses the symmetrized KL divergence, but the result holds for the usual form as well, since it becomes symmetric for infinitesimally close dis
|
9,495
|
Connection between Fisher metric and the relative entropy
|
You can find a similar relationship (for a one-dimensional parameter) in equation (3) of the following paper
D. Guo (2009), Relative Entropy and Score Function: New
Information–Estimation Relationships through Arbitrary Additive
Perturbation,
in Proc. IEEE International Symposium on Information Theory,
814–818. (stable
link).
The authors refer to
S. Kullback, Information Theory and Statistics. New York: Dover, 1968.
for a proof of this result.
|
Connection between Fisher metric and the relative entropy
|
You can find a similar relationship (for a one-dimensional parameter) in equation (3) of the following paper
D. Guo (2009), Relative Entropy and Score Function: New
Information–Estimation Relations
|
Connection between Fisher metric and the relative entropy
You can find a similar relationship (for a one-dimensional parameter) in equation (3) of the following paper
D. Guo (2009), Relative Entropy and Score Function: New
Information–Estimation Relationships through Arbitrary Additive
Perturbation,
in Proc. IEEE International Symposium on Information Theory,
814–818. (stable
link).
The authors refer to
S. Kullback, Information Theory and Statistics. New York: Dover, 1968.
for a proof of this result.
|
Connection between Fisher metric and the relative entropy
You can find a similar relationship (for a one-dimensional parameter) in equation (3) of the following paper
D. Guo (2009), Relative Entropy and Score Function: New
Information–Estimation Relations
|
9,496
|
Deriving the KL divergence loss for VAEs
|
The encoder distribution is $q(z|x)=\mathcal{N}(z|\mu(x),\Sigma(x))$ where $\Sigma=\text{diag}(\sigma_1^2,\ldots,\sigma^2_n)$.
The latent prior is given by $p(z)=\mathcal{N}(0,I)$.
Both are multivariate Gaussians of dimension $n$, for which in general the KL divergence is:
$$
\mathfrak{D}_\text{KL}[p_1\mid\mid p_2] =
\frac{1}{2}\left[\log\frac{|\Sigma_2|}{|\Sigma_1|} - n + \text{tr} \{ \Sigma_2^{-1}\Sigma_1 \} + (\mu_2 - \mu_1)^T \Sigma_2^{-1}(\mu_2 - \mu_1)\right]
$$
where $p_1 = \mathcal{N}(\mu_1,\Sigma_1)$ and $p_2 = \mathcal{N}(\mu_2,\Sigma_2)$.
In the VAE case, $p_1 = q(z|x)$ and $p_2=p(z)$, so $\mu_1=\mu$, $\Sigma_1 = \Sigma$, $\mu_2=\vec{0}$, $\Sigma_2=I$. Thus:
\begin{align}
\mathfrak{D}_\text{KL}[q(z|x)\mid\mid p(z)]
&=
\frac{1}{2}\left[\log\frac{|\Sigma_2|}{|\Sigma_1|} - n + \text{tr} \{ \Sigma_2^{-1}\Sigma_1 \} + (\mu_2 - \mu_1)^T \Sigma_2^{-1}(\mu_2 - \mu_1)\right]\\
&= \frac{1}{2}\left[\log\frac{|I|}{|\Sigma|} - n + \text{tr} \{ I^{-1}\Sigma \} + (\vec{0} - \mu)^T I^{-1}(\vec{0} - \mu)\right]\\
&= \frac{1}{2}\left[-\log{|\Sigma|} - n + \text{tr} \{ \Sigma \} + \mu^T \mu\right]\\
&= \frac{1}{2}\left[-\log\prod_i\sigma_i^2 - n + \sum_i\sigma_i^2 + \sum_i\mu^2_i\right]\\
&= \frac{1}{2}\left[-\sum_i\log\sigma_i^2 - n + \sum_i\sigma_i^2 + \sum_i\mu^2_i\right]\\
&= \frac{1}{2}\left[-\sum_i\left(\log\sigma_i^2 + 1\right) + \sum_i\sigma_i^2 + \sum_i\mu^2_i\right]\\
\end{align}
|
Deriving the KL divergence loss for VAEs
|
The encoder distribution is $q(z|x)=\mathcal{N}(z|\mu(x),\Sigma(x))$ where $\Sigma=\text{diag}(\sigma_1^2,\ldots,\sigma^2_n)$.
The latent prior is given by $p(z)=\mathcal{N}(0,I)$.
Both are multivaria
|
Deriving the KL divergence loss for VAEs
The encoder distribution is $q(z|x)=\mathcal{N}(z|\mu(x),\Sigma(x))$ where $\Sigma=\text{diag}(\sigma_1^2,\ldots,\sigma^2_n)$.
The latent prior is given by $p(z)=\mathcal{N}(0,I)$.
Both are multivariate Gaussians of dimension $n$, for which in general the KL divergence is:
$$
\mathfrak{D}_\text{KL}[p_1\mid\mid p_2] =
\frac{1}{2}\left[\log\frac{|\Sigma_2|}{|\Sigma_1|} - n + \text{tr} \{ \Sigma_2^{-1}\Sigma_1 \} + (\mu_2 - \mu_1)^T \Sigma_2^{-1}(\mu_2 - \mu_1)\right]
$$
where $p_1 = \mathcal{N}(\mu_1,\Sigma_1)$ and $p_2 = \mathcal{N}(\mu_2,\Sigma_2)$.
In the VAE case, $p_1 = q(z|x)$ and $p_2=p(z)$, so $\mu_1=\mu$, $\Sigma_1 = \Sigma$, $\mu_2=\vec{0}$, $\Sigma_2=I$. Thus:
\begin{align}
\mathfrak{D}_\text{KL}[q(z|x)\mid\mid p(z)]
&=
\frac{1}{2}\left[\log\frac{|\Sigma_2|}{|\Sigma_1|} - n + \text{tr} \{ \Sigma_2^{-1}\Sigma_1 \} + (\mu_2 - \mu_1)^T \Sigma_2^{-1}(\mu_2 - \mu_1)\right]\\
&= \frac{1}{2}\left[\log\frac{|I|}{|\Sigma|} - n + \text{tr} \{ I^{-1}\Sigma \} + (\vec{0} - \mu)^T I^{-1}(\vec{0} - \mu)\right]\\
&= \frac{1}{2}\left[-\log{|\Sigma|} - n + \text{tr} \{ \Sigma \} + \mu^T \mu\right]\\
&= \frac{1}{2}\left[-\log\prod_i\sigma_i^2 - n + \sum_i\sigma_i^2 + \sum_i\mu^2_i\right]\\
&= \frac{1}{2}\left[-\sum_i\log\sigma_i^2 - n + \sum_i\sigma_i^2 + \sum_i\mu^2_i\right]\\
&= \frac{1}{2}\left[-\sum_i\left(\log\sigma_i^2 + 1\right) + \sum_i\sigma_i^2 + \sum_i\mu^2_i\right]\\
\end{align}
|
Deriving the KL divergence loss for VAEs
The encoder distribution is $q(z|x)=\mathcal{N}(z|\mu(x),\Sigma(x))$ where $\Sigma=\text{diag}(\sigma_1^2,\ldots,\sigma^2_n)$.
The latent prior is given by $p(z)=\mathcal{N}(0,I)$.
Both are multivaria
|
9,497
|
Why Normalizing Factor is Required in Bayes Theorem?
|
First, the integral of "likelihood x prior" is not necessarily 1.
It is not true that if:
$0 \leq P(\textrm{model}) \leq 1$ and $ 0 \leq P(\textrm{data}|\textrm{model}) \leq 1$
then the integral of this product with respect to the model (to the parameters of the model, indeed) is 1.
Demonstration. Imagine two discrete densities:
$$
P(\textrm{model}) = [0.5, 0.5] \text{ (this is called "prior")}\\
P(\textrm{data | model}) = [0.80, 0.2] \text{ (this is called "likelihood")}\\
$$
If you multiply them both you get:
$$
[0.40, 0.25]
$$
which is not a valid density since it does not integrate to one:
$$
0.40 + 0.25 = 0.65
$$
So, what should we do to force the integral to be 1? Use the normalizing factor, which is:
$$
\sum_{\text{model_params}} P(\text{model}) P(\text{data | model}) = \sum_\text{model_params} P(\text{model, data}) = P(\text{data}) = 0.65
$$
(sorry about the poor notation. I wrote three different expressions for the same thing since you might see them all in the literature)
Second, the "likelihood" can be anything, and even if it is a density, it can have values higher than 1.
As @whuber said this factors do not need to be between 0 and 1. They need that their integral (or sum) be 1.
Third [extra], "conjugates" are your friends to help you find the normalizing constant.
You will often see:
$$
P(\textrm{model}|\textrm{data}) \propto P(\textrm{data}|\textrm{model}) P(\text{model})
$$
because the missing denominator can be easily get by integrating this product. Note that this integration will have one well known result if the prior and the likelihood are conjugate.
|
Why Normalizing Factor is Required in Bayes Theorem?
|
First, the integral of "likelihood x prior" is not necessarily 1.
It is not true that if:
$0 \leq P(\textrm{model}) \leq 1$ and $ 0 \leq P(\textrm{data}|\textrm{model}) \leq 1$
then the integral of t
|
Why Normalizing Factor is Required in Bayes Theorem?
First, the integral of "likelihood x prior" is not necessarily 1.
It is not true that if:
$0 \leq P(\textrm{model}) \leq 1$ and $ 0 \leq P(\textrm{data}|\textrm{model}) \leq 1$
then the integral of this product with respect to the model (to the parameters of the model, indeed) is 1.
Demonstration. Imagine two discrete densities:
$$
P(\textrm{model}) = [0.5, 0.5] \text{ (this is called "prior")}\\
P(\textrm{data | model}) = [0.80, 0.2] \text{ (this is called "likelihood")}\\
$$
If you multiply them both you get:
$$
[0.40, 0.25]
$$
which is not a valid density since it does not integrate to one:
$$
0.40 + 0.25 = 0.65
$$
So, what should we do to force the integral to be 1? Use the normalizing factor, which is:
$$
\sum_{\text{model_params}} P(\text{model}) P(\text{data | model}) = \sum_\text{model_params} P(\text{model, data}) = P(\text{data}) = 0.65
$$
(sorry about the poor notation. I wrote three different expressions for the same thing since you might see them all in the literature)
Second, the "likelihood" can be anything, and even if it is a density, it can have values higher than 1.
As @whuber said this factors do not need to be between 0 and 1. They need that their integral (or sum) be 1.
Third [extra], "conjugates" are your friends to help you find the normalizing constant.
You will often see:
$$
P(\textrm{model}|\textrm{data}) \propto P(\textrm{data}|\textrm{model}) P(\text{model})
$$
because the missing denominator can be easily get by integrating this product. Note that this integration will have one well known result if the prior and the likelihood are conjugate.
|
Why Normalizing Factor is Required in Bayes Theorem?
First, the integral of "likelihood x prior" is not necessarily 1.
It is not true that if:
$0 \leq P(\textrm{model}) \leq 1$ and $ 0 \leq P(\textrm{data}|\textrm{model}) \leq 1$
then the integral of t
|
9,498
|
Why Normalizing Factor is Required in Bayes Theorem?
|
The short answer to your question is that without the denominator, the expression on the right-hand side is merely a likelihood, not a probability, which can only range from 0 to 1. The "normalizing constant" allows us to get the probability for the occurrence of an event, rather than merely the relative likelihood of that event compared to another.
|
Why Normalizing Factor is Required in Bayes Theorem?
|
The short answer to your question is that without the denominator, the expression on the right-hand side is merely a likelihood, not a probability, which can only range from 0 to 1. The "normalizing
|
Why Normalizing Factor is Required in Bayes Theorem?
The short answer to your question is that without the denominator, the expression on the right-hand side is merely a likelihood, not a probability, which can only range from 0 to 1. The "normalizing constant" allows us to get the probability for the occurrence of an event, rather than merely the relative likelihood of that event compared to another.
|
Why Normalizing Factor is Required in Bayes Theorem?
The short answer to your question is that without the denominator, the expression on the right-hand side is merely a likelihood, not a probability, which can only range from 0 to 1. The "normalizing
|
9,499
|
Why Normalizing Factor is Required in Bayes Theorem?
|
You already got two valid answers but let me add my two cents.
Bayes theorem is often defined as:
$$P(\text{model}~ | ~\text{data}) \propto P(\text{model}) \times P(\text{data}~|~\text{model})$$
because the only reason why you need the constant is so that it integrates to 1 (see the answers by others). This is not needed in most MCMC simulation approaches to Bayesian analysis and hence the constant is dropped from the equation. So for most simulations it is not even required.
I love the description by Kruschke: the last puppy (constant) is sleepy because he has nothing to do in the formula.
Also some, like Andrew Gelman, consider the constant as "overrated" and "basically meaningless when people use flat priors" (check the discussion here).
|
Why Normalizing Factor is Required in Bayes Theorem?
|
You already got two valid answers but let me add my two cents.
Bayes theorem is often defined as:
$$P(\text{model}~ | ~\text{data}) \propto P(\text{model}) \times P(\text{data}~|~\text{model})$$
beca
|
Why Normalizing Factor is Required in Bayes Theorem?
You already got two valid answers but let me add my two cents.
Bayes theorem is often defined as:
$$P(\text{model}~ | ~\text{data}) \propto P(\text{model}) \times P(\text{data}~|~\text{model})$$
because the only reason why you need the constant is so that it integrates to 1 (see the answers by others). This is not needed in most MCMC simulation approaches to Bayesian analysis and hence the constant is dropped from the equation. So for most simulations it is not even required.
I love the description by Kruschke: the last puppy (constant) is sleepy because he has nothing to do in the formula.
Also some, like Andrew Gelman, consider the constant as "overrated" and "basically meaningless when people use flat priors" (check the discussion here).
|
Why Normalizing Factor is Required in Bayes Theorem?
You already got two valid answers but let me add my two cents.
Bayes theorem is often defined as:
$$P(\text{model}~ | ~\text{data}) \propto P(\text{model}) \times P(\text{data}~|~\text{model})$$
beca
|
9,500
|
Why doesn't backpropagation work when you initialize the weights the same value?
|
Symmetry breaking.
If all weights start with equal values and if the solution requires that unequal weights be developed, the system can never learn.
This is because error is propagated back through the weights in proportion to the values of the weights. This means that all hidden units connected directly to the output units will get identical error signals, and, since the weight changes depend on the error signals, the weights from those units to the output units must always be the same. The system is starting out at a kind of unstable equilibrium point that keeps the weights equal, but it is higher than some neighboring points on the error surface, and once it moves away to one of these points, it will never return. We counteract this problem by starting the system with small random weights. Under these conditions symmetry problems of this kind do not arise.
|
Why doesn't backpropagation work when you initialize the weights the same value?
|
Symmetry breaking.
If all weights start with equal values and if the solution requires that unequal weights be developed, the system can never learn.
This is because error is propagated back through
|
Why doesn't backpropagation work when you initialize the weights the same value?
Symmetry breaking.
If all weights start with equal values and if the solution requires that unequal weights be developed, the system can never learn.
This is because error is propagated back through the weights in proportion to the values of the weights. This means that all hidden units connected directly to the output units will get identical error signals, and, since the weight changes depend on the error signals, the weights from those units to the output units must always be the same. The system is starting out at a kind of unstable equilibrium point that keeps the weights equal, but it is higher than some neighboring points on the error surface, and once it moves away to one of these points, it will never return. We counteract this problem by starting the system with small random weights. Under these conditions symmetry problems of this kind do not arise.
|
Why doesn't backpropagation work when you initialize the weights the same value?
Symmetry breaking.
If all weights start with equal values and if the solution requires that unequal weights be developed, the system can never learn.
This is because error is propagated back through
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.