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
38,901
Does adjusting for superfluous variables bias OLS estimates?
There's no contradiction. The first paragraph there talks about superfluous variables. If Simpson's paradox applies, the variables are not superfluous.
Does adjusting for superfluous variables bias OLS estimates?
There's no contradiction. The first paragraph there talks about superfluous variables. If Simpson's paradox applies, the variables are not superfluous.
Does adjusting for superfluous variables bias OLS estimates? There's no contradiction. The first paragraph there talks about superfluous variables. If Simpson's paradox applies, the variables are not superfluous.
Does adjusting for superfluous variables bias OLS estimates? There's no contradiction. The first paragraph there talks about superfluous variables. If Simpson's paradox applies, the variables are not superfluous.
38,902
Does adjusting for superfluous variables bias OLS estimates?
Consider a postulated linear regression model $$y_i = b_0 + b_1X_{1i} + b_2X_{2i} + u_i,\;\; i=1,...,n$$ As a matter of algebra (and not any stochastic assumptions), the OLS estimator in matrix notation is $$\hat b = b + \left(\mathbf X'\mathbf X\right)^{-1}\mathbf X'\mathbf u$$ Its expected value conditional on the regressor matrix is therefore $$E\left(\hat b\mid \mathbf X\right) = b + \left(\mathbf X'\mathbf X\right)^{-1}\mathbf X'E\left(\mathbf u\mid\mathbf X \right)$$ So: If "strict exogeneity" of the regressors with respect to the error term holds, or, in other words, if all error terms are mean-independent from all regressors,past present and future, (which is the benchmark assumption in the Classical Linear Regression model), i.e. if $E\left(\mathbf u\mid\mathbf X \right)=\mathbf 0$, we will have $$E\left(\hat b\mid \mathbf X\right) = b + \mathbf 0 \Rightarrow E(\hat b) = b$$ using also the law of iterated expectations. Given all the above, what "superfluous variable" means? I take it, it means "unrelated" to the dependent variable. But "unrelated" should be translated as "stochastically independent". But if it is independent from the dependent variable, it is necessarily independent from the error term (and so also strictly exogenous with respect to it), so all the above hold for any superfluous variable also, and the OLS estimator is unbiased even if, say, the variable $X_2$ is "superfluous" and the true model does not contain it. This is how econometricians understand the issue. Now, in a more general setting, "superfluous" could mean that say, $X_2$ is independent of $y$ conditional on the presence of $X_1$ (which I suspect is more close to what Pearl has in mind). Still, as long as $X_2$ is strictly exogenous to the error term, the unbiasedness result holds.
Does adjusting for superfluous variables bias OLS estimates?
Consider a postulated linear regression model $$y_i = b_0 + b_1X_{1i} + b_2X_{2i} + u_i,\;\; i=1,...,n$$ As a matter of algebra (and not any stochastic assumptions), the OLS estimator in matrix notati
Does adjusting for superfluous variables bias OLS estimates? Consider a postulated linear regression model $$y_i = b_0 + b_1X_{1i} + b_2X_{2i} + u_i,\;\; i=1,...,n$$ As a matter of algebra (and not any stochastic assumptions), the OLS estimator in matrix notation is $$\hat b = b + \left(\mathbf X'\mathbf X\right)^{-1}\mathbf X'\mathbf u$$ Its expected value conditional on the regressor matrix is therefore $$E\left(\hat b\mid \mathbf X\right) = b + \left(\mathbf X'\mathbf X\right)^{-1}\mathbf X'E\left(\mathbf u\mid\mathbf X \right)$$ So: If "strict exogeneity" of the regressors with respect to the error term holds, or, in other words, if all error terms are mean-independent from all regressors,past present and future, (which is the benchmark assumption in the Classical Linear Regression model), i.e. if $E\left(\mathbf u\mid\mathbf X \right)=\mathbf 0$, we will have $$E\left(\hat b\mid \mathbf X\right) = b + \mathbf 0 \Rightarrow E(\hat b) = b$$ using also the law of iterated expectations. Given all the above, what "superfluous variable" means? I take it, it means "unrelated" to the dependent variable. But "unrelated" should be translated as "stochastically independent". But if it is independent from the dependent variable, it is necessarily independent from the error term (and so also strictly exogenous with respect to it), so all the above hold for any superfluous variable also, and the OLS estimator is unbiased even if, say, the variable $X_2$ is "superfluous" and the true model does not contain it. This is how econometricians understand the issue. Now, in a more general setting, "superfluous" could mean that say, $X_2$ is independent of $y$ conditional on the presence of $X_1$ (which I suspect is more close to what Pearl has in mind). Still, as long as $X_2$ is strictly exogenous to the error term, the unbiasedness result holds.
Does adjusting for superfluous variables bias OLS estimates? Consider a postulated linear regression model $$y_i = b_0 + b_1X_{1i} + b_2X_{2i} + u_i,\;\; i=1,...,n$$ As a matter of algebra (and not any stochastic assumptions), the OLS estimator in matrix notati
38,903
How can I calculate t-score without knowing true population mean?
As far as I know μ is used to define true population mean. Not quite, and here's the rub. μ represents whatever the true mean is. It's defined by the problem for which this little bit of statistical inference is the analysis, not by the data itself (that would make it an estimate, not a hypothesis) So in formula above I need true population mean μ to calculate t-score. You need a hypothesis about what it is, that is: a possible value for it. You dont need to know what that value really is. But as I said before when calculating t-score we don't know true population parameters, in this case true population mean μ. So what number I should use in μ and how to calculate it? An example, done a few ways Assume for a moment that you ask that a pool of subjects estimate the price of something - say a new college textbook, for concreteness - and you're interested whether they over- or underestimate the true price. Here you can look up the true price, so if it's 45 dollars and the price guesses are in dollars too, then the μ=45. If the subjects average guess is 60 then your t-test is testing whether there is enough evidence that they are systematically overestimating the price or whether their guesses could have have come from a population of subjects that neither under nor overestimated the textbook price. Looking at this another completely equivalent way, you might subtract the true price from each subject's guess. Then you are looking at deviations from the correct price and the test would set μ=0 (unbiased price guessing) Looked at a third way, you might think about running this test for all values of μ (you wouldn't really do this, but bear with me). For μs near the subjects' average, the test will 'not reject', but for μs quite far away from the subjects' average, the test will reject that the data came from a distribution with that value of μ. The region of μ values for which the test does not reject is, in a sense, the region of μ values that are 'reasonable' in the light of the data. This is one way to motivate the idea of (and sometimes actually construct) a confidence interval. When the confidence interval (the region of non-rejected μs) does not overlap 45 (or zero in the second formulation), then we reject the hypothesis that this population is unbiased in its textbook price guessing. Each of these approaches get you to the same place in a different way. None of them require knowing the true value of μ. The first two are the ones to consider in your case.
How can I calculate t-score without knowing true population mean?
As far as I know μ is used to define true population mean. Not quite, and here's the rub. μ represents whatever the true mean is. It's defined by the problem for which this little bit of statistic
How can I calculate t-score without knowing true population mean? As far as I know μ is used to define true population mean. Not quite, and here's the rub. μ represents whatever the true mean is. It's defined by the problem for which this little bit of statistical inference is the analysis, not by the data itself (that would make it an estimate, not a hypothesis) So in formula above I need true population mean μ to calculate t-score. You need a hypothesis about what it is, that is: a possible value for it. You dont need to know what that value really is. But as I said before when calculating t-score we don't know true population parameters, in this case true population mean μ. So what number I should use in μ and how to calculate it? An example, done a few ways Assume for a moment that you ask that a pool of subjects estimate the price of something - say a new college textbook, for concreteness - and you're interested whether they over- or underestimate the true price. Here you can look up the true price, so if it's 45 dollars and the price guesses are in dollars too, then the μ=45. If the subjects average guess is 60 then your t-test is testing whether there is enough evidence that they are systematically overestimating the price or whether their guesses could have have come from a population of subjects that neither under nor overestimated the textbook price. Looking at this another completely equivalent way, you might subtract the true price from each subject's guess. Then you are looking at deviations from the correct price and the test would set μ=0 (unbiased price guessing) Looked at a third way, you might think about running this test for all values of μ (you wouldn't really do this, but bear with me). For μs near the subjects' average, the test will 'not reject', but for μs quite far away from the subjects' average, the test will reject that the data came from a distribution with that value of μ. The region of μ values for which the test does not reject is, in a sense, the region of μ values that are 'reasonable' in the light of the data. This is one way to motivate the idea of (and sometimes actually construct) a confidence interval. When the confidence interval (the region of non-rejected μs) does not overlap 45 (or zero in the second formulation), then we reject the hypothesis that this population is unbiased in its textbook price guessing. Each of these approaches get you to the same place in a different way. None of them require knowing the true value of μ. The first two are the ones to consider in your case.
How can I calculate t-score without knowing true population mean? As far as I know μ is used to define true population mean. Not quite, and here's the rub. μ represents whatever the true mean is. It's defined by the problem for which this little bit of statistic
38,904
How can I calculate t-score without knowing true population mean?
There are two different $\mu$'s involved here: the hypothesized mean that you use in the numerator of your t-statistic for a t-test (sometimes denoted as $\mu_0$), and the true population mean, $\mu$. The t-test is actually to see whether the true population mean differs from the hypothesized mean -- that is, it's a test for a null hypothesis $H_0\!:\, \mu=\mu_0$. Don't confuse $\mu$ with $\mu_0$. Only one of the two is known.
How can I calculate t-score without knowing true population mean?
There are two different $\mu$'s involved here: the hypothesized mean that you use in the numerator of your t-statistic for a t-test (sometimes denoted as $\mu_0$), and the true population mean, $\mu$
How can I calculate t-score without knowing true population mean? There are two different $\mu$'s involved here: the hypothesized mean that you use in the numerator of your t-statistic for a t-test (sometimes denoted as $\mu_0$), and the true population mean, $\mu$. The t-test is actually to see whether the true population mean differs from the hypothesized mean -- that is, it's a test for a null hypothesis $H_0\!:\, \mu=\mu_0$. Don't confuse $\mu$ with $\mu_0$. Only one of the two is known.
How can I calculate t-score without knowing true population mean? There are two different $\mu$'s involved here: the hypothesized mean that you use in the numerator of your t-statistic for a t-test (sometimes denoted as $\mu_0$), and the true population mean, $\mu$
38,905
Approximate the distribution of the sum of ind. Beta r.v
If you want better approximations than what you get from the central limit theorem, there is results in a book dedicated exclusively to the beta distribution: http://www.amazon.com/Handbook-Beta-Distribution-Applications-Statistics/dp/0824753968/ref=sr_1_1?s=books&ie=UTF8&qid=1403444915&sr=1-1&keywords=beta+distribution (On the amazon.com website you can search within this book!) Arouind page 70 there is exact results for the sum of two independent beta distributions, arouind page 70 they find an approximation by assuming the sum also has an generalized beta distribution, and then equate moments. On page 85 they give approximations for general sums by using the same method, equating moments. Around page 85-87 they give references you can follow up.
Approximate the distribution of the sum of ind. Beta r.v
If you want better approximations than what you get from the central limit theorem, there is results in a book dedicated exclusively to the beta distribution: http://www.amazon.com/Handbook-Beta-Di
Approximate the distribution of the sum of ind. Beta r.v If you want better approximations than what you get from the central limit theorem, there is results in a book dedicated exclusively to the beta distribution: http://www.amazon.com/Handbook-Beta-Distribution-Applications-Statistics/dp/0824753968/ref=sr_1_1?s=books&ie=UTF8&qid=1403444915&sr=1-1&keywords=beta+distribution (On the amazon.com website you can search within this book!) Arouind page 70 there is exact results for the sum of two independent beta distributions, arouind page 70 they find an approximation by assuming the sum also has an generalized beta distribution, and then equate moments. On page 85 they give approximations for general sums by using the same method, equating moments. Around page 85-87 they give references you can follow up.
Approximate the distribution of the sum of ind. Beta r.v If you want better approximations than what you get from the central limit theorem, there is results in a book dedicated exclusively to the beta distribution: http://www.amazon.com/Handbook-Beta-Di
38,906
Approximate the distribution of the sum of ind. Beta r.v
Since you cannot share details, we cannot know to what extend you can use transformations of your variables, and still get what you need. For what is worth, a usual transformation here is the following: $$X_i \sim \beta(1,K) \Rightarrow Z_i=-\ln(1-X_i) \sim \text{Exp}(K)$$ and $$S_z = \sum_{i=1}^NZ_i \sim \text{Erlang}(N,K)$$ with pdf $$f_{S_z}(s_z) = \frac {K^NS_z^{N-1}e^{-KS_z}}{(N-1)!}$$
Approximate the distribution of the sum of ind. Beta r.v
Since you cannot share details, we cannot know to what extend you can use transformations of your variables, and still get what you need. For what is worth, a usual transformation here is the followin
Approximate the distribution of the sum of ind. Beta r.v Since you cannot share details, we cannot know to what extend you can use transformations of your variables, and still get what you need. For what is worth, a usual transformation here is the following: $$X_i \sim \beta(1,K) \Rightarrow Z_i=-\ln(1-X_i) \sim \text{Exp}(K)$$ and $$S_z = \sum_{i=1}^NZ_i \sim \text{Erlang}(N,K)$$ with pdf $$f_{S_z}(s_z) = \frac {K^NS_z^{N-1}e^{-KS_z}}{(N-1)!}$$
Approximate the distribution of the sum of ind. Beta r.v Since you cannot share details, we cannot know to what extend you can use transformations of your variables, and still get what you need. For what is worth, a usual transformation here is the followin
38,907
Approximate the distribution of the sum of ind. Beta r.v
CLT: $(S_n-n\mu)/\sigma\sqrt{n}$ is approximately distribured as $\mathrm{N}(0,1)$ for large $n$. To determine $\mu$ and $\sigma$ use this and this.
Approximate the distribution of the sum of ind. Beta r.v
CLT: $(S_n-n\mu)/\sigma\sqrt{n}$ is approximately distribured as $\mathrm{N}(0,1)$ for large $n$. To determine $\mu$ and $\sigma$ use this and this.
Approximate the distribution of the sum of ind. Beta r.v CLT: $(S_n-n\mu)/\sigma\sqrt{n}$ is approximately distribured as $\mathrm{N}(0,1)$ for large $n$. To determine $\mu$ and $\sigma$ use this and this.
Approximate the distribution of the sum of ind. Beta r.v CLT: $(S_n-n\mu)/\sigma\sqrt{n}$ is approximately distribured as $\mathrm{N}(0,1)$ for large $n$. To determine $\mu$ and $\sigma$ use this and this.
38,908
False discovery rate of multiple regressions models
@Dian breathe easy, it's pretty much not too difficult. So let's work from familiar territory to false discovery rate (FDR). First, I see that you have a bunch of outcomes, with a varying number of predictors. Someone who is more familiar with multivariate regression (i.e. multiple dependent variables, assuming possible correlations between errors of different models) will have to speak to whether your modeling approach is the best one. Let's take it as given. Each of your models will produce some number of $p$-values (incidentally I am an epidemiologist, and have absolutely no idea what you mean about "only one $p$-value." If that were true, it would change the nature of my work and that of my colleagues considerably. :). You could go ahead and test your hypotheses about individual effects separately using these $p$-values. Unfortunately, hypothesis testing is like the lottery (the more you play, the more your chance to "win"), so if you want to go into each hypothesis test assuming that the null hypothesis is true, then you are in trouble, because $\alpha$ (your willingness to make/probability of making a false rejection of a true null hypothesis) only applies to a single test. You may have heard of "the Bonferroni correction/adjustment", where you try to solve this conundrum by multiplying your $p$-values by the total number of null hypotheses you are testing (let's call that number of tests $m$). You are effectively trying to redefine $\alpha$ as a family-wise error rate (FWER), or the probability of making at least one false rejection out of a family of tests, assuming all null hypotheses are true. Alternatively, and equivalently, you can think about the Bonferroni adjustment as dividing $\alpha$ by $m$ (or $\alpha/2$ by $m$ if you are performing two-tailed tests, which in all likelihood you are in a regression context). We get these two alternatives because basing a rejection decision on $p \le \frac{\alpha/2}{m}$ is equivalent to $mp \le \frac{\alpha}{2}$. Of course, the Bonferroni technique is a blunt hammer. It positively hemorrhages statistical power. $\overset{_{\vee}}{\mathrm{S}}\mathrm{idák}$ got a smidge more statistical power, by altering the adjustment of the $p$-value to $1-(1-p)^{m}$. Holm improved upon both Bonferroni and $\overset{_{\vee}}{\mathrm{S}}\mathrm{idák}$ adjustments by creating a stepwise adjustment. The step-up procedure for the Bonferroni adjustemnt: Compute the exact $p$-value for each test. Order the $p$-values from smallest to largest. For the first test, adjust the $p$-value to be $pm$; and generally: For the i$^{\text{th}}$ test, adjust the $p$-value to be $p(m–(i–1))$. Using Holm’s method, for all tests following the first test for which we fail to reject H$_{0}$ we will also fail to reject the null hypothesis. The Holm-$\overset{_{\vee}}{\mathrm{S}}\mathrm{idák}$ adjustment is similar, but you would adjust each $p$-value using $1-(1-p)^{m-(i-1)}$. Some folks, most notably Benjamini and Hochberg (1995), were not comfortable with the world view implied by the assumption that all null hypotheses are true within a stepwise procedure. Surely, they reasoned, if you make an adjustment and reject a single hypothesis, that must imply that a better assumption would be that the remaining $m-1$ hypotheses have a lower probability of all null hypotheses being true? Also, science in general does not assume that there are no relationships in the world: quite the opposite, in fact. Enter the FDR which progressively assumes that rejection probabilities must increase if previous hypotheses were rejected after adjustment. Here's the step-down procedure they proposed: Compute the exact $p$-value for each test. Order the $p$-values from largest to smallest (step-down!). For the first test ($i=1$), adjust the $p$-value to be $\frac{pm}{m-(1-1)} = p$. For the i$^{\text{th}}$ test, adjust the $p$-value to be $\frac{pm}{m-(i–1)}$. Using Benjamini & Hochberg’s method, we reject all tests including and following the first test for which we reject the null hypothesis. We often term $p$-values that have been adjusted this way $q$-values. The advantages of this FDR adjustment include (1) more statistical power, especially for large $m$, and (2) easy integration of additional tests/$p$-values (say, adding $p$-values from an additional regression model) in a manner which leaves the inferences from the first FDR adjustment unchanged. Update: All these FWER procedures, and the FDR procedure I just described can produce adjusted $p$-values that are greater than one. When reporting adjusted $p$-values, these are typically reported as $p=1$, $p>.999$, $p=$not reject or something along those lines. References Benjamini, Y. and Hochberg, Y. (1995). Controlling the False Discovery Rate: A Practical and Powerful Approach to Multiple Testing. Journal of the Royal Statistical Society. Series B (Methodological), 57(1):289–300.
False discovery rate of multiple regressions models
@Dian breathe easy, it's pretty much not too difficult. So let's work from familiar territory to false discovery rate (FDR). First, I see that you have a bunch of outcomes, with a varying number of pr
False discovery rate of multiple regressions models @Dian breathe easy, it's pretty much not too difficult. So let's work from familiar territory to false discovery rate (FDR). First, I see that you have a bunch of outcomes, with a varying number of predictors. Someone who is more familiar with multivariate regression (i.e. multiple dependent variables, assuming possible correlations between errors of different models) will have to speak to whether your modeling approach is the best one. Let's take it as given. Each of your models will produce some number of $p$-values (incidentally I am an epidemiologist, and have absolutely no idea what you mean about "only one $p$-value." If that were true, it would change the nature of my work and that of my colleagues considerably. :). You could go ahead and test your hypotheses about individual effects separately using these $p$-values. Unfortunately, hypothesis testing is like the lottery (the more you play, the more your chance to "win"), so if you want to go into each hypothesis test assuming that the null hypothesis is true, then you are in trouble, because $\alpha$ (your willingness to make/probability of making a false rejection of a true null hypothesis) only applies to a single test. You may have heard of "the Bonferroni correction/adjustment", where you try to solve this conundrum by multiplying your $p$-values by the total number of null hypotheses you are testing (let's call that number of tests $m$). You are effectively trying to redefine $\alpha$ as a family-wise error rate (FWER), or the probability of making at least one false rejection out of a family of tests, assuming all null hypotheses are true. Alternatively, and equivalently, you can think about the Bonferroni adjustment as dividing $\alpha$ by $m$ (or $\alpha/2$ by $m$ if you are performing two-tailed tests, which in all likelihood you are in a regression context). We get these two alternatives because basing a rejection decision on $p \le \frac{\alpha/2}{m}$ is equivalent to $mp \le \frac{\alpha}{2}$. Of course, the Bonferroni technique is a blunt hammer. It positively hemorrhages statistical power. $\overset{_{\vee}}{\mathrm{S}}\mathrm{idák}$ got a smidge more statistical power, by altering the adjustment of the $p$-value to $1-(1-p)^{m}$. Holm improved upon both Bonferroni and $\overset{_{\vee}}{\mathrm{S}}\mathrm{idák}$ adjustments by creating a stepwise adjustment. The step-up procedure for the Bonferroni adjustemnt: Compute the exact $p$-value for each test. Order the $p$-values from smallest to largest. For the first test, adjust the $p$-value to be $pm$; and generally: For the i$^{\text{th}}$ test, adjust the $p$-value to be $p(m–(i–1))$. Using Holm’s method, for all tests following the first test for which we fail to reject H$_{0}$ we will also fail to reject the null hypothesis. The Holm-$\overset{_{\vee}}{\mathrm{S}}\mathrm{idák}$ adjustment is similar, but you would adjust each $p$-value using $1-(1-p)^{m-(i-1)}$. Some folks, most notably Benjamini and Hochberg (1995), were not comfortable with the world view implied by the assumption that all null hypotheses are true within a stepwise procedure. Surely, they reasoned, if you make an adjustment and reject a single hypothesis, that must imply that a better assumption would be that the remaining $m-1$ hypotheses have a lower probability of all null hypotheses being true? Also, science in general does not assume that there are no relationships in the world: quite the opposite, in fact. Enter the FDR which progressively assumes that rejection probabilities must increase if previous hypotheses were rejected after adjustment. Here's the step-down procedure they proposed: Compute the exact $p$-value for each test. Order the $p$-values from largest to smallest (step-down!). For the first test ($i=1$), adjust the $p$-value to be $\frac{pm}{m-(1-1)} = p$. For the i$^{\text{th}}$ test, adjust the $p$-value to be $\frac{pm}{m-(i–1)}$. Using Benjamini & Hochberg’s method, we reject all tests including and following the first test for which we reject the null hypothesis. We often term $p$-values that have been adjusted this way $q$-values. The advantages of this FDR adjustment include (1) more statistical power, especially for large $m$, and (2) easy integration of additional tests/$p$-values (say, adding $p$-values from an additional regression model) in a manner which leaves the inferences from the first FDR adjustment unchanged. Update: All these FWER procedures, and the FDR procedure I just described can produce adjusted $p$-values that are greater than one. When reporting adjusted $p$-values, these are typically reported as $p=1$, $p>.999$, $p=$not reject or something along those lines. References Benjamini, Y. and Hochberg, Y. (1995). Controlling the False Discovery Rate: A Practical and Powerful Approach to Multiple Testing. Journal of the Royal Statistical Society. Series B (Methodological), 57(1):289–300.
False discovery rate of multiple regressions models @Dian breathe easy, it's pretty much not too difficult. So let's work from familiar territory to false discovery rate (FDR). First, I see that you have a bunch of outcomes, with a varying number of pr
38,909
False discovery rate of multiple regressions models
What you're doing is a type of step-wise regression, so FDR in this context serves to guide the model selection: the p-value would be that of the goodness-of-fit (coefficient of determination), not of any individual explanatory variable.
False discovery rate of multiple regressions models
What you're doing is a type of step-wise regression, so FDR in this context serves to guide the model selection: the p-value would be that of the goodness-of-fit (coefficient of determination), not of
False discovery rate of multiple regressions models What you're doing is a type of step-wise regression, so FDR in this context serves to guide the model selection: the p-value would be that of the goodness-of-fit (coefficient of determination), not of any individual explanatory variable.
False discovery rate of multiple regressions models What you're doing is a type of step-wise regression, so FDR in this context serves to guide the model selection: the p-value would be that of the goodness-of-fit (coefficient of determination), not of
38,910
How to get only desirable comparisons from post-hoc
Suppose that we have one response variable and one explanatory variable (5 levels). con.data <- data.frame(x = c(rnorm(75), c(rnorm(75)+5)), category = rep(c("A","B1","B2","C1","C2"), each=30)) If we do ANOVA followed by classical TukeyHSD post-hoc... m1 <- aov(con.data$x ~ con.data$category); summary(m1) TukeyHSD(m1) diff lwr upr p adj B1-A 0.1877877 -0.9109837 1.286559 0.9897357 B2-A 2.2050543 1.1062829 3.303826 0.0000013 C1-A 4.5951737 3.4964022 5.693945 0.0000000 C2-A 4.7790488 3.6802773 5.877820 0.0000000 B2-B1 2.0172666 0.9184952 3.116038 0.0000117 C1-B1 4.4073860 3.3086145 5.506157 0.0000000 C2-B1 4.5912611 3.4924896 5.690033 0.0000000 C1-B2 2.3901193 1.2913479 3.488891 0.0000001 C2-B2 2.5739944 1.4752230 3.672766 0.0000000 C2-C1 0.1838751 -0.9148963 1.282647 0.9905238 ...we obtain all possible combinations. If you want to make only comparison that are interesting to you, use CONTRASTS. In R there are several default contrast matrices (overview): treatment, helmert, sum , polynomial... but you can create your own. First - decide which comparisons you are interested in. Then create a contrast matrix: contrasts(con.data$category) <- cbind(c(1,-1/4,-1/4,-1/4,-1/4), c(0,-1/2,-1/2,1/2,1/2), c(0,0,0,1/2,-1/2), c(0,-1/2,1/2,0,0)) look at this table for reference: contrasts(con.data$category) [,1] [,2] [,3] [,4] A 1.00 0.0 0.0 0.0 B1 -0.25 -0.5 0.0 -0.5 B2 -0.25 -0.5 0.0 0.5 C1 -0.25 0.5 0.5 0.0 C2 -0.25 0.5 -0.5 0.0 Take notice that sum of each column is equal to 0. If you have 5 levels in a factor, there can be only 4 comparisons, due to degrees of freedom. In the first column you compare mean of "A" with mean of all others categories. In the second column you compare only category "B" with "C" (B1+B2 vs. C1+C2). In the third column you compare only within "C" category (C1 vs. C2). In the fourth column you compare only within "B" category (B1 vs. B2). To see the results re-make the ANOVA with created contrast matrix. summary(lm(con.data$x, con.data$category)) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.5910 0.1258 20.599 < 2e-16 *** con.data$category1 -2.3534 0.2516 -9.355 < 2e-16 *** con.data$category2 3.4907 0.2813 12.411 < 2e-16 *** con.data$category3 -0.1839 0.3978 -0.462 0.645 con.data$category4 2.0173 0.3978 5.072 1.19e-06 *** ...and each row in the table corresponds to each comparison (column in contrast matrix) made. (i.e. con.data$category1 is significant so there is significant difference between mean of "A" vs. mean of all others groups...etc.) In short: Try to make a contrast matrix containing only comparisons you are interested in. With the example above it should not be difficult. However !!! I would not use post-hoc (or contrasts) on data immediately. It is like to teach a model to "run" before it can "walk". So as a first thing I would create a model containing all variables. Subsequently, remove all non-significant variables (or their interaction) according to marginality rule. This procedure (reduction) will determine if all your desired comparisons are necessary. So try to make full model: m1 <- glm(measurement ~ my.profile*my.contrast*my.disease, data = my.data) anova(m1, test = "F") For example, if factor "disease" will not be significant (alone or in interaction - it should not be included in post-hoc. Suppose the results of m1 model will look like this: my.profile 0.00012 ** my.contrast 0.00231 * my.disease 0.07690 . my.profile:my.contrast 0.26159 my.profile:my.disease 0.07709 . my.contrast:my.disease 0.21256 my.profile:my.contrast:my.disease 0.23319 Use the rule of marginality: update no. 1: you can see that triple interaction is non-significant - let's remove it m2 <- update(m1, ~.-my.profile:my.contrast:my.disease) Now, show the anova of updated model: anova(m2, test = "F") my.profile 0.00012 ** my.contrast 0.00231 * my.disease 0.07690 . my.profile:my.contrast 0.26159 my.profile:my.disease 0.07709 . my.contrast:my.disease 0.21256 update no. 2: you can see that double interactions are non-significant - let's remove them (start with double interaction with highest p-value) m3 <- update(m2, ~.-my.profile:my.contrast) anova(m3, test = "F") my.profile 0.00012 ** my.contrast 0.00231 * my.disease 0.07690 . my.profile:my.disease 0.07709 . my.contrast:my.disease 0.21256 update no. 3: remove another double interaction m4 <- update(m3, ~.-my.contrast:my.disease) anova(m4, test = "F") my.profile 0.00012 ** my.contrast 0.00231 * my.disease 0.07690 . my.profile:my.disease 0.07709 . update no. 4: remove the last double interaction m5 <- update(m4, ~.-my.profile:my.disease) anova(m5, test = "F") my.profile 0.00012 ** my.contrast 0.00231 * my.disease 0.07690 . update no. 5: remove non-significant factor m6 <- update(m5, ~.-my.disease) anova(m6, test = "F") my.profile 0.00012 ** my.contrast 0.00231 * Model m6 is our final model. Unfortunately it is obvious that making comparisons (Y.NEG.NO, X.NEG.NO and others) has no sense, because the triple and double interaction are non-significant as well. And it would not be correct to select the desired rows from TukeyHSD (even if such post-hoc will show significant difference !!!). Believe me, such approach will be very hard to defend in peer-review process. So you can make only comparison in profile (X vs. Y) and contrast (NO vs. YES). Disease factor is non-significant. Do not be sad - even non-significant result is a result. Marginality rule is the practical application of Occam's razor (See also in Crawley, M.J. Statistics: An Introduction Using R. 2nd ed. Wiley, 2014, Ch. 10 Multiple Regression, p. 195). A good model is always the simplest one - and explains the largest portion of variability in data. You can publish this result in an article as a "full model" (containing all the factors and their interaction(s)) or as a "minimal adequate model" (MAM, containing only significant effects). I would prefer to include both versions into a manuscript and let reviewers to decide which one to prefer. The point is not to fishing for p-values in post-hoc tests when ANOVA results are non-significant.
How to get only desirable comparisons from post-hoc
Suppose that we have one response variable and one explanatory variable (5 levels). con.data <- data.frame(x = c(rnorm(75), c(rnorm(75)+5)), category = rep(c("A","B1","B2","C1","
How to get only desirable comparisons from post-hoc Suppose that we have one response variable and one explanatory variable (5 levels). con.data <- data.frame(x = c(rnorm(75), c(rnorm(75)+5)), category = rep(c("A","B1","B2","C1","C2"), each=30)) If we do ANOVA followed by classical TukeyHSD post-hoc... m1 <- aov(con.data$x ~ con.data$category); summary(m1) TukeyHSD(m1) diff lwr upr p adj B1-A 0.1877877 -0.9109837 1.286559 0.9897357 B2-A 2.2050543 1.1062829 3.303826 0.0000013 C1-A 4.5951737 3.4964022 5.693945 0.0000000 C2-A 4.7790488 3.6802773 5.877820 0.0000000 B2-B1 2.0172666 0.9184952 3.116038 0.0000117 C1-B1 4.4073860 3.3086145 5.506157 0.0000000 C2-B1 4.5912611 3.4924896 5.690033 0.0000000 C1-B2 2.3901193 1.2913479 3.488891 0.0000001 C2-B2 2.5739944 1.4752230 3.672766 0.0000000 C2-C1 0.1838751 -0.9148963 1.282647 0.9905238 ...we obtain all possible combinations. If you want to make only comparison that are interesting to you, use CONTRASTS. In R there are several default contrast matrices (overview): treatment, helmert, sum , polynomial... but you can create your own. First - decide which comparisons you are interested in. Then create a contrast matrix: contrasts(con.data$category) <- cbind(c(1,-1/4,-1/4,-1/4,-1/4), c(0,-1/2,-1/2,1/2,1/2), c(0,0,0,1/2,-1/2), c(0,-1/2,1/2,0,0)) look at this table for reference: contrasts(con.data$category) [,1] [,2] [,3] [,4] A 1.00 0.0 0.0 0.0 B1 -0.25 -0.5 0.0 -0.5 B2 -0.25 -0.5 0.0 0.5 C1 -0.25 0.5 0.5 0.0 C2 -0.25 0.5 -0.5 0.0 Take notice that sum of each column is equal to 0. If you have 5 levels in a factor, there can be only 4 comparisons, due to degrees of freedom. In the first column you compare mean of "A" with mean of all others categories. In the second column you compare only category "B" with "C" (B1+B2 vs. C1+C2). In the third column you compare only within "C" category (C1 vs. C2). In the fourth column you compare only within "B" category (B1 vs. B2). To see the results re-make the ANOVA with created contrast matrix. summary(lm(con.data$x, con.data$category)) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.5910 0.1258 20.599 < 2e-16 *** con.data$category1 -2.3534 0.2516 -9.355 < 2e-16 *** con.data$category2 3.4907 0.2813 12.411 < 2e-16 *** con.data$category3 -0.1839 0.3978 -0.462 0.645 con.data$category4 2.0173 0.3978 5.072 1.19e-06 *** ...and each row in the table corresponds to each comparison (column in contrast matrix) made. (i.e. con.data$category1 is significant so there is significant difference between mean of "A" vs. mean of all others groups...etc.) In short: Try to make a contrast matrix containing only comparisons you are interested in. With the example above it should not be difficult. However !!! I would not use post-hoc (or contrasts) on data immediately. It is like to teach a model to "run" before it can "walk". So as a first thing I would create a model containing all variables. Subsequently, remove all non-significant variables (or their interaction) according to marginality rule. This procedure (reduction) will determine if all your desired comparisons are necessary. So try to make full model: m1 <- glm(measurement ~ my.profile*my.contrast*my.disease, data = my.data) anova(m1, test = "F") For example, if factor "disease" will not be significant (alone or in interaction - it should not be included in post-hoc. Suppose the results of m1 model will look like this: my.profile 0.00012 ** my.contrast 0.00231 * my.disease 0.07690 . my.profile:my.contrast 0.26159 my.profile:my.disease 0.07709 . my.contrast:my.disease 0.21256 my.profile:my.contrast:my.disease 0.23319 Use the rule of marginality: update no. 1: you can see that triple interaction is non-significant - let's remove it m2 <- update(m1, ~.-my.profile:my.contrast:my.disease) Now, show the anova of updated model: anova(m2, test = "F") my.profile 0.00012 ** my.contrast 0.00231 * my.disease 0.07690 . my.profile:my.contrast 0.26159 my.profile:my.disease 0.07709 . my.contrast:my.disease 0.21256 update no. 2: you can see that double interactions are non-significant - let's remove them (start with double interaction with highest p-value) m3 <- update(m2, ~.-my.profile:my.contrast) anova(m3, test = "F") my.profile 0.00012 ** my.contrast 0.00231 * my.disease 0.07690 . my.profile:my.disease 0.07709 . my.contrast:my.disease 0.21256 update no. 3: remove another double interaction m4 <- update(m3, ~.-my.contrast:my.disease) anova(m4, test = "F") my.profile 0.00012 ** my.contrast 0.00231 * my.disease 0.07690 . my.profile:my.disease 0.07709 . update no. 4: remove the last double interaction m5 <- update(m4, ~.-my.profile:my.disease) anova(m5, test = "F") my.profile 0.00012 ** my.contrast 0.00231 * my.disease 0.07690 . update no. 5: remove non-significant factor m6 <- update(m5, ~.-my.disease) anova(m6, test = "F") my.profile 0.00012 ** my.contrast 0.00231 * Model m6 is our final model. Unfortunately it is obvious that making comparisons (Y.NEG.NO, X.NEG.NO and others) has no sense, because the triple and double interaction are non-significant as well. And it would not be correct to select the desired rows from TukeyHSD (even if such post-hoc will show significant difference !!!). Believe me, such approach will be very hard to defend in peer-review process. So you can make only comparison in profile (X vs. Y) and contrast (NO vs. YES). Disease factor is non-significant. Do not be sad - even non-significant result is a result. Marginality rule is the practical application of Occam's razor (See also in Crawley, M.J. Statistics: An Introduction Using R. 2nd ed. Wiley, 2014, Ch. 10 Multiple Regression, p. 195). A good model is always the simplest one - and explains the largest portion of variability in data. You can publish this result in an article as a "full model" (containing all the factors and their interaction(s)) or as a "minimal adequate model" (MAM, containing only significant effects). I would prefer to include both versions into a manuscript and let reviewers to decide which one to prefer. The point is not to fishing for p-values in post-hoc tests when ANOVA results are non-significant.
How to get only desirable comparisons from post-hoc Suppose that we have one response variable and one explanatory variable (5 levels). con.data <- data.frame(x = c(rnorm(75), c(rnorm(75)+5)), category = rep(c("A","B1","B2","C1","
38,911
How to get only desirable comparisons from post-hoc
Running step on your model will also work. # Full model m1.0 = glm (logICPMS ~ SITE*ISLAND*ORG*ORGL*CAGE*Metal, data = M.m, na.action = na.exclude) # this removes each interacting factor to give you the MAM model step(m1.0) # MAM model m1.1 = glm(formula = logICPMS ~ ISLAND + ORG + CAGE + Metal + ISLAND:ORG + ISLAND:CAGE + ISLAND:Metal + ORG:Metal, data = M.m, na.action = na.exclude)
How to get only desirable comparisons from post-hoc
Running step on your model will also work. # Full model m1.0 = glm (logICPMS ~ SITE*ISLAND*ORG*ORGL*CAGE*Metal, data = M.m, na.action = na.exclude) # this removes each interacting factor
How to get only desirable comparisons from post-hoc Running step on your model will also work. # Full model m1.0 = glm (logICPMS ~ SITE*ISLAND*ORG*ORGL*CAGE*Metal, data = M.m, na.action = na.exclude) # this removes each interacting factor to give you the MAM model step(m1.0) # MAM model m1.1 = glm(formula = logICPMS ~ ISLAND + ORG + CAGE + Metal + ISLAND:ORG + ISLAND:CAGE + ISLAND:Metal + ORG:Metal, data = M.m, na.action = na.exclude)
How to get only desirable comparisons from post-hoc Running step on your model will also work. # Full model m1.0 = glm (logICPMS ~ SITE*ISLAND*ORG*ORGL*CAGE*Metal, data = M.m, na.action = na.exclude) # this removes each interacting factor
38,912
How useful is the CLT in applications?
The CLT certainly informs applications all the time, since we deal with distributions of averages or sums very frequently (including in cases that may not be always obvious; for example, $s_n^2$ - the sample variance with denominator $n$ - is an average, and so the ordinary sample variance is just a slightly rescaled average). The CLT can tell you to expect an approach to normality with increasing sample size for a particular statistic, but not when, exactly, you can treat it as normal. So while you know that normality should kick in eventually, to know if you're close enough at a particular sample size, you will need to check (say algebraically, or more often via simulation). You may sometimes run into 'rules of thumb' that say "oh, n=30 is enough for the central limit theorem to kick in". Such rules are nonsense without specifying the exact circumstances (what the distribution is we're dealing with, and what properties we care about, and 'how close is close enough'). If you have an $X$ with a distribution like this: Then sample means, $\bar X$ for $n=1000$ have a shape like this: ... which for some purposes might be just about okay to treat as normal (proportion within 2 s.d.s of the mean, say); for other purposes (probability of being more than 3 s.d.s above the mean, say), perhaps not. Sometimes n=2 is plenty, sometimes n=1000 isn't enough. Another example: the sample third and fourth moments are averages and so the CLT should apply. The Jarque-Bera test relies on that (plus Slutsky, I guess, for the denominator, along with asymptotic independence), in order to obtain a chi-square distribution for the sum of squares of standardized values. But as Bowman and Shenton had pointed out (5 years before!), this shouldn't be expected to work well until large sample sizes. Indeed my own simulations suggest that for normal data, bivariate normality of the skewness and kurtosis doesn't kick in well until the sample sizes are surprisingly large (at small and middling sample sizes, the contours of the joint distribution look more like a banana than a watermelon) Increasingly often, however, sample sizes can be huge. I've helped with several real-data problems where the sample sizes were very large indeed (in the millions). In those situations, things the CLT suggests should approach the normal as $n$ approaches infinity are often extremely well approximated by normal distributions. I wouldn't say the CLT is useless - it tells you what distribution to look for - but it doesn't do more than point to it as an eventual outcome; you still have to check whether it's a suitable approximation for your purposes at the sample size you have.
How useful is the CLT in applications?
The CLT certainly informs applications all the time, since we deal with distributions of averages or sums very frequently (including in cases that may not be always obvious; for example, $s_n^2$ - the
How useful is the CLT in applications? The CLT certainly informs applications all the time, since we deal with distributions of averages or sums very frequently (including in cases that may not be always obvious; for example, $s_n^2$ - the sample variance with denominator $n$ - is an average, and so the ordinary sample variance is just a slightly rescaled average). The CLT can tell you to expect an approach to normality with increasing sample size for a particular statistic, but not when, exactly, you can treat it as normal. So while you know that normality should kick in eventually, to know if you're close enough at a particular sample size, you will need to check (say algebraically, or more often via simulation). You may sometimes run into 'rules of thumb' that say "oh, n=30 is enough for the central limit theorem to kick in". Such rules are nonsense without specifying the exact circumstances (what the distribution is we're dealing with, and what properties we care about, and 'how close is close enough'). If you have an $X$ with a distribution like this: Then sample means, $\bar X$ for $n=1000$ have a shape like this: ... which for some purposes might be just about okay to treat as normal (proportion within 2 s.d.s of the mean, say); for other purposes (probability of being more than 3 s.d.s above the mean, say), perhaps not. Sometimes n=2 is plenty, sometimes n=1000 isn't enough. Another example: the sample third and fourth moments are averages and so the CLT should apply. The Jarque-Bera test relies on that (plus Slutsky, I guess, for the denominator, along with asymptotic independence), in order to obtain a chi-square distribution for the sum of squares of standardized values. But as Bowman and Shenton had pointed out (5 years before!), this shouldn't be expected to work well until large sample sizes. Indeed my own simulations suggest that for normal data, bivariate normality of the skewness and kurtosis doesn't kick in well until the sample sizes are surprisingly large (at small and middling sample sizes, the contours of the joint distribution look more like a banana than a watermelon) Increasingly often, however, sample sizes can be huge. I've helped with several real-data problems where the sample sizes were very large indeed (in the millions). In those situations, things the CLT suggests should approach the normal as $n$ approaches infinity are often extremely well approximated by normal distributions. I wouldn't say the CLT is useless - it tells you what distribution to look for - but it doesn't do more than point to it as an eventual outcome; you still have to check whether it's a suitable approximation for your purposes at the sample size you have.
How useful is the CLT in applications? The CLT certainly informs applications all the time, since we deal with distributions of averages or sums very frequently (including in cases that may not be always obvious; for example, $s_n^2$ - the
38,913
How useful is the CLT in applications?
Notwithstanding the problems with CLT described by Glen_b, if we are talking about econometric analysis, then practicaly all results are asymptotic (except when Bayesian analysis is used). Hence any application which is based on econometrics is based on CLT. For example Lars Hansen got the Nobel prize last year for work on generalized method of moments, which is based on CLT. It might seem that such reliance on CLT is not a good thing, but on the other hand any econometric paper relying on asymptotics usually has a chapter with Monte Carlo simulations exploring the reliability of asymptotic results on small samples, and more often than not the results are not that bad.
How useful is the CLT in applications?
Notwithstanding the problems with CLT described by Glen_b, if we are talking about econometric analysis, then practicaly all results are asymptotic (except when Bayesian analysis is used). Hence any
How useful is the CLT in applications? Notwithstanding the problems with CLT described by Glen_b, if we are talking about econometric analysis, then practicaly all results are asymptotic (except when Bayesian analysis is used). Hence any application which is based on econometrics is based on CLT. For example Lars Hansen got the Nobel prize last year for work on generalized method of moments, which is based on CLT. It might seem that such reliance on CLT is not a good thing, but on the other hand any econometric paper relying on asymptotics usually has a chapter with Monte Carlo simulations exploring the reliability of asymptotic results on small samples, and more often than not the results are not that bad.
How useful is the CLT in applications? Notwithstanding the problems with CLT described by Glen_b, if we are talking about econometric analysis, then practicaly all results are asymptotic (except when Bayesian analysis is used). Hence any
38,914
Should control variables be included in model if statistically insignificant?
One reason to include control variables is precisely because they can affect other variables. In this case, the statistical significance of the control variable is completely irrelevant. However, you may run into journal editors who disagree.
Should control variables be included in model if statistically insignificant?
One reason to include control variables is precisely because they can affect other variables. In this case, the statistical significance of the control variable is completely irrelevant. However, you
Should control variables be included in model if statistically insignificant? One reason to include control variables is precisely because they can affect other variables. In this case, the statistical significance of the control variable is completely irrelevant. However, you may run into journal editors who disagree.
Should control variables be included in model if statistically insignificant? One reason to include control variables is precisely because they can affect other variables. In this case, the statistical significance of the control variable is completely irrelevant. However, you
38,915
Should control variables be included in model if statistically insignificant?
Just a short comment: your p-values should reflect the number of models you are "trying out". In some ways your approach of trying models with and without subsets of variables is one aspect of p-hacking. Your research question alone (not the data) should determine what is a control variable and what is a variable of interest. Exploratory data analysis is fine as long as you report on all tests that you did.
Should control variables be included in model if statistically insignificant?
Just a short comment: your p-values should reflect the number of models you are "trying out". In some ways your approach of trying models with and without subsets of variables is one aspect of p-hacki
Should control variables be included in model if statistically insignificant? Just a short comment: your p-values should reflect the number of models you are "trying out". In some ways your approach of trying models with and without subsets of variables is one aspect of p-hacking. Your research question alone (not the data) should determine what is a control variable and what is a variable of interest. Exploratory data analysis is fine as long as you report on all tests that you did.
Should control variables be included in model if statistically insignificant? Just a short comment: your p-values should reflect the number of models you are "trying out". In some ways your approach of trying models with and without subsets of variables is one aspect of p-hacki
38,916
Is there a word for the phenomenon that the old are generally less affected by risk factors?
Survival bias and competing risks. Also, elderly having a high value of a risk factor who have not been affected by that risk factor have demonstrated a robustness to that particular factor in general. This is why age $\times$ risk factor interactions can be important to pre-specify in a model.
Is there a word for the phenomenon that the old are generally less affected by risk factors?
Survival bias and competing risks. Also, elderly having a high value of a risk factor who have not been affected by that risk factor have demonstrated a robustness to that particular factor in genera
Is there a word for the phenomenon that the old are generally less affected by risk factors? Survival bias and competing risks. Also, elderly having a high value of a risk factor who have not been affected by that risk factor have demonstrated a robustness to that particular factor in general. This is why age $\times$ risk factor interactions can be important to pre-specify in a model.
Is there a word for the phenomenon that the old are generally less affected by risk factors? Survival bias and competing risks. Also, elderly having a high value of a risk factor who have not been affected by that risk factor have demonstrated a robustness to that particular factor in genera
38,917
Is there a word for the phenomenon that the old are generally less affected by risk factors?
Age $\times$ risk factor interaction are, as mentioned, important. Some risk factors may have a different form of association in later life. Low values of some risk factors can be associated with mortality due to them being possible indicators of poor health in later life, leading to a u-shaped relationship. There is an interesting article by Abdelhafiz et al that discusses this phenomena: The U-shaped Relationship of Traditional Cardiovascular Risk Factors and Adverse Outcomes in Later Life
Is there a word for the phenomenon that the old are generally less affected by risk factors?
Age $\times$ risk factor interaction are, as mentioned, important. Some risk factors may have a different form of association in later life. Low values of some risk factors can be associated with mort
Is there a word for the phenomenon that the old are generally less affected by risk factors? Age $\times$ risk factor interaction are, as mentioned, important. Some risk factors may have a different form of association in later life. Low values of some risk factors can be associated with mortality due to them being possible indicators of poor health in later life, leading to a u-shaped relationship. There is an interesting article by Abdelhafiz et al that discusses this phenomena: The U-shaped Relationship of Traditional Cardiovascular Risk Factors and Adverse Outcomes in Later Life
Is there a word for the phenomenon that the old are generally less affected by risk factors? Age $\times$ risk factor interaction are, as mentioned, important. Some risk factors may have a different form of association in later life. Low values of some risk factors can be associated with mort
38,918
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration?
A $I(0)$ and a $I(1)$ timeseries can not be cointegrated. There is no linear combination of the timeseries that is stationary. And the definition of cointegration is if there is a combination of them that is stationary, they're cointegrated. I think you should fit a VAR with the stationary variable in levels and the non-stationary variable in first difference. Good luck!
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration?
A $I(0)$ and a $I(1)$ timeseries can not be cointegrated. There is no linear combination of the timeseries that is stationary. And the definition of cointegration is if there is a combination of them
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration? A $I(0)$ and a $I(1)$ timeseries can not be cointegrated. There is no linear combination of the timeseries that is stationary. And the definition of cointegration is if there is a combination of them that is stationary, they're cointegrated. I think you should fit a VAR with the stationary variable in levels and the non-stationary variable in first difference. Good luck!
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration? A $I(0)$ and a $I(1)$ timeseries can not be cointegrated. There is no linear combination of the timeseries that is stationary. And the definition of cointegration is if there is a combination of them
38,919
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration?
If johansen test result is not significant, meaning no cointegration, then take the 1st difference of the other variable to ensure stationarity. In some cases you may need to take the ln of the 1 st difference.
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration?
If johansen test result is not significant, meaning no cointegration, then take the 1st difference of the other variable to ensure stationarity. In some cases you may need to take the ln of the 1 st d
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration? If johansen test result is not significant, meaning no cointegration, then take the 1st difference of the other variable to ensure stationarity. In some cases you may need to take the ln of the 1 st difference.
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration? If johansen test result is not significant, meaning no cointegration, then take the 1st difference of the other variable to ensure stationarity. In some cases you may need to take the ln of the 1 st d
38,920
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration?
In case you have a mix of I(0) and I(1) variables, you can apply the tests proposed by Pesaran et al (2001), where you can test for cointegration. The link to the paper is: http://onlinelibrary.wiley.com/doi/10.1002/jae.616/pdf All the best
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration?
In case you have a mix of I(0) and I(1) variables, you can apply the tests proposed by Pesaran et al (2001), where you can test for cointegration. The link to the paper is: http://onlinelibrary.wiley.
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration? In case you have a mix of I(0) and I(1) variables, you can apply the tests proposed by Pesaran et al (2001), where you can test for cointegration. The link to the paper is: http://onlinelibrary.wiley.com/doi/10.1002/jae.616/pdf All the best
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration? In case you have a mix of I(0) and I(1) variables, you can apply the tests proposed by Pesaran et al (2001), where you can test for cointegration. The link to the paper is: http://onlinelibrary.wiley.
38,921
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration?
ARDL model approach described by Pesaran is the only way to find the cointegration among the variables having different orders I(0) and I(1) but keeping in mind none of the variable should stationery at I(2)
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration?
ARDL model approach described by Pesaran is the only way to find the cointegration among the variables having different orders I(0) and I(1) but keeping in mind none of the variable should stationery
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration? ARDL model approach described by Pesaran is the only way to find the cointegration among the variables having different orders I(0) and I(1) but keeping in mind none of the variable should stationery at I(2)
Time series: one I(1) and one I(0) variable, should I use VAR/VEC, test for cointegration? ARDL model approach described by Pesaran is the only way to find the cointegration among the variables having different orders I(0) and I(1) but keeping in mind none of the variable should stationery
38,922
Why will a statistic be significant with sufficiently large samples unless the population effect is exactly zero?
With increasing sample size, the statistical power (see below) to detect even the smallest effect size is also increasing and these tiny effect sizes are then found to be statistically significant, even though they bear no relevance at all. Just as a thought experiment to illustrate it further: What if you could include all people of interest in a study. All statistics calculated from that complete "sample" would reflect the true values in the population with no errors. So if the population effect sizes are exactly 0, then, and only then you would find them to be exactly 0. Otherwise you would find some tiny differences or correlations or whatever your effect size is. This post might also be interesting in that context. Addition I found this wonderful analogy of statistical power in Harvey Motulsky's Book Intuitive Biostatistics: A Nonmathematical Guide to Statistical Thinking (the analogy was originally developed by John Hartung): Suppose you send your child into your basement to fetch a tool, say a hammer. The child comes back and says, "The hammer isn't there." What is your conclusion? Is the hammer in the basement or not? We cannot be 100% sure, so the answer must be a probability. The question that you really want to answer is, "What is the probability that the hammer is in the basement?" For this question to answer, we would need a prior probability and thus, Bayesian statistics. But we can ask a different question, "If the hammer really is in the basement, what is the chance that your child would have found it?" It is immediately clear that the answer depends: How long did your child spent looking? This is analogous to sample size. The longer the child keeps looking, the more likely it is that it finds the hammer. And importantly: even if the hammer is really small, if the child spent hours looking, it is likely that it finds the hammer, despite its small size. This is also true for studies: the larger the sample size, the smaller effect sizes ("hammers") can be detected. How big is the hammer? This is analogous to the effect size. A sledgehammer is easier (i.e. faster) to find than a tiny hammer. A study has more power if the effect size is large. How messy is the basement? It is easier to find the hammer in an organized basement than in a messy one. This is analogous to experimental scatter (variation). A study has more power when the data show little variation. Your child has a hard time if it has to find a tiny hammer within a short time in a messy basement. On the other hand, your child has a good chance of finding if it spends a long time searching a sledgehammer in a tidy basement (so clean up your basement before sending your child looking for something!).
Why will a statistic be significant with sufficiently large samples unless the population effect is
With increasing sample size, the statistical power (see below) to detect even the smallest effect size is also increasing and these tiny effect sizes are then found to be statistically significant, ev
Why will a statistic be significant with sufficiently large samples unless the population effect is exactly zero? With increasing sample size, the statistical power (see below) to detect even the smallest effect size is also increasing and these tiny effect sizes are then found to be statistically significant, even though they bear no relevance at all. Just as a thought experiment to illustrate it further: What if you could include all people of interest in a study. All statistics calculated from that complete "sample" would reflect the true values in the population with no errors. So if the population effect sizes are exactly 0, then, and only then you would find them to be exactly 0. Otherwise you would find some tiny differences or correlations or whatever your effect size is. This post might also be interesting in that context. Addition I found this wonderful analogy of statistical power in Harvey Motulsky's Book Intuitive Biostatistics: A Nonmathematical Guide to Statistical Thinking (the analogy was originally developed by John Hartung): Suppose you send your child into your basement to fetch a tool, say a hammer. The child comes back and says, "The hammer isn't there." What is your conclusion? Is the hammer in the basement or not? We cannot be 100% sure, so the answer must be a probability. The question that you really want to answer is, "What is the probability that the hammer is in the basement?" For this question to answer, we would need a prior probability and thus, Bayesian statistics. But we can ask a different question, "If the hammer really is in the basement, what is the chance that your child would have found it?" It is immediately clear that the answer depends: How long did your child spent looking? This is analogous to sample size. The longer the child keeps looking, the more likely it is that it finds the hammer. And importantly: even if the hammer is really small, if the child spent hours looking, it is likely that it finds the hammer, despite its small size. This is also true for studies: the larger the sample size, the smaller effect sizes ("hammers") can be detected. How big is the hammer? This is analogous to the effect size. A sledgehammer is easier (i.e. faster) to find than a tiny hammer. A study has more power if the effect size is large. How messy is the basement? It is easier to find the hammer in an organized basement than in a messy one. This is analogous to experimental scatter (variation). A study has more power when the data show little variation. Your child has a hard time if it has to find a tiny hammer within a short time in a messy basement. On the other hand, your child has a good chance of finding if it spends a long time searching a sledgehammer in a tidy basement (so clean up your basement before sending your child looking for something!).
Why will a statistic be significant with sufficiently large samples unless the population effect is With increasing sample size, the statistical power (see below) to detect even the smallest effect size is also increasing and these tiny effect sizes are then found to be statistically significant, ev
38,923
Why will a statistic be significant with sufficiently large samples unless the population effect is exactly zero?
For concreteness, imagine a one sample test of means (large sample, on something where the population mean and variance exists to make the argument a little simpler). Let the difference between the true mean and the hypothesized sample mean be any nonzero $\delta$. Then the sampling distribution of the sample mean minus the hypothesized mean will itself have mean $\delta$ and a variance that shrinks proportionally to $1/n$. As such, as $n$ becomes sufficiently large, the probability that the test statistic will be outside the rejection region goes down. It might help, in fact, to think of it in terms of a test based off a confidence interval. The confidence interval for the population mean will shrink in width as $\frac{1}{\sqrt n}$. As $n$ becomes sufficiently large, the typical CI pulls closer and closer to the population mean (it's still a random variable, of course), but $\delta$ remains constant. Eventually, the half-width of the confidence interval ("margin of error") is typically much smaller than $\delta$ - making the hypothesized mean 'far' - more and more half-widths of a typical CI - from the actual population mean (resulting in a rejection probability that approaches 1) You can construct similar arguments for almost any hypothesis test of a point null, as long as you have a few basic conditions satisfied (if you don't have consistency, the argument will fail, for example).
Why will a statistic be significant with sufficiently large samples unless the population effect is
For concreteness, imagine a one sample test of means (large sample, on something where the population mean and variance exists to make the argument a little simpler). Let the difference between the t
Why will a statistic be significant with sufficiently large samples unless the population effect is exactly zero? For concreteness, imagine a one sample test of means (large sample, on something where the population mean and variance exists to make the argument a little simpler). Let the difference between the true mean and the hypothesized sample mean be any nonzero $\delta$. Then the sampling distribution of the sample mean minus the hypothesized mean will itself have mean $\delta$ and a variance that shrinks proportionally to $1/n$. As such, as $n$ becomes sufficiently large, the probability that the test statistic will be outside the rejection region goes down. It might help, in fact, to think of it in terms of a test based off a confidence interval. The confidence interval for the population mean will shrink in width as $\frac{1}{\sqrt n}$. As $n$ becomes sufficiently large, the typical CI pulls closer and closer to the population mean (it's still a random variable, of course), but $\delta$ remains constant. Eventually, the half-width of the confidence interval ("margin of error") is typically much smaller than $\delta$ - making the hypothesized mean 'far' - more and more half-widths of a typical CI - from the actual population mean (resulting in a rejection probability that approaches 1) You can construct similar arguments for almost any hypothesis test of a point null, as long as you have a few basic conditions satisfied (if you don't have consistency, the argument will fail, for example).
Why will a statistic be significant with sufficiently large samples unless the population effect is For concreteness, imagine a one sample test of means (large sample, on something where the population mean and variance exists to make the argument a little simpler). Let the difference between the t
38,924
Regression with ARIMA(0,0,0) errors different from linear regression
As pointed out in the comments, the difference between the models is that auto.arima() has not included an intercept. It selects a model, possibly including the constant, using the AICc. With one covariate, the model is $$y_t = \beta_0 x_t + n_t$$ where $n_t$ is an ARIMA process. Note that the intercept is shifted to the ARIMA process. In this example, the selected model for $n_t$ does not include a constant. If you know what model you want, why use auto.arima()? Instead, you could use arima(a,xreg=b) which gives Series: a ARIMA(0,0,0) with non-zero mean Coefficients: intercept b 48638.40 -26143.23 s.e. 32410.27 27893.41 sigma^2 estimated as 93138232: log likelihood=-254.25 AIC=514.5 AICc=515.7 BIC=518.03 This is the same as the model obtained using lm(a~b). The estimates are identical, but the standard errors are different because they are estimated in a different way (numerically from the hessian matrix rather than using the inverse of $(X'X)$.)
Regression with ARIMA(0,0,0) errors different from linear regression
As pointed out in the comments, the difference between the models is that auto.arima() has not included an intercept. It selects a model, possibly including the constant, using the AICc. With one cova
Regression with ARIMA(0,0,0) errors different from linear regression As pointed out in the comments, the difference between the models is that auto.arima() has not included an intercept. It selects a model, possibly including the constant, using the AICc. With one covariate, the model is $$y_t = \beta_0 x_t + n_t$$ where $n_t$ is an ARIMA process. Note that the intercept is shifted to the ARIMA process. In this example, the selected model for $n_t$ does not include a constant. If you know what model you want, why use auto.arima()? Instead, you could use arima(a,xreg=b) which gives Series: a ARIMA(0,0,0) with non-zero mean Coefficients: intercept b 48638.40 -26143.23 s.e. 32410.27 27893.41 sigma^2 estimated as 93138232: log likelihood=-254.25 AIC=514.5 AICc=515.7 BIC=518.03 This is the same as the model obtained using lm(a~b). The estimates are identical, but the standard errors are different because they are estimated in a different way (numerically from the hessian matrix rather than using the inverse of $(X'X)$.)
Regression with ARIMA(0,0,0) errors different from linear regression As pointed out in the comments, the difference between the models is that auto.arima() has not included an intercept. It selects a model, possibly including the constant, using the AICc. With one cova
38,925
Definition of "precision" of an estimator
Precision is typically defined as the reciprocal of the variance of an estimator. A high variance estimator has low precision and vice versa.
Definition of "precision" of an estimator
Precision is typically defined as the reciprocal of the variance of an estimator. A high variance estimator has low precision and vice versa.
Definition of "precision" of an estimator Precision is typically defined as the reciprocal of the variance of an estimator. A high variance estimator has low precision and vice versa.
Definition of "precision" of an estimator Precision is typically defined as the reciprocal of the variance of an estimator. A high variance estimator has low precision and vice versa.
38,926
Definition of "precision" of an estimator
Precision can be defined as 1/variance, or 1/standard deviation. See Wikipedia's article on Normal distribution (section "Alternative formulations") and references provided therein.
Definition of "precision" of an estimator
Precision can be defined as 1/variance, or 1/standard deviation. See Wikipedia's article on Normal distribution (section "Alternative formulations") and references provided therein.
Definition of "precision" of an estimator Precision can be defined as 1/variance, or 1/standard deviation. See Wikipedia's article on Normal distribution (section "Alternative formulations") and references provided therein.
Definition of "precision" of an estimator Precision can be defined as 1/variance, or 1/standard deviation. See Wikipedia's article on Normal distribution (section "Alternative formulations") and references provided therein.
38,927
What's the correct distribution for page reading time?
It helps to have data. Jakob Nielsen has measured reading times for web pages ("How Little Do Users Read", 2008), which gives some strong hints: The data show that the variation in reading time is directly proportional to the number of words on a page. The variation therefore should be expressed as a time relative to the page length, not as a fixed amount. The log of this ratio has an approximately normal distribution with a standard deviation of around 12%. This scatterplot from Nielsen's report is valuable for revealing the amount of relative variation in reading times, even though only a small portion (about 18%) of each page is actually read. Notice how the absolute variation increases with word length (page size); this complication is handled by using the log of the relative variation. Don't forget that book pages have varying amounts of words, too. The variation will depend on accumulated tiny differences related to word length, page width, paragraph length, amount of dialog, and so on. For a book with uniform looking pages we can therefore expect that variation to be normal, except for the ends and beginnings of chapters. The end pages will have approximately a uniform distribution of word lengths. The beginning pages will have approximately a normal distribution with a smaller mean than the typical (full) page, depending on the page design. This gives a complex distribution but it's relatively easy to simulate. The parameters should include The mean number of words per (full) page, $w$. You can easily measure this for actual books you are trying to simulate. The standard deviation in words per (full) page, $s$. Again, this is readily measured. The mean number of words per start page, $u$, also easily measured. The log variation in reading times, $\sigma$. Use a value around 12% to start, based on Nielsen's study; consider looking at other studies for other realistic values. The user's reading speed, $v$, as words per minute, say. Values around 200-250 wpm are often used, depending on the kind of reader. The mean number of pages per chapter, $n$, also easily measured. The mean page turning time, $t$. You could do your own little study of readers, perhaps by spending an hour with a stopwatch in a library :-). Don't be too fussy about this number--it will depend on the book size, page material, and the reader--but it could contribute enough time to be of interest in the simulation. The simulation should comprise an entire chapter, simulated as a sequence consisting of one start page, $n-2$ normal pages, and one end page. Simulate the number of words, $m$, as $$m = (n-2)w + u + zw + r$$ where $z$ has a uniform $(0,1)$ distribution and $r$ has a normal distribution with mean $0$ and standard deviation $s \sqrt{n}$. Draw a value $x$ from a normal distribution with mean $0$ and standard deviation $\sigma$. Multiply $m$ by $w \exp(x) / v$ to simulate the reading time. Add $n t$ minutes for the page turns. This process will capture the most important influences on reading time for a book with homogeneous text, uniform reading difficulty, and no illustrations. For more complex books, such as collections of readings, math or science, books with lots of dialog, illustrated books, and so on, the model may need to be more complex in order to be realistic. Edit It turns out we may be able to justify and flesh out the suggestion offered by @Jason, because it happens that this complex but realistic simulation can be extremely well approximated by a version of a Gamma distribution in most cases. We have to rescale and shift the Gamma, in addition to selecting its shape parameter. Here is a (typical) example based on $100,000$ iterations with $w=300$ words per page, $s=15$ words (SD per page), $u=100$ words per start page, $\sigma=0.12$, $v=250$ words per minute, $n=8$ pages per chapter, and $t = 0.04$ minutes per page turn. The histogram gives the distribution of results while the solid red curve is the PDF for a Gamma distribution with shape parameter $27.416$, scale parameter $0.2043$, offset by $2.98$ minutes. This approximation breaks down only for extremely short chapter lengths, but is still decent even when $n=3$: The potential advantage of this observation is that you can avoid estimating many of the parameters needed to model reading a simple, homogeneous book if you are willing to specify three independent parameters of the distribution, such as its mean, standard deviation, and skewness. For instance, if you have actual data about chapter reading times you could use the first three sample moments to fit a three-parameter Gamma distribution to the data, then perform the simulation via draws from that Gamma. Furthermore, if you assume the times to read the book chapters are independent, it is easy to add these Gammas (one per chapter) to obtain a distribution for the length of time to read the entire book (because the shape parameter for the sum of Gamma distributions having a common scale factor is the sum of their shape parameters). Even with minimal data (such as used here) you could run some simulations for a single chapter, fit a Gamma to those simulation results, and proceed to deduce (rather than simulate) the total book reading times. For instance, in this case the reading times for a book of $16$ chapters should follow a Gamma distribution with shape parameter $16 \times 27.4164$, scale parameter $0.2043$, offset by $16 \times 2.98$ minutes. For many books (having many chapters), the resulting distribution will be Normal for all practical purposes. The chance assigned to negative values by this distribution would be so astronomically small that it doesn't matter. The blue curve shows the distribution of book reading times. The dashed red curve superimposed on it is a Normal approximation. Neither distribution assigns any appreciable probability to times less than 240 minutes.
What's the correct distribution for page reading time?
It helps to have data. Jakob Nielsen has measured reading times for web pages ("How Little Do Users Read", 2008), which gives some strong hints: The data show that the variation in reading time is d
What's the correct distribution for page reading time? It helps to have data. Jakob Nielsen has measured reading times for web pages ("How Little Do Users Read", 2008), which gives some strong hints: The data show that the variation in reading time is directly proportional to the number of words on a page. The variation therefore should be expressed as a time relative to the page length, not as a fixed amount. The log of this ratio has an approximately normal distribution with a standard deviation of around 12%. This scatterplot from Nielsen's report is valuable for revealing the amount of relative variation in reading times, even though only a small portion (about 18%) of each page is actually read. Notice how the absolute variation increases with word length (page size); this complication is handled by using the log of the relative variation. Don't forget that book pages have varying amounts of words, too. The variation will depend on accumulated tiny differences related to word length, page width, paragraph length, amount of dialog, and so on. For a book with uniform looking pages we can therefore expect that variation to be normal, except for the ends and beginnings of chapters. The end pages will have approximately a uniform distribution of word lengths. The beginning pages will have approximately a normal distribution with a smaller mean than the typical (full) page, depending on the page design. This gives a complex distribution but it's relatively easy to simulate. The parameters should include The mean number of words per (full) page, $w$. You can easily measure this for actual books you are trying to simulate. The standard deviation in words per (full) page, $s$. Again, this is readily measured. The mean number of words per start page, $u$, also easily measured. The log variation in reading times, $\sigma$. Use a value around 12% to start, based on Nielsen's study; consider looking at other studies for other realistic values. The user's reading speed, $v$, as words per minute, say. Values around 200-250 wpm are often used, depending on the kind of reader. The mean number of pages per chapter, $n$, also easily measured. The mean page turning time, $t$. You could do your own little study of readers, perhaps by spending an hour with a stopwatch in a library :-). Don't be too fussy about this number--it will depend on the book size, page material, and the reader--but it could contribute enough time to be of interest in the simulation. The simulation should comprise an entire chapter, simulated as a sequence consisting of one start page, $n-2$ normal pages, and one end page. Simulate the number of words, $m$, as $$m = (n-2)w + u + zw + r$$ where $z$ has a uniform $(0,1)$ distribution and $r$ has a normal distribution with mean $0$ and standard deviation $s \sqrt{n}$. Draw a value $x$ from a normal distribution with mean $0$ and standard deviation $\sigma$. Multiply $m$ by $w \exp(x) / v$ to simulate the reading time. Add $n t$ minutes for the page turns. This process will capture the most important influences on reading time for a book with homogeneous text, uniform reading difficulty, and no illustrations. For more complex books, such as collections of readings, math or science, books with lots of dialog, illustrated books, and so on, the model may need to be more complex in order to be realistic. Edit It turns out we may be able to justify and flesh out the suggestion offered by @Jason, because it happens that this complex but realistic simulation can be extremely well approximated by a version of a Gamma distribution in most cases. We have to rescale and shift the Gamma, in addition to selecting its shape parameter. Here is a (typical) example based on $100,000$ iterations with $w=300$ words per page, $s=15$ words (SD per page), $u=100$ words per start page, $\sigma=0.12$, $v=250$ words per minute, $n=8$ pages per chapter, and $t = 0.04$ minutes per page turn. The histogram gives the distribution of results while the solid red curve is the PDF for a Gamma distribution with shape parameter $27.416$, scale parameter $0.2043$, offset by $2.98$ minutes. This approximation breaks down only for extremely short chapter lengths, but is still decent even when $n=3$: The potential advantage of this observation is that you can avoid estimating many of the parameters needed to model reading a simple, homogeneous book if you are willing to specify three independent parameters of the distribution, such as its mean, standard deviation, and skewness. For instance, if you have actual data about chapter reading times you could use the first three sample moments to fit a three-parameter Gamma distribution to the data, then perform the simulation via draws from that Gamma. Furthermore, if you assume the times to read the book chapters are independent, it is easy to add these Gammas (one per chapter) to obtain a distribution for the length of time to read the entire book (because the shape parameter for the sum of Gamma distributions having a common scale factor is the sum of their shape parameters). Even with minimal data (such as used here) you could run some simulations for a single chapter, fit a Gamma to those simulation results, and proceed to deduce (rather than simulate) the total book reading times. For instance, in this case the reading times for a book of $16$ chapters should follow a Gamma distribution with shape parameter $16 \times 27.4164$, scale parameter $0.2043$, offset by $16 \times 2.98$ minutes. For many books (having many chapters), the resulting distribution will be Normal for all practical purposes. The chance assigned to negative values by this distribution would be so astronomically small that it doesn't matter. The blue curve shows the distribution of book reading times. The dashed red curve superimposed on it is a Normal approximation. Neither distribution assigns any appreciable probability to times less than 240 minutes.
What's the correct distribution for page reading time? It helps to have data. Jakob Nielsen has measured reading times for web pages ("How Little Do Users Read", 2008), which gives some strong hints: The data show that the variation in reading time is d
38,928
What's the correct distribution for page reading time?
You could use a gamma distribution. Check it out on Wikipedia. Gamma distributions are commonly used to model waiting times, like the situation you have here.
What's the correct distribution for page reading time?
You could use a gamma distribution. Check it out on Wikipedia. Gamma distributions are commonly used to model waiting times, like the situation you have here.
What's the correct distribution for page reading time? You could use a gamma distribution. Check it out on Wikipedia. Gamma distributions are commonly used to model waiting times, like the situation you have here.
What's the correct distribution for page reading time? You could use a gamma distribution. Check it out on Wikipedia. Gamma distributions are commonly used to model waiting times, like the situation you have here.
38,929
Regression on a non-normal dependent variable
The normality assumption is a convenient property of model's residuals, since it enables correct inferences about the estimated parameters and critical values of many other tests are also dependent on this assumption (therefore some corrections should be made, or you may roughly take more strict rule-of-thumb criteria, increasing the acceptable range of your tests), however it doesn't ruin the regression estimators. Thus it may (you still need to check the other assumptions) produce well behaved predictions, but data-mining and hypothesis testing would be a bit more difficult. At this point I do agree with Huber that you need to clarify the purpose of the model. Regarding some tips: At first glance it seems that your distribution after $Y-10$ transformation, could be approximated by some truncated versions of continuous distributions: exponential (Gamma), log-normal, Pareto or some other. So in log-normal case you still may move to something close to normality. Another option could be to try something like fitting the combo of generalized logistic function and logistic regression. Since you DO know the upper and lower limits it seems feasible.
Regression on a non-normal dependent variable
The normality assumption is a convenient property of model's residuals, since it enables correct inferences about the estimated parameters and critical values of many other tests are also dependent on
Regression on a non-normal dependent variable The normality assumption is a convenient property of model's residuals, since it enables correct inferences about the estimated parameters and critical values of many other tests are also dependent on this assumption (therefore some corrections should be made, or you may roughly take more strict rule-of-thumb criteria, increasing the acceptable range of your tests), however it doesn't ruin the regression estimators. Thus it may (you still need to check the other assumptions) produce well behaved predictions, but data-mining and hypothesis testing would be a bit more difficult. At this point I do agree with Huber that you need to clarify the purpose of the model. Regarding some tips: At first glance it seems that your distribution after $Y-10$ transformation, could be approximated by some truncated versions of continuous distributions: exponential (Gamma), log-normal, Pareto or some other. So in log-normal case you still may move to something close to normality. Another option could be to try something like fitting the combo of generalized logistic function and logistic regression. Since you DO know the upper and lower limits it seems feasible.
Regression on a non-normal dependent variable The normality assumption is a convenient property of model's residuals, since it enables correct inferences about the estimated parameters and critical values of many other tests are also dependent on
38,930
Regression on a non-normal dependent variable
Ordinal regression is not affected by empty cells of Y. Quantile grouping is not required unless you just want to reduce computational burden. Proportional odds or continuation ratio ordinal logistic models are likely to be able to handle the distribution of Y you plotted (with no grouping of Y).
Regression on a non-normal dependent variable
Ordinal regression is not affected by empty cells of Y. Quantile grouping is not required unless you just want to reduce computational burden. Proportional odds or continuation ratio ordinal logisti
Regression on a non-normal dependent variable Ordinal regression is not affected by empty cells of Y. Quantile grouping is not required unless you just want to reduce computational burden. Proportional odds or continuation ratio ordinal logistic models are likely to be able to handle the distribution of Y you plotted (with no grouping of Y).
Regression on a non-normal dependent variable Ordinal regression is not affected by empty cells of Y. Quantile grouping is not required unless you just want to reduce computational burden. Proportional odds or continuation ratio ordinal logisti
38,931
Origin of strange formula for equilibrium standard deviation
The authors are providing a simple means for estimating the parameters of a mean-reverting Orstein-Uhlenbeck process via a regression on returns at discretized points in time. The model they are considering has a representation as a stochastic differential equation of the form [pg. 16, Eq. (12)] $$ \newcommand{\rd}{\mathrm{d}} \rd X(t) = \kappa (m - X(t)) \rd t + \sigma \rd W(t) $$ where $W(t)$ is a standard Brownian motion. The solution to this SDE is well-known and easy to find via Ito's lemma and an analogous technique to integrating constants in ODEs. The solution is [pg. 17, Eq. (13)] $$ X(t_0 + \Delta t) = e^{-\kappa \Delta t} X(t_0) + (1-e^{-\kappa \Delta t}) m + \sigma \int_{t_0}^{\,t_0 + \Delta t} e^{-\kappa(t_0+\Delta t - s)} \, \rd W(s) . $$ This is a Gaussian process and so is characterized by its mean and covariance as a function of time. Letting "time go to infinity" (i.e., $\Delta t \to \infty$), we get an equilibrium mean and variance of $$ \begin{aligned} \mathbb{E} X(t) &= m \\ \mathbb{V}\mathrm{ar}(X(t)) &= \frac{\sigma^2}{2 \kappa} \end{aligned} $$ Now, skipping to the appendix [bottom of page 45], the authors are trying to estimate the parameters by doing a regression using the discrete values of the process and model $$ X_{n+1} = a + b X_n + \zeta_{n+1} . $$ Matching up the parameters $a$ and $b$ with the portions from above, we get that $$ \begin{aligned} a &= m (1 - e^{-\kappa \Delta t}) \\ b &= e^{-\kappa \Delta t} \\ \mathbb{V}\mathrm{ar}(\zeta) &= \sigma^2 \frac{1-e^{-2\kappa \Delta t}}{2\kappa} \end{aligned} $$ Substituting the second equation into the first and solving for $m$ gives $m = a / (1-b)$. Use the same substitution in the third equation and rearrange to get $$ \sigma^2 = \frac{\mathbb{V}\mathrm{ar}(\zeta) \cdot 2 \kappa}{1 - b^2} \>, $$ but, recall that the variance of the equilibrium distribution (by looking far into the future) for $X(t)$ is just $\sigma^2 / 2 \kappa$ and so this gives your result. Addendum: If you're wondering how the expression $$ \mathbb{V}\mathrm{ar}(\zeta) = \sigma^2 \frac{1-e^{-2\kappa \Delta t}}{2\kappa} $$ was obtained, it is via the (remarkable and beautiful!) Ito isometry and the fact that an Ito integral is a zero-mean martingale; namely, in this instance, $$ \mathbb{E}\Big(\sigma \int_{t_0}^{\,t_0 + \Delta t} e^{-\kappa(t_0+\Delta t - s)} \, \rd W(s)\Big)^2 = \sigma^2 \int_{t_0}^{\,t_0 + \Delta t} e^{-2 \kappa(t_0 +\Delta t - s)} \, \rd s $$ where we note that the integrand has been squared on the right-hand side and we "get to replace" $\rd W(s)$ with $\rd s$, converting the problem into one of solving a standard Riemann integral.
Origin of strange formula for equilibrium standard deviation
The authors are providing a simple means for estimating the parameters of a mean-reverting Orstein-Uhlenbeck process via a regression on returns at discretized points in time. The model they are consi
Origin of strange formula for equilibrium standard deviation The authors are providing a simple means for estimating the parameters of a mean-reverting Orstein-Uhlenbeck process via a regression on returns at discretized points in time. The model they are considering has a representation as a stochastic differential equation of the form [pg. 16, Eq. (12)] $$ \newcommand{\rd}{\mathrm{d}} \rd X(t) = \kappa (m - X(t)) \rd t + \sigma \rd W(t) $$ where $W(t)$ is a standard Brownian motion. The solution to this SDE is well-known and easy to find via Ito's lemma and an analogous technique to integrating constants in ODEs. The solution is [pg. 17, Eq. (13)] $$ X(t_0 + \Delta t) = e^{-\kappa \Delta t} X(t_0) + (1-e^{-\kappa \Delta t}) m + \sigma \int_{t_0}^{\,t_0 + \Delta t} e^{-\kappa(t_0+\Delta t - s)} \, \rd W(s) . $$ This is a Gaussian process and so is characterized by its mean and covariance as a function of time. Letting "time go to infinity" (i.e., $\Delta t \to \infty$), we get an equilibrium mean and variance of $$ \begin{aligned} \mathbb{E} X(t) &= m \\ \mathbb{V}\mathrm{ar}(X(t)) &= \frac{\sigma^2}{2 \kappa} \end{aligned} $$ Now, skipping to the appendix [bottom of page 45], the authors are trying to estimate the parameters by doing a regression using the discrete values of the process and model $$ X_{n+1} = a + b X_n + \zeta_{n+1} . $$ Matching up the parameters $a$ and $b$ with the portions from above, we get that $$ \begin{aligned} a &= m (1 - e^{-\kappa \Delta t}) \\ b &= e^{-\kappa \Delta t} \\ \mathbb{V}\mathrm{ar}(\zeta) &= \sigma^2 \frac{1-e^{-2\kappa \Delta t}}{2\kappa} \end{aligned} $$ Substituting the second equation into the first and solving for $m$ gives $m = a / (1-b)$. Use the same substitution in the third equation and rearrange to get $$ \sigma^2 = \frac{\mathbb{V}\mathrm{ar}(\zeta) \cdot 2 \kappa}{1 - b^2} \>, $$ but, recall that the variance of the equilibrium distribution (by looking far into the future) for $X(t)$ is just $\sigma^2 / 2 \kappa$ and so this gives your result. Addendum: If you're wondering how the expression $$ \mathbb{V}\mathrm{ar}(\zeta) = \sigma^2 \frac{1-e^{-2\kappa \Delta t}}{2\kappa} $$ was obtained, it is via the (remarkable and beautiful!) Ito isometry and the fact that an Ito integral is a zero-mean martingale; namely, in this instance, $$ \mathbb{E}\Big(\sigma \int_{t_0}^{\,t_0 + \Delta t} e^{-\kappa(t_0+\Delta t - s)} \, \rd W(s)\Big)^2 = \sigma^2 \int_{t_0}^{\,t_0 + \Delta t} e^{-2 \kappa(t_0 +\Delta t - s)} \, \rd s $$ where we note that the integrand has been squared on the right-hand side and we "get to replace" $\rd W(s)$ with $\rd s$, converting the problem into one of solving a standard Riemann integral.
Origin of strange formula for equilibrium standard deviation The authors are providing a simple means for estimating the parameters of a mean-reverting Orstein-Uhlenbeck process via a regression on returns at discretized points in time. The model they are consi
38,932
Distance between empirically generated distributions (in R)
You can do a Kolmogorov-Smirnov test using the ks.test function. See ?ks.test. In general, when you are looking for a function in R (and you don't know its name) try using ??. For instance, ??"Kolmogorov Smirnov". If nothing comes up RSiteSearch("whatever you're looking for") should help :)
Distance between empirically generated distributions (in R)
You can do a Kolmogorov-Smirnov test using the ks.test function. See ?ks.test. In general, when you are looking for a function in R (and you don't know its name) try using ??. For instance, ??"Kolmogo
Distance between empirically generated distributions (in R) You can do a Kolmogorov-Smirnov test using the ks.test function. See ?ks.test. In general, when you are looking for a function in R (and you don't know its name) try using ??. For instance, ??"Kolmogorov Smirnov". If nothing comes up RSiteSearch("whatever you're looking for") should help :)
Distance between empirically generated distributions (in R) You can do a Kolmogorov-Smirnov test using the ks.test function. See ?ks.test. In general, when you are looking for a function in R (and you don't know its name) try using ??. For instance, ??"Kolmogo
38,933
Distance between empirically generated distributions (in R)
A standard way to compare distributions is to use the Kullback-Leibler divergence. As usual, there's an R package that does this for you! From the ?KLdiv help page in the flexmix package, we get the following bit of code: ## Gaussian and Student t are much closer to each other than ## to the uniform: > library(flexmix) > x = seq(-3, 3, length=200) > y = cbind(u=dunif(x), n=dnorm(x), t=dt(x, df=10)) > matplot(x, y, type="l") > round(KLdiv(y),3) u n t u 0.000 1.082 1.108 n 4.661 0.000 0.004 t 4.686 0.005 0.000 Notice that the comparison isn't symmetric: so uniform vs Normal is different from Normal vs Uniform. You didn't explain why you wanted to compare distributions. Giving a use-case may get you more specific answers.
Distance between empirically generated distributions (in R)
A standard way to compare distributions is to use the Kullback-Leibler divergence. As usual, there's an R package that does this for you! From the ?KLdiv help page in the flexmix package, we get the f
Distance between empirically generated distributions (in R) A standard way to compare distributions is to use the Kullback-Leibler divergence. As usual, there's an R package that does this for you! From the ?KLdiv help page in the flexmix package, we get the following bit of code: ## Gaussian and Student t are much closer to each other than ## to the uniform: > library(flexmix) > x = seq(-3, 3, length=200) > y = cbind(u=dunif(x), n=dnorm(x), t=dt(x, df=10)) > matplot(x, y, type="l") > round(KLdiv(y),3) u n t u 0.000 1.082 1.108 n 4.661 0.000 0.004 t 4.686 0.005 0.000 Notice that the comparison isn't symmetric: so uniform vs Normal is different from Normal vs Uniform. You didn't explain why you wanted to compare distributions. Giving a use-case may get you more specific answers.
Distance between empirically generated distributions (in R) A standard way to compare distributions is to use the Kullback-Leibler divergence. As usual, there's an R package that does this for you! From the ?KLdiv help page in the flexmix package, we get the f
38,934
Distance between empirically generated distributions (in R)
First thing: define "distance". That sounds like a stupid question, but what do you mean by distance? Is the data paired? Then -and only then- it makes sense to look at the sum of (squared) differences to decide about the distance between two datasets. If not, you have to resort to other means. The next question is: is the data distributed in the same manner? If so, you can see the difference between the means as the "location shift" of your data (or the distance between both datasets). But if neither of both is true, how do you define the distance between datasets then? Do you take shape of the distribution into account for example? You really have to think about those issues before trying to calculate a distance. This said : One (naive) possibility is to use the mean of the differences between all possible x-y combinations. Formalized this is : $$Dist=\sqrt{\frac{1}{n_1 n_2}\sum_{i=1}^{n_1} \sum_{j=1}^{n_2}(X_i - Y_j)^2}$$ In R : x <- rnorm(10) y <- rnorm(10,2) sqrt(mean(outer(x,y,"-")^2)) If you allow for negative distances, you can drop the sqrt and the ^2 : mean(outer(x,y,"-")) A simulation shows easily that this will give indeed the difference between the means in the example, as both distributions are equal in this case. But be warned that negative distances are not allowed in many applications. In the first scenario, the number will always be a bit larger than the difference between the mean. In any case, if you're interested in the difference between the center of your datasets, define the center and calculate the difference between those centers. That might very well be what you're after. Contrary to the other suggestions, this approach does not make any assumptions about the distribution of your data. Which makes it applicable in all situations, but also difficult to interpret.
Distance between empirically generated distributions (in R)
First thing: define "distance". That sounds like a stupid question, but what do you mean by distance? Is the data paired? Then -and only then- it makes sense to look at the sum of (squared) difference
Distance between empirically generated distributions (in R) First thing: define "distance". That sounds like a stupid question, but what do you mean by distance? Is the data paired? Then -and only then- it makes sense to look at the sum of (squared) differences to decide about the distance between two datasets. If not, you have to resort to other means. The next question is: is the data distributed in the same manner? If so, you can see the difference between the means as the "location shift" of your data (or the distance between both datasets). But if neither of both is true, how do you define the distance between datasets then? Do you take shape of the distribution into account for example? You really have to think about those issues before trying to calculate a distance. This said : One (naive) possibility is to use the mean of the differences between all possible x-y combinations. Formalized this is : $$Dist=\sqrt{\frac{1}{n_1 n_2}\sum_{i=1}^{n_1} \sum_{j=1}^{n_2}(X_i - Y_j)^2}$$ In R : x <- rnorm(10) y <- rnorm(10,2) sqrt(mean(outer(x,y,"-")^2)) If you allow for negative distances, you can drop the sqrt and the ^2 : mean(outer(x,y,"-")) A simulation shows easily that this will give indeed the difference between the means in the example, as both distributions are equal in this case. But be warned that negative distances are not allowed in many applications. In the first scenario, the number will always be a bit larger than the difference between the mean. In any case, if you're interested in the difference between the center of your datasets, define the center and calculate the difference between those centers. That might very well be what you're after. Contrary to the other suggestions, this approach does not make any assumptions about the distribution of your data. Which makes it applicable in all situations, but also difficult to interpret.
Distance between empirically generated distributions (in R) First thing: define "distance". That sounds like a stupid question, but what do you mean by distance? Is the data paired? Then -and only then- it makes sense to look at the sum of (squared) difference
38,935
How to test group differences on a five point variable?
What you are looking for seems to be a test for comparing two groups where observations are kind of ordinal data. In this case, I would suggest to apply a trend test to see if there are any differences between the CTL and TRT group. Using a t-test would not acknowledge the fact your data are discrete, and the Gaussian assumption may be seriously violated if scores distribution isn't symmetric as is often the case with Likert scores (such as the ones you seem to report). Don't know if these data come from a case-control study or not, but you might also apply rank-based method as suggested by @propfol: If it is not a matched design, the Wilcoxon-Mann-Whitney test (wilcox.test() in R) is fine, and ask for an exact p-value although you may encounter problem with tied observations. The efficiency of the WMW test is $3/\pi$ with respect to the t-test if normality holds but it may even be better otherwise, I seem to remember. Given your sample size, you may also consider applying a permutation test (see the perm or coin R packages). Check also those related questions: Group differences on a five point Likert item Under what conditions should Likert scales be used as ordinal or interval data?
How to test group differences on a five point variable?
What you are looking for seems to be a test for comparing two groups where observations are kind of ordinal data. In this case, I would suggest to apply a trend test to see if there are any difference
How to test group differences on a five point variable? What you are looking for seems to be a test for comparing two groups where observations are kind of ordinal data. In this case, I would suggest to apply a trend test to see if there are any differences between the CTL and TRT group. Using a t-test would not acknowledge the fact your data are discrete, and the Gaussian assumption may be seriously violated if scores distribution isn't symmetric as is often the case with Likert scores (such as the ones you seem to report). Don't know if these data come from a case-control study or not, but you might also apply rank-based method as suggested by @propfol: If it is not a matched design, the Wilcoxon-Mann-Whitney test (wilcox.test() in R) is fine, and ask for an exact p-value although you may encounter problem with tied observations. The efficiency of the WMW test is $3/\pi$ with respect to the t-test if normality holds but it may even be better otherwise, I seem to remember. Given your sample size, you may also consider applying a permutation test (see the perm or coin R packages). Check also those related questions: Group differences on a five point Likert item Under what conditions should Likert scales be used as ordinal or interval data?
How to test group differences on a five point variable? What you are looking for seems to be a test for comparing two groups where observations are kind of ordinal data. In this case, I would suggest to apply a trend test to see if there are any difference
38,936
How to test group differences on a five point variable?
Three things come to mind: Contingency table analysis using Fisher's exact test or Chi Square (but will only tell you that somewhere in the table there is a difference that is significant. You'd have to visualize your data or do post-hoc tests to know where this difference is.) Not my preferred solution. A non-parametric method such the Mann Whitney test. This will rank all of your scores within each group. A good method, but may be underpowered. A parametric method (such as a t test). Disadvantage is that the assumptions of this method may be violated, especially with such a small sample. Also, the difference between 0 and 1 is not likely to be the same (depending on what you're measuring) as the difference between 3 and 4. The good news is that the t test is relatively robust to the assumptions you are supposed to ensure are true before using the test. However, as I said, the sample size is fairly small. The best bet may be the Mann Whitney test.
How to test group differences on a five point variable?
Three things come to mind: Contingency table analysis using Fisher's exact test or Chi Square (but will only tell you that somewhere in the table there is a difference that is significant. You'd have
How to test group differences on a five point variable? Three things come to mind: Contingency table analysis using Fisher's exact test or Chi Square (but will only tell you that somewhere in the table there is a difference that is significant. You'd have to visualize your data or do post-hoc tests to know where this difference is.) Not my preferred solution. A non-parametric method such the Mann Whitney test. This will rank all of your scores within each group. A good method, but may be underpowered. A parametric method (such as a t test). Disadvantage is that the assumptions of this method may be violated, especially with such a small sample. Also, the difference between 0 and 1 is not likely to be the same (depending on what you're measuring) as the difference between 3 and 4. The good news is that the t test is relatively robust to the assumptions you are supposed to ensure are true before using the test. However, as I said, the sample size is fairly small. The best bet may be the Mann Whitney test.
How to test group differences on a five point variable? Three things come to mind: Contingency table analysis using Fisher's exact test or Chi Square (but will only tell you that somewhere in the table there is a difference that is significant. You'd have
38,937
How to test group differences on a five point variable?
This question is a little unusual because the nature of "different" is unspecified. This response is formulated in the spirit of trying to detect as many kinds of differences as possible, not just changes of location ("trend"). One approach that might have more power than most, while remaining agnostic about the relative magnitudes represented by the five groups (e.g., adopting a multinomial model) yet retaining the ordering of the groups, is a Kolmogorov-Smirnov test: as a test statistic use the size of the largest deviation between the two empirical cdfs. This is easy and quick to compute and it would also be easy to bootstrap a p-value by pooling the two sets of results. Specifically, let the count in bin $j$ for group $i$ be $k_{ij}$. Then the empirical cdf for group $i$ is essentially the vector $\left( 0 = m_{i0}, m_{i1}, \ldots, m_{i5}=n_i \right) / n_i$ where $m_{i,j} = m_{i-1,j} + k_{ij}, 1 \le i \le 5$. The test statistic is the sup norm of the difference of these two vectors. Critical values ($\alpha = 0.05$) with two groups of ten individuals are going to be around 0.2 - 0.4, with the higher values occurring when the 20 values are spread evenly between the two extremes.
How to test group differences on a five point variable?
This question is a little unusual because the nature of "different" is unspecified. This response is formulated in the spirit of trying to detect as many kinds of differences as possible, not just ch
How to test group differences on a five point variable? This question is a little unusual because the nature of "different" is unspecified. This response is formulated in the spirit of trying to detect as many kinds of differences as possible, not just changes of location ("trend"). One approach that might have more power than most, while remaining agnostic about the relative magnitudes represented by the five groups (e.g., adopting a multinomial model) yet retaining the ordering of the groups, is a Kolmogorov-Smirnov test: as a test statistic use the size of the largest deviation between the two empirical cdfs. This is easy and quick to compute and it would also be easy to bootstrap a p-value by pooling the two sets of results. Specifically, let the count in bin $j$ for group $i$ be $k_{ij}$. Then the empirical cdf for group $i$ is essentially the vector $\left( 0 = m_{i0}, m_{i1}, \ldots, m_{i5}=n_i \right) / n_i$ where $m_{i,j} = m_{i-1,j} + k_{ij}, 1 \le i \le 5$. The test statistic is the sup norm of the difference of these two vectors. Critical values ($\alpha = 0.05$) with two groups of ten individuals are going to be around 0.2 - 0.4, with the higher values occurring when the 20 values are spread evenly between the two extremes.
How to test group differences on a five point variable? This question is a little unusual because the nature of "different" is unspecified. This response is formulated in the spirit of trying to detect as many kinds of differences as possible, not just ch
38,938
Precedent for Bootstrap-like procedure with "invented" data?
I don't know. What you've shown is a legitimate Monte Carlo simulation Bootstrap is also a Monte Carlo method, but it is more about estimating distributions. In general yes, especially if imputation is giving poor results. In special cases when imputation works great, no. In simple words, it will be as good as strongly you are convinced that you cannot say more about I&J correlation that it is in -1..1.
Precedent for Bootstrap-like procedure with "invented" data?
I don't know. What you've shown is a legitimate Monte Carlo simulation Bootstrap is also a Monte Carlo method, but it is more about estimating distributions. In general yes, especially if imputation
Precedent for Bootstrap-like procedure with "invented" data? I don't know. What you've shown is a legitimate Monte Carlo simulation Bootstrap is also a Monte Carlo method, but it is more about estimating distributions. In general yes, especially if imputation is giving poor results. In special cases when imputation works great, no. In simple words, it will be as good as strongly you are convinced that you cannot say more about I&J correlation that it is in -1..1.
Precedent for Bootstrap-like procedure with "invented" data? I don't know. What you've shown is a legitimate Monte Carlo simulation Bootstrap is also a Monte Carlo method, but it is more about estimating distributions. In general yes, especially if imputation
38,939
Precedent for Bootstrap-like procedure with "invented" data?
An alternative approach would be to impute the missing raw data using a missing data replacement procedure. You could then run the PCA on the correlation matrix that resulted from the imputed dataset (see also multiple imputation). Here are a few links on missing data imputation in R: Gelman on missing data imputation Quick-R has links to R packages such as Amelia II, Mice and mitools
Precedent for Bootstrap-like procedure with "invented" data?
An alternative approach would be to impute the missing raw data using a missing data replacement procedure. You could then run the PCA on the correlation matrix that resulted from the imputed dataset
Precedent for Bootstrap-like procedure with "invented" data? An alternative approach would be to impute the missing raw data using a missing data replacement procedure. You could then run the PCA on the correlation matrix that resulted from the imputed dataset (see also multiple imputation). Here are a few links on missing data imputation in R: Gelman on missing data imputation Quick-R has links to R packages such as Amelia II, Mice and mitools
Precedent for Bootstrap-like procedure with "invented" data? An alternative approach would be to impute the missing raw data using a missing data replacement procedure. You could then run the PCA on the correlation matrix that resulted from the imputed dataset
38,940
Precedent for Bootstrap-like procedure with "invented" data?
I think we need to know more about the nature of the data to make recommendations on how to deal with the missing values. An exploratory task that jumps out to me is to look at the behavior of variables A through H when I is present, versus A through H when J is present. Is there anything interesting to take into account for subsequent modeling? Instead of resampling a descriptive statistic, like correlation, I would consider resampling the data itself. For example, you could use the bootstrap to create 500 new (I,J) pairs based upon the 500 values you actually have for these variables. But, again, the exploratory work may inform a resampling scheme beyond a "naive", IID approach. In general, as others have noted, filling in missing data goes by "imputation" and there are different techniques depending on the context. For example, in one setting I might simply use a median value, or a spline fit, but for a missing data point in a time series I might impute with a value generated from an ARMA time series model. Your outlined solution would be "bootstrapping" if you resample from the observed data. I think of Monte Carlo as any method that uses probabilistic sampling of data as input into a computation. When the sampling is from a non-parametric or parametric distribution that you use to model how the data was generated, I still call it Monte Carlo. But, when the sampling is done from an empirical distribution (i.e., the observed data itself, not a model of the data generating process) I call it bootstrapping.
Precedent for Bootstrap-like procedure with "invented" data?
I think we need to know more about the nature of the data to make recommendations on how to deal with the missing values. An exploratory task that jumps out to me is to look at the behavior of variabl
Precedent for Bootstrap-like procedure with "invented" data? I think we need to know more about the nature of the data to make recommendations on how to deal with the missing values. An exploratory task that jumps out to me is to look at the behavior of variables A through H when I is present, versus A through H when J is present. Is there anything interesting to take into account for subsequent modeling? Instead of resampling a descriptive statistic, like correlation, I would consider resampling the data itself. For example, you could use the bootstrap to create 500 new (I,J) pairs based upon the 500 values you actually have for these variables. But, again, the exploratory work may inform a resampling scheme beyond a "naive", IID approach. In general, as others have noted, filling in missing data goes by "imputation" and there are different techniques depending on the context. For example, in one setting I might simply use a median value, or a spline fit, but for a missing data point in a time series I might impute with a value generated from an ARMA time series model. Your outlined solution would be "bootstrapping" if you resample from the observed data. I think of Monte Carlo as any method that uses probabilistic sampling of data as input into a computation. When the sampling is from a non-parametric or parametric distribution that you use to model how the data was generated, I still call it Monte Carlo. But, when the sampling is done from an empirical distribution (i.e., the observed data itself, not a model of the data generating process) I call it bootstrapping.
Precedent for Bootstrap-like procedure with "invented" data? I think we need to know more about the nature of the data to make recommendations on how to deal with the missing values. An exploratory task that jumps out to me is to look at the behavior of variabl
38,941
Free treemapping software
Flowing Data has a tutorial on how to use the map.market function in the portfolio package in R.
Free treemapping software
Flowing Data has a tutorial on how to use the map.market function in the portfolio package in R.
Free treemapping software Flowing Data has a tutorial on how to use the map.market function in the portfolio package in R.
Free treemapping software Flowing Data has a tutorial on how to use the map.market function in the portfolio package in R.
38,942
Free treemapping software
Protovis has an nice treemap layout. I could try to add this into webvis if you want to create it from R, but it isn't currently an option.
Free treemapping software
Protovis has an nice treemap layout. I could try to add this into webvis if you want to create it from R, but it isn't currently an option.
Free treemapping software Protovis has an nice treemap layout. I could try to add this into webvis if you want to create it from R, but it isn't currently an option.
Free treemapping software Protovis has an nice treemap layout. I could try to add this into webvis if you want to create it from R, but it isn't currently an option.
38,943
Free treemapping software
While I haven't used either of these, I have these two projects bookmarked: Treeviz JTreeMap Both are implemented in Java, are free and open source (MIT and Apache 2.0 licenses, respectively). Both appear to be actually libraries, but seem to come with an example application.
Free treemapping software
While I haven't used either of these, I have these two projects bookmarked: Treeviz JTreeMap Both are implemented in Java, are free and open source (MIT and Apache 2.0 licenses, respectively). Both
Free treemapping software While I haven't used either of these, I have these two projects bookmarked: Treeviz JTreeMap Both are implemented in Java, are free and open source (MIT and Apache 2.0 licenses, respectively). Both appear to be actually libraries, but seem to come with an example application.
Free treemapping software While I haven't used either of these, I have these two projects bookmarked: Treeviz JTreeMap Both are implemented in Java, are free and open source (MIT and Apache 2.0 licenses, respectively). Both
38,944
Free treemapping software
While commercial, Macrofocus provides a free 30-days evaluation of their TreeMap software.
Free treemapping software
While commercial, Macrofocus provides a free 30-days evaluation of their TreeMap software.
Free treemapping software While commercial, Macrofocus provides a free 30-days evaluation of their TreeMap software.
Free treemapping software While commercial, Macrofocus provides a free 30-days evaluation of their TreeMap software.
38,945
Free treemapping software
The treemap package for R is superior - better look, much more flexible - to the map.market function in package portfolio featured in FlowingData's tutorial.
Free treemapping software
The treemap package for R is superior - better look, much more flexible - to the map.market function in package portfolio featured in FlowingData's tutorial.
Free treemapping software The treemap package for R is superior - better look, much more flexible - to the map.market function in package portfolio featured in FlowingData's tutorial.
Free treemapping software The treemap package for R is superior - better look, much more flexible - to the map.market function in package portfolio featured in FlowingData's tutorial.
38,946
What is the name of this normalization (which yields mean 0 and sd 1)?
The quantity $z = \frac{X - \mu}{\sigma}$ is a standard score. So, standardization is a common way to refer to it.
What is the name of this normalization (which yields mean 0 and sd 1)?
The quantity $z = \frac{X - \mu}{\sigma}$ is a standard score. So, standardization is a common way to refer to it.
What is the name of this normalization (which yields mean 0 and sd 1)? The quantity $z = \frac{X - \mu}{\sigma}$ is a standard score. So, standardization is a common way to refer to it.
What is the name of this normalization (which yields mean 0 and sd 1)? The quantity $z = \frac{X - \mu}{\sigma}$ is a standard score. So, standardization is a common way to refer to it.
38,947
What is the name of this normalization (which yields mean 0 and sd 1)?
I think it is just called z-score. [@ttnphns remark: that is correct, however "z-score" also has other meanings in statistics. z-standardization, z standard value - probably the most widely used terms for the linear transform to mean 0 and sd 1]
What is the name of this normalization (which yields mean 0 and sd 1)?
I think it is just called z-score. [@ttnphns remark: that is correct, however "z-score" also has other meanings in statistics. z-standardization, z standard value - probably the most widely used terms
What is the name of this normalization (which yields mean 0 and sd 1)? I think it is just called z-score. [@ttnphns remark: that is correct, however "z-score" also has other meanings in statistics. z-standardization, z standard value - probably the most widely used terms for the linear transform to mean 0 and sd 1]
What is the name of this normalization (which yields mean 0 and sd 1)? I think it is just called z-score. [@ttnphns remark: that is correct, however "z-score" also has other meanings in statistics. z-standardization, z standard value - probably the most widely used terms
38,948
What is the name of this normalization (which yields mean 0 and sd 1)?
As ars' answer states, standardization is the transformation that involves: mean-centering, and rescaling to unit variance. A generalization of standardization is whitening or sphering whereby a set of one or more variables is linearly-transformed (typically after mean-centering) so that the covariance matrix is the identity matrix. A great reference is: A. Kessy, A. Lewin, and K. Strimmer, “Optimal whitening and decorrelation,” Statistics, no. May, p. 12, 2015.
What is the name of this normalization (which yields mean 0 and sd 1)?
As ars' answer states, standardization is the transformation that involves: mean-centering, and rescaling to unit variance. A generalization of standardization is whitening or sphering whereby a set
What is the name of this normalization (which yields mean 0 and sd 1)? As ars' answer states, standardization is the transformation that involves: mean-centering, and rescaling to unit variance. A generalization of standardization is whitening or sphering whereby a set of one or more variables is linearly-transformed (typically after mean-centering) so that the covariance matrix is the identity matrix. A great reference is: A. Kessy, A. Lewin, and K. Strimmer, “Optimal whitening and decorrelation,” Statistics, no. May, p. 12, 2015.
What is the name of this normalization (which yields mean 0 and sd 1)? As ars' answer states, standardization is the transformation that involves: mean-centering, and rescaling to unit variance. A generalization of standardization is whitening or sphering whereby a set
38,949
What is the name of this normalization (which yields mean 0 and sd 1)?
You have to say it was "mean-zero standardized." Dividing by the original calculated standard deviation, $\sigma$, results in a standardized variate with a standard deviation of 1. It has mean zero since it was "centered" (the average was subtracted as well). It's also not normalizing since normalizing implies the final range of the feature (variable) is [0,1], whereas the range of a mean-zero standardized feature is determined from the calculated min and max values, i.e., range= [$Z_{\rm min}, Z_{\rm max}$]. You can also calculate percentiles, which are a type of normalizing, since the final range is [0,1]. Something to note is that mean-zero standardizing and normalizing don't remove skewness, so if a histogram of the original feature (before transformation) had a heavy left or right tail, the tail(s) will still remain in the transformed feature. To get rid of tails after transforming, you have to use the van der Waerden score (VDW). The van der Waerden (VDW) score for a single observation is merely the inverse cumulative (standard) normal mapping of the observation's percentile value. For example, say you have $n=100$ observations for a continuous variable, you can determine the VDW scores using: First, sort the values in ascending order, then assign ranks, so you would obtain ranks of $R_i=1,2,\ldots,100.$ Next, determine the percentile for each observations as $pct_i=R_i/(n+1)$. Once the percentile values are obtained, input them into the inverse mapping function for the CDF of the standard normal distribution, i.e., $N(0,1)$, to obtain the $Z$-score for each, using $Z_i=\Phi^{-1}(pct_i)$. For example, if you plug in a $pct_i$ value 0.025, you will get $-1.96=\Phi^{-1}(0.025)$. Same goes for a plugin value of $pct_i=0.975$, you'll get $1.96=\Phi^{-1}(0.975)$. Use of VDW scores is very popular in genetics, where many variables are transformed into VDW scores, and then input into analyses. The advantage of using VDW scores is that skewness and outlier effects are removed from the data, and can be used if the goal is to perform an analysis under the contraints of normality -- and every variable needs to be purely standard normal distributed with no skewness or outliers. Below is a plot of a log-normal variable V1 based on parameters ln($\mu$) =6, and GSD of 0.3, with its corresponding transforms: n_V1(6,0.3)_1 - normalized into range [0,1] z_V1(6,0.3)_2 - mean-zero standardized into range [$Z_{min}, Z_{max}$] p_V1(6,0.3)_3 - percentiles with range [0,1] vdw_V1(6,0.3)_4 - van der Waerden scores, with usual range [-3,3] As you can see, the skewness (right tail) is removed by only the VDW transform.
What is the name of this normalization (which yields mean 0 and sd 1)?
You have to say it was "mean-zero standardized." Dividing by the original calculated standard deviation, $\sigma$, results in a standardized variate with a standard deviation of 1. It has mean zero
What is the name of this normalization (which yields mean 0 and sd 1)? You have to say it was "mean-zero standardized." Dividing by the original calculated standard deviation, $\sigma$, results in a standardized variate with a standard deviation of 1. It has mean zero since it was "centered" (the average was subtracted as well). It's also not normalizing since normalizing implies the final range of the feature (variable) is [0,1], whereas the range of a mean-zero standardized feature is determined from the calculated min and max values, i.e., range= [$Z_{\rm min}, Z_{\rm max}$]. You can also calculate percentiles, which are a type of normalizing, since the final range is [0,1]. Something to note is that mean-zero standardizing and normalizing don't remove skewness, so if a histogram of the original feature (before transformation) had a heavy left or right tail, the tail(s) will still remain in the transformed feature. To get rid of tails after transforming, you have to use the van der Waerden score (VDW). The van der Waerden (VDW) score for a single observation is merely the inverse cumulative (standard) normal mapping of the observation's percentile value. For example, say you have $n=100$ observations for a continuous variable, you can determine the VDW scores using: First, sort the values in ascending order, then assign ranks, so you would obtain ranks of $R_i=1,2,\ldots,100.$ Next, determine the percentile for each observations as $pct_i=R_i/(n+1)$. Once the percentile values are obtained, input them into the inverse mapping function for the CDF of the standard normal distribution, i.e., $N(0,1)$, to obtain the $Z$-score for each, using $Z_i=\Phi^{-1}(pct_i)$. For example, if you plug in a $pct_i$ value 0.025, you will get $-1.96=\Phi^{-1}(0.025)$. Same goes for a plugin value of $pct_i=0.975$, you'll get $1.96=\Phi^{-1}(0.975)$. Use of VDW scores is very popular in genetics, where many variables are transformed into VDW scores, and then input into analyses. The advantage of using VDW scores is that skewness and outlier effects are removed from the data, and can be used if the goal is to perform an analysis under the contraints of normality -- and every variable needs to be purely standard normal distributed with no skewness or outliers. Below is a plot of a log-normal variable V1 based on parameters ln($\mu$) =6, and GSD of 0.3, with its corresponding transforms: n_V1(6,0.3)_1 - normalized into range [0,1] z_V1(6,0.3)_2 - mean-zero standardized into range [$Z_{min}, Z_{max}$] p_V1(6,0.3)_3 - percentiles with range [0,1] vdw_V1(6,0.3)_4 - van der Waerden scores, with usual range [-3,3] As you can see, the skewness (right tail) is removed by only the VDW transform.
What is the name of this normalization (which yields mean 0 and sd 1)? You have to say it was "mean-zero standardized." Dividing by the original calculated standard deviation, $\sigma$, results in a standardized variate with a standard deviation of 1. It has mean zero
38,950
Chi squared for goodnes of fit test always rejects my fits
You are keeping bins with 0 counts and assigning them an uncertainty of 0. When you measure 0 counts, 0 is a poor estimate of the uncertainty. 0 is a valid outcome even when you expect a few counts. Common practices are to remove those bins or assign them a non-zero value for the std (I would use 1.14 since it's when you expect 0 at 32% probability). Your chi2 value should be much closer to the expectation value, and you will be able to use a chi2 test to determine goodness of fit.
Chi squared for goodnes of fit test always rejects my fits
You are keeping bins with 0 counts and assigning them an uncertainty of 0. When you measure 0 counts, 0 is a poor estimate of the uncertainty. 0 is a valid outcome even when you expect a few counts. C
Chi squared for goodnes of fit test always rejects my fits You are keeping bins with 0 counts and assigning them an uncertainty of 0. When you measure 0 counts, 0 is a poor estimate of the uncertainty. 0 is a valid outcome even when you expect a few counts. Common practices are to remove those bins or assign them a non-zero value for the std (I would use 1.14 since it's when you expect 0 at 32% probability). Your chi2 value should be much closer to the expectation value, and you will be able to use a chi2 test to determine goodness of fit.
Chi squared for goodnes of fit test always rejects my fits You are keeping bins with 0 counts and assigning them an uncertainty of 0. When you measure 0 counts, 0 is a poor estimate of the uncertainty. 0 is a valid outcome even when you expect a few counts. C
38,951
Chi squared for goodnes of fit test always rejects my fits
In a way, the "eye test" measures an effect size but not a p-value. Looking at the histogram versus the fit line can give you a sense of "how far" the two are apart, but the p-value will depend very much on the sample size represented in the graph, which is not as immediately obvious. With sufficient sample size, arbitrarily small deviations from the true distribution may be deemed significant, which you would never be able to discern by the eye test. What you're seeing here is a "pretty good" fit with a decent amount of data - the effect size of the deviation from the chi-squared distribution is small, but we have sufficient data to be sure it's not by chance. Oftentimes, downstream analysis that makes particular assumptions about data distribution will still work reasonably well even if the data is not truly from the assumed distribution. The eye test may mislead you about whether a difference is of statistical significance, but it's usually a reasonable indicator of whether the difference is of practical significance. Rather than looking at p-value, you could examine a measure of effect size like phi or Cramer's V. These measures can quantify "how similar" the observed and expected distributions are, rather than "how sure" you are that they are different. It may be trickier to justify an effect size cutoff for rejecting/accepting fits, but you could perhaps use the eye test to identify meaningful differences and see if that represents a common effect size range where you'd reject by eye.
Chi squared for goodnes of fit test always rejects my fits
In a way, the "eye test" measures an effect size but not a p-value. Looking at the histogram versus the fit line can give you a sense of "how far" the two are apart, but the p-value will depend very m
Chi squared for goodnes of fit test always rejects my fits In a way, the "eye test" measures an effect size but not a p-value. Looking at the histogram versus the fit line can give you a sense of "how far" the two are apart, but the p-value will depend very much on the sample size represented in the graph, which is not as immediately obvious. With sufficient sample size, arbitrarily small deviations from the true distribution may be deemed significant, which you would never be able to discern by the eye test. What you're seeing here is a "pretty good" fit with a decent amount of data - the effect size of the deviation from the chi-squared distribution is small, but we have sufficient data to be sure it's not by chance. Oftentimes, downstream analysis that makes particular assumptions about data distribution will still work reasonably well even if the data is not truly from the assumed distribution. The eye test may mislead you about whether a difference is of statistical significance, but it's usually a reasonable indicator of whether the difference is of practical significance. Rather than looking at p-value, you could examine a measure of effect size like phi or Cramer's V. These measures can quantify "how similar" the observed and expected distributions are, rather than "how sure" you are that they are different. It may be trickier to justify an effect size cutoff for rejecting/accepting fits, but you could perhaps use the eye test to identify meaningful differences and see if that represents a common effect size range where you'd reject by eye.
Chi squared for goodnes of fit test always rejects my fits In a way, the "eye test" measures an effect size but not a p-value. Looking at the histogram versus the fit line can give you a sense of "how far" the two are apart, but the p-value will depend very m
38,952
Chi squared for goodnes of fit test always rejects my fits
Your fit is pretty good. It is not perfect. In some sense, you are correct that your eye calibration is off, but that is not such a terrible issue. Basically every model is at least a little bit wrong. With sufficient data, the slightest of deviations can be caught. However, the eye test is often a powerful and useful approach when “good enough for subsequent work” falls into that “I know it when I see it” category. It seems that you are experiencing the same kind of issue encountered with a lot of testing for distribution normality.
Chi squared for goodnes of fit test always rejects my fits
Your fit is pretty good. It is not perfect. In some sense, you are correct that your eye calibration is off, but that is not such a terrible issue. Basically every model is at least a little bit wrong
Chi squared for goodnes of fit test always rejects my fits Your fit is pretty good. It is not perfect. In some sense, you are correct that your eye calibration is off, but that is not such a terrible issue. Basically every model is at least a little bit wrong. With sufficient data, the slightest of deviations can be caught. However, the eye test is often a powerful and useful approach when “good enough for subsequent work” falls into that “I know it when I see it” category. It seems that you are experiencing the same kind of issue encountered with a lot of testing for distribution normality.
Chi squared for goodnes of fit test always rejects my fits Your fit is pretty good. It is not perfect. In some sense, you are correct that your eye calibration is off, but that is not such a terrible issue. Basically every model is at least a little bit wrong
38,953
Probability of one horse finishing ahead of another [duplicate]
This is similar to Christian Hennig's answer. If you make the strong assumption that the probabilities are in effect weights, and the first horse is sampled with probabilities proportional to the weights of all the horses, the second horse sampled with probabilities proportional to the weights of all the horses except that already selected as the first horse, and so on, then the answer to your question is simple, namely $$\frac{P(E)}{P(E)+P(C)}= \frac{26\%}{26\%+35\%}=\frac{26}{61}\approx 0.426$$ since, if at any stage neither E nor C have been sampled yet and one of them is sampled at that stage, the probability that it is E is $\frac{26}{61}$ and that it is C is $\frac{35}{61}$. Other assumptions about horses which do not come first finish would produce different results. This is how R's sample() function does weighted samples without replacement, so it is easy to simulate, for example with positions <- function(probs){ h <- names(probs) result <- sample(h, prob=probs) c(which(result == h[1]), which(result == h[2]), which(result == h[3]), which(result == h[4]), which(result == h[5])) # positions in simulation } set.seed(2023) probsABCDE <- c("A"=0.25, "B"=0.04, "C"=0.35, "D"=0.10, "E"=0.26) sims <- replicate(10^5, positions(probsABCDE)) rownames(sims) <- names(probsABCDE) rowMeans(sims == 1) # who comes first # A B C D E # 0.24825 0.04160 0.34847 0.09984 0.26184 which is close to the original probabilities allowing for simulation noise. Actually addressing the question of the probability of Horse E finishing the race in front of Horse C, the simulated probability is close to the theoretical probability allowing for simulation noise: mean(sims["E",] < sims["C",]) # 0.42862 probsABCDE["E"] / (probsABCDE["E"] + probsABCDE["C"]) # 0.4262295
Probability of one horse finishing ahead of another [duplicate]
This is similar to Christian Hennig's answer. If you make the strong assumption that the probabilities are in effect weights, and the first horse is sampled with probabilities proportional to the weig
Probability of one horse finishing ahead of another [duplicate] This is similar to Christian Hennig's answer. If you make the strong assumption that the probabilities are in effect weights, and the first horse is sampled with probabilities proportional to the weights of all the horses, the second horse sampled with probabilities proportional to the weights of all the horses except that already selected as the first horse, and so on, then the answer to your question is simple, namely $$\frac{P(E)}{P(E)+P(C)}= \frac{26\%}{26\%+35\%}=\frac{26}{61}\approx 0.426$$ since, if at any stage neither E nor C have been sampled yet and one of them is sampled at that stage, the probability that it is E is $\frac{26}{61}$ and that it is C is $\frac{35}{61}$. Other assumptions about horses which do not come first finish would produce different results. This is how R's sample() function does weighted samples without replacement, so it is easy to simulate, for example with positions <- function(probs){ h <- names(probs) result <- sample(h, prob=probs) c(which(result == h[1]), which(result == h[2]), which(result == h[3]), which(result == h[4]), which(result == h[5])) # positions in simulation } set.seed(2023) probsABCDE <- c("A"=0.25, "B"=0.04, "C"=0.35, "D"=0.10, "E"=0.26) sims <- replicate(10^5, positions(probsABCDE)) rownames(sims) <- names(probsABCDE) rowMeans(sims == 1) # who comes first # A B C D E # 0.24825 0.04160 0.34847 0.09984 0.26184 which is close to the original probabilities allowing for simulation noise. Actually addressing the question of the probability of Horse E finishing the race in front of Horse C, the simulated probability is close to the theoretical probability allowing for simulation noise: mean(sims["E",] < sims["C",]) # 0.42862 probsABCDE["E"] / (probsABCDE["E"] + probsABCDE["C"]) # 0.4262295
Probability of one horse finishing ahead of another [duplicate] This is similar to Christian Hennig's answer. If you make the strong assumption that the probabilities are in effect weights, and the first horse is sampled with probabilities proportional to the weig
38,954
Probability of one horse finishing ahead of another [duplicate]
The given information is not enough to compute these probabilities in general, because it may be that for example Horse C is of a kind that it either wins or gets frustrated and finishes last. But it may also just be the best horse and if it doesn't win it may be very likely that it comes second. Which of these is the case is not captured by the data you have. The problem can be solved making a simplifying assumption that in reality not may b0e true, even though it doesn't look wildly unrealistic either. The assumption I'm thinking of is that we assume that for all ranks the relative probability of any horse finishing on a lower rank assuming that certain given horses occupy the higher ranks is the same among the horses that don't yet have finished. This for example implies that the probability for Horse A being second given that we know Horse C has won is $\frac{25}{25+4+10+26}=\frac{25}{100-35}=38.5\%$. This assumption will determine the probabilities for all possible rankings, which can be fully computed using a fairly simple computer program (but complicated enough that I won't take the time to write it for you), going down from rank 1. One can then add all probabilities for cases in which E is ahead of C (or write the program so that it only computes those). There may be a simpler way of doing this, but if nobody else explains it, here you are. PS: The answer by Henry uses the same assumption, and it looks like $\frac{26}{61}$ is the result even without running a program.
Probability of one horse finishing ahead of another [duplicate]
The given information is not enough to compute these probabilities in general, because it may be that for example Horse C is of a kind that it either wins or gets frustrated and finishes last. But it
Probability of one horse finishing ahead of another [duplicate] The given information is not enough to compute these probabilities in general, because it may be that for example Horse C is of a kind that it either wins or gets frustrated and finishes last. But it may also just be the best horse and if it doesn't win it may be very likely that it comes second. Which of these is the case is not captured by the data you have. The problem can be solved making a simplifying assumption that in reality not may b0e true, even though it doesn't look wildly unrealistic either. The assumption I'm thinking of is that we assume that for all ranks the relative probability of any horse finishing on a lower rank assuming that certain given horses occupy the higher ranks is the same among the horses that don't yet have finished. This for example implies that the probability for Horse A being second given that we know Horse C has won is $\frac{25}{25+4+10+26}=\frac{25}{100-35}=38.5\%$. This assumption will determine the probabilities for all possible rankings, which can be fully computed using a fairly simple computer program (but complicated enough that I won't take the time to write it for you), going down from rank 1. One can then add all probabilities for cases in which E is ahead of C (or write the program so that it only computes those). There may be a simpler way of doing this, but if nobody else explains it, here you are. PS: The answer by Henry uses the same assumption, and it looks like $\frac{26}{61}$ is the result even without running a program.
Probability of one horse finishing ahead of another [duplicate] The given information is not enough to compute these probabilities in general, because it may be that for example Horse C is of a kind that it either wins or gets frustrated and finishes last. But it
38,955
Probability of one horse finishing ahead of another [duplicate]
Let $p_i$, $i=1,2,\dots,n$ denote the probabilities that each horse wins given in the problem statement. A model that leads to simple calculations is to assume that some monotonically decreasing transformation $Z_i$ of the race times $T_i$ follow exponential distributions with rate parameters $\lambda_i=p_i$. For instance, this would be consistent with the assumption that the race times follow Gumbel distribution with different locations which is perhaps not entirely unrealistic. The probability that horse $i$ wins is then the probability that $Z_i$ is the smallest order statistic which indeed clearly is $\lambda_i/\sum_{j=1}^n \lambda_j=p_i$. By the product rule and and the memoryless property of the exponential distribution the probability of a particular ranking $(\sigma(1),\sigma(2),\dots,\sigma(n))$ is $$ \prod_{i=1}^n\frac{p_{\sigma(i)}}{\sum_{j=i}^n p_{\sigma(j)}}. $$ The following R code verifies that the probabilities of all rankings computed this way sums to 1: library(combinat) #> #> Attaching package: 'combinat' #> The following object is masked from 'package:utils': #> #> combn revcumsum <- function(x) rev(cumsum(rev(x))) probranking <- function(sigma, p) { n <- length(p) prod(p[sigma]/revcumsum(p[sigma])) } p <- c(.25,.04,.35,.1,.26) n <- length(p) sum(unlist(permn(1:n, probranking, p = p))) #> [1] 1
Probability of one horse finishing ahead of another [duplicate]
Let $p_i$, $i=1,2,\dots,n$ denote the probabilities that each horse wins given in the problem statement. A model that leads to simple calculations is to assume that some monotonically decreasing tran
Probability of one horse finishing ahead of another [duplicate] Let $p_i$, $i=1,2,\dots,n$ denote the probabilities that each horse wins given in the problem statement. A model that leads to simple calculations is to assume that some monotonically decreasing transformation $Z_i$ of the race times $T_i$ follow exponential distributions with rate parameters $\lambda_i=p_i$. For instance, this would be consistent with the assumption that the race times follow Gumbel distribution with different locations which is perhaps not entirely unrealistic. The probability that horse $i$ wins is then the probability that $Z_i$ is the smallest order statistic which indeed clearly is $\lambda_i/\sum_{j=1}^n \lambda_j=p_i$. By the product rule and and the memoryless property of the exponential distribution the probability of a particular ranking $(\sigma(1),\sigma(2),\dots,\sigma(n))$ is $$ \prod_{i=1}^n\frac{p_{\sigma(i)}}{\sum_{j=i}^n p_{\sigma(j)}}. $$ The following R code verifies that the probabilities of all rankings computed this way sums to 1: library(combinat) #> #> Attaching package: 'combinat' #> The following object is masked from 'package:utils': #> #> combn revcumsum <- function(x) rev(cumsum(rev(x))) probranking <- function(sigma, p) { n <- length(p) prod(p[sigma]/revcumsum(p[sigma])) } p <- c(.25,.04,.35,.1,.26) n <- length(p) sum(unlist(permn(1:n, probranking, p = p))) #> [1] 1
Probability of one horse finishing ahead of another [duplicate] Let $p_i$, $i=1,2,\dots,n$ denote the probabilities that each horse wins given in the problem statement. A model that leads to simple calculations is to assume that some monotonically decreasing tran
38,956
How to obtain the model coefficients of GAM in R?
The model you fitted with {mgcv} is $$ y_i = \alpha + f(x_i) + \varepsilon_i $$ not $$ y_i = \alpha + \beta \cdot f(x_i) + \varepsilon_i $$ So that makes me a little unsure as to what $\beta$ you want. In the {mgcv} formulation, the smooth function $f$ is parameterised as a penalised spline and represented as a sum of one or more ($K$) basis functions, each of which has a coefficient $\beta_k$ $$ f(x_i) = \sum_{k=1}^{K} \beta_k b_k(x_i) $$ Hence, if you want those $\beta_k$, use the coef() method library(mgcv) set.seed(2) ## simulate some data... dat <- gamSim(1, n = 400, dist = "normal", scale = 2) m <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat) coef(m) The last line yields: > coef(m) (Intercept) s(x0).1 s(x0).2 s(x0).3 s(x0).4 7.833279e+00 2.173964e-01 3.805544e-01 -1.356960e-01 -3.768858e-01 s(x0).5 s(x0).6 s(x0).7 s(x0).8 s(x0).9 -4.175098e-02 3.566379e-01 -1.460338e-02 1.662533e+00 -1.107835e-02 s(x1).1 s(x1).2 s(x1).3 s(x1).4 s(x1).5 -5.169824e-02 -3.356803e-01 -7.802932e-02 2.992721e-01 -7.940761e-02 s(x1).6 s(x1).7 s(x1).8 s(x1).9 s(x2).1 -2.829178e-01 -1.044189e-01 -1.378039e+00 1.520851e+00 -6.550020e+00 s(x2).2 s(x2).3 s(x2).4 s(x2).5 s(x2).6 1.005427e+01 2.136084e+00 1.614333e+00 -2.352140e+00 1.495629e+00 s(x2).7 s(x2).8 s(x2).9 s(x3).1 s(x3).2 -1.550494e+00 9.859330e+00 5.834315e+00 1.083155e-10 5.828135e-11 s(x3).3 s(x3).4 s(x3).5 s(x3).6 s(x3).7 -5.924120e-11 9.849940e-11 4.198290e-11 1.014248e-10 3.309607e-11 s(x3).8 s(x3).9 4.894399e-10 -2.082265e-01
How to obtain the model coefficients of GAM in R?
The model you fitted with {mgcv} is $$ y_i = \alpha + f(x_i) + \varepsilon_i $$ not $$ y_i = \alpha + \beta \cdot f(x_i) + \varepsilon_i $$ So that makes me a little unsure as to what $\beta$ you want
How to obtain the model coefficients of GAM in R? The model you fitted with {mgcv} is $$ y_i = \alpha + f(x_i) + \varepsilon_i $$ not $$ y_i = \alpha + \beta \cdot f(x_i) + \varepsilon_i $$ So that makes me a little unsure as to what $\beta$ you want. In the {mgcv} formulation, the smooth function $f$ is parameterised as a penalised spline and represented as a sum of one or more ($K$) basis functions, each of which has a coefficient $\beta_k$ $$ f(x_i) = \sum_{k=1}^{K} \beta_k b_k(x_i) $$ Hence, if you want those $\beta_k$, use the coef() method library(mgcv) set.seed(2) ## simulate some data... dat <- gamSim(1, n = 400, dist = "normal", scale = 2) m <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat) coef(m) The last line yields: > coef(m) (Intercept) s(x0).1 s(x0).2 s(x0).3 s(x0).4 7.833279e+00 2.173964e-01 3.805544e-01 -1.356960e-01 -3.768858e-01 s(x0).5 s(x0).6 s(x0).7 s(x0).8 s(x0).9 -4.175098e-02 3.566379e-01 -1.460338e-02 1.662533e+00 -1.107835e-02 s(x1).1 s(x1).2 s(x1).3 s(x1).4 s(x1).5 -5.169824e-02 -3.356803e-01 -7.802932e-02 2.992721e-01 -7.940761e-02 s(x1).6 s(x1).7 s(x1).8 s(x1).9 s(x2).1 -2.829178e-01 -1.044189e-01 -1.378039e+00 1.520851e+00 -6.550020e+00 s(x2).2 s(x2).3 s(x2).4 s(x2).5 s(x2).6 1.005427e+01 2.136084e+00 1.614333e+00 -2.352140e+00 1.495629e+00 s(x2).7 s(x2).8 s(x2).9 s(x3).1 s(x3).2 -1.550494e+00 9.859330e+00 5.834315e+00 1.083155e-10 5.828135e-11 s(x3).3 s(x3).4 s(x3).5 s(x3).6 s(x3).7 -5.924120e-11 9.849940e-11 4.198290e-11 1.014248e-10 3.309607e-11 s(x3).8 s(x3).9 4.894399e-10 -2.082265e-01
How to obtain the model coefficients of GAM in R? The model you fitted with {mgcv} is $$ y_i = \alpha + f(x_i) + \varepsilon_i $$ not $$ y_i = \alpha + \beta \cdot f(x_i) + \varepsilon_i $$ So that makes me a little unsure as to what $\beta$ you want
38,957
Why does Hutchinson's trace estimator reduce computation complexity?
You are right that for calculating the trace of a matrix this does not reduce cost vs a simple calculation...but this trick is very useful when we need to compute the trace of a function of a matrix, $tr(f(A))$. For example, consider estimating a log determinant, which can be rewritten as $tr( log(A) )$, the trace of the log of the matrix; or consider (the closely related!) calculation where we need the trace of a matrix raised to a power, e.g. $tr(A^k)$. If you are calculating the trace of a function of a matrix, Hutchison's trace estimator may dramatically reduce your computational cost. If you are trying to calculate $tr(A^2)$, for example, where A is some square $D x D$ matrix, you could calculate $AA$ and then take the trace of this -- this costs $O(D^3)$, for a large matrix this will be quite expensive, or you could use Hutchison's trace estimator to replace that series of matrix multiplications with a series of matrix-vector multiplications which will be substantially cheaper, as long as the number $M$ of probe vectors that you use is $M << D$. Another use case is when forming the matrix $A$ explicitly would be very expensive but taking a matrix vector product would be much cheaper. For example, consider if we have a matrix formed from $XX^T$, where $X$ is some $N x M$ matrix and $N$ is very large, so that $A$ would be too large to fit in memory. In this case, if you need to evaluate $tr(A)$, it might be much cheaper to use matrix-vector products rather than forming $A$ explicitly. Basically, the trick helps us reduce the cost of trace estimation when we want to estimate the trace of a function of a matrix or when we are working with matrices that we do not want to for explicitly. Estimating log determinants is a common use case -- this paper uses Hutchison's trace estimator in their approach for approximating log determinants for example: http://proceedings.mlr.press/v37/hana15.pdf
Why does Hutchinson's trace estimator reduce computation complexity?
You are right that for calculating the trace of a matrix this does not reduce cost vs a simple calculation...but this trick is very useful when we need to compute the trace of a function of a matrix,
Why does Hutchinson's trace estimator reduce computation complexity? You are right that for calculating the trace of a matrix this does not reduce cost vs a simple calculation...but this trick is very useful when we need to compute the trace of a function of a matrix, $tr(f(A))$. For example, consider estimating a log determinant, which can be rewritten as $tr( log(A) )$, the trace of the log of the matrix; or consider (the closely related!) calculation where we need the trace of a matrix raised to a power, e.g. $tr(A^k)$. If you are calculating the trace of a function of a matrix, Hutchison's trace estimator may dramatically reduce your computational cost. If you are trying to calculate $tr(A^2)$, for example, where A is some square $D x D$ matrix, you could calculate $AA$ and then take the trace of this -- this costs $O(D^3)$, for a large matrix this will be quite expensive, or you could use Hutchison's trace estimator to replace that series of matrix multiplications with a series of matrix-vector multiplications which will be substantially cheaper, as long as the number $M$ of probe vectors that you use is $M << D$. Another use case is when forming the matrix $A$ explicitly would be very expensive but taking a matrix vector product would be much cheaper. For example, consider if we have a matrix formed from $XX^T$, where $X$ is some $N x M$ matrix and $N$ is very large, so that $A$ would be too large to fit in memory. In this case, if you need to evaluate $tr(A)$, it might be much cheaper to use matrix-vector products rather than forming $A$ explicitly. Basically, the trick helps us reduce the cost of trace estimation when we want to estimate the trace of a function of a matrix or when we are working with matrices that we do not want to for explicitly. Estimating log determinants is a common use case -- this paper uses Hutchison's trace estimator in their approach for approximating log determinants for example: http://proceedings.mlr.press/v37/hana15.pdf
Why does Hutchinson's trace estimator reduce computation complexity? You are right that for calculating the trace of a matrix this does not reduce cost vs a simple calculation...but this trick is very useful when we need to compute the trace of a function of a matrix,
38,958
Why does Hutchinson's trace estimator reduce computation complexity?
I have never heard of this trick before, and it does look strange ... since the trace is a sum of the $n$ diagonal terms, while the quadratic form needs a double sum over all the $n^2$ terms. So I guess the "trick" must be used only as one idea in combination with others, for some more involved problem than just a trace. And indeed, in your own linked reference such examples are given, so just start top read those examples with attention. But I do not find the example in that link very well written, so better to go to the reference they give Randomized algorithms for matrices and data, but that paper does not mention the trick! Search gives a lot of relevant papers, and RANDOMIZED ALGORITHMS FOR ESTIMATING THE TRACE OF AN IMPLICIT SYMMETRIC POSITIVE SEMI-DEFINITE MATRIX says, in its abstract that these algorithms are useful in applications in which there is no explicit representation of $A$ but rather an efficient method to compute $z^T Az$ given $z$. So this trick is not useful in isolation, but as a building block for randomized algorithms.
Why does Hutchinson's trace estimator reduce computation complexity?
I have never heard of this trick before, and it does look strange ... since the trace is a sum of the $n$ diagonal terms, while the quadratic form needs a double sum over all the $n^2$ terms. So I gue
Why does Hutchinson's trace estimator reduce computation complexity? I have never heard of this trick before, and it does look strange ... since the trace is a sum of the $n$ diagonal terms, while the quadratic form needs a double sum over all the $n^2$ terms. So I guess the "trick" must be used only as one idea in combination with others, for some more involved problem than just a trace. And indeed, in your own linked reference such examples are given, so just start top read those examples with attention. But I do not find the example in that link very well written, so better to go to the reference they give Randomized algorithms for matrices and data, but that paper does not mention the trick! Search gives a lot of relevant papers, and RANDOMIZED ALGORITHMS FOR ESTIMATING THE TRACE OF AN IMPLICIT SYMMETRIC POSITIVE SEMI-DEFINITE MATRIX says, in its abstract that these algorithms are useful in applications in which there is no explicit representation of $A$ but rather an efficient method to compute $z^T Az$ given $z$. So this trick is not useful in isolation, but as a building block for randomized algorithms.
Why does Hutchinson's trace estimator reduce computation complexity? I have never heard of this trick before, and it does look strange ... since the trace is a sum of the $n$ diagonal terms, while the quadratic form needs a double sum over all the $n^2$ terms. So I gue
38,959
Why does Hutchinson's trace estimator reduce computation complexity?
It depends a lot on what accuracy you need as well as the form of the matrix. In the application I had, there was a matrix $A=GP$ that was the product of a large (say $N\times M$) sparse matrix $G$ of genotypes and a projection matrix $P$ on to the residual space of a linear regression. This means $A$ wasn't itself sparse, but computing matrix-vector products $Ax$ or $A^TAx$ was still fast. I needed the trace of $B=A^TA$ and $B^TB$ as part of an approximation to the distribution of a quadratic form, and they didn't need to be all that accurate. The trace of $B$ can be computed directly in $MN$ operations, but $tr(B^TB)$ requires explicitly computing all of $B$, taking $M^2N$ (assuming $M<N$, with both in the thousands). Hutchinson's trace estimator with sample size $k$ could be computed in the time needed for $2k$ matrix multiplications by $A$ (small compared to $MNk$). The error in the estimator was $O_p(k^{-1/2})$, but that was ok (with $k\sim 500$) The rest of the approximation involved the first few (~100)leading eigenvalues of $B$ and stochastic SVD gives an algorithm whose time is dominated by doing ~100 matrix-vector multiplications by $B$, so it was desirable for the trace part of the whole computation not to be hugely slower than this.
Why does Hutchinson's trace estimator reduce computation complexity?
It depends a lot on what accuracy you need as well as the form of the matrix. In the application I had, there was a matrix $A=GP$ that was the product of a large (say $N\times M$) sparse matrix $G$ o
Why does Hutchinson's trace estimator reduce computation complexity? It depends a lot on what accuracy you need as well as the form of the matrix. In the application I had, there was a matrix $A=GP$ that was the product of a large (say $N\times M$) sparse matrix $G$ of genotypes and a projection matrix $P$ on to the residual space of a linear regression. This means $A$ wasn't itself sparse, but computing matrix-vector products $Ax$ or $A^TAx$ was still fast. I needed the trace of $B=A^TA$ and $B^TB$ as part of an approximation to the distribution of a quadratic form, and they didn't need to be all that accurate. The trace of $B$ can be computed directly in $MN$ operations, but $tr(B^TB)$ requires explicitly computing all of $B$, taking $M^2N$ (assuming $M<N$, with both in the thousands). Hutchinson's trace estimator with sample size $k$ could be computed in the time needed for $2k$ matrix multiplications by $A$ (small compared to $MNk$). The error in the estimator was $O_p(k^{-1/2})$, but that was ok (with $k\sim 500$) The rest of the approximation involved the first few (~100)leading eigenvalues of $B$ and stochastic SVD gives an algorithm whose time is dominated by doing ~100 matrix-vector multiplications by $B$, so it was desirable for the trace part of the whole computation not to be hugely slower than this.
Why does Hutchinson's trace estimator reduce computation complexity? It depends a lot on what accuracy you need as well as the form of the matrix. In the application I had, there was a matrix $A=GP$ that was the product of a large (say $N\times M$) sparse matrix $G$ o
38,960
what is the difference between a two-sample t-test and a paired t-test
In a two-sample test, you have two independent samples. Of course, by independence, we expect the two sets of measurements will not be correlated. Sample sizes for the two samples need not be equal. (But it often makes sense for them to be approximately equal.) In a paired test you have one sample of pairs. Typically, there will be $n$ paired observations $(x_i, x_2).$ These may be two measurements on each individual subject. (For example, Before and After 'treatment' scores on a questionnaire, exam, or lab test.) Alternatively, the pairs may be pairs of subjects. (For example, married couples, twins, or subjects matched according to some criterion. They might also be two devices manufactured at the same time and place.) It is expected that the two measurements on pairs will be correlated. In analysis, one may look at a sample of differences $d_i = x_1-x_2.$ Examples: Paired. Suppose you have a study in which subjects have diverse skills at a particular task. It is claimed that a training course will increase skills by a small, but important amount. You test 20 subjects before (test scorex1) and after (x2) the training. summary(x1) Min. 1st Qu. Median Mean 3rd Qu. Max. 71.16 99.70 105.31 105.91 122.32 125.95 length(x1); sd(x1) [1] 20 # sample size [1] 16.33155 # sample standard deviation summary(x2) Min. 1st Qu. Median Mean 3rd Qu. Max. 72.63 102.04 111.76 109.16 123.90 134.25 length(x2); sd(x2) [1] 20 [1] 17.30927 The average score increases from 105.91 Before training to 109.16 After. Before and after scores are highly correlated. cor(x1,x2) [1] 0.9859222 A scatterplot shows the strong linear correlation. Also, most of the $(X_{1i},X_{2i})$ points lie above the 45-degree line, indicating modest, but mostly positive results from the training course. A paired t test in R, tests $H_0: \mu_B = \mu_A$ against the one-sided alternative $H_0: \mu_B < \mu_A.$ The P-value (near $0)$ shows that the observed improvement is highly significant. t.test(x1, x2, pair=T, alt="less") Paired t-test data: x1 and x2 t = -4.8675, df = 19, p-value = 5.347e-05 alternative hypothesis: true difference in means is less than 0 95 percent confidence interval: -Inf -2.095359 sample estimates: mean of the differences -3.249817 The pairing has allowed us to detect a small improvement 'above the noise' of great subject variability. Two-samples. By contrast, suppose we gave the training to a group of 20 randomly chosen subjects obtaining test scores t. For comparison we taka a group of 20 subjects from the same population who did not take the training course. Also, suppose the true mean score of subjects with the training is 4 points above the true mean score of subjects who did not take the training. Then we would have a one-sided, two-sample t test. And, we would have only about a 20% chance of detecting the difference, on account of the diversity of skills in the population. set.seed(516) pv = replicate(10^4, t.test(rnorm(20, 100, 15), rnorm(20, 104, 15), alt="less")$p.val) mean(pv < 0.05) [1] 0.2043 Note: In the simulation above 10,000 two-sample tests are performed on samples of size $n_1=n_2=20$ from populations $\mathsf{Norm}(100, 15)$ and $\mathsf{Norm}(104, 15),$ respectively. The data summary and the Welch 2-sample t test are shown for the first one of these 10,000 simulated experiments. set.seed(516) u = rnorm(20, 100, 15); u = rnorm(20, 104, 15) summary(u); length(u); sd(u) Min. 1st Qu. Median Mean 3rd Qu. Max. 85.29 101.01 111.27 110.69 120.35 134.40 [1] 20 [1] 13.30721 t = rnorm(20, 100, 15); t = rnorm(20, 104, 15) summary(t); length(t); sd(t) Min. 1st Qu. Median Mean 3rd Qu. Max. 75.96 93.48 109.83 106.62 115.34 135.87 [1] 20 [1] 15.66145 boxplot(u, t, horizontal=TRUE, col="skyblue2", names=TRUE) t.test(u, t, alt="less") Welch Two Sample t-test data: u and t t = 0.88607, df = 37.034, p-value = 0.8094 alternative hypothesis: true difference in means is less than 0 95 percent confidence interval: -Inf 11.82465 sample estimates: mean of x mean of y 110.6948 106.6229 Notice that, in this particular case, the sample for the mean score for the subjects in the training group happens to be smaller than the mean for the control group. With such variable populations this is not a rare occurrence. Generally speaking, much larger sample sizes (about 200 in each sample) would be required for the two-sample t test reliably to detect a 'training' effect of 4 units.
what is the difference between a two-sample t-test and a paired t-test
In a two-sample test, you have two independent samples. Of course, by independence, we expect the two sets of measurements will not be correlated. Sample sizes for the two samples need not be equal. (
what is the difference between a two-sample t-test and a paired t-test In a two-sample test, you have two independent samples. Of course, by independence, we expect the two sets of measurements will not be correlated. Sample sizes for the two samples need not be equal. (But it often makes sense for them to be approximately equal.) In a paired test you have one sample of pairs. Typically, there will be $n$ paired observations $(x_i, x_2).$ These may be two measurements on each individual subject. (For example, Before and After 'treatment' scores on a questionnaire, exam, or lab test.) Alternatively, the pairs may be pairs of subjects. (For example, married couples, twins, or subjects matched according to some criterion. They might also be two devices manufactured at the same time and place.) It is expected that the two measurements on pairs will be correlated. In analysis, one may look at a sample of differences $d_i = x_1-x_2.$ Examples: Paired. Suppose you have a study in which subjects have diverse skills at a particular task. It is claimed that a training course will increase skills by a small, but important amount. You test 20 subjects before (test scorex1) and after (x2) the training. summary(x1) Min. 1st Qu. Median Mean 3rd Qu. Max. 71.16 99.70 105.31 105.91 122.32 125.95 length(x1); sd(x1) [1] 20 # sample size [1] 16.33155 # sample standard deviation summary(x2) Min. 1st Qu. Median Mean 3rd Qu. Max. 72.63 102.04 111.76 109.16 123.90 134.25 length(x2); sd(x2) [1] 20 [1] 17.30927 The average score increases from 105.91 Before training to 109.16 After. Before and after scores are highly correlated. cor(x1,x2) [1] 0.9859222 A scatterplot shows the strong linear correlation. Also, most of the $(X_{1i},X_{2i})$ points lie above the 45-degree line, indicating modest, but mostly positive results from the training course. A paired t test in R, tests $H_0: \mu_B = \mu_A$ against the one-sided alternative $H_0: \mu_B < \mu_A.$ The P-value (near $0)$ shows that the observed improvement is highly significant. t.test(x1, x2, pair=T, alt="less") Paired t-test data: x1 and x2 t = -4.8675, df = 19, p-value = 5.347e-05 alternative hypothesis: true difference in means is less than 0 95 percent confidence interval: -Inf -2.095359 sample estimates: mean of the differences -3.249817 The pairing has allowed us to detect a small improvement 'above the noise' of great subject variability. Two-samples. By contrast, suppose we gave the training to a group of 20 randomly chosen subjects obtaining test scores t. For comparison we taka a group of 20 subjects from the same population who did not take the training course. Also, suppose the true mean score of subjects with the training is 4 points above the true mean score of subjects who did not take the training. Then we would have a one-sided, two-sample t test. And, we would have only about a 20% chance of detecting the difference, on account of the diversity of skills in the population. set.seed(516) pv = replicate(10^4, t.test(rnorm(20, 100, 15), rnorm(20, 104, 15), alt="less")$p.val) mean(pv < 0.05) [1] 0.2043 Note: In the simulation above 10,000 two-sample tests are performed on samples of size $n_1=n_2=20$ from populations $\mathsf{Norm}(100, 15)$ and $\mathsf{Norm}(104, 15),$ respectively. The data summary and the Welch 2-sample t test are shown for the first one of these 10,000 simulated experiments. set.seed(516) u = rnorm(20, 100, 15); u = rnorm(20, 104, 15) summary(u); length(u); sd(u) Min. 1st Qu. Median Mean 3rd Qu. Max. 85.29 101.01 111.27 110.69 120.35 134.40 [1] 20 [1] 13.30721 t = rnorm(20, 100, 15); t = rnorm(20, 104, 15) summary(t); length(t); sd(t) Min. 1st Qu. Median Mean 3rd Qu. Max. 75.96 93.48 109.83 106.62 115.34 135.87 [1] 20 [1] 15.66145 boxplot(u, t, horizontal=TRUE, col="skyblue2", names=TRUE) t.test(u, t, alt="less") Welch Two Sample t-test data: u and t t = 0.88607, df = 37.034, p-value = 0.8094 alternative hypothesis: true difference in means is less than 0 95 percent confidence interval: -Inf 11.82465 sample estimates: mean of x mean of y 110.6948 106.6229 Notice that, in this particular case, the sample for the mean score for the subjects in the training group happens to be smaller than the mean for the control group. With such variable populations this is not a rare occurrence. Generally speaking, much larger sample sizes (about 200 in each sample) would be required for the two-sample t test reliably to detect a 'training' effect of 4 units.
what is the difference between a two-sample t-test and a paired t-test In a two-sample test, you have two independent samples. Of course, by independence, we expect the two sets of measurements will not be correlated. Sample sizes for the two samples need not be equal. (
38,961
what is the difference between a two-sample t-test and a paired t-test
When you use a paired T-test, you are essentially doing a one-sample test, where your one sample consists of the paired differences between outcomes in two groups. If you create a new sample of these difference values and then apply the formula for a one-sample T-test, you will see that this is equivalent to the paired test.
what is the difference between a two-sample t-test and a paired t-test
When you use a paired T-test, you are essentially doing a one-sample test, where your one sample consists of the paired differences between outcomes in two groups. If you create a new sample of these
what is the difference between a two-sample t-test and a paired t-test When you use a paired T-test, you are essentially doing a one-sample test, where your one sample consists of the paired differences between outcomes in two groups. If you create a new sample of these difference values and then apply the formula for a one-sample T-test, you will see that this is equivalent to the paired test.
what is the difference between a two-sample t-test and a paired t-test When you use a paired T-test, you are essentially doing a one-sample test, where your one sample consists of the paired differences between outcomes in two groups. If you create a new sample of these
38,962
Applying Wilks' theorem to uniform distribution
From the Wikipedia page for Wilks' theorem: The theorem no longer applies when any one of the estimated parameters is at its upper or lower limit: Wilks’ theorem assumes that the ‘true’ but unknown values of the estimated parameters lie within the interior of the supported parameter space. The likelihood maximum may no longer have the assumed ellipsoidal shape if the maximum value for the population likelihood function occurs at some boundary-value of one of the parameters, i.e. on an edge of the parameter space. In that event, the likelihood test will still be valid and optimal as guaranteed by the Neyman-Pearson lemma,[2] but the significance (the p-value) can not be reliably estimated using the chi-squared distribution with the number of degrees of freedom prescribed by Wilks. In this case the estimated parameter $b$ is at its lower limit $x_{\left(n\right)}$, as the likelihood is zero for $b < x_{\left(n\right)}$. Other proofs such as the asymptotic normality of the MLE also rely on the assumption that the true value of the parameter lies within the parameter space. So $\hat{b}$ is not asymptotically normal either.
Applying Wilks' theorem to uniform distribution
From the Wikipedia page for Wilks' theorem: The theorem no longer applies when any one of the estimated parameters is at its upper or lower limit: Wilks’ theorem assumes that the ‘true’ but unknown v
Applying Wilks' theorem to uniform distribution From the Wikipedia page for Wilks' theorem: The theorem no longer applies when any one of the estimated parameters is at its upper or lower limit: Wilks’ theorem assumes that the ‘true’ but unknown values of the estimated parameters lie within the interior of the supported parameter space. The likelihood maximum may no longer have the assumed ellipsoidal shape if the maximum value for the population likelihood function occurs at some boundary-value of one of the parameters, i.e. on an edge of the parameter space. In that event, the likelihood test will still be valid and optimal as guaranteed by the Neyman-Pearson lemma,[2] but the significance (the p-value) can not be reliably estimated using the chi-squared distribution with the number of degrees of freedom prescribed by Wilks. In this case the estimated parameter $b$ is at its lower limit $x_{\left(n\right)}$, as the likelihood is zero for $b < x_{\left(n\right)}$. Other proofs such as the asymptotic normality of the MLE also rely on the assumption that the true value of the parameter lies within the parameter space. So $\hat{b}$ is not asymptotically normal either.
Applying Wilks' theorem to uniform distribution From the Wikipedia page for Wilks' theorem: The theorem no longer applies when any one of the estimated parameters is at its upper or lower limit: Wilks’ theorem assumes that the ‘true’ but unknown v
38,963
Applying Wilks' theorem to uniform distribution
Wilk's theorem assumes that the support of the distribution, i.e., the sample space, does not depend on the unknown parameter. Here, the parameter $b$ determines the width of the sample space so Wilk's theorem cannot be applied. All the standard asymptotic tests associated with likelihood theory (Wald tests, likelihood ratio tests, score tests) make the same assumption. To see why this assumption is so important, consider one of the most fundamental theorems used in likelihood theory, the fact that $$E\left(\frac{\partial}{\partial \theta}\log f(X;\theta)\right)=0$$ where $f(x;\theta)$ is the density of $X$. This theorem is proved by differentiating the left hand side of $$ \int \exp(\log f(x;\theta)) dx = 1 $$ with respect to $\theta$ under the integral sign. But now imagine what happens when the limits of the integral depend on $\theta$: $$ \int_{a(\theta)}^{b(\theta)} \exp\left(\log f(x;\theta)\right) dx = 1 $$ Now the derivative of the left-hand-side is far more complex and the theorem is no longer true. The same sort of problem occurs for all the other identities used in asympototic likelihod theory and for Wilk's theorem in particular.
Applying Wilks' theorem to uniform distribution
Wilk's theorem assumes that the support of the distribution, i.e., the sample space, does not depend on the unknown parameter. Here, the parameter $b$ determines the width of the sample space so Wilk'
Applying Wilks' theorem to uniform distribution Wilk's theorem assumes that the support of the distribution, i.e., the sample space, does not depend on the unknown parameter. Here, the parameter $b$ determines the width of the sample space so Wilk's theorem cannot be applied. All the standard asymptotic tests associated with likelihood theory (Wald tests, likelihood ratio tests, score tests) make the same assumption. To see why this assumption is so important, consider one of the most fundamental theorems used in likelihood theory, the fact that $$E\left(\frac{\partial}{\partial \theta}\log f(X;\theta)\right)=0$$ where $f(x;\theta)$ is the density of $X$. This theorem is proved by differentiating the left hand side of $$ \int \exp(\log f(x;\theta)) dx = 1 $$ with respect to $\theta$ under the integral sign. But now imagine what happens when the limits of the integral depend on $\theta$: $$ \int_{a(\theta)}^{b(\theta)} \exp\left(\log f(x;\theta)\right) dx = 1 $$ Now the derivative of the left-hand-side is far more complex and the theorem is no longer true. The same sort of problem occurs for all the other identities used in asympototic likelihod theory and for Wilk's theorem in particular.
Applying Wilks' theorem to uniform distribution Wilk's theorem assumes that the support of the distribution, i.e., the sample space, does not depend on the unknown parameter. Here, the parameter $b$ determines the width of the sample space so Wilk'
38,964
Applying Wilks' theorem to uniform distribution
Wilks' theorem does not apply here Before getting to Wilks' theorem, one problem here (as with many questions about uniform distributions on this site) is that you have not taken account of the support of the uniform distribution in your mathematics, and this leads you to an incorrect form for the likelihood-ratio statistic. You didn't specify your alternative hypothesis, but I'm going to assume it is $H_\text{A}:b>1$ (i.e., a one-sided test). Given data $\mathbf{x} = (x_1,...,x_n)$ the likelihood function is: $$L_\mathbf{x}(b) = \frac{\mathbb{I}(x_{(n)} \leqslant b)}{b^n} \quad \quad \quad \quad \quad \text{for all } b > 0,$$ so the maximised likelihood over any parameter subspace $\mathscr{B} \subseteq (0, \infty)$ is: $$\begin{align} \hat{L}_\mathbf{x}(\mathscr{B}) \equiv \sup_{b \in \mathscr{B}} L_\mathbf{x}(b) &= \sup_{b \in \mathscr{B}} \frac{\mathbb{I}(x_{(n)} \leqslant b)}{b^n} \\[12pt] &= \begin{cases} (\inf \mathscr{B})^{-n} & \text{if } \mathscr{B} \cap [x_{(n)}, \infty) \neq \varnothing, \\[6pt] 0 & \text{if } \mathscr{B} \cap [x_{(n)}, \infty) = \varnothing. \\[6pt] \end{cases} \end{align}$$ (Note that this maximised likelihood is zero if there are no values $b \in \mathscr{B}$ with $b \geqslant x_{(n)}$.) Consequently, using the hypotheses $H_0:b=1$ versus $H_\text{A}:b>1$ you get: $$\begin{align} \hat{L}_\mathbf{x}(H_\text{A}) &= \hat{L}_\mathbf{x}((1,\infty)) = 1, \\[12pt] \hat{L}_\mathbf{x}(H_0) &= \hat{L}_\mathbf{x}([1]) = \mathbb{I}(x_{(n)} \leqslant 1). \end{align}$$ This gives the likelihood-ratio statistic: $$\begin{align} \Delta_{LR} \equiv 2 \log \Bigg( \frac{\hat{L}_\mathbf{x}(H_\text{A})}{\hat{L}_\mathbf{x}(H_0)} \Bigg) &= 2 [ \hat{\ell}_\mathbf{x}(H_\text{A}) - \hat{\ell}_\mathbf{x}(H_0) ] \\[12pt] &= 2 [ 0 - \log \mathbb{I}(x_{(n)} \leqslant 1)] \\[12pt] &= \begin{cases} 0 & & \text{if } x_{(n)} \leqslant 1, \\[6pt] \infty & & \text{if } x_{(n)} > 1. \\[6pt] \end{cases} \end{align}$$ This statistic has a distribution concentrated on two possible values, so it does not obey the approximate chi-squared distribution. The reason that Wilks' theorem does not apply to this case is that the maximising parameter values for each maximised likelihood value occur on the boundary of the parameter range rather than the interior of the parameter range.
Applying Wilks' theorem to uniform distribution
Wilks' theorem does not apply here Before getting to Wilks' theorem, one problem here (as with many questions about uniform distributions on this site) is that you have not taken account of the suppor
Applying Wilks' theorem to uniform distribution Wilks' theorem does not apply here Before getting to Wilks' theorem, one problem here (as with many questions about uniform distributions on this site) is that you have not taken account of the support of the uniform distribution in your mathematics, and this leads you to an incorrect form for the likelihood-ratio statistic. You didn't specify your alternative hypothesis, but I'm going to assume it is $H_\text{A}:b>1$ (i.e., a one-sided test). Given data $\mathbf{x} = (x_1,...,x_n)$ the likelihood function is: $$L_\mathbf{x}(b) = \frac{\mathbb{I}(x_{(n)} \leqslant b)}{b^n} \quad \quad \quad \quad \quad \text{for all } b > 0,$$ so the maximised likelihood over any parameter subspace $\mathscr{B} \subseteq (0, \infty)$ is: $$\begin{align} \hat{L}_\mathbf{x}(\mathscr{B}) \equiv \sup_{b \in \mathscr{B}} L_\mathbf{x}(b) &= \sup_{b \in \mathscr{B}} \frac{\mathbb{I}(x_{(n)} \leqslant b)}{b^n} \\[12pt] &= \begin{cases} (\inf \mathscr{B})^{-n} & \text{if } \mathscr{B} \cap [x_{(n)}, \infty) \neq \varnothing, \\[6pt] 0 & \text{if } \mathscr{B} \cap [x_{(n)}, \infty) = \varnothing. \\[6pt] \end{cases} \end{align}$$ (Note that this maximised likelihood is zero if there are no values $b \in \mathscr{B}$ with $b \geqslant x_{(n)}$.) Consequently, using the hypotheses $H_0:b=1$ versus $H_\text{A}:b>1$ you get: $$\begin{align} \hat{L}_\mathbf{x}(H_\text{A}) &= \hat{L}_\mathbf{x}((1,\infty)) = 1, \\[12pt] \hat{L}_\mathbf{x}(H_0) &= \hat{L}_\mathbf{x}([1]) = \mathbb{I}(x_{(n)} \leqslant 1). \end{align}$$ This gives the likelihood-ratio statistic: $$\begin{align} \Delta_{LR} \equiv 2 \log \Bigg( \frac{\hat{L}_\mathbf{x}(H_\text{A})}{\hat{L}_\mathbf{x}(H_0)} \Bigg) &= 2 [ \hat{\ell}_\mathbf{x}(H_\text{A}) - \hat{\ell}_\mathbf{x}(H_0) ] \\[12pt] &= 2 [ 0 - \log \mathbb{I}(x_{(n)} \leqslant 1)] \\[12pt] &= \begin{cases} 0 & & \text{if } x_{(n)} \leqslant 1, \\[6pt] \infty & & \text{if } x_{(n)} > 1. \\[6pt] \end{cases} \end{align}$$ This statistic has a distribution concentrated on two possible values, so it does not obey the approximate chi-squared distribution. The reason that Wilks' theorem does not apply to this case is that the maximising parameter values for each maximised likelihood value occur on the boundary of the parameter range rather than the interior of the parameter range.
Applying Wilks' theorem to uniform distribution Wilks' theorem does not apply here Before getting to Wilks' theorem, one problem here (as with many questions about uniform distributions on this site) is that you have not taken account of the suppor
38,965
Is (covariance) stationarity preserved under log or exponential transformation?
The underlying idea is that equality of moments does not survive nonlinear transformations. In particular, when two variables $X$ and $Y$ have the same moments (up to some finite order) and $f$ is a nonlinear transformation, there is no assurance that $f(X)$ and $f(Y)$ will have any of the same moments. Thus, when the marginal distributions of a weakly stationary process have different shapes, it's possible--even likely--that any given function of that process will produce a process that is not weakly stationary, even when the moments of everything involved are finite. Lest this seem like so much hand-waving, I will provide a rigorous example. For any number $a\ge 1$ let $\mathcal{D}(a)$ be the distribution assigning probability $1/(2a^2)$ to the values $2\pm a$ and putting the remaining probability of $1-a^2$ on the value $2.$ Compute that this distribution has expectation $$\frac{2-a}{2a^2} + \frac{2+a}{2a^2} + 2\left(1-\frac{1}{a^2}\right) = 2$$ and variance $$\frac{a^2}{2a^2} + \frac{a^2}{2a^2} + 0\left(1 - \frac{1}{a^2}\right) = 1$$ and notice that when $a\lt 2,$ the support of $\mathcal{D}$ is positive. Thus, all these distributions are bounded, of positive support, with equal means $(2)$ and equal variances $(1).$ When $X$ has distribution $\mathcal{D}(a)$ and $f$ is any transformation (a real-valued function of real numbers), compute that $$E[f(X)] = \frac{f(2-a)}{2a^2} + \frac{f(2+a)}{2a^2} + f(2)\left(1 - \frac{1}{a^2}\right).$$ For example, when $f$ is the exponential, $$E[e^X] = \frac{e^{2-a}}{2a^2} + \frac{e^{2+a}}{2a^2} + e^2\left(1 - \frac{1}{a^2}\right).\tag{*}$$ For $1\le a \lt 2,$ these values are all different. Here is a plot: A similar analysis applies to $\log(X),$ showing it exists and has finite moments but that its expectation varies with $a.$ Consider a sequence of independent random variables $(X_n)=X_1, X_2,X_3,\ldots$ (a discrete time-series process) for which $X_n$ has $\mathcal{D}(1 + \exp(-n))$ for its distribution. Because $2 \gt 1+\exp(-n)\gt 1,$ all these variables are positive and bounded above by $4.$ Thus their logarithms and exponentials exist. Since first and second moments of $(X_n)$ are finite and are equal, and all cross-moments are zero (by independence), this is a weakly stationary process. Nevertheless, as $(*)$ shows, the process $(e^{X_n})$ is not even weakly first-order stationary (despite having all finite moments) because its expectation varies with $n;$ and similarly $\log(X_n),$ although it is defined and has all finite moments, is also not weakly first-order stationary.
Is (covariance) stationarity preserved under log or exponential transformation?
The underlying idea is that equality of moments does not survive nonlinear transformations. In particular, when two variables $X$ and $Y$ have the same moments (up to some finite order) and $f$ is a
Is (covariance) stationarity preserved under log or exponential transformation? The underlying idea is that equality of moments does not survive nonlinear transformations. In particular, when two variables $X$ and $Y$ have the same moments (up to some finite order) and $f$ is a nonlinear transformation, there is no assurance that $f(X)$ and $f(Y)$ will have any of the same moments. Thus, when the marginal distributions of a weakly stationary process have different shapes, it's possible--even likely--that any given function of that process will produce a process that is not weakly stationary, even when the moments of everything involved are finite. Lest this seem like so much hand-waving, I will provide a rigorous example. For any number $a\ge 1$ let $\mathcal{D}(a)$ be the distribution assigning probability $1/(2a^2)$ to the values $2\pm a$ and putting the remaining probability of $1-a^2$ on the value $2.$ Compute that this distribution has expectation $$\frac{2-a}{2a^2} + \frac{2+a}{2a^2} + 2\left(1-\frac{1}{a^2}\right) = 2$$ and variance $$\frac{a^2}{2a^2} + \frac{a^2}{2a^2} + 0\left(1 - \frac{1}{a^2}\right) = 1$$ and notice that when $a\lt 2,$ the support of $\mathcal{D}$ is positive. Thus, all these distributions are bounded, of positive support, with equal means $(2)$ and equal variances $(1).$ When $X$ has distribution $\mathcal{D}(a)$ and $f$ is any transformation (a real-valued function of real numbers), compute that $$E[f(X)] = \frac{f(2-a)}{2a^2} + \frac{f(2+a)}{2a^2} + f(2)\left(1 - \frac{1}{a^2}\right).$$ For example, when $f$ is the exponential, $$E[e^X] = \frac{e^{2-a}}{2a^2} + \frac{e^{2+a}}{2a^2} + e^2\left(1 - \frac{1}{a^2}\right).\tag{*}$$ For $1\le a \lt 2,$ these values are all different. Here is a plot: A similar analysis applies to $\log(X),$ showing it exists and has finite moments but that its expectation varies with $a.$ Consider a sequence of independent random variables $(X_n)=X_1, X_2,X_3,\ldots$ (a discrete time-series process) for which $X_n$ has $\mathcal{D}(1 + \exp(-n))$ for its distribution. Because $2 \gt 1+\exp(-n)\gt 1,$ all these variables are positive and bounded above by $4.$ Thus their logarithms and exponentials exist. Since first and second moments of $(X_n)$ are finite and are equal, and all cross-moments are zero (by independence), this is a weakly stationary process. Nevertheless, as $(*)$ shows, the process $(e^{X_n})$ is not even weakly first-order stationary (despite having all finite moments) because its expectation varies with $n;$ and similarly $\log(X_n),$ although it is defined and has all finite moments, is also not weakly first-order stationary.
Is (covariance) stationarity preserved under log or exponential transformation? The underlying idea is that equality of moments does not survive nonlinear transformations. In particular, when two variables $X$ and $Y$ have the same moments (up to some finite order) and $f$ is a
38,966
Is (covariance) stationarity preserved under log or exponential transformation?
Weak stationarity is generally not preserved under exponential or logarithmic transformations. Exponential transformation Covariance (or weak) stationarity requires the second moment to be finite. If a random variable has a finite second moment, it is not guaranteed that the second (or even first) moment of its exponential transformation will be finite; think Student's $t(2+\varepsilon)$ distribution for a small $\varepsilon>0$. (See "Random variable with finite exponential first moment, infinite exponential variance" for details.) Thus, an exponential transformation can make a weakly stationary process nonstationary. Logarithmic transformation First of all, the logarithmic transformation needs to be well defined. For random variables that may take nonpositive values (e.g. a Normal random variable), this is violated. Hence, the logarithm of a stationary process with a Normal marginal distribution will not be a stationary process as it will not be well defined to begin with. Regarding the cases where the logarithmic transformation is well defined, an analogous problem to the case of the exponential transformation may arise. If the original random variable has a sufficiently high density for values very close to zero, taking a logarithm will make them explode into large negative numbers. Then the variance (and perhaps even the mean) might become infinite. (See "Random variable with finite logarithmic first moment, infinite logarithmic variance" for details.)
Is (covariance) stationarity preserved under log or exponential transformation?
Weak stationarity is generally not preserved under exponential or logarithmic transformations. Exponential transformation Covariance (or weak) stationarity requires the second moment to be finite. If
Is (covariance) stationarity preserved under log or exponential transformation? Weak stationarity is generally not preserved under exponential or logarithmic transformations. Exponential transformation Covariance (or weak) stationarity requires the second moment to be finite. If a random variable has a finite second moment, it is not guaranteed that the second (or even first) moment of its exponential transformation will be finite; think Student's $t(2+\varepsilon)$ distribution for a small $\varepsilon>0$. (See "Random variable with finite exponential first moment, infinite exponential variance" for details.) Thus, an exponential transformation can make a weakly stationary process nonstationary. Logarithmic transformation First of all, the logarithmic transformation needs to be well defined. For random variables that may take nonpositive values (e.g. a Normal random variable), this is violated. Hence, the logarithm of a stationary process with a Normal marginal distribution will not be a stationary process as it will not be well defined to begin with. Regarding the cases where the logarithmic transformation is well defined, an analogous problem to the case of the exponential transformation may arise. If the original random variable has a sufficiently high density for values very close to zero, taking a logarithm will make them explode into large negative numbers. Then the variance (and perhaps even the mean) might become infinite. (See "Random variable with finite logarithmic first moment, infinite logarithmic variance" for details.)
Is (covariance) stationarity preserved under log or exponential transformation? Weak stationarity is generally not preserved under exponential or logarithmic transformations. Exponential transformation Covariance (or weak) stationarity requires the second moment to be finite. If
38,967
Distribution of the ratio of a Normal distribution divided by Lognormal distribution
Finding a closed-form distribution for the product or ratio looks rather challenging, as even simple cases (zero mean and unit standard deviation) do not appear to produce closed forms. The other part of the question ... to find the moments of $Z = X/Y$ ... is readily solvable, assuming that $X$ and $Y$ are independent random variables. In particular, if $Y\sim \text{Lognormal}(\mu_{y},\sigma_{y})$, and $W = 1/Y$, then $W\sim \text{Lognormal}(-\mu_{y},\sigma_{y})$. Then, by independence: $$ E[Z^r] = E[X^r] \, E[W^r]$$ which is the product of the $r^\text{th}$ moment of a Normal random variable and the $r^\text{th}$ moment of a Lognormal random variable, both of which are standard results readily available in any textbook or wiki etc
Distribution of the ratio of a Normal distribution divided by Lognormal distribution
Finding a closed-form distribution for the product or ratio looks rather challenging, as even simple cases (zero mean and unit standard deviation) do not appear to produce closed forms. The other part
Distribution of the ratio of a Normal distribution divided by Lognormal distribution Finding a closed-form distribution for the product or ratio looks rather challenging, as even simple cases (zero mean and unit standard deviation) do not appear to produce closed forms. The other part of the question ... to find the moments of $Z = X/Y$ ... is readily solvable, assuming that $X$ and $Y$ are independent random variables. In particular, if $Y\sim \text{Lognormal}(\mu_{y},\sigma_{y})$, and $W = 1/Y$, then $W\sim \text{Lognormal}(-\mu_{y},\sigma_{y})$. Then, by independence: $$ E[Z^r] = E[X^r] \, E[W^r]$$ which is the product of the $r^\text{th}$ moment of a Normal random variable and the $r^\text{th}$ moment of a Lognormal random variable, both of which are standard results readily available in any textbook or wiki etc
Distribution of the ratio of a Normal distribution divided by Lognormal distribution Finding a closed-form distribution for the product or ratio looks rather challenging, as even simple cases (zero mean and unit standard deviation) do not appear to produce closed forms. The other part
38,968
Distribution of the ratio of a Normal distribution divided by Lognormal distribution
The density of $Z$ is $$f(z)=\frac{1}{2\pi\sigma_x\sigma_y}\int_0^\infty \exp\{ -[zy-\mu_x]^2/2\sigma_x^2-[\log(y)-\mu_y]^2/2\sigma_y^2\}~\text dy$$ since the Jacobian of turning $(x,y)$ into $(zy,y)$ is $y$.
Distribution of the ratio of a Normal distribution divided by Lognormal distribution
The density of $Z$ is $$f(z)=\frac{1}{2\pi\sigma_x\sigma_y}\int_0^\infty \exp\{ -[zy-\mu_x]^2/2\sigma_x^2-[\log(y)-\mu_y]^2/2\sigma_y^2\}~\text dy$$ since the Jacobian of turning $(x,y)$ into $(zy,y)$
Distribution of the ratio of a Normal distribution divided by Lognormal distribution The density of $Z$ is $$f(z)=\frac{1}{2\pi\sigma_x\sigma_y}\int_0^\infty \exp\{ -[zy-\mu_x]^2/2\sigma_x^2-[\log(y)-\mu_y]^2/2\sigma_y^2\}~\text dy$$ since the Jacobian of turning $(x,y)$ into $(zy,y)$ is $y$.
Distribution of the ratio of a Normal distribution divided by Lognormal distribution The density of $Z$ is $$f(z)=\frac{1}{2\pi\sigma_x\sigma_y}\int_0^\infty \exp\{ -[zy-\mu_x]^2/2\sigma_x^2-[\log(y)-\mu_y]^2/2\sigma_y^2\}~\text dy$$ since the Jacobian of turning $(x,y)$ into $(zy,y)$
38,969
Using two sensors instead of one: Statistically meaningful?
Intuitively, if the noise and measurement errors from your sensors are independent and have zero mean, then using multiple sensors will improve the signal to noise ratio because the noise and errors will tend to cancel each other out as you increase the number of sensors. There is an interesting parallel to be made with the concept of ensembling in machine learning: Averaging the output of multiple models will improve accuracy for similar reasons (They reduce the variance that is inherent in a single model). So you can check the math underlying ensemble prediction methods to figure out a similar mathematical justification to using multiple sensors. Look for example at how Random Forests work as ensembles of high variance decision trees. But, but...this only works if the noise and errors are independent and zero mean. Often times in lab and industrial instrumentation situations, the noise and errors have some systemic environmental cause or are due to flaws in the measurement process which is introducing a non-zero mean bias to your model, so a more in-depth analysis is necessary than simply averaging the output of multiple censors.
Using two sensors instead of one: Statistically meaningful?
Intuitively, if the noise and measurement errors from your sensors are independent and have zero mean, then using multiple sensors will improve the signal to noise ratio because the noise and errors w
Using two sensors instead of one: Statistically meaningful? Intuitively, if the noise and measurement errors from your sensors are independent and have zero mean, then using multiple sensors will improve the signal to noise ratio because the noise and errors will tend to cancel each other out as you increase the number of sensors. There is an interesting parallel to be made with the concept of ensembling in machine learning: Averaging the output of multiple models will improve accuracy for similar reasons (They reduce the variance that is inherent in a single model). So you can check the math underlying ensemble prediction methods to figure out a similar mathematical justification to using multiple sensors. Look for example at how Random Forests work as ensembles of high variance decision trees. But, but...this only works if the noise and errors are independent and zero mean. Often times in lab and industrial instrumentation situations, the noise and errors have some systemic environmental cause or are due to flaws in the measurement process which is introducing a non-zero mean bias to your model, so a more in-depth analysis is necessary than simply averaging the output of multiple censors.
Using two sensors instead of one: Statistically meaningful? Intuitively, if the noise and measurement errors from your sensors are independent and have zero mean, then using multiple sensors will improve the signal to noise ratio because the noise and errors w
38,970
Using two sensors instead of one: Statistically meaningful?
Sensor fusion via a Kalman filter takes 2 (or more) separate measurements, combines them within the filter calculations, and outputs a smoother/more accurate measurement of the underlying. Some good stuff online about this, e.g. https://simondlevy.academic.wlu.edu/kalman-tutorial/the-extended-kalman-filter-an-interactive-tutorial-for-non-experts-part-14/
Using two sensors instead of one: Statistically meaningful?
Sensor fusion via a Kalman filter takes 2 (or more) separate measurements, combines them within the filter calculations, and outputs a smoother/more accurate measurement of the underlying. Some good s
Using two sensors instead of one: Statistically meaningful? Sensor fusion via a Kalman filter takes 2 (or more) separate measurements, combines them within the filter calculations, and outputs a smoother/more accurate measurement of the underlying. Some good stuff online about this, e.g. https://simondlevy.academic.wlu.edu/kalman-tutorial/the-extended-kalman-filter-an-interactive-tutorial-for-non-experts-part-14/
Using two sensors instead of one: Statistically meaningful? Sensor fusion via a Kalman filter takes 2 (or more) separate measurements, combines them within the filter calculations, and outputs a smoother/more accurate measurement of the underlying. Some good s
38,971
What is the variance of Y = AX where A is a matrix?
This (linear transform) is typically listed as a property of covariance, but easy to show as well: $$\begin{align}\operatorname{cov}(AX)&=\mathbb E[AXX^TA^T]-\mathbb E[AX]\mathbb E[X^TA^T]\\&=A\mathbb E[XX^T]A^T-A\mathbb E[X]\mathbb E[X^T]A^T\\&=A(\mathbb E[XX^T]-\mathbb E[X]\mathbb E[X^T])A^T\\&=ADA^T\end{align}$$
What is the variance of Y = AX where A is a matrix?
This (linear transform) is typically listed as a property of covariance, but easy to show as well: $$\begin{align}\operatorname{cov}(AX)&=\mathbb E[AXX^TA^T]-\mathbb E[AX]\mathbb E[X^TA^T]\\&=A\mathbb
What is the variance of Y = AX where A is a matrix? This (linear transform) is typically listed as a property of covariance, but easy to show as well: $$\begin{align}\operatorname{cov}(AX)&=\mathbb E[AXX^TA^T]-\mathbb E[AX]\mathbb E[X^TA^T]\\&=A\mathbb E[XX^T]A^T-A\mathbb E[X]\mathbb E[X^T]A^T\\&=A(\mathbb E[XX^T]-\mathbb E[X]\mathbb E[X^T])A^T\\&=ADA^T\end{align}$$
What is the variance of Y = AX where A is a matrix? This (linear transform) is typically listed as a property of covariance, but easy to show as well: $$\begin{align}\operatorname{cov}(AX)&=\mathbb E[AXX^TA^T]-\mathbb E[AX]\mathbb E[X^TA^T]\\&=A\mathbb
38,972
For a time series problem, Why is it preferrable to use a time series model over a model without an explicit time component?
Yes, in principle your "classical" approaches would catch periodicities and autocorrelations as well. Fitting an AR time series model is not that much different from OLS regressing the actuals on lagged values of the actuals, after all. However: Suppose you run a standard linear regression with day, month and year as predictors. Your regression will not understand that a predictor setting (1, 3, 2020) is very similar to (29, 2, 2020). Yes, the third predictor is identical, but the other two are not, and the difference in the fit will be $28\hat{\beta}_{\text{Day}}+\hat{\beta}_{\text{Month}}$. Compare this to the difference in the fits for a predictor setting of (28, 2, 2020) versus (29, 2, 2020), which is just $\hat{\beta}_{\text{Day}}$, although the two pairs of predictor settings are both spaced just one day apart. Also, regression has no idea of autoregression. Of course, you can hand-craft your regression, by including a day counter to account for the first fact above, and lagged values of the outcome to account for autoregression. But this will be a lot of work, and it will actually not be mathematically optimal. Now suppose you look at a decision tree, or possibly a Random Forest. Yes, this should be able to learn interactions between predictors, like the difference between (1, 3, 2020) and (29, 2, 2020) above. However, it will need a lot of data to do so. Much more than if you just used a time series approach. Bottom line: you can either use a specific tool for the job (time series analysis), or adapt other tools (regression with a lot of predictor adaptation), or use very general tools that will then require a lot of data (CARTs and Random Forests).
For a time series problem, Why is it preferrable to use a time series model over a model without an
Yes, in principle your "classical" approaches would catch periodicities and autocorrelations as well. Fitting an AR time series model is not that much different from OLS regressing the actuals on lagg
For a time series problem, Why is it preferrable to use a time series model over a model without an explicit time component? Yes, in principle your "classical" approaches would catch periodicities and autocorrelations as well. Fitting an AR time series model is not that much different from OLS regressing the actuals on lagged values of the actuals, after all. However: Suppose you run a standard linear regression with day, month and year as predictors. Your regression will not understand that a predictor setting (1, 3, 2020) is very similar to (29, 2, 2020). Yes, the third predictor is identical, but the other two are not, and the difference in the fit will be $28\hat{\beta}_{\text{Day}}+\hat{\beta}_{\text{Month}}$. Compare this to the difference in the fits for a predictor setting of (28, 2, 2020) versus (29, 2, 2020), which is just $\hat{\beta}_{\text{Day}}$, although the two pairs of predictor settings are both spaced just one day apart. Also, regression has no idea of autoregression. Of course, you can hand-craft your regression, by including a day counter to account for the first fact above, and lagged values of the outcome to account for autoregression. But this will be a lot of work, and it will actually not be mathematically optimal. Now suppose you look at a decision tree, or possibly a Random Forest. Yes, this should be able to learn interactions between predictors, like the difference between (1, 3, 2020) and (29, 2, 2020) above. However, it will need a lot of data to do so. Much more than if you just used a time series approach. Bottom line: you can either use a specific tool for the job (time series analysis), or adapt other tools (regression with a lot of predictor adaptation), or use very general tools that will then require a lot of data (CARTs and Random Forests).
For a time series problem, Why is it preferrable to use a time series model over a model without an Yes, in principle your "classical" approaches would catch periodicities and autocorrelations as well. Fitting an AR time series model is not that much different from OLS regressing the actuals on lagg
38,973
For a time series problem, Why is it preferrable to use a time series model over a model without an explicit time component?
Superficially, the time series approach is more convenient mathematically, whereas the human date is more convenient for presenting the data/results. On a deeper level, as you correctly noted, one could use day, month and year as three independent variables, particularly, especially if there are reasons to think that there are periodic variations (e.g., seasonal or related to the cycle of the solar activity). Whether it improves or worsens the things depends a) on the method used to analyze the time series (is it capable of capturing periodic movements on the scale of a year or several years?) and on the amount of data (more variables means more parameters, so this increase the risk of overfitting.)
For a time series problem, Why is it preferrable to use a time series model over a model without an
Superficially, the time series approach is more convenient mathematically, whereas the human date is more convenient for presenting the data/results. On a deeper level, as you correctly noted, one cou
For a time series problem, Why is it preferrable to use a time series model over a model without an explicit time component? Superficially, the time series approach is more convenient mathematically, whereas the human date is more convenient for presenting the data/results. On a deeper level, as you correctly noted, one could use day, month and year as three independent variables, particularly, especially if there are reasons to think that there are periodic variations (e.g., seasonal or related to the cycle of the solar activity). Whether it improves or worsens the things depends a) on the method used to analyze the time series (is it capable of capturing periodic movements on the scale of a year or several years?) and on the amount of data (more variables means more parameters, so this increase the risk of overfitting.)
For a time series problem, Why is it preferrable to use a time series model over a model without an Superficially, the time series approach is more convenient mathematically, whereas the human date is more convenient for presenting the data/results. On a deeper level, as you correctly noted, one cou
38,974
For a time series problem, Why is it preferrable to use a time series model over a model without an explicit time component?
If you think that the impact of X on y changes over time regression will not work (well, OLS won't). Autocorrelation is another problem inherent in time series data although special SE have been developed to address that. If Y influences itself over time then linear regression (non-time series) is not going to work correctly either I believe.
For a time series problem, Why is it preferrable to use a time series model over a model without an
If you think that the impact of X on y changes over time regression will not work (well, OLS won't). Autocorrelation is another problem inherent in time series data although special SE have been devel
For a time series problem, Why is it preferrable to use a time series model over a model without an explicit time component? If you think that the impact of X on y changes over time regression will not work (well, OLS won't). Autocorrelation is another problem inherent in time series data although special SE have been developed to address that. If Y influences itself over time then linear regression (non-time series) is not going to work correctly either I believe.
For a time series problem, Why is it preferrable to use a time series model over a model without an If you think that the impact of X on y changes over time regression will not work (well, OLS won't). Autocorrelation is another problem inherent in time series data although special SE have been devel
38,975
What math classes are relevant for machine learning? [closed]
A great professional of machine learning should know a mix of the ingredients that make up the Computer Scientist and Statistician. Furthermore, It should also know some math to be able to realy learn these subjects. Math 1) Calculus in $\mathbb{R}^n$ and Optimization (diferential calculus, interior optimization, properties of gradients, constraint optimization, integrals (to know how to calculate expected values)). Calculus 2) Math analysis Mathematical analysis 3) Linear Algebra (The more you know, the better. Solutions of linear systems, inverses and pseudo inverses, decompositions, vector spaces, linear transformations) Linear algebra Linear algebra and optimization 4) Numerical Calculus and analysis (solution of linear and non-linear systems, numerical solutions of eigenvectors/eigenvectors, several gradient methods) Scientific computing Numerical analysis 5) Notions of Applied Functional Analysis (for example, Banach Fixed Point Theorem, Hilbert Spaces Projection Theorem) Functional analysis 6) Convex optimization and optimization (theory and numerical analysis) Convex optimization Optimization 7) Measure theory (to understand the details of probability theory) Concise and great measure theory Related knowledge: 1) Probability Theory and Statistics Probability theory Introduction to probability Statistical inference Statistical learning Monte Carlo methods Bayesian theory Bayesian analysis 2) Multivariate statistics (for example, principal component analysis) Multivariate statistics 3) Regression models (linear regression, binary response) Introductory econometrics Intermediate econometrics: lots of interesting models Generalized linear models 4) Time series A very good introduction Hamilton: The bible With deep math 5) Neural network models (classic problems and also those that include Deep Learning) Classical neural networks (preparation for deep learning) Deep learning 6) Lots of computer programming (structured, functional and object oriented programming, pattern design) Think python Functional programming OOP and Design pattern A great book of design pattern 7) Algorithms (algorithms and algorithm complexity). Levitin Cormen Kleinberg 8) Reinforcement learning (Dynamic Programming and Monte Carlo methods) Putterman: Math Suton and Barto: Computation 9) Languages: Python and R Think python Advanced R 10) Database: MySQL, PostgreSQL and Hadoop Data base systems Beautiful database in python More database Finally, you need to have practical experience. Nothing better than connecting with a community that has the same interests as you. You can also face competitions. Most of this answer comes from a previous answers 1 and 2 that I gave to this (Brazilian) site. I must have forgotten lots of great references... Sorry about that.
What math classes are relevant for machine learning? [closed]
A great professional of machine learning should know a mix of the ingredients that make up the Computer Scientist and Statistician. Furthermore, It should also know some math to be able to realy learn
What math classes are relevant for machine learning? [closed] A great professional of machine learning should know a mix of the ingredients that make up the Computer Scientist and Statistician. Furthermore, It should also know some math to be able to realy learn these subjects. Math 1) Calculus in $\mathbb{R}^n$ and Optimization (diferential calculus, interior optimization, properties of gradients, constraint optimization, integrals (to know how to calculate expected values)). Calculus 2) Math analysis Mathematical analysis 3) Linear Algebra (The more you know, the better. Solutions of linear systems, inverses and pseudo inverses, decompositions, vector spaces, linear transformations) Linear algebra Linear algebra and optimization 4) Numerical Calculus and analysis (solution of linear and non-linear systems, numerical solutions of eigenvectors/eigenvectors, several gradient methods) Scientific computing Numerical analysis 5) Notions of Applied Functional Analysis (for example, Banach Fixed Point Theorem, Hilbert Spaces Projection Theorem) Functional analysis 6) Convex optimization and optimization (theory and numerical analysis) Convex optimization Optimization 7) Measure theory (to understand the details of probability theory) Concise and great measure theory Related knowledge: 1) Probability Theory and Statistics Probability theory Introduction to probability Statistical inference Statistical learning Monte Carlo methods Bayesian theory Bayesian analysis 2) Multivariate statistics (for example, principal component analysis) Multivariate statistics 3) Regression models (linear regression, binary response) Introductory econometrics Intermediate econometrics: lots of interesting models Generalized linear models 4) Time series A very good introduction Hamilton: The bible With deep math 5) Neural network models (classic problems and also those that include Deep Learning) Classical neural networks (preparation for deep learning) Deep learning 6) Lots of computer programming (structured, functional and object oriented programming, pattern design) Think python Functional programming OOP and Design pattern A great book of design pattern 7) Algorithms (algorithms and algorithm complexity). Levitin Cormen Kleinberg 8) Reinforcement learning (Dynamic Programming and Monte Carlo methods) Putterman: Math Suton and Barto: Computation 9) Languages: Python and R Think python Advanced R 10) Database: MySQL, PostgreSQL and Hadoop Data base systems Beautiful database in python More database Finally, you need to have practical experience. Nothing better than connecting with a community that has the same interests as you. You can also face competitions. Most of this answer comes from a previous answers 1 and 2 that I gave to this (Brazilian) site. I must have forgotten lots of great references... Sorry about that.
What math classes are relevant for machine learning? [closed] A great professional of machine learning should know a mix of the ingredients that make up the Computer Scientist and Statistician. Furthermore, It should also know some math to be able to realy learn
38,976
Right-skewed distribution with mean equals to mode?
Easy examples come from binomial distributions -- which can hardly be dismissed as pathological or as bizarre counter-examples constructed ad hoc. Here is one for 10 trials and probability of success 0.1. Then the mean is 10 $\times$ 0.1 = 1, and 1 also is the mode (and for a bonus the median too), but the distribution is manifestly right skewed. The code giving the number of successes 0 to 10 and their probabilities 0.348678... and so forth is Mata code from Stata, but your favourite statistical platform should be able to do it. (If not, you need a new favourite.) : (0::10), binomialp(10, (0::10), 0.1) 1 2 +-----------------------------+ 1 | 0 .3486784401 | 2 | 1 .387420489 | 3 | 2 .1937102445 | 4 | 3 .057395628 | 5 | 4 .011160261 | 6 | 5 .0014880348 | 7 | 6 .000137781 | 8 | 7 8.74800e-06 | 9 | 8 3.64500e-07 | 10 | 9 9.00000e-09 | 11 | 10 1.00000e-10 | +-----------------------------+ Among continuous distributions, the Weibull distribution can show equal mean and mode yet be right-skewed.
Right-skewed distribution with mean equals to mode?
Easy examples come from binomial distributions -- which can hardly be dismissed as pathological or as bizarre counter-examples constructed ad hoc. Here is one for 10 trials and probability of success
Right-skewed distribution with mean equals to mode? Easy examples come from binomial distributions -- which can hardly be dismissed as pathological or as bizarre counter-examples constructed ad hoc. Here is one for 10 trials and probability of success 0.1. Then the mean is 10 $\times$ 0.1 = 1, and 1 also is the mode (and for a bonus the median too), but the distribution is manifestly right skewed. The code giving the number of successes 0 to 10 and their probabilities 0.348678... and so forth is Mata code from Stata, but your favourite statistical platform should be able to do it. (If not, you need a new favourite.) : (0::10), binomialp(10, (0::10), 0.1) 1 2 +-----------------------------+ 1 | 0 .3486784401 | 2 | 1 .387420489 | 3 | 2 .1937102445 | 4 | 3 .057395628 | 5 | 4 .011160261 | 6 | 5 .0014880348 | 7 | 6 .000137781 | 8 | 7 8.74800e-06 | 9 | 8 3.64500e-07 | 10 | 9 9.00000e-09 | 11 | 10 1.00000e-10 | +-----------------------------+ Among continuous distributions, the Weibull distribution can show equal mean and mode yet be right-skewed.
Right-skewed distribution with mean equals to mode? Easy examples come from binomial distributions -- which can hardly be dismissed as pathological or as bizarre counter-examples constructed ad hoc. Here is one for 10 trials and probability of success
38,977
Right-skewed distribution with mean equals to mode?
If the distribution is discrete, sure. It's easy. For example, a distribution with probability mass function $P(X=0) = 0.36$ $P(X=1) = 0.40$ $P(X=2) = 0.13$ $P(X=3) = 0.10$ $P(X=4) = 0.01$ is right (i.e. positively) skewed and has both a mean and a mode of 1.
Right-skewed distribution with mean equals to mode?
If the distribution is discrete, sure. It's easy. For example, a distribution with probability mass function $P(X=0) = 0.36$ $P(X=1) = 0.40$ $P(X=2) = 0.13$ $P(X=3) = 0.10$ $P(X=4) = 0.01$ is r
Right-skewed distribution with mean equals to mode? If the distribution is discrete, sure. It's easy. For example, a distribution with probability mass function $P(X=0) = 0.36$ $P(X=1) = 0.40$ $P(X=2) = 0.13$ $P(X=3) = 0.10$ $P(X=4) = 0.01$ is right (i.e. positively) skewed and has both a mean and a mode of 1.
Right-skewed distribution with mean equals to mode? If the distribution is discrete, sure. It's easy. For example, a distribution with probability mass function $P(X=0) = 0.36$ $P(X=1) = 0.40$ $P(X=2) = 0.13$ $P(X=3) = 0.10$ $P(X=4) = 0.01$ is r
38,978
What are the benefits of layer-specific learning rates?
Here is a great article on this topic: Basically, it usually makes training faster. The first layers are usually good enough, so the learning rate for them could be lower, but the last layers need to be tuned for out dataset, so lr should be higher.
What are the benefits of layer-specific learning rates?
Here is a great article on this topic: Basically, it usually makes training faster. The first layers are usually good enough, so the learning rate for them could be lower, but the last layers need to
What are the benefits of layer-specific learning rates? Here is a great article on this topic: Basically, it usually makes training faster. The first layers are usually good enough, so the learning rate for them could be lower, but the last layers need to be tuned for out dataset, so lr should be higher.
What are the benefits of layer-specific learning rates? Here is a great article on this topic: Basically, it usually makes training faster. The first layers are usually good enough, so the learning rate for them could be lower, but the last layers need to
38,979
What are the benefits of layer-specific learning rates?
The layer-specific learning rates help in overcoming the slow learning (thus slow training) problem in deep neural networks. As stated in the paper Layer-Specific Adaptive Learning Rates for Deep Networks: When the gradient descent methods are used to train deep networks, additional problems are introduced. As the number of layers in a network increases, the gradients that are propagated back to the initial layers get very small (vanishing gradient problem). This dramatically slows down the rate of learning in the initial layers and slows down the convergence of the whole network. The learning rates specific to each layer in the network allows larger learning rates to compensate for the small size of gradients in shallow layers (layers near the input layer). This method also helps in transfer learning as stated in the answer by @Andrey based on the blog post. -- check discriminative fine-tuning by Jeremy Howard and post on CaffeNet. The intuition is that in the layers closer to the input layer are more likely to have learned more general features -- such as lines and edges, which we won’t want to change much. Thus, we set their learning rate low. On the other hand, in case of later layers of the model -- which learn the detailed features, we increase the learning rate -- to let the new layers learn fast.
What are the benefits of layer-specific learning rates?
The layer-specific learning rates help in overcoming the slow learning (thus slow training) problem in deep neural networks. As stated in the paper Layer-Specific Adaptive Learning Rates for Deep Netw
What are the benefits of layer-specific learning rates? The layer-specific learning rates help in overcoming the slow learning (thus slow training) problem in deep neural networks. As stated in the paper Layer-Specific Adaptive Learning Rates for Deep Networks: When the gradient descent methods are used to train deep networks, additional problems are introduced. As the number of layers in a network increases, the gradients that are propagated back to the initial layers get very small (vanishing gradient problem). This dramatically slows down the rate of learning in the initial layers and slows down the convergence of the whole network. The learning rates specific to each layer in the network allows larger learning rates to compensate for the small size of gradients in shallow layers (layers near the input layer). This method also helps in transfer learning as stated in the answer by @Andrey based on the blog post. -- check discriminative fine-tuning by Jeremy Howard and post on CaffeNet. The intuition is that in the layers closer to the input layer are more likely to have learned more general features -- such as lines and edges, which we won’t want to change much. Thus, we set their learning rate low. On the other hand, in case of later layers of the model -- which learn the detailed features, we increase the learning rate -- to let the new layers learn fast.
What are the benefits of layer-specific learning rates? The layer-specific learning rates help in overcoming the slow learning (thus slow training) problem in deep neural networks. As stated in the paper Layer-Specific Adaptive Learning Rates for Deep Netw
38,980
What does the angle bracket mean in variance formula?
It's the expected value of $(X-\mu)^2$, i.e., it's the same as $\sigma^2=E[(X-\mu)^2]$.
What does the angle bracket mean in variance formula?
It's the expected value of $(X-\mu)^2$, i.e., it's the same as $\sigma^2=E[(X-\mu)^2]$.
What does the angle bracket mean in variance formula? It's the expected value of $(X-\mu)^2$, i.e., it's the same as $\sigma^2=E[(X-\mu)^2]$.
What does the angle bracket mean in variance formula? It's the expected value of $(X-\mu)^2$, i.e., it's the same as $\sigma^2=E[(X-\mu)^2]$.
38,981
What does the angle bracket mean in variance formula?
It means an inner product for the multi-dimensional case. When $X \in \mathbb{R}^n$ and $n \geq 2$ and want to define variance, the definition of the variance is related to the inner product of $X-\mu$ to itself, and denoted as $\langle X-\mu, X-\mu\rangle$
What does the angle bracket mean in variance formula?
It means an inner product for the multi-dimensional case. When $X \in \mathbb{R}^n$ and $n \geq 2$ and want to define variance, the definition of the variance is related to the inner product of $X-\mu
What does the angle bracket mean in variance formula? It means an inner product for the multi-dimensional case. When $X \in \mathbb{R}^n$ and $n \geq 2$ and want to define variance, the definition of the variance is related to the inner product of $X-\mu$ to itself, and denoted as $\langle X-\mu, X-\mu\rangle$
What does the angle bracket mean in variance formula? It means an inner product for the multi-dimensional case. When $X \in \mathbb{R}^n$ and $n \geq 2$ and want to define variance, the definition of the variance is related to the inner product of $X-\mu
38,982
How do you multiply two conditional probabilities?
Those two expressions simply mean: (the Probability of event $a$ given the events $b$ and $c$) $\times$ (the Probability of event $b$ given event $c$). The two terms are probabilities which are scalar values between the 0 and 1 (including 0 and 1). So you simply multiply the two values together as you would any two numbers. So for example, if the probability of $a$, given $b$ and $c$ were 0.40 and the probability of $b$ given $c$ where .70, then: $P(a|b,c)·P(b|c)=0.40\times0.70=0.28$ UPDATED BASED ON YOUR EDITED QUESTION: The proof is straight-forward and is based on three applications of the the definition of conditional probability, which states that if $D$ and $E$ are two events in space $S$, and $P(E)>0$, then the conditional probability of $D$ given $E$, written by $P(D|E)$ is $\frac{P(DE)}{P(E)}$ \begin{eqnarray*} P(a|bc)P(b|c) & = & P(a|bc)\frac{P(bc)}{P(c)}\\ & = & \frac{P(abc)}{P(bc)}\frac{P(bc)}{P(c)}\\ & = & \frac{P(abc)}{P(c)}\\ & = & \frac{P[(ab)c]}{P(c)}\\ & = & P(ab|c) \end{eqnarray*} So, in all, we have: \begin{eqnarray*} P(a|bc)P(b|c) & = & P(ab|c) \end{eqnarray*}
How do you multiply two conditional probabilities?
Those two expressions simply mean: (the Probability of event $a$ given the events $b$ and $c$) $\times$ (the Probability of event $b$ given event $c$). The two terms are probabilities which are sca
How do you multiply two conditional probabilities? Those two expressions simply mean: (the Probability of event $a$ given the events $b$ and $c$) $\times$ (the Probability of event $b$ given event $c$). The two terms are probabilities which are scalar values between the 0 and 1 (including 0 and 1). So you simply multiply the two values together as you would any two numbers. So for example, if the probability of $a$, given $b$ and $c$ were 0.40 and the probability of $b$ given $c$ where .70, then: $P(a|b,c)·P(b|c)=0.40\times0.70=0.28$ UPDATED BASED ON YOUR EDITED QUESTION: The proof is straight-forward and is based on three applications of the the definition of conditional probability, which states that if $D$ and $E$ are two events in space $S$, and $P(E)>0$, then the conditional probability of $D$ given $E$, written by $P(D|E)$ is $\frac{P(DE)}{P(E)}$ \begin{eqnarray*} P(a|bc)P(b|c) & = & P(a|bc)\frac{P(bc)}{P(c)}\\ & = & \frac{P(abc)}{P(bc)}\frac{P(bc)}{P(c)}\\ & = & \frac{P(abc)}{P(c)}\\ & = & \frac{P[(ab)c]}{P(c)}\\ & = & P(ab|c) \end{eqnarray*} So, in all, we have: \begin{eqnarray*} P(a|bc)P(b|c) & = & P(ab|c) \end{eqnarray*}
How do you multiply two conditional probabilities? Those two expressions simply mean: (the Probability of event $a$ given the events $b$ and $c$) $\times$ (the Probability of event $b$ given event $c$). The two terms are probabilities which are sca
38,983
How do you multiply two conditional probabilities?
If you don't know the probabilities $P(a|b,c)$ or $P(b|c)$ themselves, you can try to reformulate them in terms of probabilities that you do know. The chain rule, or Baye's theorem would be useful for doing so. For example, by the chain rule: $$ P(a,b,c) = P(a|b,c) P(b|c) P(c) $$ which would imply: $$ P(a|b,c) P(b|c) = \frac{P(a,b,c)}{P(c)} $$ so if you had the probabilities $P(a,b,c)$ and $P(c)$, you would be able to calculate the product of $P(a|b,c)$ and $P(b|c)$.
How do you multiply two conditional probabilities?
If you don't know the probabilities $P(a|b,c)$ or $P(b|c)$ themselves, you can try to reformulate them in terms of probabilities that you do know. The chain rule, or Baye's theorem would be useful for
How do you multiply two conditional probabilities? If you don't know the probabilities $P(a|b,c)$ or $P(b|c)$ themselves, you can try to reformulate them in terms of probabilities that you do know. The chain rule, or Baye's theorem would be useful for doing so. For example, by the chain rule: $$ P(a,b,c) = P(a|b,c) P(b|c) P(c) $$ which would imply: $$ P(a|b,c) P(b|c) = \frac{P(a,b,c)}{P(c)} $$ so if you had the probabilities $P(a,b,c)$ and $P(c)$, you would be able to calculate the product of $P(a|b,c)$ and $P(b|c)$.
How do you multiply two conditional probabilities? If you don't know the probabilities $P(a|b,c)$ or $P(b|c)$ themselves, you can try to reformulate them in terms of probabilities that you do know. The chain rule, or Baye's theorem would be useful for
38,984
Subtracting very small probabilities - How to compute? [duplicate]
To see how to deal with differences of this kind, we first note a useful mathematical result concerning differences of exponentials: $$\begin{equation} \begin{aligned} \exp(\ell_1) - \exp(\ell_2) &= \exp(\ell_1) (1 - \exp(-(\ell_1 - \ell_2))). \\[6pt] \end{aligned} \end{equation}$$ This result converts the difference to a product, which allows us to present the log-difference as: $$\begin{equation} \begin{aligned} \ell_- &= \ln \big( \exp(\ell_1) - \exp(\ell_2) \big) \\[6pt] &= \ln \big( \exp(\ell_1) (1 - \exp(-(\ell_1 - \ell_2))) \big) \\[6pt] &= \ell_1 + \ln (1 - \exp(-(\ell_1 - \ell_2))). \\[6pt] \end{aligned} \end{equation}$$ In the case where $\ell_1 = \ell_2$ we obtain the expression $\ell_+ = \ell_1 + \ln 0 = -\infty$. Using the Maclaurin series expansion for $\ln(1-x)$ we obtain the formula: $$\begin{equation} \begin{aligned} \ell_- &= \ell_1 - \sum_{k=1}^\infty \frac{\exp(-k(\ell_1 - \ell_2))}{k} \quad \quad \quad \text{for } \ell_1 \neq \ell_2. \\[6pt] \end{aligned} \end{equation}$$ Since $\exp(-(\ell_1 - \ell_2)) < 1$ the terms in this expansion diminish rapidly (faster than exponential decay). If $\ell_1 - \ell_2$ is large then the terms diminish particularly rapid. In any case, this expression allows us to compute the log-sum to any desired level of accuracy by truncating the infinite sum to a desired number of terms. Implementation in base R: It is possible to compute this log-difference accurately in base R using the log1p function. This is a primitive function in the base package that computes the value of $\ln(1+x)$ for an argument $x$ (with accurate computation even for $x \ll 1$). This primitive function can be used to give a simple function for the log-difference: logdiff <- function(l1, l2) { l1 + log1p(-exp(-(l1-l2))); } Implementation with VGAM package: Machler (2012) analyses accuracy issues in evaluating the function $\ln(1-\exp(-|x|))$, and suggests that use of the base R functions may involve a loss of accuracy. It is possible to compute this log-difference more accurately in using the log1mexp function in the VGAM package. This gives you the an alternative function for the log-difference: logdiff <- function(l1, l2) { l1 + VGAM::log1mexp(l1-l2); }
Subtracting very small probabilities - How to compute? [duplicate]
To see how to deal with differences of this kind, we first note a useful mathematical result concerning differences of exponentials: $$\begin{equation} \begin{aligned} \exp(\ell_1) - \exp(\ell_2) &=
Subtracting very small probabilities - How to compute? [duplicate] To see how to deal with differences of this kind, we first note a useful mathematical result concerning differences of exponentials: $$\begin{equation} \begin{aligned} \exp(\ell_1) - \exp(\ell_2) &= \exp(\ell_1) (1 - \exp(-(\ell_1 - \ell_2))). \\[6pt] \end{aligned} \end{equation}$$ This result converts the difference to a product, which allows us to present the log-difference as: $$\begin{equation} \begin{aligned} \ell_- &= \ln \big( \exp(\ell_1) - \exp(\ell_2) \big) \\[6pt] &= \ln \big( \exp(\ell_1) (1 - \exp(-(\ell_1 - \ell_2))) \big) \\[6pt] &= \ell_1 + \ln (1 - \exp(-(\ell_1 - \ell_2))). \\[6pt] \end{aligned} \end{equation}$$ In the case where $\ell_1 = \ell_2$ we obtain the expression $\ell_+ = \ell_1 + \ln 0 = -\infty$. Using the Maclaurin series expansion for $\ln(1-x)$ we obtain the formula: $$\begin{equation} \begin{aligned} \ell_- &= \ell_1 - \sum_{k=1}^\infty \frac{\exp(-k(\ell_1 - \ell_2))}{k} \quad \quad \quad \text{for } \ell_1 \neq \ell_2. \\[6pt] \end{aligned} \end{equation}$$ Since $\exp(-(\ell_1 - \ell_2)) < 1$ the terms in this expansion diminish rapidly (faster than exponential decay). If $\ell_1 - \ell_2$ is large then the terms diminish particularly rapid. In any case, this expression allows us to compute the log-sum to any desired level of accuracy by truncating the infinite sum to a desired number of terms. Implementation in base R: It is possible to compute this log-difference accurately in base R using the log1p function. This is a primitive function in the base package that computes the value of $\ln(1+x)$ for an argument $x$ (with accurate computation even for $x \ll 1$). This primitive function can be used to give a simple function for the log-difference: logdiff <- function(l1, l2) { l1 + log1p(-exp(-(l1-l2))); } Implementation with VGAM package: Machler (2012) analyses accuracy issues in evaluating the function $\ln(1-\exp(-|x|))$, and suggests that use of the base R functions may involve a loss of accuracy. It is possible to compute this log-difference more accurately in using the log1mexp function in the VGAM package. This gives you the an alternative function for the log-difference: logdiff <- function(l1, l2) { l1 + VGAM::log1mexp(l1-l2); }
Subtracting very small probabilities - How to compute? [duplicate] To see how to deal with differences of this kind, we first note a useful mathematical result concerning differences of exponentials: $$\begin{equation} \begin{aligned} \exp(\ell_1) - \exp(\ell_2) &=
38,985
Subtracting very small probabilities - How to compute? [duplicate]
The following workaround is often very useful for these sorts of problems: subtract the smaller of l1 and l2 from each of l1 and l2 (effectively, we have multiplied the probabilities by some constant z = exp(min(l1,l2))) Now compute the sum using standard functions (you can use log1p and expm1 if you want). Afterwards, add the quantity you subtracted in step 1. A simple example: l1 <- -2000 ## exp(-2000) is computational zero l2 <- -2002 z <- min(l1,l2) l1 <- l1 - z l2 <- l2 - z ## now we are guaranteed that one of them is zero y <- log(exp(l1) - exp(l2)) y + z returns the correct value -2000.145, which is equal to -2000 + log(1-exp(-2)).
Subtracting very small probabilities - How to compute? [duplicate]
The following workaround is often very useful for these sorts of problems: subtract the smaller of l1 and l2 from each of l1 and l2 (effectively, we have multiplied the probabilities by some constant
Subtracting very small probabilities - How to compute? [duplicate] The following workaround is often very useful for these sorts of problems: subtract the smaller of l1 and l2 from each of l1 and l2 (effectively, we have multiplied the probabilities by some constant z = exp(min(l1,l2))) Now compute the sum using standard functions (you can use log1p and expm1 if you want). Afterwards, add the quantity you subtracted in step 1. A simple example: l1 <- -2000 ## exp(-2000) is computational zero l2 <- -2002 z <- min(l1,l2) l1 <- l1 - z l2 <- l2 - z ## now we are guaranteed that one of them is zero y <- log(exp(l1) - exp(l2)) y + z returns the correct value -2000.145, which is equal to -2000 + log(1-exp(-2)).
Subtracting very small probabilities - How to compute? [duplicate] The following workaround is often very useful for these sorts of problems: subtract the smaller of l1 and l2 from each of l1 and l2 (effectively, we have multiplied the probabilities by some constant
38,986
Likelihood function when $X\sim U(0,\theta)$
The fact that all the observable values $X_1,...,X_n$ are all non-negative is generally considered to be implicit throughout the working (since this is the support of the original distribution) and so it is not stated explicitly. You can certainly add it in explicitly if you wish, which is what you are doing in the condition $\min (X_1,...,X_n) \geqslant 0$.
Likelihood function when $X\sim U(0,\theta)$
The fact that all the observable values $X_1,...,X_n$ are all non-negative is generally considered to be implicit throughout the working (since this is the support of the original distribution) and s
Likelihood function when $X\sim U(0,\theta)$ The fact that all the observable values $X_1,...,X_n$ are all non-negative is generally considered to be implicit throughout the working (since this is the support of the original distribution) and so it is not stated explicitly. You can certainly add it in explicitly if you wish, which is what you are doing in the condition $\min (X_1,...,X_n) \geqslant 0$.
Likelihood function when $X\sim U(0,\theta)$ The fact that all the observable values $X_1,...,X_n$ are all non-negative is generally considered to be implicit throughout the working (since this is the support of the original distribution) and s
38,987
Likelihood function when $X\sim U(0,\theta)$
You are correct that the third equality could use the event $\{\min(X_1, \ldots, X_n)\geq 0, \max(X_1, \ldots, X_n)\leq\theta\}$. The more compact notation is used because for any value of $\theta$, $\min(X_1, \ldots, X_n)\geq 0$ almost surely, so that event is not informative. The only useful event is $\max(X_1, \ldots, X_n)\leq\theta$.
Likelihood function when $X\sim U(0,\theta)$
You are correct that the third equality could use the event $\{\min(X_1, \ldots, X_n)\geq 0, \max(X_1, \ldots, X_n)\leq\theta\}$. The more compact notation is used because for any value of $\theta$, $
Likelihood function when $X\sim U(0,\theta)$ You are correct that the third equality could use the event $\{\min(X_1, \ldots, X_n)\geq 0, \max(X_1, \ldots, X_n)\leq\theta\}$. The more compact notation is used because for any value of $\theta$, $\min(X_1, \ldots, X_n)\geq 0$ almost surely, so that event is not informative. The only useful event is $\max(X_1, \ldots, X_n)\leq\theta$.
Likelihood function when $X\sim U(0,\theta)$ You are correct that the third equality could use the event $\{\min(X_1, \ldots, X_n)\geq 0, \max(X_1, \ldots, X_n)\leq\theta\}$. The more compact notation is used because for any value of $\theta$, $
38,988
Likelihood function when $X\sim U(0,\theta)$
Just to stress a point, namely that the notion of likelihood is one of a function of $\theta$ indexed by the sample $(x_1,\ldots,x_n)$, instead of the density as a function of $(x_1,\ldots,x_n)$ indexed by the parameter $\theta$. This means that, as a function of $\theta$, and for a given sample $(x_1,\ldots,x_n)$ from that family of Uniform distributions there is no more relevance in stating that $$\mathbb{I}_{\min(x_1,\ldots,x_n)>0}=1$$ than in stating that, say, $3$ is larger than $2$. Both statements are true but irrelevant.
Likelihood function when $X\sim U(0,\theta)$
Just to stress a point, namely that the notion of likelihood is one of a function of $\theta$ indexed by the sample $(x_1,\ldots,x_n)$, instead of the density as a function of $(x_1,\ldots,x_n)$ index
Likelihood function when $X\sim U(0,\theta)$ Just to stress a point, namely that the notion of likelihood is one of a function of $\theta$ indexed by the sample $(x_1,\ldots,x_n)$, instead of the density as a function of $(x_1,\ldots,x_n)$ indexed by the parameter $\theta$. This means that, as a function of $\theta$, and for a given sample $(x_1,\ldots,x_n)$ from that family of Uniform distributions there is no more relevance in stating that $$\mathbb{I}_{\min(x_1,\ldots,x_n)>0}=1$$ than in stating that, say, $3$ is larger than $2$. Both statements are true but irrelevant.
Likelihood function when $X\sim U(0,\theta)$ Just to stress a point, namely that the notion of likelihood is one of a function of $\theta$ indexed by the sample $(x_1,\ldots,x_n)$, instead of the density as a function of $(x_1,\ldots,x_n)$ index
38,989
Is there a difference between Bayesian and Classical sufficiency?
In addition to the other excellent answer: The question of equivalence between Bayesian (B-) sufficiency and Classical (F-sufficiency) is answered in the abstract by NOT. But, this is based on abstract measure-theoretic definitions, and proofs are technical using measure theory. But, counterexamples to equivalence are artificial, models constructed to be counterexamples, not to be useful. As long as your sample and parameter space are (measurable) subsets of some finite-dim euclidean space, there are no counterexamples. In short: F-sufficiency implies B-sufficiency, but not the other way. [D Blackwell][1] gives the artificial example. They refer to a proof of equivalence in the dominated case, all the probability measures in the hypothesis space are dominated by some common, sigma-finite measure. That covers most models. The proof, says this authors, "follows easily from the results of [Halmos and Savage][2]". Another interesting paper, [K. K.Roy and R. V. Ramamoorthi][3] is working towards finding conditions under witch B-sufficiency will imply F-sufficiency. The conditions are technical, measure-theoretic conditions on the sample and parameter space and their sigma-algebras (Proposed by D Blackwell). That paper studies a special case of that condition (spaces standard Borel, sigma-algebras countably generated. "Interest in countably generated sigma-fields stems from the fact that these are precisely the sigma-fields generated by Borel measurable real valued statistics." [1]: A Bayes but not Classically Sufficient Statistic, The annals of statistics, Vol 10, No 3 (sept, 1982) (in JSTOR and project Euclid) [2]: Halmos, P. R. and Savage, L. J. (1949) Applications of the Radon-Nikodym theorem to the theory of sufficient statistics. Ann. Math. Statistics 20 225--241 [3]: *Sankhya, the Indian Journal of Statistics, Series A (1961--2002), 1979 Indian Statistical Institute
Is there a difference between Bayesian and Classical sufficiency?
In addition to the other excellent answer: The question of equivalence between Bayesian (B-) sufficiency and Classical (F-sufficiency) is answered in the abstract by NOT. But, this is based on abstra
Is there a difference between Bayesian and Classical sufficiency? In addition to the other excellent answer: The question of equivalence between Bayesian (B-) sufficiency and Classical (F-sufficiency) is answered in the abstract by NOT. But, this is based on abstract measure-theoretic definitions, and proofs are technical using measure theory. But, counterexamples to equivalence are artificial, models constructed to be counterexamples, not to be useful. As long as your sample and parameter space are (measurable) subsets of some finite-dim euclidean space, there are no counterexamples. In short: F-sufficiency implies B-sufficiency, but not the other way. [D Blackwell][1] gives the artificial example. They refer to a proof of equivalence in the dominated case, all the probability measures in the hypothesis space are dominated by some common, sigma-finite measure. That covers most models. The proof, says this authors, "follows easily from the results of [Halmos and Savage][2]". Another interesting paper, [K. K.Roy and R. V. Ramamoorthi][3] is working towards finding conditions under witch B-sufficiency will imply F-sufficiency. The conditions are technical, measure-theoretic conditions on the sample and parameter space and their sigma-algebras (Proposed by D Blackwell). That paper studies a special case of that condition (spaces standard Borel, sigma-algebras countably generated. "Interest in countably generated sigma-fields stems from the fact that these are precisely the sigma-fields generated by Borel measurable real valued statistics." [1]: A Bayes but not Classically Sufficient Statistic, The annals of statistics, Vol 10, No 3 (sept, 1982) (in JSTOR and project Euclid) [2]: Halmos, P. R. and Savage, L. J. (1949) Applications of the Radon-Nikodym theorem to the theory of sufficient statistics. Ann. Math. Statistics 20 225--241 [3]: *Sankhya, the Indian Journal of Statistics, Series A (1961--2002), 1979 Indian Statistical Institute
Is there a difference between Bayesian and Classical sufficiency? In addition to the other excellent answer: The question of equivalence between Bayesian (B-) sufficiency and Classical (F-sufficiency) is answered in the abstract by NOT. But, this is based on abstra
38,990
Is there a difference between Bayesian and Classical sufficiency?
Here is one example of differentiation between classical and Bayesian statistics: when comparing two models $\mathcal{M}_1$ and $\mathcal{M}_2$, a statistic $S(\cdot)$ may be sufficient for both models, hence sufficient in a classical sense, but insufficient for model comparison as e.g. in Bayes factors, when the conditional distribution of the data given $S$ varies between models. The difference is due to the fact that the model index is a parameter from a Bayesian perspective but not a parameter from a classical one. (This is discussed further in our ABC model choice papers.)
Is there a difference between Bayesian and Classical sufficiency?
Here is one example of differentiation between classical and Bayesian statistics: when comparing two models $\mathcal{M}_1$ and $\mathcal{M}_2$, a statistic $S(\cdot)$ may be sufficient for both model
Is there a difference between Bayesian and Classical sufficiency? Here is one example of differentiation between classical and Bayesian statistics: when comparing two models $\mathcal{M}_1$ and $\mathcal{M}_2$, a statistic $S(\cdot)$ may be sufficient for both models, hence sufficient in a classical sense, but insufficient for model comparison as e.g. in Bayes factors, when the conditional distribution of the data given $S$ varies between models. The difference is due to the fact that the model index is a parameter from a Bayesian perspective but not a parameter from a classical one. (This is discussed further in our ABC model choice papers.)
Is there a difference between Bayesian and Classical sufficiency? Here is one example of differentiation between classical and Bayesian statistics: when comparing two models $\mathcal{M}_1$ and $\mathcal{M}_2$, a statistic $S(\cdot)$ may be sufficient for both model
38,991
MLE for a homogeneous Poisson process?
You can use Maximum Likelihood Estimation, either with synchronous data (time-binned data) or asynchronous data (time-stamped data). The likelihood function changes accordingly. For time-binned (or synchronous) data, you can simply use the joint Poisson probability mass function for your observed counts as the likelihood function: $ L = \prod^{K}_{i=1} \frac{\lambda^{x_i}}{x_i!} \exp(-\lambda) $, where $K$ is the number of bins, $x_i$ the count of events in bin $i$, and $\lambda$ the constant intensity that you want to estimate. For asynchronous data, the likelihood is specified as follows: $L = \left[ \prod^{N(T)}_{i=1} \lambda^*(t_i) \right] \exp\left[-\int^{T}_{0}\lambda^*(s) ds \right] $, where $N(T)$ is the number of points at end-of-sample time $T$, and $\lambda^*(t)$ is the conditional intensity function, which is simply the constant $\lambda^*(t)=\lambda$ for the homogeneous Poisson process. In some cases including the homogeneous Poisson process, there are closed-form solutions for both cases (take logs, set derivative with respect to $\lambda$ equal to zero, and solve for $\lambda$). Otherwise the log-likelihood can be optimised numerically. For more background on theory and estimation, these are good references: Lecture notes on temporal point processes by Rassmussen Daley, D. J.; Vere-Jones, D., An introduction to the theory of point processes. Vol. I: Elementary theory and methods., Probability and Its Applications. New York, NY: Springer. xxi, 469 p. (2003). ZBL1026.60061.
MLE for a homogeneous Poisson process?
You can use Maximum Likelihood Estimation, either with synchronous data (time-binned data) or asynchronous data (time-stamped data). The likelihood function changes accordingly. For time-binned (or sy
MLE for a homogeneous Poisson process? You can use Maximum Likelihood Estimation, either with synchronous data (time-binned data) or asynchronous data (time-stamped data). The likelihood function changes accordingly. For time-binned (or synchronous) data, you can simply use the joint Poisson probability mass function for your observed counts as the likelihood function: $ L = \prod^{K}_{i=1} \frac{\lambda^{x_i}}{x_i!} \exp(-\lambda) $, where $K$ is the number of bins, $x_i$ the count of events in bin $i$, and $\lambda$ the constant intensity that you want to estimate. For asynchronous data, the likelihood is specified as follows: $L = \left[ \prod^{N(T)}_{i=1} \lambda^*(t_i) \right] \exp\left[-\int^{T}_{0}\lambda^*(s) ds \right] $, where $N(T)$ is the number of points at end-of-sample time $T$, and $\lambda^*(t)$ is the conditional intensity function, which is simply the constant $\lambda^*(t)=\lambda$ for the homogeneous Poisson process. In some cases including the homogeneous Poisson process, there are closed-form solutions for both cases (take logs, set derivative with respect to $\lambda$ equal to zero, and solve for $\lambda$). Otherwise the log-likelihood can be optimised numerically. For more background on theory and estimation, these are good references: Lecture notes on temporal point processes by Rassmussen Daley, D. J.; Vere-Jones, D., An introduction to the theory of point processes. Vol. I: Elementary theory and methods., Probability and Its Applications. New York, NY: Springer. xxi, 469 p. (2003). ZBL1026.60061.
MLE for a homogeneous Poisson process? You can use Maximum Likelihood Estimation, either with synchronous data (time-binned data) or asynchronous data (time-stamped data). The likelihood function changes accordingly. For time-binned (or sy
38,992
MLE for a homogeneous Poisson process?
For the homogeneous Poisson process with rate $\lambda$ the likelihood function can be written as $L(\lambda)=\prod\limits_{n=1}^{N}\dfrac{\left(\lambda.(t_n-t_{n-1})\right)^1.e^{-\lambda(t_n-t_{n-1})}}{1!}$, with $t_0=0$, s.t., the log-likelihood $l(\lambda)=\sum\limits_{n=1}^{N}ln(\lambda) + ln(t_n-t_{n-1})-\lambda(t_n-t_{n-1})$ For MLE, setting $\dfrac{dl}{d\lambda}=0$, we get, $\sum\limits_{n=1}^{N}\dfrac{1}{\lambda} - (t_n-t_{n-1})=0$ $\implies \dfrac{N}{\lambda_{MLE}} = \sum\limits_{n=1}^{N}(t_n-t_{n-1})$ $\quad \quad = t_N-t_{N-1}+t_{N-1}-t_{N-2}+\ldots+t_2-t_1+t_1-t_0=t_N-t_0$ $\quad \quad =t_N$ $\lambda_{MLE}=\dfrac{N}{t_N}$
MLE for a homogeneous Poisson process?
For the homogeneous Poisson process with rate $\lambda$ the likelihood function can be written as $L(\lambda)=\prod\limits_{n=1}^{N}\dfrac{\left(\lambda.(t_n-t_{n-1})\right)^1.e^{-\lambda(t_n-t_{n-1})
MLE for a homogeneous Poisson process? For the homogeneous Poisson process with rate $\lambda$ the likelihood function can be written as $L(\lambda)=\prod\limits_{n=1}^{N}\dfrac{\left(\lambda.(t_n-t_{n-1})\right)^1.e^{-\lambda(t_n-t_{n-1})}}{1!}$, with $t_0=0$, s.t., the log-likelihood $l(\lambda)=\sum\limits_{n=1}^{N}ln(\lambda) + ln(t_n-t_{n-1})-\lambda(t_n-t_{n-1})$ For MLE, setting $\dfrac{dl}{d\lambda}=0$, we get, $\sum\limits_{n=1}^{N}\dfrac{1}{\lambda} - (t_n-t_{n-1})=0$ $\implies \dfrac{N}{\lambda_{MLE}} = \sum\limits_{n=1}^{N}(t_n-t_{n-1})$ $\quad \quad = t_N-t_{N-1}+t_{N-1}-t_{N-2}+\ldots+t_2-t_1+t_1-t_0=t_N-t_0$ $\quad \quad =t_N$ $\lambda_{MLE}=\dfrac{N}{t_N}$
MLE for a homogeneous Poisson process? For the homogeneous Poisson process with rate $\lambda$ the likelihood function can be written as $L(\lambda)=\prod\limits_{n=1}^{N}\dfrac{\left(\lambda.(t_n-t_{n-1})\right)^1.e^{-\lambda(t_n-t_{n-1})
38,993
MLE for a homogeneous Poisson process?
Expanding from @sandipan-dey's answer for homogenous process:
MLE for a homogeneous Poisson process?
Expanding from @sandipan-dey's answer for homogenous process:
MLE for a homogeneous Poisson process? Expanding from @sandipan-dey's answer for homogenous process:
MLE for a homogeneous Poisson process? Expanding from @sandipan-dey's answer for homogenous process:
38,994
Why does glm() provide estimates and standard errors on the link scale?
Hard to know for sure, but there are a few reasons the link scale is useful. Using standard errors as a summary of uncertainty is generally more reliable on the link scale, where the domain of the parameters is unbounded and where the assumption that the likelihood surface is approximately quadratic ($\leftrightarrow$ sampling distribution of the parameter estimates is approximately Normal) is more likely to be reasonable. For example, suppose you have a log-link model with estimate (on the link scale) 1.0 and standard error 3.0. On the link scale, the confidence interval is approximately $1 \pm 1.96 \times 3$. If you back-transform, exponentiating the parameter and multiplying the standard error by the exponentiated parameter (as in this answer), and then try to construct symmetric CIs, you get $2.718 \pm 1.96 \times 3 \times 2.718$, which includes negative values ... if you do want to back-transform, it makes more sense to back-transform the confidence intervals, i.e. $\exp(1 \pm 1.96 \times 3)$. Probably more importantly, for the very common logit link, it's basically impossible to sensibly back-transform the parameters all the way to the data scale (i.e., from logit/log-odds-ratios to probability). It is common to exponentiate parameters to move from the log-odds-ratio to the odds-ratio scale, but you can't go back from odds ratios to probabilities without specifying a baseline value. That is, you can say in general "the odds ratio associated with control vs. treatment is XXX", but the change in probability from control to treatment will depend on other covariates (e.g., the odds ratio for females and males may be the same while the change in probability is different because the baseline risk is different for females and males). Probably the proximal reason is that because of the issues listed above, most people who do a lot of statistical modeling have gotten used to interpreting parameters on the link scale; most epidemiologists and biostatisticians have to spend time learning about odds ratios and log-odds ratios, and there are lots of papers written about their interpretation. For better or worse, R was written by people who are comfortable interpreting parameters on the link scale. Many downstream packages such as broom have options that will exponentiate parameters and CIs for you (putting them on the data (count) scale for the log link; the odds-ratio scale for logit links; and the hazard-ratio scale for cloglog links).
Why does glm() provide estimates and standard errors on the link scale?
Hard to know for sure, but there are a few reasons the link scale is useful. Using standard errors as a summary of uncertainty is generally more reliable on the link scale, where the domain of the pa
Why does glm() provide estimates and standard errors on the link scale? Hard to know for sure, but there are a few reasons the link scale is useful. Using standard errors as a summary of uncertainty is generally more reliable on the link scale, where the domain of the parameters is unbounded and where the assumption that the likelihood surface is approximately quadratic ($\leftrightarrow$ sampling distribution of the parameter estimates is approximately Normal) is more likely to be reasonable. For example, suppose you have a log-link model with estimate (on the link scale) 1.0 and standard error 3.0. On the link scale, the confidence interval is approximately $1 \pm 1.96 \times 3$. If you back-transform, exponentiating the parameter and multiplying the standard error by the exponentiated parameter (as in this answer), and then try to construct symmetric CIs, you get $2.718 \pm 1.96 \times 3 \times 2.718$, which includes negative values ... if you do want to back-transform, it makes more sense to back-transform the confidence intervals, i.e. $\exp(1 \pm 1.96 \times 3)$. Probably more importantly, for the very common logit link, it's basically impossible to sensibly back-transform the parameters all the way to the data scale (i.e., from logit/log-odds-ratios to probability). It is common to exponentiate parameters to move from the log-odds-ratio to the odds-ratio scale, but you can't go back from odds ratios to probabilities without specifying a baseline value. That is, you can say in general "the odds ratio associated with control vs. treatment is XXX", but the change in probability from control to treatment will depend on other covariates (e.g., the odds ratio for females and males may be the same while the change in probability is different because the baseline risk is different for females and males). Probably the proximal reason is that because of the issues listed above, most people who do a lot of statistical modeling have gotten used to interpreting parameters on the link scale; most epidemiologists and biostatisticians have to spend time learning about odds ratios and log-odds ratios, and there are lots of papers written about their interpretation. For better or worse, R was written by people who are comfortable interpreting parameters on the link scale. Many downstream packages such as broom have options that will exponentiate parameters and CIs for you (putting them on the data (count) scale for the log link; the odds-ratio scale for logit links; and the hazard-ratio scale for cloglog links).
Why does glm() provide estimates and standard errors on the link scale? Hard to know for sure, but there are a few reasons the link scale is useful. Using standard errors as a summary of uncertainty is generally more reliable on the link scale, where the domain of the pa
38,995
Finding the slope at different points in a sigmoid curve
Your question is very broad. There are many ways to do this, even without assuming a specific function. For the following I assume that you have a good reason to use the Gompertz model. First let's fit the model: y <- c(0.5,3.0,22.2,46.0,77.3,97.0,98.9,100.0) x <- seq_along(y) plot(x, y) fit <- nls(y ~ SSgompertz(x, Asym, b2, b3), data = data.frame(x, y)) curve(predict(fit, newdata = data.frame(x)), add = TRUE) Now, in order to get the desired slopes, you'll need to calculate the first derivative of the fitted function. That is simple highschool maths. In fact, it's so simple that even R can do it although it is not a computer algebra system. #assign coefficients into global environment list2env(as.list(coef(fit)), .GlobalEnv) #create function that returns the gradient dGomp <- deriv((y ~ Asym*exp(-b2*b3^x)), "x", func = TRUE) #the model slopes: c(attr(dGomp(x), "gradient")) ##[1] 0.1010109 6.9594864 27.3791349 31.0194397 20.4539646 10.6588397 5.0141801 2.2561393
Finding the slope at different points in a sigmoid curve
Your question is very broad. There are many ways to do this, even without assuming a specific function. For the following I assume that you have a good reason to use the Gompertz model. First let's fi
Finding the slope at different points in a sigmoid curve Your question is very broad. There are many ways to do this, even without assuming a specific function. For the following I assume that you have a good reason to use the Gompertz model. First let's fit the model: y <- c(0.5,3.0,22.2,46.0,77.3,97.0,98.9,100.0) x <- seq_along(y) plot(x, y) fit <- nls(y ~ SSgompertz(x, Asym, b2, b3), data = data.frame(x, y)) curve(predict(fit, newdata = data.frame(x)), add = TRUE) Now, in order to get the desired slopes, you'll need to calculate the first derivative of the fitted function. That is simple highschool maths. In fact, it's so simple that even R can do it although it is not a computer algebra system. #assign coefficients into global environment list2env(as.list(coef(fit)), .GlobalEnv) #create function that returns the gradient dGomp <- deriv((y ~ Asym*exp(-b2*b3^x)), "x", func = TRUE) #the model slopes: c(attr(dGomp(x), "gradient")) ##[1] 0.1010109 6.9594864 27.3791349 31.0194397 20.4539646 10.6588397 5.0141801 2.2561393
Finding the slope at different points in a sigmoid curve Your question is very broad. There are many ways to do this, even without assuming a specific function. For the following I assume that you have a good reason to use the Gompertz model. First let's fi
38,996
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic?
No, posterior distribution is not a statistic if you define it strictly and agree that there is a distinction between statistic and estimator. First of all, it is an estimator of the posterior distribution (see What is the difference between an estimator and a statistic?). Second, as already noticed in the comment by @whuber, a statistic is a function of the data, while posterior distribution is a function of the data and the priors, so it depends not only on the data. Posterior distribution is an estimate of the distribution of the parameter of the assumed model; statistic would be a function of the sample that characterizes it. The problem is not with the fact that it is a distribution (e.g. one could argue that kernel density estimator, as well as histogram, are statistics), but with your interest in the model, rather then the sample. On another hand, the definition of statistic is very broad and many handbooks give only brief definitions ("function of the sample", or "numerical characteristic of a sample"), or like Leehman and Casella in Theory of Point Estimation say that "estimators are statistics" (p. 16). So when sticking to the definition that statistic is any function of the sample, the answer would be "yes". Do Bayesians use the term "statistic" in the same way that frequentists do, or does Bayesian inference not depend as heavily on the concept of a statistic? In general, Bayesians use all of the statistical terms the same way as other statisticians. They only differ in how they interpret the probability, while sticking to the same definitions (Kolomogorov axioms etc.). If they didn't, they wouldn't be able to communicate with the rest of statistical community and would not be considered as a part of statistics.
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic?
No, posterior distribution is not a statistic if you define it strictly and agree that there is a distinction between statistic and estimator. First of all, it is an estimator of the posterior distrib
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic? No, posterior distribution is not a statistic if you define it strictly and agree that there is a distinction between statistic and estimator. First of all, it is an estimator of the posterior distribution (see What is the difference between an estimator and a statistic?). Second, as already noticed in the comment by @whuber, a statistic is a function of the data, while posterior distribution is a function of the data and the priors, so it depends not only on the data. Posterior distribution is an estimate of the distribution of the parameter of the assumed model; statistic would be a function of the sample that characterizes it. The problem is not with the fact that it is a distribution (e.g. one could argue that kernel density estimator, as well as histogram, are statistics), but with your interest in the model, rather then the sample. On another hand, the definition of statistic is very broad and many handbooks give only brief definitions ("function of the sample", or "numerical characteristic of a sample"), or like Leehman and Casella in Theory of Point Estimation say that "estimators are statistics" (p. 16). So when sticking to the definition that statistic is any function of the sample, the answer would be "yes". Do Bayesians use the term "statistic" in the same way that frequentists do, or does Bayesian inference not depend as heavily on the concept of a statistic? In general, Bayesians use all of the statistical terms the same way as other statisticians. They only differ in how they interpret the probability, while sticking to the same definitions (Kolomogorov axioms etc.). If they didn't, they wouldn't be able to communicate with the rest of statistical community and would not be considered as a part of statistics.
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic? No, posterior distribution is not a statistic if you define it strictly and agree that there is a distinction between statistic and estimator. First of all, it is an estimator of the posterior distrib
38,997
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic?
Yes, a posterior is a statistic. As you point out a statistic is any function of the data and the posterior is a function of the data and thus a statistic. Yes, Bayesians use the notion of statistic but typically not describing the posterior as a statistic. We are certainly interested in sufficient statistics since a posterior, i.e. a distribution for a parameter given the data, is equivalent to the conditional distribution of the parameter given a sufficient statistic. Yes it is technically correct and it is moral. You could even look at the sampling distribution of the posterior to understand properties of the posterior over different realizations of the data. Efron does this in this manuscript.
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic?
Yes, a posterior is a statistic. As you point out a statistic is any function of the data and the posterior is a function of the data and thus a statistic. Yes, Bayesians use the notion of statistic b
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic? Yes, a posterior is a statistic. As you point out a statistic is any function of the data and the posterior is a function of the data and thus a statistic. Yes, Bayesians use the notion of statistic but typically not describing the posterior as a statistic. We are certainly interested in sufficient statistics since a posterior, i.e. a distribution for a parameter given the data, is equivalent to the conditional distribution of the parameter given a sufficient statistic. Yes it is technically correct and it is moral. You could even look at the sampling distribution of the posterior to understand properties of the posterior over different realizations of the data. Efron does this in this manuscript.
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic? Yes, a posterior is a statistic. As you point out a statistic is any function of the data and the posterior is a function of the data and thus a statistic. Yes, Bayesians use the notion of statistic b
38,998
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic?
I don't agree with the view that the posterior is not a statistic because it is an estimator (e.g., in the accepted answer to this question, and the accompanying answer to the related question on alleged differences between a statistic and an estimator). But for other reasons, set out in detail below, I would say that it is possible to form a "statistic" with this quantity, but the thing that is a statistic is not really the "posterior distribution". To understand this, it is important to remember that a multivariate function can be viewed in many different ways, depending on which variables we are treating as arguments and which we are treating as fixed values. In particular, a multivariate function can be a distribution with respect to one argument variable, but not a distribution with respect to another argument variable. In the present case, the function $P(\theta | \boldsymbol{x})$ can be viewed in three different ways$^\dagger$: As a function of both $\theta$ and $\boldsymbol{x}$, in which case it is a conditional distribution; As a function of $\theta$ only (with $\boldsymbol{x}$ treated as fixed), in which case it is a single distribution; or As a function of $\boldsymbol{x}$ only (with $\theta$ treated as fixed), in which case it is a statistic, but not a distribution. From these three views, we see that it is possible to view this object as a "statistic" (holding one argument constant) or as the "posterior distribution" (holding the other argument constant), but it is not strictly correct to view it as both of these things at once. Hence, it is very dubious to claim that the "posterior distribution" (which is a distribution) is also a "statistic". A more detailed answer is given below, where I explore this issue as a mapping with a domain and codomain including distribution functions. What is a "statistic": The standard definition of a statistic refers to a function of the data vector - i.e., a function whose domain is the support of the data vector. The mere fact that a statistic can function as an estimator of some model parameter does not preclude it from being a statistic. While it is arguable that an estimator is something more than a statistic (e.g., a statistic plus a specified parameter it is used to estimate), this does not imply that a statistic is not a statistic merely because it can be used as an estimator of something. Now, some definitions of a "statistic" (in various textbooks) restrict the concept only to mappings that output a real number of real-vector (as opposed to a distribution or function), but this is usually a contextual definition, made to deal with standard real scalar or vector statistics in other contexts (e.g., when discussing the theory of statistical inference). In my view, there is no reason in principle that a function cannot be considered a "statistic" if it maps a data vector to some other output such as a distribution. Hence, if $\mathscr{X}$ is the support of our observable data vector in some inference problem, I would regard any mapping $f: \mathscr{X} \rightarrow \text{Codomain}$ to be a "statistic" on the specified codomain. With this broad definition of a "statistic" let us now consider the question at issue. Is the posterior distribution a "statistic"? It is certainly true that the posterior is determined both by the data vector and the prior distribution. Letting $\mathscr{X}$ be the support of the data vector and letting $\Pi$ be the space of allowable distributions for the parameter $\theta$, we can consider Bayes' rule to be a mapping $P: \mathscr{X} \times \Pi \rightarrow \Pi$ which maps a data vector and prior to the posterior distribution (with the latter considered as a function of $\theta$). So here we have a mapping where the domain is not just the support of the data vector. However, as with any function of two arguments, we can also treat one of these (the prior) as a fixed value and consider the mapping as a function only of the other argument (the data vector). That is, for any fixed prior distribution $\pi \in \Pi$ we can consider the corresponding mapping $P_\pi: \mathscr{X} \rightarrow \Pi$ which maps a data vector to a posterior distribution (the one that results from our fixed prior). So now we have a mapping where the domain is the support of the data vector, and hence, we have a "statistic" (in the broad sense defined above). Although $P_\pi$ is a "statistic" in the sense specified above, it is a bit of a stretch to call it the "posterior distribution". Effectively, it is the mapping you get if you treat the posterior distribution as a function only of its conditioning variable $\boldsymbol{x}$ for a fixed prior. It is not really accurate to call this a "distribution" since it is not a distribution with respect to the argument variable $\boldsymbol{x}$. I would argue that the mapping $P_\pi$ is a "statistic", insofar as it is a function whose domain is the support of the data vector. It is not really accurate to call this function the "posterior distribution"; rather, it is the mapping that maps any allowable data vector to the corresponding posterior distribution. The "posterior distribution" is the element $P_\pi(\boldsymbol{x})$ in the codomain, not the mapping itself. $^\dagger$ The posterior is also implicitly dependent on an unstated prior distribution $\pi(\theta)$ and so we could also take an enlarged view of things, by looking at the multivariate function $P(\theta | \boldsymbol{x}, \pi)$, in which case there are even more interpretations.
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic?
I don't agree with the view that the posterior is not a statistic because it is an estimator (e.g., in the accepted answer to this question, and the accompanying answer to the related question on alle
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic? I don't agree with the view that the posterior is not a statistic because it is an estimator (e.g., in the accepted answer to this question, and the accompanying answer to the related question on alleged differences between a statistic and an estimator). But for other reasons, set out in detail below, I would say that it is possible to form a "statistic" with this quantity, but the thing that is a statistic is not really the "posterior distribution". To understand this, it is important to remember that a multivariate function can be viewed in many different ways, depending on which variables we are treating as arguments and which we are treating as fixed values. In particular, a multivariate function can be a distribution with respect to one argument variable, but not a distribution with respect to another argument variable. In the present case, the function $P(\theta | \boldsymbol{x})$ can be viewed in three different ways$^\dagger$: As a function of both $\theta$ and $\boldsymbol{x}$, in which case it is a conditional distribution; As a function of $\theta$ only (with $\boldsymbol{x}$ treated as fixed), in which case it is a single distribution; or As a function of $\boldsymbol{x}$ only (with $\theta$ treated as fixed), in which case it is a statistic, but not a distribution. From these three views, we see that it is possible to view this object as a "statistic" (holding one argument constant) or as the "posterior distribution" (holding the other argument constant), but it is not strictly correct to view it as both of these things at once. Hence, it is very dubious to claim that the "posterior distribution" (which is a distribution) is also a "statistic". A more detailed answer is given below, where I explore this issue as a mapping with a domain and codomain including distribution functions. What is a "statistic": The standard definition of a statistic refers to a function of the data vector - i.e., a function whose domain is the support of the data vector. The mere fact that a statistic can function as an estimator of some model parameter does not preclude it from being a statistic. While it is arguable that an estimator is something more than a statistic (e.g., a statistic plus a specified parameter it is used to estimate), this does not imply that a statistic is not a statistic merely because it can be used as an estimator of something. Now, some definitions of a "statistic" (in various textbooks) restrict the concept only to mappings that output a real number of real-vector (as opposed to a distribution or function), but this is usually a contextual definition, made to deal with standard real scalar or vector statistics in other contexts (e.g., when discussing the theory of statistical inference). In my view, there is no reason in principle that a function cannot be considered a "statistic" if it maps a data vector to some other output such as a distribution. Hence, if $\mathscr{X}$ is the support of our observable data vector in some inference problem, I would regard any mapping $f: \mathscr{X} \rightarrow \text{Codomain}$ to be a "statistic" on the specified codomain. With this broad definition of a "statistic" let us now consider the question at issue. Is the posterior distribution a "statistic"? It is certainly true that the posterior is determined both by the data vector and the prior distribution. Letting $\mathscr{X}$ be the support of the data vector and letting $\Pi$ be the space of allowable distributions for the parameter $\theta$, we can consider Bayes' rule to be a mapping $P: \mathscr{X} \times \Pi \rightarrow \Pi$ which maps a data vector and prior to the posterior distribution (with the latter considered as a function of $\theta$). So here we have a mapping where the domain is not just the support of the data vector. However, as with any function of two arguments, we can also treat one of these (the prior) as a fixed value and consider the mapping as a function only of the other argument (the data vector). That is, for any fixed prior distribution $\pi \in \Pi$ we can consider the corresponding mapping $P_\pi: \mathscr{X} \rightarrow \Pi$ which maps a data vector to a posterior distribution (the one that results from our fixed prior). So now we have a mapping where the domain is the support of the data vector, and hence, we have a "statistic" (in the broad sense defined above). Although $P_\pi$ is a "statistic" in the sense specified above, it is a bit of a stretch to call it the "posterior distribution". Effectively, it is the mapping you get if you treat the posterior distribution as a function only of its conditioning variable $\boldsymbol{x}$ for a fixed prior. It is not really accurate to call this a "distribution" since it is not a distribution with respect to the argument variable $\boldsymbol{x}$. I would argue that the mapping $P_\pi$ is a "statistic", insofar as it is a function whose domain is the support of the data vector. It is not really accurate to call this function the "posterior distribution"; rather, it is the mapping that maps any allowable data vector to the corresponding posterior distribution. The "posterior distribution" is the element $P_\pi(\boldsymbol{x})$ in the codomain, not the mapping itself. $^\dagger$ The posterior is also implicitly dependent on an unstated prior distribution $\pi(\theta)$ and so we could also take an enlarged view of things, by looking at the multivariate function $P(\theta | \boldsymbol{x}, \pi)$, in which case there are even more interpretations.
Is the posterior distribution $P(\theta|\mathbf{X})$ a statistic? I don't agree with the view that the posterior is not a statistic because it is an estimator (e.g., in the accepted answer to this question, and the accompanying answer to the related question on alle
38,999
Given a GLM using Tweedie, how do I find the coefficients?
Are you familiar with generalized linear models in R? If so, you can fit Tweedie glms just like any other glms. The glm family definition necessary to make this happen is provided by the statmod R package from CRAN. Tweedie glms assume that the variance function is a power function: $${\rm var}(y)=V(\mu)\phi=\mu^\alpha \phi$$ Special case include normal glms ($\alpha=0$), Poisson glms $\alpha=1$), gamma glms ($\alpha=2$) and inverse-Gaussian glms ($\alpha=3$). Here is an example of R code: > library(statmod) > y <- c(4.0, 5.9, 3.9, 13.2, 10.0, 9.0) > x <- 1:6 > fit <- glm(y~x, family = tweedie(var.power=1.1, link.power=0)) > summary(fit) Call: glm(formula = y ~ x, family = tweedie(var.power = 1.1, link.power = 0)) Deviance Residuals: 1 2 3 4 5 6 -0.2966 0.1183 -1.0742 1.4985 0.1205 -0.6716 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.3625 0.4336 3.143 0.0348 * x 0.1794 0.1008 1.779 0.1498 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for Tweedie family taken to be 1.056557) Null deviance: 7.3459 on 5 degrees of freedom Residual deviance: 3.9670 on 4 degrees of freedom AIC: NA Number of Fisher Scoring iterations: 4 The Tweedie package allows you to fit a glm with any power function and any power link. In the glm family call, var.power is the $\alpha$ parameter so that var.power=1.1 specifies $\alpha=1.1$. The var.power refers to exponent of the glm variance function, so that var.power=0 specifies a normal family, var.power=1 means Poisson family, var.power=2 means gamma family, var.power=3 means inverse Gaussian family and so on. Values between 0 and 1 are not permitted but virtually anything else in allowed. link.power=0 specifies a log-link. The link is specified in terms of Box-Cox transformation powers, so link.power=1 is the identity link and link.power=0 means log. The above model assumes that $y_i\sim {\rm Tweedie}_\alpha(\mu_i,\phi)$ where $$\log \mu_i=\beta_0+\beta_1 x_i$$ and $${\rm var}(y_i)=\mu_i^{1.1} \phi$$ The regression coefficients $\beta_j$ have been estimated by maximum likelihood. The dispersion parameter $\phi$ has been estimated using the residual sum of squared residuals -- this is called the Pearson estimator. Regardless of what $\alpha$ or link you use, any of the downstream functions provided in R for glms will work on the glm fitted model object produced by glm().
Given a GLM using Tweedie, how do I find the coefficients?
Are you familiar with generalized linear models in R? If so, you can fit Tweedie glms just like any other glms. The glm family definition necessary to make this happen is provided by the statmod R pac
Given a GLM using Tweedie, how do I find the coefficients? Are you familiar with generalized linear models in R? If so, you can fit Tweedie glms just like any other glms. The glm family definition necessary to make this happen is provided by the statmod R package from CRAN. Tweedie glms assume that the variance function is a power function: $${\rm var}(y)=V(\mu)\phi=\mu^\alpha \phi$$ Special case include normal glms ($\alpha=0$), Poisson glms $\alpha=1$), gamma glms ($\alpha=2$) and inverse-Gaussian glms ($\alpha=3$). Here is an example of R code: > library(statmod) > y <- c(4.0, 5.9, 3.9, 13.2, 10.0, 9.0) > x <- 1:6 > fit <- glm(y~x, family = tweedie(var.power=1.1, link.power=0)) > summary(fit) Call: glm(formula = y ~ x, family = tweedie(var.power = 1.1, link.power = 0)) Deviance Residuals: 1 2 3 4 5 6 -0.2966 0.1183 -1.0742 1.4985 0.1205 -0.6716 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.3625 0.4336 3.143 0.0348 * x 0.1794 0.1008 1.779 0.1498 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for Tweedie family taken to be 1.056557) Null deviance: 7.3459 on 5 degrees of freedom Residual deviance: 3.9670 on 4 degrees of freedom AIC: NA Number of Fisher Scoring iterations: 4 The Tweedie package allows you to fit a glm with any power function and any power link. In the glm family call, var.power is the $\alpha$ parameter so that var.power=1.1 specifies $\alpha=1.1$. The var.power refers to exponent of the glm variance function, so that var.power=0 specifies a normal family, var.power=1 means Poisson family, var.power=2 means gamma family, var.power=3 means inverse Gaussian family and so on. Values between 0 and 1 are not permitted but virtually anything else in allowed. link.power=0 specifies a log-link. The link is specified in terms of Box-Cox transformation powers, so link.power=1 is the identity link and link.power=0 means log. The above model assumes that $y_i\sim {\rm Tweedie}_\alpha(\mu_i,\phi)$ where $$\log \mu_i=\beta_0+\beta_1 x_i$$ and $${\rm var}(y_i)=\mu_i^{1.1} \phi$$ The regression coefficients $\beta_j$ have been estimated by maximum likelihood. The dispersion parameter $\phi$ has been estimated using the residual sum of squared residuals -- this is called the Pearson estimator. Regardless of what $\alpha$ or link you use, any of the downstream functions provided in R for glms will work on the glm fitted model object produced by glm().
Given a GLM using Tweedie, how do I find the coefficients? Are you familiar with generalized linear models in R? If so, you can fit Tweedie glms just like any other glms. The glm family definition necessary to make this happen is provided by the statmod R pac
39,000
Multicollinearity between ln(x) and ln(x)^2
Except for very small counts, $\log(x)^2$ is essentially a linear function of $\log(x)$: The colored lines are least squares fits to $\log(x)^2$ vs $\log(x)$ for various ranges of counts $x$. They are extremely good once $x$ exceeds $10$ (and still awfully good even when $x\gt 4$ or so). Introducing the square of a variable sometimes is used to test goodness of fit, but (in my experience) is rarely a good choice as an explanatory variable. To account for a nonlinear response, consider these options: Study the nature of the nonlinearity. Select appropriate variables and/or transformation to capture it. Keep the count itself in the model. There will still be collinearity for larger counts, so consider creating a pair of orthogonal variables from $x$ and $\log(x)$ in order to achieve a numerically stable fit. Use splines of $x$ (and/or $\log(x)$) to model the nonlinearity. Ignore the problem altogether. If you have enough data, a large VIF may be inconsequential. Unless your purpose is to obtain precise coefficient estimates (which your willingness to transform suggests is not the case), then collinearity scarcely matters anyway.
Multicollinearity between ln(x) and ln(x)^2
Except for very small counts, $\log(x)^2$ is essentially a linear function of $\log(x)$: The colored lines are least squares fits to $\log(x)^2$ vs $\log(x)$ for various ranges of counts $x$. They a
Multicollinearity between ln(x) and ln(x)^2 Except for very small counts, $\log(x)^2$ is essentially a linear function of $\log(x)$: The colored lines are least squares fits to $\log(x)^2$ vs $\log(x)$ for various ranges of counts $x$. They are extremely good once $x$ exceeds $10$ (and still awfully good even when $x\gt 4$ or so). Introducing the square of a variable sometimes is used to test goodness of fit, but (in my experience) is rarely a good choice as an explanatory variable. To account for a nonlinear response, consider these options: Study the nature of the nonlinearity. Select appropriate variables and/or transformation to capture it. Keep the count itself in the model. There will still be collinearity for larger counts, so consider creating a pair of orthogonal variables from $x$ and $\log(x)$ in order to achieve a numerically stable fit. Use splines of $x$ (and/or $\log(x)$) to model the nonlinearity. Ignore the problem altogether. If you have enough data, a large VIF may be inconsequential. Unless your purpose is to obtain precise coefficient estimates (which your willingness to transform suggests is not the case), then collinearity scarcely matters anyway.
Multicollinearity between ln(x) and ln(x)^2 Except for very small counts, $\log(x)^2$ is essentially a linear function of $\log(x)$: The colored lines are least squares fits to $\log(x)^2$ vs $\log(x)$ for various ranges of counts $x$. They a