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
|
|---|---|---|---|---|---|---|
47,001
|
How to know if the p value will increase or decrease
|
I thought I would add some code so OP can easily see this effect in action. This answer supports that by @Romain, except I used a one-sample t-test instead of a one-sample Z-test. That won't make much of a difference.
A is a sample of 100 observations with a mean of approximately 10 and a standard deviation of approximately 3. (These could be changed in the rnorm function.)
B will be a similar sample of 200 observations. A and B have exactly the same mean. Their sample standard deviation will be just slightly different, because of the way sample standard deviation is calculated.
This code can be run in R or at rdrr.io/snippets. The code is a little complex, but the output is easy to read. You can run it many times to see the behavior of the p-value starting with different samples.
Funny = function(){
A = rnorm(100, 10, 3)
lA = length(A)
mA = mean(A)
sdA = sd(A)
pA = t.test(A, mu=10)$p.value
B = c(A,A)
lB = length(B)
mB = mean(B)
sdB = sd(B)
pB = t.test(B, mu=10)$p.value
Out = data.frame(Statistic=rep("A", 8), Value = rep(0.00, 8))
Out$Statistic = c("n for A", "Mean of A",
"Standard deviation of A", "t-test p-value for A",
"n for B", "Mean of B",
"Standard deviation of B", "t-test p-value for B")
Out$Value = c(signif(lA,3), signif(mA,3), signif(sdA,3), signif(pA,3),
signif(lB,3), signif(mB,3), signif(sdB,3), signif(pB,3))
return(Out)
}
Funny()
### Example output
###
### Statistic Value
### 1 n for A 100.000
### 2 Mean of A 10.200
### 3 Standard deviation of A 3.140
### 4 t-test p-value for A 0.518
### 5 n for B 200.000
### 6 Mean of B 10.200
### 7 Standard deviation of B 3.140
### 8 t-test p-value for B 0.358
|
How to know if the p value will increase or decrease
|
I thought I would add some code so OP can easily see this effect in action. This answer supports that by @Romain, except I used a one-sample t-test instead of a one-sample Z-test. That won't make mu
|
How to know if the p value will increase or decrease
I thought I would add some code so OP can easily see this effect in action. This answer supports that by @Romain, except I used a one-sample t-test instead of a one-sample Z-test. That won't make much of a difference.
A is a sample of 100 observations with a mean of approximately 10 and a standard deviation of approximately 3. (These could be changed in the rnorm function.)
B will be a similar sample of 200 observations. A and B have exactly the same mean. Their sample standard deviation will be just slightly different, because of the way sample standard deviation is calculated.
This code can be run in R or at rdrr.io/snippets. The code is a little complex, but the output is easy to read. You can run it many times to see the behavior of the p-value starting with different samples.
Funny = function(){
A = rnorm(100, 10, 3)
lA = length(A)
mA = mean(A)
sdA = sd(A)
pA = t.test(A, mu=10)$p.value
B = c(A,A)
lB = length(B)
mB = mean(B)
sdB = sd(B)
pB = t.test(B, mu=10)$p.value
Out = data.frame(Statistic=rep("A", 8), Value = rep(0.00, 8))
Out$Statistic = c("n for A", "Mean of A",
"Standard deviation of A", "t-test p-value for A",
"n for B", "Mean of B",
"Standard deviation of B", "t-test p-value for B")
Out$Value = c(signif(lA,3), signif(mA,3), signif(sdA,3), signif(pA,3),
signif(lB,3), signif(mB,3), signif(sdB,3), signif(pB,3))
return(Out)
}
Funny()
### Example output
###
### Statistic Value
### 1 n for A 100.000
### 2 Mean of A 10.200
### 3 Standard deviation of A 3.140
### 4 t-test p-value for A 0.518
### 5 n for B 200.000
### 6 Mean of B 10.200
### 7 Standard deviation of B 3.140
### 8 t-test p-value for B 0.358
|
How to know if the p value will increase or decrease
I thought I would add some code so OP can easily see this effect in action. This answer supports that by @Romain, except I used a one-sample t-test instead of a one-sample Z-test. That won't make mu
|
47,002
|
Projections in new coordinates in PCA example
|
We are subtracting from the mean, hence shifting the mean as the new origin.
We are told the mean is $[0, -1]$.
Hence we first subtract $0$ from $X_1$ and we subtract $-1$ from $X_2$. Hence that is how we obtain $(X_1, X_2+1)$.
After that we project it to the eigenvector, $(0.95, -0.31)$, this is done by taking the inner product of $(X_1, X_2+1)$ and $(0.95, -0.31)$.
Similarly for the second eigenvector.
|
Projections in new coordinates in PCA example
|
We are subtracting from the mean, hence shifting the mean as the new origin.
We are told the mean is $[0, -1]$.
Hence we first subtract $0$ from $X_1$ and we subtract $-1$ from $X_2$. Hence that is ho
|
Projections in new coordinates in PCA example
We are subtracting from the mean, hence shifting the mean as the new origin.
We are told the mean is $[0, -1]$.
Hence we first subtract $0$ from $X_1$ and we subtract $-1$ from $X_2$. Hence that is how we obtain $(X_1, X_2+1)$.
After that we project it to the eigenvector, $(0.95, -0.31)$, this is done by taking the inner product of $(X_1, X_2+1)$ and $(0.95, -0.31)$.
Similarly for the second eigenvector.
|
Projections in new coordinates in PCA example
We are subtracting from the mean, hence shifting the mean as the new origin.
We are told the mean is $[0, -1]$.
Hence we first subtract $0$ from $X_1$ and we subtract $-1$ from $X_2$. Hence that is ho
|
47,003
|
one example on naive bayes?
|
According to Bayes formula, $$P(B| (X,Y)=(3,1))=\frac{P((X,Y)=(3,1)|B)P(B)}{P((X,Y)=(3,1))}$$
$P(B)$ is $4/7$ based on number of examples in each class. And, we’ll apply the Naive assumption, i.e. conditional independence, on features given class as follows:
$$P((X,Y)=(3,1)|B) =P(X=3|B)P(Y=1|B)=1/4\times1/2=1/8$$
So, the numerator is 1/14, which is equal to the given answer. But, this is not normalized, so it is not the probability of this sample belonging to class B. However, typically, in Naive Bayes, we only calculate the numerator and decide the class which maximizes it.
Normally, you need to calculate the denominator for a probability, and there you’ll apply total law of probability:
$$P((X,Y)=(3,1)) = P((X,Y)=(3,1)|B)P(B) + P((X,Y)=(3,1)|A)P(A) $$
Here, we proceed similarly for class A. $P(A)=3/7$ and $$P((X,Y)=(3,1)|A)=P(X=3|A)P(Y=1|A)=1/3\times1/3=1/9$$
So,
$$P((X,Y)=(3,1))=1/14+1/9\times3/7=1/14+1/21=5/42$$
When we substitute into the original Bayes formula, we have
$$P(B| (X,Y)=(3,1))=\frac{1/14}{5/42}=3/5$$
Edit: If priors P(A) and P(B) are given as equal and not estimated from the data, i.e. they're both 1/2, we'll just substitute 1/2 for them (i.e. P(A) and P(B)) in the above equations, the probability we're interested in is
$$p=\frac{1/8\times1/2}{1/8\times1/2+1/9\times1/2}=9/17$$
|
one example on naive bayes?
|
According to Bayes formula, $$P(B| (X,Y)=(3,1))=\frac{P((X,Y)=(3,1)|B)P(B)}{P((X,Y)=(3,1))}$$
$P(B)$ is $4/7$ based on number of examples in each class. And, we’ll apply the Naive assumption, i.e. con
|
one example on naive bayes?
According to Bayes formula, $$P(B| (X,Y)=(3,1))=\frac{P((X,Y)=(3,1)|B)P(B)}{P((X,Y)=(3,1))}$$
$P(B)$ is $4/7$ based on number of examples in each class. And, we’ll apply the Naive assumption, i.e. conditional independence, on features given class as follows:
$$P((X,Y)=(3,1)|B) =P(X=3|B)P(Y=1|B)=1/4\times1/2=1/8$$
So, the numerator is 1/14, which is equal to the given answer. But, this is not normalized, so it is not the probability of this sample belonging to class B. However, typically, in Naive Bayes, we only calculate the numerator and decide the class which maximizes it.
Normally, you need to calculate the denominator for a probability, and there you’ll apply total law of probability:
$$P((X,Y)=(3,1)) = P((X,Y)=(3,1)|B)P(B) + P((X,Y)=(3,1)|A)P(A) $$
Here, we proceed similarly for class A. $P(A)=3/7$ and $$P((X,Y)=(3,1)|A)=P(X=3|A)P(Y=1|A)=1/3\times1/3=1/9$$
So,
$$P((X,Y)=(3,1))=1/14+1/9\times3/7=1/14+1/21=5/42$$
When we substitute into the original Bayes formula, we have
$$P(B| (X,Y)=(3,1))=\frac{1/14}{5/42}=3/5$$
Edit: If priors P(A) and P(B) are given as equal and not estimated from the data, i.e. they're both 1/2, we'll just substitute 1/2 for them (i.e. P(A) and P(B)) in the above equations, the probability we're interested in is
$$p=\frac{1/8\times1/2}{1/8\times1/2+1/9\times1/2}=9/17$$
|
one example on naive bayes?
According to Bayes formula, $$P(B| (X,Y)=(3,1))=\frac{P((X,Y)=(3,1)|B)P(B)}{P((X,Y)=(3,1))}$$
$P(B)$ is $4/7$ based on number of examples in each class. And, we’ll apply the Naive assumption, i.e. con
|
47,004
|
Is there a formal proof that Autoencoders perform non-linear PCA?
|
There is not a formal proof because the assertion is false: autoencoders do not perform non-linear PCA.
PCA is defined as a (reversible) linear transformation into a space where variables are now orthogonal that captures maximal variance.
Autoencoders do not do that in general.
Linear autoencoders with $k$-dimensional bottlenecks will often converge to the space spanned by the $k$ first principal components.
Notice, however, that the orthogonal part is forsaken.
Non-linear PCA is mostly Kernel PCA.
This entails a specific space: one defined by the kernel of choice.
Non-linear autoencoders, most often (I'm sure there are exceptions) do not employ kernels, instead modelling a local space directly.
So, in essence, they are not performing non-linear PCA, just non-linear dimension reduction.
|
Is there a formal proof that Autoencoders perform non-linear PCA?
|
There is not a formal proof because the assertion is false: autoencoders do not perform non-linear PCA.
PCA is defined as a (reversible) linear transformation into a space where variables are now orth
|
Is there a formal proof that Autoencoders perform non-linear PCA?
There is not a formal proof because the assertion is false: autoencoders do not perform non-linear PCA.
PCA is defined as a (reversible) linear transformation into a space where variables are now orthogonal that captures maximal variance.
Autoencoders do not do that in general.
Linear autoencoders with $k$-dimensional bottlenecks will often converge to the space spanned by the $k$ first principal components.
Notice, however, that the orthogonal part is forsaken.
Non-linear PCA is mostly Kernel PCA.
This entails a specific space: one defined by the kernel of choice.
Non-linear autoencoders, most often (I'm sure there are exceptions) do not employ kernels, instead modelling a local space directly.
So, in essence, they are not performing non-linear PCA, just non-linear dimension reduction.
|
Is there a formal proof that Autoencoders perform non-linear PCA?
There is not a formal proof because the assertion is false: autoencoders do not perform non-linear PCA.
PCA is defined as a (reversible) linear transformation into a space where variables are now orth
|
47,005
|
Linear regression coefficient when residuals are regressed against each other
|
As a hint, consider this simulation in R:
rm(list=ls())
set.seed(42)
n=1000
x3= rnorm(n)
x2 = 1 + 2 * x3 + rnorm(n)
lm(x2 ~ x3)
Coefficients:
(Intercept) x3
0.9949 2.0098
# let's store the residual v2:
v2 = lm(x2~x3)$res
# now let's consider the second model:
lm(x3~x2)
Coefficients:
(Intercept) x2
-0.4044 0.4014
# and store the residual v3:
v3 = lm(x3~x2)$res
# let's regress v3 on v2:
lm(v3~v2)
Coefficients:
(Intercept) v2
-2.255e-17 -4.014e-01
They're not equal but they look related.
Edit:
Plug the equation of $X_2$ in the second model and isolate $v_3$. You will see that the parameter on $v_2$ is $-d$.
|
Linear regression coefficient when residuals are regressed against each other
|
As a hint, consider this simulation in R:
rm(list=ls())
set.seed(42)
n=1000
x3= rnorm(n)
x2 = 1 + 2 * x3 + rnorm(n)
lm(x2 ~ x3)
Coefficients:
(Intercept) x3
0.9949 2.0098
# let's store
|
Linear regression coefficient when residuals are regressed against each other
As a hint, consider this simulation in R:
rm(list=ls())
set.seed(42)
n=1000
x3= rnorm(n)
x2 = 1 + 2 * x3 + rnorm(n)
lm(x2 ~ x3)
Coefficients:
(Intercept) x3
0.9949 2.0098
# let's store the residual v2:
v2 = lm(x2~x3)$res
# now let's consider the second model:
lm(x3~x2)
Coefficients:
(Intercept) x2
-0.4044 0.4014
# and store the residual v3:
v3 = lm(x3~x2)$res
# let's regress v3 on v2:
lm(v3~v2)
Coefficients:
(Intercept) v2
-2.255e-17 -4.014e-01
They're not equal but they look related.
Edit:
Plug the equation of $X_2$ in the second model and isolate $v_3$. You will see that the parameter on $v_2$ is $-d$.
|
Linear regression coefficient when residuals are regressed against each other
As a hint, consider this simulation in R:
rm(list=ls())
set.seed(42)
n=1000
x3= rnorm(n)
x2 = 1 + 2 * x3 + rnorm(n)
lm(x2 ~ x3)
Coefficients:
(Intercept) x3
0.9949 2.0098
# let's store
|
47,006
|
Linear regression coefficient when residuals are regressed against each other
|
From the first regression, we have $$X_3 = -\frac{a}{b} + \frac{1}{b} X_2 - \frac{v_2}{b}$$
Comparing this with $$ X_3 = c + dX_2 + v_3$$
and assuming the two regressions are performed similarly, we have $$c = -\frac{a}{b}$$ $$d = \frac{1}{b} $$ and $$v_3 = \frac{-1}{b}v2$$
Therefore we have $$v3 = -d v2$$
|
Linear regression coefficient when residuals are regressed against each other
|
From the first regression, we have $$X_3 = -\frac{a}{b} + \frac{1}{b} X_2 - \frac{v_2}{b}$$
Comparing this with $$ X_3 = c + dX_2 + v_3$$
and assuming the two regressions are performed similarly, we h
|
Linear regression coefficient when residuals are regressed against each other
From the first regression, we have $$X_3 = -\frac{a}{b} + \frac{1}{b} X_2 - \frac{v_2}{b}$$
Comparing this with $$ X_3 = c + dX_2 + v_3$$
and assuming the two regressions are performed similarly, we have $$c = -\frac{a}{b}$$ $$d = \frac{1}{b} $$ and $$v_3 = \frac{-1}{b}v2$$
Therefore we have $$v3 = -d v2$$
|
Linear regression coefficient when residuals are regressed against each other
From the first regression, we have $$X_3 = -\frac{a}{b} + \frac{1}{b} X_2 - \frac{v_2}{b}$$
Comparing this with $$ X_3 = c + dX_2 + v_3$$
and assuming the two regressions are performed similarly, we h
|
47,007
|
Is Bayesian estimation useful for causal analyses?
|
While you say we want unbiased estimators of the causal effect, generally we are interested in obtaining an accurate/precise estimate of a quantity of interest. When offered a range of estimators to choose from, a sensible selection criterion is to choose one that minimizes the expected loss, where loss is due to the estimation error. A convenient special case is square (quadratic) loss. Due to the bias-variance trade-off, a biased estimator may have lower expected squared error (lower expected loss) and thus higher precision/accuracy than an unbiased one. Bayesian methods take advantage of that as they introduce bias into their estimators but simultaneously achieve a reduction in variance. If the trade-off is favorable as compared to an unbiased estimator, i.e. the reduction in variance outweighs the squared bias, this looks like a good-enough reason for opting for Bayesian estimation. This applies not only to estimators of causal effects but also more generally.
|
Is Bayesian estimation useful for causal analyses?
|
While you say we want unbiased estimators of the causal effect, generally we are interested in obtaining an accurate/precise estimate of a quantity of interest. When offered a range of estimators to c
|
Is Bayesian estimation useful for causal analyses?
While you say we want unbiased estimators of the causal effect, generally we are interested in obtaining an accurate/precise estimate of a quantity of interest. When offered a range of estimators to choose from, a sensible selection criterion is to choose one that minimizes the expected loss, where loss is due to the estimation error. A convenient special case is square (quadratic) loss. Due to the bias-variance trade-off, a biased estimator may have lower expected squared error (lower expected loss) and thus higher precision/accuracy than an unbiased one. Bayesian methods take advantage of that as they introduce bias into their estimators but simultaneously achieve a reduction in variance. If the trade-off is favorable as compared to an unbiased estimator, i.e. the reduction in variance outweighs the squared bias, this looks like a good-enough reason for opting for Bayesian estimation. This applies not only to estimators of causal effects but also more generally.
|
Is Bayesian estimation useful for causal analyses?
While you say we want unbiased estimators of the causal effect, generally we are interested in obtaining an accurate/precise estimate of a quantity of interest. When offered a range of estimators to c
|
47,008
|
KL-divergence: P||Q vs. Q||P
|
In
$$\DeclareMathOperator{\E}{\mathbb{E}}
D_{KL}(P || Q) = \int_{-\infty}^{\infty}p(x)\log\left(\frac{p(x)}{q(x)}\right)\;dx
= \E_{P}\log\left(\frac{p(X)}{q(X)}\right)
$$ we see this is the expectation of the loglikelihood ratio when $P$ is the truth, see Intuition on the Kullback-Leibler (KL) Divergence.
If, in hypothesis test language, $P$ is the null while $Q$ is the alternative:
So $D_{KL}(P || Q)$ is divergence of $Q$ from (null) truth, while $D_{KL}(Q || P)$ is divergence when the alternative hypothesis is taken as truth. Then your question:
which distribution $P_1,\dotsc,P_k$ is the closest to $Q$ is a sense
of KL-divergence?
If this means you want a model which is difficult to distinguish from $Q$ when/if $Q$ is the truth, you needs $D_{KL}(Q || P)$. Remember, the first argument is the truth (This is a way of saying that we calculate the divergence calculating an expectation assuming that the distribution generating $X$ is the distribution given in the first argument. That is, the truth about what is generating $X$.)
|
KL-divergence: P||Q vs. Q||P
|
In
$$\DeclareMathOperator{\E}{\mathbb{E}}
D_{KL}(P || Q) = \int_{-\infty}^{\infty}p(x)\log\left(\frac{p(x)}{q(x)}\right)\;dx
= \E_{P}\log\left(\frac{p(X)}{q(X)}\right)
$$ we see this is the expectati
|
KL-divergence: P||Q vs. Q||P
In
$$\DeclareMathOperator{\E}{\mathbb{E}}
D_{KL}(P || Q) = \int_{-\infty}^{\infty}p(x)\log\left(\frac{p(x)}{q(x)}\right)\;dx
= \E_{P}\log\left(\frac{p(X)}{q(X)}\right)
$$ we see this is the expectation of the loglikelihood ratio when $P$ is the truth, see Intuition on the Kullback-Leibler (KL) Divergence.
If, in hypothesis test language, $P$ is the null while $Q$ is the alternative:
So $D_{KL}(P || Q)$ is divergence of $Q$ from (null) truth, while $D_{KL}(Q || P)$ is divergence when the alternative hypothesis is taken as truth. Then your question:
which distribution $P_1,\dotsc,P_k$ is the closest to $Q$ is a sense
of KL-divergence?
If this means you want a model which is difficult to distinguish from $Q$ when/if $Q$ is the truth, you needs $D_{KL}(Q || P)$. Remember, the first argument is the truth (This is a way of saying that we calculate the divergence calculating an expectation assuming that the distribution generating $X$ is the distribution given in the first argument. That is, the truth about what is generating $X$.)
|
KL-divergence: P||Q vs. Q||P
In
$$\DeclareMathOperator{\E}{\mathbb{E}}
D_{KL}(P || Q) = \int_{-\infty}^{\infty}p(x)\log\left(\frac{p(x)}{q(x)}\right)\;dx
= \E_{P}\log\left(\frac{p(X)}{q(X)}\right)
$$ we see this is the expectati
|
47,009
|
Uncertainty propagation for the solution of an integral equation
|
Let's break this down into easier problems. To keep the post reasonably short, I will only sketch a good confidence interval procedure without going into all the details.
What is interesting about this situation is that because $Y$ varies in such a complex, nonlinear fashion with the distribution parameters, a careful analysis and special solution are needed to obtain valid, unbiased confidence intervals.
The Weibull model and parameterization
To begin, we have to get into the details of the model because we need to know how $Y$ depends on the parameter estimates. The basic Weibull distribution of shape $k\gt 0$ is determined by the survival function
$$S(x;k) = \exp(-(x^k)),\quad x \ge 0.$$
It extends to a family of distributions by introducing a rate parameter $\theta\gt 0$ to multiply $x:$
$$S(x;k,\theta) = S(\theta x;k).$$
Its hazard function is defined as the negative logarithmic derivative of $S,$
$$h(x;k,\theta) = -\frac{\mathrm{d}}{\mathrm{d}x}\log S(x;k,\theta) = \frac{\mathrm{d}}{\mathrm{d}x} (\theta x)^k = k\, \theta^k x^{k-1},$$
a particularly simple form.
The integral
Thus, the integral in the question is
$$s(x,k,\theta)=\int_0^x S(t;k,\theta)\,\mathrm{d}t = \int_0^x \exp(-(\theta t)^k)\,\mathrm{d}t$$
which we may integrate via the (strictly increasing) substitution $t=(u/\theta)^{1/k},$ $\mathrm{d}t=\theta^{-1/k}u^{1/k-1}\mathrm{d}u/k:$
$$s(x,k,\theta) = \int_0^u \exp(-u)\,\theta^{-1/k}u^{1/k-1}\mathrm{d}u/k=\frac{1}{k\,\theta^{1/k}}\Gamma\left(\frac{1}{k}, (\theta x)^k\right).$$
$\Gamma$ is the incomplete Gamma function, widely available in statistical software as a multiple of the Gamma CDF of shape $1/k.$
An explicit representation of $Y$
The foregoing results yield
$$\begin{aligned}
Y(x;k,\theta) &= h(x;k,\theta) s(x;k,\theta) + S(x;k,\theta)\\
&= \theta^{k-1/k}x^{k-1} \Gamma\left(\frac{1}{k}, (\theta x)^k\right) + \exp(-(\theta x)^k).
\end{aligned}$$
This example for $x=2$ shows $Y$ may have a saddle point. Here, that point is near $(k,\theta)=(1.7, 0.6).$ For this reason I chose to study these particular parameter values in detail below.
A confidence interval for $Y$
At this point the situation gets complicated because
$Y$ is a function of two parameters, not just a transformation of one.
Even when you fix one of the parameters, $Y$ is not necessary a one-to-one transformation of the other.
What we can do is explore the values of $Y$ that are consistent with the data. What that means is variations in the parameters $(k,\theta)$ can only decrease the likelihood of the data. When they decrease it too much (more about that in an instant), their combined values have to be considered implausible.
Theory (based on the asymptotic distribution of the log likelihood) says that when you allow $p$ parameters to vary, you should allow the log likelihood to decrease by up to one-half a percentile of a $\chi^2(p)$ distribution: anything smaller is implausible. Doing this determines a region (in the parameter space, a subset of $\mathbb{R}^p$) called a confidence set. The confidence level of this confidence set is the chosen percentile. For instance, for 95% confidence with $p=1$ parameter you would let the log likelihood to fall by up to $1.92$ because there is a 95% chance that a $\chi^2(1)$ variable will be $2\times 1.92 = 3.84$ or less. When varying $p=2$ parameters simultaneously, you would let the log likelihood fall by up to $3.0.$
Because $Y$ cannot necessarily be used as a parameter, we must vary the two parameters $k$ and $\theta$ to explore how the log likelihood depends on them, while examining the range of values of $Y=Y(x,k,\theta)$ that arise within the confidence region. But what value should we use for $p:$ $1$ to reflect our focus on a single value $Y$ or $2$ to reflect the need to vary two parameters?
Simulations indicate the right value may be neither. I studied the case $k=1.7,$ $\theta=0.6,$ $x=2$ intensively. For sample sizes of $51$ and $300$ I found that assuming $p=1$ produces an interval for $Y$ having around $92\%$ confidence. Here is a plot of the intervals for 500 datasets of $51$ observations each:
The true value of $Y$ is marked with a horizontal axis at $1.456.$ The datasets sorted by the lengths of the confidence intervals they produced. Estimated values of $Y$ are shown with dots (which tend to be near the upper ends of the confidence intervals). Intervals that do not cover $Y$ are shown in red. There are too many of them and they tend to be biased low. (This bias persists with sample sizes of $300.$)
Assuming $p=2$ produces an interval having around 98% confidence (based on the same simulated datasets):
(Notice the change of scale on the vertical axis.)
Now there aren't enough red intervals: if you set $p=2,$ your procedure will have higher confidence than you want. (That's not a good thing, because it implies you spent too much to obtain your data. Roughly, the sample size is $40\%$ greater than needed to achieve a decision procedure that meets your requirements.)
A solution: bootstrapping
These potential problems with bias (in the estimates of $Y$ and in the confidence interval coverage) suggest bootstrapping the confidence interval. Two forms of bootstrap are attractive: the usual nonparametric method in which the data are resampled from the raw dataset and a parametric method in which the data are sampled from the distribution defined by the Maximum Likelihood parameter estimates.
I experimented with both methods, but recommend the parametric method because it is likelier to compensate well for the bias in using MLEs in the first place.
This is the default output of the boot::boot function in R after $50000$ parametric iterations. The original dataset consisted of $300$ observations this time. "$t$" is the bootstrap value of $Y.$ The skewed bootstrap distribution shown here indicates the desirability of the bias correction.
To summarize,
The Maximum Likelihood nominal $95\%$ confidence intervals are $[1.431, 1.459]$ ($p=1$) and $[1.423, 1.462]$ ($p=2$). Remember, though, that the former is likely too short and the latter too long.
The 95% BCa (bias corrected and accelerated) confidence interval was estimated from these results as $[1.453, 1.497].$ This interval is shifted noticeably higher than the MLE intervals. This is (mild) confirmation of the expectation that bootstrapping will remove at least some of the bias in the MLE estimator.
Unfortunately, BCa intervals tend to be "unstable" in the sense that they often use extreme quantiles of the bootstrap distribution. Three other bootstrap intervals ("Normal", "Basic", and "Percentile") run from $1.446$ to $1.449$ on the lower end to $1.469$ on the upper end. These, too, are shifted but not by as much. They are also narrower than the MLE intervals. If this pattern persists, narrower intervals are good: they provide more precision.
One could identify which interval is best to use via simulation, as in the first two figures above, but since this would require days of computation, I haven't bothered.
Bootstrapping code
#
# The log likelihood for data array `x`, as a function of the shape parameter `k`
# and the log of the rate parameter. (Log rates or scales are better estimation targets
# than the rates or scales themselves.)
#
Lambda <- function(beta, x) sum(dweibull(x, beta[1], exp(-beta[2]), log=TRUE))
#
# `Y` as a function of the shape parameter `k`, rate parameter `theta`, and
# data vector `x`.
#
Y <- function(k, theta, x) {
z <- (k - 1/k) * log(theta) +
(k-1) * log(x) +
pgamma((x*theta)^k, 1/k, log.p=TRUE) + lgamma(1/k) - log(k) - log(theta)
exp(z) + exp(-(theta * x)^k)
}
#
# A synthetic dataset.
#
k <- 1.7
theta <- 0.6
t0 <- 2 # Endpoint of integral defining `Y`
print(Y(k, theta, t0)) # True value of `Y`
n <- 300
set.seed(17)
x <- rweibull(n, k, 1/theta)
fit <- maxLik(Lambda, start=c(1, 0), x=x)
#
# The maximum likelihood estimates.
#
k.hat <- coefficients(fit)[1]
theta.hat <- exp(-coefficients(fit)[2])
print(Y(k.hat, theta.hat, t0)) # MLE of `Y`
#
# The function to bootstrap.
#
f <- function(ds, i, method="Parametric") {
if (method=="Parametric") {
x <- rweibull(length(i), k.hat, 1/theta.hat) # Parametric
} else {
x <- ds[i] # Nonparametric
}
fit <- maxLik(Lambda, start=c(1, 0), x=x)
Y(coefficients(fit)[1], exp(-coefficients(fit)[2]), t0)
}
#
# The bootstrap.
# (Requires perhaps 0.005 sec per iteration.)
#
library(boot)
B <- boot(x, f, 5e4)
plot(B)
boot.ci(B) # Prints four CIs for comparison
|
Uncertainty propagation for the solution of an integral equation
|
Let's break this down into easier problems. To keep the post reasonably short, I will only sketch a good confidence interval procedure without going into all the details.
What is interesting about th
|
Uncertainty propagation for the solution of an integral equation
Let's break this down into easier problems. To keep the post reasonably short, I will only sketch a good confidence interval procedure without going into all the details.
What is interesting about this situation is that because $Y$ varies in such a complex, nonlinear fashion with the distribution parameters, a careful analysis and special solution are needed to obtain valid, unbiased confidence intervals.
The Weibull model and parameterization
To begin, we have to get into the details of the model because we need to know how $Y$ depends on the parameter estimates. The basic Weibull distribution of shape $k\gt 0$ is determined by the survival function
$$S(x;k) = \exp(-(x^k)),\quad x \ge 0.$$
It extends to a family of distributions by introducing a rate parameter $\theta\gt 0$ to multiply $x:$
$$S(x;k,\theta) = S(\theta x;k).$$
Its hazard function is defined as the negative logarithmic derivative of $S,$
$$h(x;k,\theta) = -\frac{\mathrm{d}}{\mathrm{d}x}\log S(x;k,\theta) = \frac{\mathrm{d}}{\mathrm{d}x} (\theta x)^k = k\, \theta^k x^{k-1},$$
a particularly simple form.
The integral
Thus, the integral in the question is
$$s(x,k,\theta)=\int_0^x S(t;k,\theta)\,\mathrm{d}t = \int_0^x \exp(-(\theta t)^k)\,\mathrm{d}t$$
which we may integrate via the (strictly increasing) substitution $t=(u/\theta)^{1/k},$ $\mathrm{d}t=\theta^{-1/k}u^{1/k-1}\mathrm{d}u/k:$
$$s(x,k,\theta) = \int_0^u \exp(-u)\,\theta^{-1/k}u^{1/k-1}\mathrm{d}u/k=\frac{1}{k\,\theta^{1/k}}\Gamma\left(\frac{1}{k}, (\theta x)^k\right).$$
$\Gamma$ is the incomplete Gamma function, widely available in statistical software as a multiple of the Gamma CDF of shape $1/k.$
An explicit representation of $Y$
The foregoing results yield
$$\begin{aligned}
Y(x;k,\theta) &= h(x;k,\theta) s(x;k,\theta) + S(x;k,\theta)\\
&= \theta^{k-1/k}x^{k-1} \Gamma\left(\frac{1}{k}, (\theta x)^k\right) + \exp(-(\theta x)^k).
\end{aligned}$$
This example for $x=2$ shows $Y$ may have a saddle point. Here, that point is near $(k,\theta)=(1.7, 0.6).$ For this reason I chose to study these particular parameter values in detail below.
A confidence interval for $Y$
At this point the situation gets complicated because
$Y$ is a function of two parameters, not just a transformation of one.
Even when you fix one of the parameters, $Y$ is not necessary a one-to-one transformation of the other.
What we can do is explore the values of $Y$ that are consistent with the data. What that means is variations in the parameters $(k,\theta)$ can only decrease the likelihood of the data. When they decrease it too much (more about that in an instant), their combined values have to be considered implausible.
Theory (based on the asymptotic distribution of the log likelihood) says that when you allow $p$ parameters to vary, you should allow the log likelihood to decrease by up to one-half a percentile of a $\chi^2(p)$ distribution: anything smaller is implausible. Doing this determines a region (in the parameter space, a subset of $\mathbb{R}^p$) called a confidence set. The confidence level of this confidence set is the chosen percentile. For instance, for 95% confidence with $p=1$ parameter you would let the log likelihood to fall by up to $1.92$ because there is a 95% chance that a $\chi^2(1)$ variable will be $2\times 1.92 = 3.84$ or less. When varying $p=2$ parameters simultaneously, you would let the log likelihood fall by up to $3.0.$
Because $Y$ cannot necessarily be used as a parameter, we must vary the two parameters $k$ and $\theta$ to explore how the log likelihood depends on them, while examining the range of values of $Y=Y(x,k,\theta)$ that arise within the confidence region. But what value should we use for $p:$ $1$ to reflect our focus on a single value $Y$ or $2$ to reflect the need to vary two parameters?
Simulations indicate the right value may be neither. I studied the case $k=1.7,$ $\theta=0.6,$ $x=2$ intensively. For sample sizes of $51$ and $300$ I found that assuming $p=1$ produces an interval for $Y$ having around $92\%$ confidence. Here is a plot of the intervals for 500 datasets of $51$ observations each:
The true value of $Y$ is marked with a horizontal axis at $1.456.$ The datasets sorted by the lengths of the confidence intervals they produced. Estimated values of $Y$ are shown with dots (which tend to be near the upper ends of the confidence intervals). Intervals that do not cover $Y$ are shown in red. There are too many of them and they tend to be biased low. (This bias persists with sample sizes of $300.$)
Assuming $p=2$ produces an interval having around 98% confidence (based on the same simulated datasets):
(Notice the change of scale on the vertical axis.)
Now there aren't enough red intervals: if you set $p=2,$ your procedure will have higher confidence than you want. (That's not a good thing, because it implies you spent too much to obtain your data. Roughly, the sample size is $40\%$ greater than needed to achieve a decision procedure that meets your requirements.)
A solution: bootstrapping
These potential problems with bias (in the estimates of $Y$ and in the confidence interval coverage) suggest bootstrapping the confidence interval. Two forms of bootstrap are attractive: the usual nonparametric method in which the data are resampled from the raw dataset and a parametric method in which the data are sampled from the distribution defined by the Maximum Likelihood parameter estimates.
I experimented with both methods, but recommend the parametric method because it is likelier to compensate well for the bias in using MLEs in the first place.
This is the default output of the boot::boot function in R after $50000$ parametric iterations. The original dataset consisted of $300$ observations this time. "$t$" is the bootstrap value of $Y.$ The skewed bootstrap distribution shown here indicates the desirability of the bias correction.
To summarize,
The Maximum Likelihood nominal $95\%$ confidence intervals are $[1.431, 1.459]$ ($p=1$) and $[1.423, 1.462]$ ($p=2$). Remember, though, that the former is likely too short and the latter too long.
The 95% BCa (bias corrected and accelerated) confidence interval was estimated from these results as $[1.453, 1.497].$ This interval is shifted noticeably higher than the MLE intervals. This is (mild) confirmation of the expectation that bootstrapping will remove at least some of the bias in the MLE estimator.
Unfortunately, BCa intervals tend to be "unstable" in the sense that they often use extreme quantiles of the bootstrap distribution. Three other bootstrap intervals ("Normal", "Basic", and "Percentile") run from $1.446$ to $1.449$ on the lower end to $1.469$ on the upper end. These, too, are shifted but not by as much. They are also narrower than the MLE intervals. If this pattern persists, narrower intervals are good: they provide more precision.
One could identify which interval is best to use via simulation, as in the first two figures above, but since this would require days of computation, I haven't bothered.
Bootstrapping code
#
# The log likelihood for data array `x`, as a function of the shape parameter `k`
# and the log of the rate parameter. (Log rates or scales are better estimation targets
# than the rates or scales themselves.)
#
Lambda <- function(beta, x) sum(dweibull(x, beta[1], exp(-beta[2]), log=TRUE))
#
# `Y` as a function of the shape parameter `k`, rate parameter `theta`, and
# data vector `x`.
#
Y <- function(k, theta, x) {
z <- (k - 1/k) * log(theta) +
(k-1) * log(x) +
pgamma((x*theta)^k, 1/k, log.p=TRUE) + lgamma(1/k) - log(k) - log(theta)
exp(z) + exp(-(theta * x)^k)
}
#
# A synthetic dataset.
#
k <- 1.7
theta <- 0.6
t0 <- 2 # Endpoint of integral defining `Y`
print(Y(k, theta, t0)) # True value of `Y`
n <- 300
set.seed(17)
x <- rweibull(n, k, 1/theta)
fit <- maxLik(Lambda, start=c(1, 0), x=x)
#
# The maximum likelihood estimates.
#
k.hat <- coefficients(fit)[1]
theta.hat <- exp(-coefficients(fit)[2])
print(Y(k.hat, theta.hat, t0)) # MLE of `Y`
#
# The function to bootstrap.
#
f <- function(ds, i, method="Parametric") {
if (method=="Parametric") {
x <- rweibull(length(i), k.hat, 1/theta.hat) # Parametric
} else {
x <- ds[i] # Nonparametric
}
fit <- maxLik(Lambda, start=c(1, 0), x=x)
Y(coefficients(fit)[1], exp(-coefficients(fit)[2]), t0)
}
#
# The bootstrap.
# (Requires perhaps 0.005 sec per iteration.)
#
library(boot)
B <- boot(x, f, 5e4)
plot(B)
boot.ci(B) # Prints four CIs for comparison
|
Uncertainty propagation for the solution of an integral equation
Let's break this down into easier problems. To keep the post reasonably short, I will only sketch a good confidence interval procedure without going into all the details.
What is interesting about th
|
47,010
|
Understanding Simpson's paradox with random effects
|
but again this is a singular fit because the variance of the random slopes is zero - which also does not make sense because it is clearly quite variable (from the plot).
The first thing I notice here is, just eyeballing the plot, I have to disagree that the variation in the slopes is clear. The slopes all appear fairly similar. Then there is this line in your code:
subj_slopes = rep(-.5, n_subj)
The slopes are simulated to all be -0.5 ! So it not surprising that you obtain a singular gfit with random slopes.
If you change that line to, for example:
subj_slopes = rnorm(n_subj, -0.5, 0.5)
And then do the plot, you get:
where it really is now quite obvious that the slopes vary, and running the random slopes models they fit without singular fit warnings:
> lmer(y ~ x + (x|subject), data=data) %>% summary()
Linear mixed model fit by REML ['lmerMod']
Formula: y ~ x + (x | subject)
Data: data
REML criterion at convergence: 320.7
Scaled residuals:
Min 1Q Median 3Q Max
-2.83147 -0.59817 -0.00588 0.52935 2.98311
Random effects:
Groups Name Variance Std.Dev. Corr
subject (Intercept) 6.6353 2.5759
x 0.3193 0.5651 -0.70
Residual 1.0948 1.0463
Number of obs: 100, groups: subject, 5
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.1947 1.1811 0.165
x -0.6800 0.2768 -2.456
> lmer(y ~ x + (x||subject), data=data) %>% summary()
Linear mixed model fit by REML ['lmerMod']
Formula: y ~ x + ((1 | subject) + (0 + x | subject))
Data: data
REML criterion at convergence: 322.8
Scaled residuals:
Min 1Q Median 3Q Max
-2.83873 -0.62491 0.00786 0.51776 2.90389
Random effects:
Groups Name Variance Std.Dev.
subject (Intercept) 7.8235 2.7971
subject.1 x 0.3054 0.5526
Residual 1.0951 1.0465
Number of obs: 100, groups: subject, 5
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.03628 1.28880 0.028
x -0.69406 0.27343 -2.538
and we recover good estimates of the random intercepts and random slopes variance components.
Note that, as it stands, these models cannot reveal the between and within slopes. To do that you need to model "contextual effects" - centre the independent variable for each subject and also include the subject means:
> mydata <- merge(data, data %>% group_by(subject) %>% summarise(subject_mean = mean(x)))
> mydata$mean_cent <- mydata$x - mydata$subject_mean
> lmer(y ~ mean_cent + subject_mean + (1|subject), data = mydata) %>% summary()
Linear mixed model fit by REML ['lmerMod']
Formula: y ~ mean_cent + subject_mean + (1 | subject)
Data: mydata
REML criterion at convergence: 317.5
Scaled residuals:
Min 1Q Median 3Q Max
-2.70128 -0.51542 -0.03518 0.62543 2.48001
Random effects:
Groups Name Variance Std.Dev.
subject (Intercept) 0.204 0.4517
Residual 1.259 1.1221
Number of obs: 100, groups: subject, 5
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.19598 0.24301 0.806
mean_cent -0.76498 0.12396 -6.171
subject_mean 0.43955 0.08972 4.899
So now we have the between subject slope of 0.44 and the within-subject slope of -0.77, as requested. Of course you could also fit random slopes for mean_cent if you wish:
> lmer(y ~ mean_cent + subject_mean + (mean_cent|subject), data = mydata) %>% summary()
Linear mixed model fit by REML ['lmerMod']
Formula: y ~ mean_cent + subject_mean + (mean_cent | subject)
Data: mydata
REML criterion at convergence: 310
Scaled residuals:
Min 1Q Median 3Q Max
-2.82854 -0.64286 -0.01652 0.59854 2.81995
Random effects:
Groups Name Variance Std.Dev. Corr
subject (Intercept) 0.2230 0.4723
mean_cent 0.2729 0.5224 0.65
Residual 1.0964 1.0471
Number of obs: 100, groups: subject, 5
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.24382 0.24469 0.996
mean_cent -0.74379 0.26276 -2.831
subject_mean 0.49657 0.07819 6.351
and we find that the standard error for the fixed effect of mean_cent is higher due to the variation in it's slope being modelled by the random slopes.
In case you are wondering why the within-subject slope is -0.74, and not -0.5 (the mean we specified when we simulated them) it's because there are only 5 subjects, and:
> mean(subj_slopes)
[1] -0.7069806
Finally, it is also worth noting that you could also get basically the same result if you use a mutivariable regression (not a mixed mode) and fitted subject as a fixed effect :
> lm(y ~ subject + mean_cent + subject_mean, data = mydata) %>% summary()
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.59982 0.28457 2.108 0.0376 *
subject -0.13151 0.08359 -1.573 0.1189
mean_cent -0.76498 0.12905 -5.928 4.81e-08 ***
subject_mean 0.45063 0.04590 9.817 3.67e-16 ***
where subject here is not a factor (as per your simulation code). If it was a factor then you would need to exclude subject_mean from the model, as it would be perfectly collinear with the levels of subject.
|
Understanding Simpson's paradox with random effects
|
but again this is a singular fit because the variance of the random slopes is zero - which also does not make sense because it is clearly quite variable (from the plot).
The first thing I notice here
|
Understanding Simpson's paradox with random effects
but again this is a singular fit because the variance of the random slopes is zero - which also does not make sense because it is clearly quite variable (from the plot).
The first thing I notice here is, just eyeballing the plot, I have to disagree that the variation in the slopes is clear. The slopes all appear fairly similar. Then there is this line in your code:
subj_slopes = rep(-.5, n_subj)
The slopes are simulated to all be -0.5 ! So it not surprising that you obtain a singular gfit with random slopes.
If you change that line to, for example:
subj_slopes = rnorm(n_subj, -0.5, 0.5)
And then do the plot, you get:
where it really is now quite obvious that the slopes vary, and running the random slopes models they fit without singular fit warnings:
> lmer(y ~ x + (x|subject), data=data) %>% summary()
Linear mixed model fit by REML ['lmerMod']
Formula: y ~ x + (x | subject)
Data: data
REML criterion at convergence: 320.7
Scaled residuals:
Min 1Q Median 3Q Max
-2.83147 -0.59817 -0.00588 0.52935 2.98311
Random effects:
Groups Name Variance Std.Dev. Corr
subject (Intercept) 6.6353 2.5759
x 0.3193 0.5651 -0.70
Residual 1.0948 1.0463
Number of obs: 100, groups: subject, 5
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.1947 1.1811 0.165
x -0.6800 0.2768 -2.456
> lmer(y ~ x + (x||subject), data=data) %>% summary()
Linear mixed model fit by REML ['lmerMod']
Formula: y ~ x + ((1 | subject) + (0 + x | subject))
Data: data
REML criterion at convergence: 322.8
Scaled residuals:
Min 1Q Median 3Q Max
-2.83873 -0.62491 0.00786 0.51776 2.90389
Random effects:
Groups Name Variance Std.Dev.
subject (Intercept) 7.8235 2.7971
subject.1 x 0.3054 0.5526
Residual 1.0951 1.0465
Number of obs: 100, groups: subject, 5
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.03628 1.28880 0.028
x -0.69406 0.27343 -2.538
and we recover good estimates of the random intercepts and random slopes variance components.
Note that, as it stands, these models cannot reveal the between and within slopes. To do that you need to model "contextual effects" - centre the independent variable for each subject and also include the subject means:
> mydata <- merge(data, data %>% group_by(subject) %>% summarise(subject_mean = mean(x)))
> mydata$mean_cent <- mydata$x - mydata$subject_mean
> lmer(y ~ mean_cent + subject_mean + (1|subject), data = mydata) %>% summary()
Linear mixed model fit by REML ['lmerMod']
Formula: y ~ mean_cent + subject_mean + (1 | subject)
Data: mydata
REML criterion at convergence: 317.5
Scaled residuals:
Min 1Q Median 3Q Max
-2.70128 -0.51542 -0.03518 0.62543 2.48001
Random effects:
Groups Name Variance Std.Dev.
subject (Intercept) 0.204 0.4517
Residual 1.259 1.1221
Number of obs: 100, groups: subject, 5
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.19598 0.24301 0.806
mean_cent -0.76498 0.12396 -6.171
subject_mean 0.43955 0.08972 4.899
So now we have the between subject slope of 0.44 and the within-subject slope of -0.77, as requested. Of course you could also fit random slopes for mean_cent if you wish:
> lmer(y ~ mean_cent + subject_mean + (mean_cent|subject), data = mydata) %>% summary()
Linear mixed model fit by REML ['lmerMod']
Formula: y ~ mean_cent + subject_mean + (mean_cent | subject)
Data: mydata
REML criterion at convergence: 310
Scaled residuals:
Min 1Q Median 3Q Max
-2.82854 -0.64286 -0.01652 0.59854 2.81995
Random effects:
Groups Name Variance Std.Dev. Corr
subject (Intercept) 0.2230 0.4723
mean_cent 0.2729 0.5224 0.65
Residual 1.0964 1.0471
Number of obs: 100, groups: subject, 5
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.24382 0.24469 0.996
mean_cent -0.74379 0.26276 -2.831
subject_mean 0.49657 0.07819 6.351
and we find that the standard error for the fixed effect of mean_cent is higher due to the variation in it's slope being modelled by the random slopes.
In case you are wondering why the within-subject slope is -0.74, and not -0.5 (the mean we specified when we simulated them) it's because there are only 5 subjects, and:
> mean(subj_slopes)
[1] -0.7069806
Finally, it is also worth noting that you could also get basically the same result if you use a mutivariable regression (not a mixed mode) and fitted subject as a fixed effect :
> lm(y ~ subject + mean_cent + subject_mean, data = mydata) %>% summary()
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.59982 0.28457 2.108 0.0376 *
subject -0.13151 0.08359 -1.573 0.1189
mean_cent -0.76498 0.12905 -5.928 4.81e-08 ***
subject_mean 0.45063 0.04590 9.817 3.67e-16 ***
where subject here is not a factor (as per your simulation code). If it was a factor then you would need to exclude subject_mean from the model, as it would be perfectly collinear with the levels of subject.
|
Understanding Simpson's paradox with random effects
but again this is a singular fit because the variance of the random slopes is zero - which also does not make sense because it is clearly quite variable (from the plot).
The first thing I notice here
|
47,011
|
Exchangeability and joint distribution
|
Instead of focusing only on the distribution function, let's focus on equality in distribution.
A finite sequence of random variables $X_1, \ldots, X_n$ is exchangeable if for every permutation $\pi$ we have
$$
X_1, \ldots, X_N =_d X_{\pi(1)}, \ldots, X_{\pi(n)}
$$
where $=_d$ means equality in distribution.
Equality in distribution is equivalent to equality of the distribution function, equality of the probability distribution function if the random variables are continuous and equality of the probability mass function if the random variables are discrete.
Now let's get back to your example, suppose that we have a realization
$X_1, \ldots, X_5 = 1, 1, 1, 0, 0$. We can compute the joint law of $X_1, \ldots, X_n$ by hand an in particular we have
$$
P(X_1, \ldots, X_5 = 1, 1, 1, 0, 0) = \frac{3}{5} \frac{2}{4} \frac{1}{3} \frac{1}{2} \frac{1}{1}
$$
Looking at the expression above, it is clear that a permutation of the indices will leave the denominators unchanged and only the numerators will permute, leaving overall the joint probability unchanged, which is the definition of exchangeability
|
Exchangeability and joint distribution
|
Instead of focusing only on the distribution function, let's focus on equality in distribution.
A finite sequence of random variables $X_1, \ldots, X_n$ is exchangeable if for every permutation $\pi$
|
Exchangeability and joint distribution
Instead of focusing only on the distribution function, let's focus on equality in distribution.
A finite sequence of random variables $X_1, \ldots, X_n$ is exchangeable if for every permutation $\pi$ we have
$$
X_1, \ldots, X_N =_d X_{\pi(1)}, \ldots, X_{\pi(n)}
$$
where $=_d$ means equality in distribution.
Equality in distribution is equivalent to equality of the distribution function, equality of the probability distribution function if the random variables are continuous and equality of the probability mass function if the random variables are discrete.
Now let's get back to your example, suppose that we have a realization
$X_1, \ldots, X_5 = 1, 1, 1, 0, 0$. We can compute the joint law of $X_1, \ldots, X_n$ by hand an in particular we have
$$
P(X_1, \ldots, X_5 = 1, 1, 1, 0, 0) = \frac{3}{5} \frac{2}{4} \frac{1}{3} \frac{1}{2} \frac{1}{1}
$$
Looking at the expression above, it is clear that a permutation of the indices will leave the denominators unchanged and only the numerators will permute, leaving overall the joint probability unchanged, which is the definition of exchangeability
|
Exchangeability and joint distribution
Instead of focusing only on the distribution function, let's focus on equality in distribution.
A finite sequence of random variables $X_1, \ldots, X_n$ is exchangeable if for every permutation $\pi$
|
47,012
|
Exchangeability and joint distribution
|
Something that might be helpful in unifying these two views is the Hewitt-Savage(-de Finetti) representation theorem.
The theorem says that $X_1,\dots,X_n$ are exchangeable precisely when they are independent and identically distributed conditional on some additional information. This is important in Bayesian statistics, because it means that an exchangeable sequence (which seems a reasonable thing to assume) can be modelled as an iid sequence plus a prior (which is convenient mathematically).
For binary variables the extra information is just the probability. If $P$ is a random variable between 0 and 1, and $X_i|P\sim \mathrm{Bern}(P)$, then $X_i$ are exchangeable, and they are conditionally iid given $P$. That's the de Finetti result.
Hewitt and Savage showed this was true generally, not just for binary sequences: a sequence is exchangeable if and only if it's iid conditional on some extra information, in this case the 'tail $\sigma$-field'
|
Exchangeability and joint distribution
|
Something that might be helpful in unifying these two views is the Hewitt-Savage(-de Finetti) representation theorem.
The theorem says that $X_1,\dots,X_n$ are exchangeable precisely when they are ind
|
Exchangeability and joint distribution
Something that might be helpful in unifying these two views is the Hewitt-Savage(-de Finetti) representation theorem.
The theorem says that $X_1,\dots,X_n$ are exchangeable precisely when they are independent and identically distributed conditional on some additional information. This is important in Bayesian statistics, because it means that an exchangeable sequence (which seems a reasonable thing to assume) can be modelled as an iid sequence plus a prior (which is convenient mathematically).
For binary variables the extra information is just the probability. If $P$ is a random variable between 0 and 1, and $X_i|P\sim \mathrm{Bern}(P)$, then $X_i$ are exchangeable, and they are conditionally iid given $P$. That's the de Finetti result.
Hewitt and Savage showed this was true generally, not just for binary sequences: a sequence is exchangeable if and only if it's iid conditional on some extra information, in this case the 'tail $\sigma$-field'
|
Exchangeability and joint distribution
Something that might be helpful in unifying these two views is the Hewitt-Savage(-de Finetti) representation theorem.
The theorem says that $X_1,\dots,X_n$ are exchangeable precisely when they are ind
|
47,013
|
Mixed models in ecology: when to use a random effect [duplicate]
|
For almost all variables you have the choice to model them with a fixed or random effect. I personally find the term random effect quite confusing, since random effects are usually just grouping factors for which we are trying to control. They are always categorical, as you can’t force R to treat a continuous variable as a random effect. A lot of the time we are not specifically interested in their impact on the response variable, but we know that they might be influencing the patterns we see.
I’m not interested in the differences between locations or date, only X. In fact, I’d like to control for the differences between location and date to get a better understanding of the effect of X on my response. Would treating location and date as random effects accomplish this?
Including date and location as grouping factors (= random effects) would achieve exactly what you have outlined in your question.
But why not treat location and date as fixed variables?
Response ~ X + location + date + (1|pair)
This will still separate the effect of location and date from the effect of X, so why have them as random variables? If I have them as fixed effects I'll be able to measure the effect they're having on X, so why use random effects?
This second part is not entirely true. You are not measuring the effect of location and date on X but you are estimating the effect of location, date or X individually while keeping the other two constant. Also it adds more degrees of freedom which might be undesirable with small sample size.
|
Mixed models in ecology: when to use a random effect [duplicate]
|
For almost all variables you have the choice to model them with a fixed or random effect. I personally find the term random effect quite confusing, since random effects are usually just grouping facto
|
Mixed models in ecology: when to use a random effect [duplicate]
For almost all variables you have the choice to model them with a fixed or random effect. I personally find the term random effect quite confusing, since random effects are usually just grouping factors for which we are trying to control. They are always categorical, as you can’t force R to treat a continuous variable as a random effect. A lot of the time we are not specifically interested in their impact on the response variable, but we know that they might be influencing the patterns we see.
I’m not interested in the differences between locations or date, only X. In fact, I’d like to control for the differences between location and date to get a better understanding of the effect of X on my response. Would treating location and date as random effects accomplish this?
Including date and location as grouping factors (= random effects) would achieve exactly what you have outlined in your question.
But why not treat location and date as fixed variables?
Response ~ X + location + date + (1|pair)
This will still separate the effect of location and date from the effect of X, so why have them as random variables? If I have them as fixed effects I'll be able to measure the effect they're having on X, so why use random effects?
This second part is not entirely true. You are not measuring the effect of location and date on X but you are estimating the effect of location, date or X individually while keeping the other two constant. Also it adds more degrees of freedom which might be undesirable with small sample size.
|
Mixed models in ecology: when to use a random effect [duplicate]
For almost all variables you have the choice to model them with a fixed or random effect. I personally find the term random effect quite confusing, since random effects are usually just grouping facto
|
47,014
|
Mixed models in ecology: when to use a random effect [duplicate]
|
Yes, when you include the location and date as independent variables (as in your formula), you are separating their effects from X.
However, you do want to be sure that you are not missing variables in your formula that impact the dependent variable. If you are missing variables, the effect of X that you get may not be the pure effect from X alone.
By the way, the random effects that you describe sounds a lot like a simpler version of Bootstrap Aggregation, used to reduce variance and overfitting.
|
Mixed models in ecology: when to use a random effect [duplicate]
|
Yes, when you include the location and date as independent variables (as in your formula), you are separating their effects from X.
However, you do want to be sure that you are not missing variables i
|
Mixed models in ecology: when to use a random effect [duplicate]
Yes, when you include the location and date as independent variables (as in your formula), you are separating their effects from X.
However, you do want to be sure that you are not missing variables in your formula that impact the dependent variable. If you are missing variables, the effect of X that you get may not be the pure effect from X alone.
By the way, the random effects that you describe sounds a lot like a simpler version of Bootstrap Aggregation, used to reduce variance and overfitting.
|
Mixed models in ecology: when to use a random effect [duplicate]
Yes, when you include the location and date as independent variables (as in your formula), you are separating their effects from X.
However, you do want to be sure that you are not missing variables i
|
47,015
|
Mixed models in ecology: when to use a random effect [duplicate]
|
Yes, the proposed mixed model will separate the sources of variability, leaving the fixed effects (X) separated from the random effects of the combination of location/pair nested variables and date.
Essentially, what the introduction of random effects do is to identify sources of variability, and by estimating them you can separate it from the error term, which is the one used for hypothesis testing on the fixed effects (potentially, the object of study). This is accomplished by modelling them with expected value equal to zero, but non-zero variance, probably with some structure. Responses of the same random effect will be correlated.
For just one fixed effect and one random effect, $Y_{ij} = \mu + \alpha_i+\beta_j+\varepsilon_{ij}=X\alpha_i+Z\beta_j+\varepsilon_{ij}$, where $X$ corresponds to the design matrix of the fixed effects and $Z$ to the random effects, assuming $\varepsilon_{ij}\thicksim N(0,\sigma_\varepsilon^2)$ and $\beta_j \thicksim N(0,\sigma_\beta^2)$. Then, the expected value for $Y_{ij}$ is $E(Y_{ij})=\mu+\alpha_i$, and you can run hypothesis tests on their estimators, and the variance is $Var(Y_{ij})=\sigma_\varepsilon^2+\sigma_\beta^2$, identifying the sources of variability, the first one to noise and the second one to the random effect.
|
Mixed models in ecology: when to use a random effect [duplicate]
|
Yes, the proposed mixed model will separate the sources of variability, leaving the fixed effects (X) separated from the random effects of the combination of location/pair nested variables and date.
E
|
Mixed models in ecology: when to use a random effect [duplicate]
Yes, the proposed mixed model will separate the sources of variability, leaving the fixed effects (X) separated from the random effects of the combination of location/pair nested variables and date.
Essentially, what the introduction of random effects do is to identify sources of variability, and by estimating them you can separate it from the error term, which is the one used for hypothesis testing on the fixed effects (potentially, the object of study). This is accomplished by modelling them with expected value equal to zero, but non-zero variance, probably with some structure. Responses of the same random effect will be correlated.
For just one fixed effect and one random effect, $Y_{ij} = \mu + \alpha_i+\beta_j+\varepsilon_{ij}=X\alpha_i+Z\beta_j+\varepsilon_{ij}$, where $X$ corresponds to the design matrix of the fixed effects and $Z$ to the random effects, assuming $\varepsilon_{ij}\thicksim N(0,\sigma_\varepsilon^2)$ and $\beta_j \thicksim N(0,\sigma_\beta^2)$. Then, the expected value for $Y_{ij}$ is $E(Y_{ij})=\mu+\alpha_i$, and you can run hypothesis tests on their estimators, and the variance is $Var(Y_{ij})=\sigma_\varepsilon^2+\sigma_\beta^2$, identifying the sources of variability, the first one to noise and the second one to the random effect.
|
Mixed models in ecology: when to use a random effect [duplicate]
Yes, the proposed mixed model will separate the sources of variability, leaving the fixed effects (X) separated from the random effects of the combination of location/pair nested variables and date.
E
|
47,016
|
Should I put outcome variable in Matchit::matchit ()
|
DO NOT include the outcome in the propensity score calculation. To analyze your data after matching, don't use match.data(). Just use your original data set, which hopefully contains the treatment and the outcome, and include the weights in the matchit output object in the outcome model. You can do this as follows:
m.out <- matchit(treatment ~ var1 + var2 + var3 + var4, data = data,
method = "nearest", ratio=1)
fit <- glm(outcome ~ treat, data = data, family = binomial,
weights = m.out$weights)
Observations with weights of zero (indicating that they were not matched) will simply be excluded from the analysis. If you want to do a paired analysis, pair membership is in the subclass component of the matchit output object and you can include it as a fixed or random effect in the outcome regression model to mimic a paired t-test or use it as the clustering variable in a cluster-robust standard error.
|
Should I put outcome variable in Matchit::matchit ()
|
DO NOT include the outcome in the propensity score calculation. To analyze your data after matching, don't use match.data(). Just use your original data set, which hopefully contains the treatment and
|
Should I put outcome variable in Matchit::matchit ()
DO NOT include the outcome in the propensity score calculation. To analyze your data after matching, don't use match.data(). Just use your original data set, which hopefully contains the treatment and the outcome, and include the weights in the matchit output object in the outcome model. You can do this as follows:
m.out <- matchit(treatment ~ var1 + var2 + var3 + var4, data = data,
method = "nearest", ratio=1)
fit <- glm(outcome ~ treat, data = data, family = binomial,
weights = m.out$weights)
Observations with weights of zero (indicating that they were not matched) will simply be excluded from the analysis. If you want to do a paired analysis, pair membership is in the subclass component of the matchit output object and you can include it as a fixed or random effect in the outcome regression model to mimic a paired t-test or use it as the clustering variable in a cluster-robust standard error.
|
Should I put outcome variable in Matchit::matchit ()
DO NOT include the outcome in the propensity score calculation. To analyze your data after matching, don't use match.data(). Just use your original data set, which hopefully contains the treatment and
|
47,017
|
Why don't we use OLS estimator to test hypothesis in linear regression?
|
The test you are proposing is exactly what is done in the T-test for an individual coefficient, which is presented in the coefficient estimates table. One of the major theorems of regression analysis is that the F-test reduces to equivalence to the T-test when you apply it to a single coefficient. Thus, for an individual coefficient $\beta_2$, you should find that the p-value for the two tests you mention are always the same (since they are effectively the same test).
|
Why don't we use OLS estimator to test hypothesis in linear regression?
|
The test you are proposing is exactly what is done in the T-test for an individual coefficient, which is presented in the coefficient estimates table. One of the major theorems of regression analysis
|
Why don't we use OLS estimator to test hypothesis in linear regression?
The test you are proposing is exactly what is done in the T-test for an individual coefficient, which is presented in the coefficient estimates table. One of the major theorems of regression analysis is that the F-test reduces to equivalence to the T-test when you apply it to a single coefficient. Thus, for an individual coefficient $\beta_2$, you should find that the p-value for the two tests you mention are always the same (since they are effectively the same test).
|
Why don't we use OLS estimator to test hypothesis in linear regression?
The test you are proposing is exactly what is done in the T-test for an individual coefficient, which is presented in the coefficient estimates table. One of the major theorems of regression analysis
|
47,018
|
Does Shannon Entropy uniquely characterise distribution function $f$?
|
The answer is in the negative. For any real number $a$ define the function
$$f_a(x) = f(x-a).$$
It is clear that when $f$ is a distribution function, so is $f_a;$ that when $f$ is supported on the real line, so is $f_a;$ and that both $f$ and $f_a$ have equal entropy. For $a\ne 0$ it is impossible that $f=f_a,$ though, for if so, $f$ would be periodic with period $a$ and therefore the total probability would either be zero or infinite, which is not possible for any probability distribution.
|
Does Shannon Entropy uniquely characterise distribution function $f$?
|
The answer is in the negative. For any real number $a$ define the function
$$f_a(x) = f(x-a).$$
It is clear that when $f$ is a distribution function, so is $f_a;$ that when $f$ is supported on the re
|
Does Shannon Entropy uniquely characterise distribution function $f$?
The answer is in the negative. For any real number $a$ define the function
$$f_a(x) = f(x-a).$$
It is clear that when $f$ is a distribution function, so is $f_a;$ that when $f$ is supported on the real line, so is $f_a;$ and that both $f$ and $f_a$ have equal entropy. For $a\ne 0$ it is impossible that $f=f_a,$ though, for if so, $f$ would be periodic with period $a$ and therefore the total probability would either be zero or infinite, which is not possible for any probability distribution.
|
Does Shannon Entropy uniquely characterise distribution function $f$?
The answer is in the negative. For any real number $a$ define the function
$$f_a(x) = f(x-a).$$
It is clear that when $f$ is a distribution function, so is $f_a;$ that when $f$ is supported on the re
|
47,019
|
Confused about meaning of subject-specific coefficients in a binomial generalised mixed-effects model
|
The point that is made in this paper is with regard to the conditional versus marginal interpretation of the regression coefficients. Namely, because of the nonlinear link function used in the mixed effects logistic regression, the fixed effects coefficients have an interpretation conditional on the random effects. Most often this is not the desirable interpretation that relates to groups of individuals. You may find more information regarding this issue here and here.
On the contrary, in linear mixed models and because the link function is the identity, you do not have this problem.
|
Confused about meaning of subject-specific coefficients in a binomial generalised mixed-effects mode
|
The point that is made in this paper is with regard to the conditional versus marginal interpretation of the regression coefficients. Namely, because of the nonlinear link function used in the mixed e
|
Confused about meaning of subject-specific coefficients in a binomial generalised mixed-effects model
The point that is made in this paper is with regard to the conditional versus marginal interpretation of the regression coefficients. Namely, because of the nonlinear link function used in the mixed effects logistic regression, the fixed effects coefficients have an interpretation conditional on the random effects. Most often this is not the desirable interpretation that relates to groups of individuals. You may find more information regarding this issue here and here.
On the contrary, in linear mixed models and because the link function is the identity, you do not have this problem.
|
Confused about meaning of subject-specific coefficients in a binomial generalised mixed-effects mode
The point that is made in this paper is with regard to the conditional versus marginal interpretation of the regression coefficients. Namely, because of the nonlinear link function used in the mixed e
|
47,020
|
Confused about meaning of subject-specific coefficients in a binomial generalised mixed-effects model
|
I agree that this can be a little confusing. Some authors avoid setting it up in this way. The important point is that the $\alpha_{i}$ are not estimated individually, instead they are subsumed into a general model and the usual assumption is that they are normally distributed, with an unknown variance, which is to be estimated.
Focusing on the main point:
parameters $\alpha_{i}$ specific to the $i$th cluster
and translating this to something a bit more usual:
$$ y_i = X_i \beta + Z_i b_i + \epsilon_i, \text{ }\text{ }\text{ }\text{ } i=1,...,N $$
where $b_i$ is a vector of random effects and $Z_i$ is the design matrix for the $i$th cluster, we then combine vectors $y_i$ and matrices $X_i$ into the $\Sigma n_i \times 1$ vector $y$ and $\Sigma n_i \times m$ matrix $X$, and letting $Z = \text{diag}(Z_1,...,Z_N)$ the model can be written as
$$ y = X \beta + Z b + \epsilon$$
which is the usual mixed model equation.
|
Confused about meaning of subject-specific coefficients in a binomial generalised mixed-effects mode
|
I agree that this can be a little confusing. Some authors avoid setting it up in this way. The important point is that the $\alpha_{i}$ are not estimated individually, instead they are subsumed into a
|
Confused about meaning of subject-specific coefficients in a binomial generalised mixed-effects model
I agree that this can be a little confusing. Some authors avoid setting it up in this way. The important point is that the $\alpha_{i}$ are not estimated individually, instead they are subsumed into a general model and the usual assumption is that they are normally distributed, with an unknown variance, which is to be estimated.
Focusing on the main point:
parameters $\alpha_{i}$ specific to the $i$th cluster
and translating this to something a bit more usual:
$$ y_i = X_i \beta + Z_i b_i + \epsilon_i, \text{ }\text{ }\text{ }\text{ } i=1,...,N $$
where $b_i$ is a vector of random effects and $Z_i$ is the design matrix for the $i$th cluster, we then combine vectors $y_i$ and matrices $X_i$ into the $\Sigma n_i \times 1$ vector $y$ and $\Sigma n_i \times m$ matrix $X$, and letting $Z = \text{diag}(Z_1,...,Z_N)$ the model can be written as
$$ y = X \beta + Z b + \epsilon$$
which is the usual mixed model equation.
|
Confused about meaning of subject-specific coefficients in a binomial generalised mixed-effects mode
I agree that this can be a little confusing. Some authors avoid setting it up in this way. The important point is that the $\alpha_{i}$ are not estimated individually, instead they are subsumed into a
|
47,021
|
Random Forest pruning vs stopping criteria
|
As you say, Breiman himself suggests pruning over stopping, and the reason for this is that stopping might be short-sighted, as blocking a "bad" split now might prevent some very "good" splits from happening later. Pruning, on the other hand, starts from the fully grown tree (so it takes longer to run) but it does not have this problem.
When using decision trees, I would therefore only use a pruning parameter to avoid overfitting, while you can still keep a "relaxed" value of max_depth or min_samples_leaf just in case you want your trees to avoid having a certain size.
For Random Forests instead, I would not use any pruning/stopping criterion, unless you have restrictions with memory usage, as the algorithm most of the time works best with fully grown trees (it is mentioned both by Breiman in the original paper, and by Hastie/Tibshirani in their book, if you need references)
|
Random Forest pruning vs stopping criteria
|
As you say, Breiman himself suggests pruning over stopping, and the reason for this is that stopping might be short-sighted, as blocking a "bad" split now might prevent some very "good" splits from ha
|
Random Forest pruning vs stopping criteria
As you say, Breiman himself suggests pruning over stopping, and the reason for this is that stopping might be short-sighted, as blocking a "bad" split now might prevent some very "good" splits from happening later. Pruning, on the other hand, starts from the fully grown tree (so it takes longer to run) but it does not have this problem.
When using decision trees, I would therefore only use a pruning parameter to avoid overfitting, while you can still keep a "relaxed" value of max_depth or min_samples_leaf just in case you want your trees to avoid having a certain size.
For Random Forests instead, I would not use any pruning/stopping criterion, unless you have restrictions with memory usage, as the algorithm most of the time works best with fully grown trees (it is mentioned both by Breiman in the original paper, and by Hastie/Tibshirani in their book, if you need references)
|
Random Forest pruning vs stopping criteria
As you say, Breiman himself suggests pruning over stopping, and the reason for this is that stopping might be short-sighted, as blocking a "bad" split now might prevent some very "good" splits from ha
|
47,022
|
Is the issue of multiple testing related to doing several tests on the same sample?
|
The concern over multiple testing is, at its root, a reflection of what a "significant" result actually means. A significant result means that the observed data were unlikely to have occurred due to chance if the null hypothesis is true.
If your alpha is 0.05, then roughly 1 in 20 times that you run a statistical test when the null is true you should get a significant result. So, if you run tests of 20 different treatments — none of which are effective — you would expect one of them to give you a significant result.
The question, then, is how to handle that risk. If you are testing 20 different treatments, it is obvious that you should be a little more skeptical of your results (becuase you expect one significant result by chance). The same is true for the case where you are testing two aspects of a single treatment. However, in this case you are only going to accept the treatment if both are significant. That is very different than if you were going to accept either statement (safe or efficacious).
In this case, you probably don't need to use a Bonferoni style correction. Those corrections reduce the risk of getting any significant results in a series of test. In this case, using an alpha of 0.05 already means that you have only a 0.25% chance of accepting a product that is both ineffective and unsafe (5% times 5%).
This is also an area where Bayes can be really helpful. A non-significant result does not, necessarily, mean that the treatment is dangerous (or ineffective). Having some idea about the probability that the drug is safe (or effective) can help guide how you interpret the results.
|
Is the issue of multiple testing related to doing several tests on the same sample?
|
The concern over multiple testing is, at its root, a reflection of what a "significant" result actually means. A significant result means that the observed data were unlikely to have occurred due to c
|
Is the issue of multiple testing related to doing several tests on the same sample?
The concern over multiple testing is, at its root, a reflection of what a "significant" result actually means. A significant result means that the observed data were unlikely to have occurred due to chance if the null hypothesis is true.
If your alpha is 0.05, then roughly 1 in 20 times that you run a statistical test when the null is true you should get a significant result. So, if you run tests of 20 different treatments — none of which are effective — you would expect one of them to give you a significant result.
The question, then, is how to handle that risk. If you are testing 20 different treatments, it is obvious that you should be a little more skeptical of your results (becuase you expect one significant result by chance). The same is true for the case where you are testing two aspects of a single treatment. However, in this case you are only going to accept the treatment if both are significant. That is very different than if you were going to accept either statement (safe or efficacious).
In this case, you probably don't need to use a Bonferoni style correction. Those corrections reduce the risk of getting any significant results in a series of test. In this case, using an alpha of 0.05 already means that you have only a 0.25% chance of accepting a product that is both ineffective and unsafe (5% times 5%).
This is also an area where Bayes can be really helpful. A non-significant result does not, necessarily, mean that the treatment is dangerous (or ineffective). Having some idea about the probability that the drug is safe (or effective) can help guide how you interpret the results.
|
Is the issue of multiple testing related to doing several tests on the same sample?
The concern over multiple testing is, at its root, a reflection of what a "significant" result actually means. A significant result means that the observed data were unlikely to have occurred due to c
|
47,023
|
Is the issue of multiple testing related to doing several tests on the same sample?
|
Technically, the probability of making at least one false positive will increase assuming the null is true. However, there is typically no need to correct for this as the two measures can be considered independent (arguments about safety and efficacy being related aside. If efficacy impacts safety, or the other way around, a more nuanced experimental design might be required).
The reason we do not correct in this instance is the same as the reason we do not correct for every other experiment we have performed in our lives; the experiments are unrelated. I think correction is applied only when tests are being performed on the same data (for example, all pairwise differences between groups).
|
Is the issue of multiple testing related to doing several tests on the same sample?
|
Technically, the probability of making at least one false positive will increase assuming the null is true. However, there is typically no need to correct for this as the two measures can be considere
|
Is the issue of multiple testing related to doing several tests on the same sample?
Technically, the probability of making at least one false positive will increase assuming the null is true. However, there is typically no need to correct for this as the two measures can be considered independent (arguments about safety and efficacy being related aside. If efficacy impacts safety, or the other way around, a more nuanced experimental design might be required).
The reason we do not correct in this instance is the same as the reason we do not correct for every other experiment we have performed in our lives; the experiments are unrelated. I think correction is applied only when tests are being performed on the same data (for example, all pairwise differences between groups).
|
Is the issue of multiple testing related to doing several tests on the same sample?
Technically, the probability of making at least one false positive will increase assuming the null is true. However, there is typically no need to correct for this as the two measures can be considere
|
47,024
|
Sample Variance and Dividing by $n-1$
|
A somewhat intuitive argument (though one that can be made rigorous):
The population variance is itself a population average. Specifically if you define a new variable to be the square of the difference of the original variable from its population mean, $Y=(X-\mu_X)^2$ (NB when using capital letters I am referring to random variables, rather than their realizations), then the expected value (population mean) of the new variable is the variance of the original one.
The n-denominator variance from the population mean is the corresponding sample average for observations from the distribution of $Y$. Sample averages are unbiased estimators of their population counterpart - that is, the expected value of a sample average IS the population mean.
So if we were able to calculate an average of samples filled with $(X_i-\mu_X)^2$ values, it would be an unbiased estimator of the variance of the $X$-distribution (that is, correct on average, over many such samples).
Let $\bar{Y}$ be the mean of a sample taken from the $Y$ distribution.
Computationally speaking, what we're saying is that $E[\bar{Y}] = \mu_Y = Var(X)$.
Written out in full, $E[\sum{(X_i-\mu_X)^2}/n] = Var(X)$. The expected value of the average of a sample from the $Y$ distribution is the variance of $X$. This is what it means for the sample average from the $Y$ distribution to be an "unbiased" estimator of $Var(X)$.
If we were to replace $\mu_X$ with the average of the $X_i$ sample, $\bar{X}$, that sum would always become smaller, and thus the overall expected value would become smaller.
Since it's smaller than something that is unbiased (the only exception is when the variance is 0), it is therefore biased (specifically, biased downward, too small on average).
|
Sample Variance and Dividing by $n-1$
|
A somewhat intuitive argument (though one that can be made rigorous):
The population variance is itself a population average. Specifically if you define a new variable to be the square of the differen
|
Sample Variance and Dividing by $n-1$
A somewhat intuitive argument (though one that can be made rigorous):
The population variance is itself a population average. Specifically if you define a new variable to be the square of the difference of the original variable from its population mean, $Y=(X-\mu_X)^2$ (NB when using capital letters I am referring to random variables, rather than their realizations), then the expected value (population mean) of the new variable is the variance of the original one.
The n-denominator variance from the population mean is the corresponding sample average for observations from the distribution of $Y$. Sample averages are unbiased estimators of their population counterpart - that is, the expected value of a sample average IS the population mean.
So if we were able to calculate an average of samples filled with $(X_i-\mu_X)^2$ values, it would be an unbiased estimator of the variance of the $X$-distribution (that is, correct on average, over many such samples).
Let $\bar{Y}$ be the mean of a sample taken from the $Y$ distribution.
Computationally speaking, what we're saying is that $E[\bar{Y}] = \mu_Y = Var(X)$.
Written out in full, $E[\sum{(X_i-\mu_X)^2}/n] = Var(X)$. The expected value of the average of a sample from the $Y$ distribution is the variance of $X$. This is what it means for the sample average from the $Y$ distribution to be an "unbiased" estimator of $Var(X)$.
If we were to replace $\mu_X$ with the average of the $X_i$ sample, $\bar{X}$, that sum would always become smaller, and thus the overall expected value would become smaller.
Since it's smaller than something that is unbiased (the only exception is when the variance is 0), it is therefore biased (specifically, biased downward, too small on average).
|
Sample Variance and Dividing by $n-1$
A somewhat intuitive argument (though one that can be made rigorous):
The population variance is itself a population average. Specifically if you define a new variable to be the square of the differen
|
47,025
|
Sample Variance and Dividing by $n-1$
|
Let $X_1, X_2, \cdots X_n$ be iid with mean $\mu$ and variance $\sigma^2$. Lets look at the class of estimators
$$S^2_j = \frac{1}{n-j}\sum_{i=1}^n(X_i- \bar X)^2$$
Using this notation, $S_1^2$ is the usual sample variance and $S_0^2$ is the variant where we divide by the sample size.
The sample variance is unbiased for $\sigma^2$
The derivation of this fact is fairly straightforward. Let's start by finding the expected value of $S_j^2$ for all $j$.
\begin{align}
E(S_j^2) &= \frac{1}{n-j}E\left(\sum_{i=1}^n(X_i- \bar X)^2 \right) \\
&= \frac{1}{n-j}E\left(\sum_{i=1}^nX_i^2 - n\bar X^2\right) && \text{"short-cut formula"} \\
&= \frac{1}{n-j}\left(\sum_{i=1}^nE(X_i^2) - nE(\bar X^2)\right) \\
&= \frac{1}{n-j}\left(\sum_{i=1}^n(Var(X_i) - E(X_i)^2) + n(Var(\bar X) + E(\bar X)^2)\right) \\
&= \frac{1}{n-j}\left(n(\sigma^2 + \mu^2) - n(\sigma^2/n + \mu^2)\right)\\[1.2ex]
&= \frac{n-1}{n-j}\sigma^2.
\end{align}
The bias for this class of estimators is therefore
$$B(S_j^2) = E(S_j^2) - \sigma^2 = \frac{j-1}{n-j}\sigma^2$$
which is clearly equal to $0$ if (and only if) $j=1$.
MSE under normality
Mean squared error is a popular criteria for evaluating estimators which considers the bias-variance tradeoff. Lets consider the case where $X_1, \cdots X_n \stackrel{\text{iid}}{\sim} N(\mu, \sigma^2)$. Under normality, we can show that
$$\frac{(n-j)S_j^2}{\sigma^2} \sim \chi^2(n-1).$$
The expected value (and hence the bias) is the same as before. The chi-square result provides an easy way of calculating the variance for this class of estimators.
Since the variance of a $\chi^2(v)$ RV is $2v$, we have that
$$\text{Var}\left(\frac{(n-j)S_j^2}{\sigma^2}\right) = 2(n-1).$$
We also have that
$$\text{Var}\left(\frac{(n-j)S_j^2}{\sigma^2}\right) = \frac{(n-j)^2}{\sigma^4}\text{Var}(S_j^2).$$
Putting these pieces together implies that $$Var(S_j^2) = \frac{2\sigma^4(n-1)}{(n-j)^2}.$$
Therefore the MSE of $S_j^2$ is
$$MSE(S_j^2) = B(S_j^2)^2 + Var(S_j^2) = \sigma^4\left(\frac{2(n-1) + (j-1)^2}{(n-j)^2} \right)$$
Here is a plot of the MSE as a function of $j$ for $\sigma = 1$ and $n=30$.
According to MSE, the method of moments (divide by $n$) estimator $S_0^2$ is preferable to the sample variance $S_1^2$. The truly surprising result here is that the "optimal" estimator according to MSE is
$$S_{-1}^2 = \frac{1}{n+1}\sum_{i=1}^n(X_i- \bar X)^2.$$
Despite this result, I've never seen anybody use this as an estimator in practice. The reason this happens, is that MSE is exchanging bias for a reduction in variance. By artificially shrinking the estimator towards zero, we get an improvement in MSE (this is an example of Stein's Paradox).
So is the sample variance a better estimator? It depends on your criteria and your underlying goals. Although dividing by $n$ (or even, strangely, by $n+1$) leads to a reduction in MSE, it is important to note that this reduction in MSE is negligible when the sample size is large. The sample variance has some nice properties including unbiasedness which leads to its popularity in practice.
|
Sample Variance and Dividing by $n-1$
|
Let $X_1, X_2, \cdots X_n$ be iid with mean $\mu$ and variance $\sigma^2$. Lets look at the class of estimators
$$S^2_j = \frac{1}{n-j}\sum_{i=1}^n(X_i- \bar X)^2$$
Using this notation, $S_1^2$ is the
|
Sample Variance and Dividing by $n-1$
Let $X_1, X_2, \cdots X_n$ be iid with mean $\mu$ and variance $\sigma^2$. Lets look at the class of estimators
$$S^2_j = \frac{1}{n-j}\sum_{i=1}^n(X_i- \bar X)^2$$
Using this notation, $S_1^2$ is the usual sample variance and $S_0^2$ is the variant where we divide by the sample size.
The sample variance is unbiased for $\sigma^2$
The derivation of this fact is fairly straightforward. Let's start by finding the expected value of $S_j^2$ for all $j$.
\begin{align}
E(S_j^2) &= \frac{1}{n-j}E\left(\sum_{i=1}^n(X_i- \bar X)^2 \right) \\
&= \frac{1}{n-j}E\left(\sum_{i=1}^nX_i^2 - n\bar X^2\right) && \text{"short-cut formula"} \\
&= \frac{1}{n-j}\left(\sum_{i=1}^nE(X_i^2) - nE(\bar X^2)\right) \\
&= \frac{1}{n-j}\left(\sum_{i=1}^n(Var(X_i) - E(X_i)^2) + n(Var(\bar X) + E(\bar X)^2)\right) \\
&= \frac{1}{n-j}\left(n(\sigma^2 + \mu^2) - n(\sigma^2/n + \mu^2)\right)\\[1.2ex]
&= \frac{n-1}{n-j}\sigma^2.
\end{align}
The bias for this class of estimators is therefore
$$B(S_j^2) = E(S_j^2) - \sigma^2 = \frac{j-1}{n-j}\sigma^2$$
which is clearly equal to $0$ if (and only if) $j=1$.
MSE under normality
Mean squared error is a popular criteria for evaluating estimators which considers the bias-variance tradeoff. Lets consider the case where $X_1, \cdots X_n \stackrel{\text{iid}}{\sim} N(\mu, \sigma^2)$. Under normality, we can show that
$$\frac{(n-j)S_j^2}{\sigma^2} \sim \chi^2(n-1).$$
The expected value (and hence the bias) is the same as before. The chi-square result provides an easy way of calculating the variance for this class of estimators.
Since the variance of a $\chi^2(v)$ RV is $2v$, we have that
$$\text{Var}\left(\frac{(n-j)S_j^2}{\sigma^2}\right) = 2(n-1).$$
We also have that
$$\text{Var}\left(\frac{(n-j)S_j^2}{\sigma^2}\right) = \frac{(n-j)^2}{\sigma^4}\text{Var}(S_j^2).$$
Putting these pieces together implies that $$Var(S_j^2) = \frac{2\sigma^4(n-1)}{(n-j)^2}.$$
Therefore the MSE of $S_j^2$ is
$$MSE(S_j^2) = B(S_j^2)^2 + Var(S_j^2) = \sigma^4\left(\frac{2(n-1) + (j-1)^2}{(n-j)^2} \right)$$
Here is a plot of the MSE as a function of $j$ for $\sigma = 1$ and $n=30$.
According to MSE, the method of moments (divide by $n$) estimator $S_0^2$ is preferable to the sample variance $S_1^2$. The truly surprising result here is that the "optimal" estimator according to MSE is
$$S_{-1}^2 = \frac{1}{n+1}\sum_{i=1}^n(X_i- \bar X)^2.$$
Despite this result, I've never seen anybody use this as an estimator in practice. The reason this happens, is that MSE is exchanging bias for a reduction in variance. By artificially shrinking the estimator towards zero, we get an improvement in MSE (this is an example of Stein's Paradox).
So is the sample variance a better estimator? It depends on your criteria and your underlying goals. Although dividing by $n$ (or even, strangely, by $n+1$) leads to a reduction in MSE, it is important to note that this reduction in MSE is negligible when the sample size is large. The sample variance has some nice properties including unbiasedness which leads to its popularity in practice.
|
Sample Variance and Dividing by $n-1$
Let $X_1, X_2, \cdots X_n$ be iid with mean $\mu$ and variance $\sigma^2$. Lets look at the class of estimators
$$S^2_j = \frac{1}{n-j}\sum_{i=1}^n(X_i- \bar X)^2$$
Using this notation, $S_1^2$ is the
|
47,026
|
When is performing back-transformation of inferences on transformed variables Ok, and when is it not Ok?
|
You actually lay out most of the important points in your question.
I assume we're restricting attention to strictly monotonic transformations.
Monotonic transformations preserve order so quantiles are "preserved" (more precisely, quantiles are equivariant to monotonic transformation) but they don't preserve relative lengths/distances so moments and moment ratios are not "preserved".
So for example, if $Y$ has mean $\mu_Y$, median $\delta_Y$ and standard deviation $\sigma_Y$, and $Z=t(Y)$ for some monotonic increasing transformation $t$ (with corresponding population parameters $\mu_Z$, median $\delta_Z$ and $\sigma_Z$), then backtransforming we have that in general $\mu_Y\neq t^{-1}(\mu_Z)$, $\sigma_Y\neq t^{-1}(\sigma_Z)$ but it is the case that $\delta_Y= t^{-1}(\delta_Z)$.
Similarly, modes are not preserved.
It's important to note that because relative distances are not preserved distances between quantiles are not equivariant. The backtransformed interquartile range is not the interquartile range of the original data, even though that works for the quantiles individually.
In many cases, the key is to be precise about what it is you want to know on the scale of the original response variable.
In hypothesis testing, if your null + assumptions corresponds to having the distributions be the same, then on the transformed scale the distributions should still be the same. However, the relationship under the alternative is different. An example would be transforming, doing a two-sample t-test and transforming back. If the usual assumptions are satisfied on the transformed scale, then you're dealing with a location-shift alternative (though this is not absolutely necessary, somewhat more general alternatives can be dealt with). When you backtransform the alternative will not be a location shift. (For an example, if your transformation was the log, once you transform back you're looking at a change of scale, not location.)
A typical case where transformation crops up is when someone transforms a response in order to fit a linear regression model, producing an estimate of the conditional mean response. However, when you transform back you don't end up with the conditional mean.
You can find an approximation (e.g. via the delta method) to try to get a reasonable estimate of $E(Y|x)$ from estimates of $E(Z|x)$ and $\text{Var}(Z|x)$ where $x$ represents the vector of predictors. Alternatively if you're prepared to assume you have a normal distribution on the transformed scale you may be able to get more precise estimate of the conditional mean after backtransforming.
One common error with regression I've seen is people backtransform a coefficient estimate and treat the result like they would a coefficient in a regression. This usually doesn't make sense. It certainly doesn't describe a linear relationship between $Y$ and some predictor $x$. Interpretation of backtransformed relationships is nontrivial. Even additivity is not preserved. That is, if you had a main-effects model on the transformed scale you can't write a backtransformed conditional mean as a sum of nonlinear effects in the variables.
A simple example would be taking a log transform and transforming back by exponentiation. If you fit $\log Y = \beta_0 + \beta_1 x_1 +\beta_2 x_2+\epsilon$ then you cannot write $E(Y|x_1,x_2) = f(x_1) + g(x_2)$; you can't even assume symmetry on the log scale and have it hold for the backtransformed median (the connection would be multiplicative in that case). It's important to think about how the backtransformation acts on the whole relationship.
If conditional means are an important consideration, an alternative is generalized linear models. By writing the linear predictor as a model for the transformed mean (via the link function) rather than transforming the data, you end up with a model for the conditional mean on the original scale, and no similar issues result from backtransforming there (well, aside from the kind of error described in the previous two paragraphs).
There are times when transformation makes sense -- but most often this is when the transformed variable is easily interpretable in its own right.
|
When is performing back-transformation of inferences on transformed variables Ok, and when is it not
|
You actually lay out most of the important points in your question.
I assume we're restricting attention to strictly monotonic transformations.
Monotonic transformations preserve order so quantiles ar
|
When is performing back-transformation of inferences on transformed variables Ok, and when is it not Ok?
You actually lay out most of the important points in your question.
I assume we're restricting attention to strictly monotonic transformations.
Monotonic transformations preserve order so quantiles are "preserved" (more precisely, quantiles are equivariant to monotonic transformation) but they don't preserve relative lengths/distances so moments and moment ratios are not "preserved".
So for example, if $Y$ has mean $\mu_Y$, median $\delta_Y$ and standard deviation $\sigma_Y$, and $Z=t(Y)$ for some monotonic increasing transformation $t$ (with corresponding population parameters $\mu_Z$, median $\delta_Z$ and $\sigma_Z$), then backtransforming we have that in general $\mu_Y\neq t^{-1}(\mu_Z)$, $\sigma_Y\neq t^{-1}(\sigma_Z)$ but it is the case that $\delta_Y= t^{-1}(\delta_Z)$.
Similarly, modes are not preserved.
It's important to note that because relative distances are not preserved distances between quantiles are not equivariant. The backtransformed interquartile range is not the interquartile range of the original data, even though that works for the quantiles individually.
In many cases, the key is to be precise about what it is you want to know on the scale of the original response variable.
In hypothesis testing, if your null + assumptions corresponds to having the distributions be the same, then on the transformed scale the distributions should still be the same. However, the relationship under the alternative is different. An example would be transforming, doing a two-sample t-test and transforming back. If the usual assumptions are satisfied on the transformed scale, then you're dealing with a location-shift alternative (though this is not absolutely necessary, somewhat more general alternatives can be dealt with). When you backtransform the alternative will not be a location shift. (For an example, if your transformation was the log, once you transform back you're looking at a change of scale, not location.)
A typical case where transformation crops up is when someone transforms a response in order to fit a linear regression model, producing an estimate of the conditional mean response. However, when you transform back you don't end up with the conditional mean.
You can find an approximation (e.g. via the delta method) to try to get a reasonable estimate of $E(Y|x)$ from estimates of $E(Z|x)$ and $\text{Var}(Z|x)$ where $x$ represents the vector of predictors. Alternatively if you're prepared to assume you have a normal distribution on the transformed scale you may be able to get more precise estimate of the conditional mean after backtransforming.
One common error with regression I've seen is people backtransform a coefficient estimate and treat the result like they would a coefficient in a regression. This usually doesn't make sense. It certainly doesn't describe a linear relationship between $Y$ and some predictor $x$. Interpretation of backtransformed relationships is nontrivial. Even additivity is not preserved. That is, if you had a main-effects model on the transformed scale you can't write a backtransformed conditional mean as a sum of nonlinear effects in the variables.
A simple example would be taking a log transform and transforming back by exponentiation. If you fit $\log Y = \beta_0 + \beta_1 x_1 +\beta_2 x_2+\epsilon$ then you cannot write $E(Y|x_1,x_2) = f(x_1) + g(x_2)$; you can't even assume symmetry on the log scale and have it hold for the backtransformed median (the connection would be multiplicative in that case). It's important to think about how the backtransformation acts on the whole relationship.
If conditional means are an important consideration, an alternative is generalized linear models. By writing the linear predictor as a model for the transformed mean (via the link function) rather than transforming the data, you end up with a model for the conditional mean on the original scale, and no similar issues result from backtransforming there (well, aside from the kind of error described in the previous two paragraphs).
There are times when transformation makes sense -- but most often this is when the transformed variable is easily interpretable in its own right.
|
When is performing back-transformation of inferences on transformed variables Ok, and when is it not
You actually lay out most of the important points in your question.
I assume we're restricting attention to strictly monotonic transformations.
Monotonic transformations preserve order so quantiles ar
|
47,027
|
Optimality of AIC w.r.t. loss functions used for evaluation
|
I think the answer to 1) should be "no", as there is no reason in general to expect that the model which minimizes the expected likelihood will also minimize
the MSE, MAE, etc. One might even think of the case in which the likelihood is well defined and the MSE will diverge as the sample size increases (e.g. a distribution with no moments, such as the Cauchy).
I would think that AIC will still be a good method for model selection for any loss function which is a monotone function of expected likelihood, but that's probably a trivial remark that will not help you much.
|
Optimality of AIC w.r.t. loss functions used for evaluation
|
I think the answer to 1) should be "no", as there is no reason in general to expect that the model which minimizes the expected likelihood will also minimize
the MSE, MAE, etc. One might even think of
|
Optimality of AIC w.r.t. loss functions used for evaluation
I think the answer to 1) should be "no", as there is no reason in general to expect that the model which minimizes the expected likelihood will also minimize
the MSE, MAE, etc. One might even think of the case in which the likelihood is well defined and the MSE will diverge as the sample size increases (e.g. a distribution with no moments, such as the Cauchy).
I would think that AIC will still be a good method for model selection for any loss function which is a monotone function of expected likelihood, but that's probably a trivial remark that will not help you much.
|
Optimality of AIC w.r.t. loss functions used for evaluation
I think the answer to 1) should be "no", as there is no reason in general to expect that the model which minimizes the expected likelihood will also minimize
the MSE, MAE, etc. One might even think of
|
47,028
|
Optimality of AIC w.r.t. loss functions used for evaluation
|
I have to disagree with F. Tusell's answer, which I believe reflects a confusion about what the AIC and other loss functions evaluate.
The AIC evaluates a "modeling" density. (I use quotes around "modeling", to distinguish it from a predictive density, where we would use proper scoring rules for evaluation.) Loss functions like the MAE, the MSE and quantile losses evaluate single number summaries (Kolassa, 2020, IJF) of such modeling (or predictive) densities.
Now, by Stone (1977), the AIC will asymptotically be minimized by the true conditional density (provided it is in the candidate pool; more on this below). Once we have the true conditional density, we can extract the functional from it that minimizes the loss function (the conditional expectation for the MSE, the median for the MAE, the quantile for the quantile loss). Thus, the procedure of "pick the density that minimizes AIC, then extract the appropriate functional for our loss" will asymptotically yield the lowest loss.
Now, all this of course relies on a number of assumptions.
As F. Tusell writes, if the conditional density does not have an expectation, then the "extract the minimum MSE functional" part will not work, so the entire pipeline breaks down. (But if the true DGP follows a Cauchy distribution, what would be the optimal point prediction under the MSE, anyway?)
If the true conditional density is not in our candidate pool of possible models, the asymptotics results of Stone (1977) do not hold. AIC will still asymptotically find the model in the pool with minimal Kullback-Leibler distance from the true DGP, so it would still be a good start - although that one might have a worse expected loss than some other model.
As an example, your data may be $N(0,2)$ distributed, but our model pool may only contain all $N(\mu,1)$ distributions, so the key assumption of Stone (1977) is not satisfied. Assume we are interested in a 90% quantile prediction. The AIC will be optimized in our pool by $N(0,1)$ and report its quantile of $q_{90\%}(0,1)\approx 1.28$. A distribution-free approach that simply optimizes on quantile loss will yield the correct $1.81$. And of course, there is a model in our pool that would yield a lower loss, namely $N(0.54,1)$ with $q_{90\%}(0.54,1)\approx 1.81$, but the AIC won't like that one.
Finally, of course if the functional form differs between fitting and prediction, all bets are off. If you get hit by a world-wide pandemic, your AIC-optimal model based on 2019 data will not be very useful for a (point) forecast for toilet paper demand in Germany in early 2020.
And finally-finally, asymptotics may be a long way off - far enough for the DGP to indeed change, as per the previous bullet point.
|
Optimality of AIC w.r.t. loss functions used for evaluation
|
I have to disagree with F. Tusell's answer, which I believe reflects a confusion about what the AIC and other loss functions evaluate.
The AIC evaluates a "modeling" density. (I use quotes around "mod
|
Optimality of AIC w.r.t. loss functions used for evaluation
I have to disagree with F. Tusell's answer, which I believe reflects a confusion about what the AIC and other loss functions evaluate.
The AIC evaluates a "modeling" density. (I use quotes around "modeling", to distinguish it from a predictive density, where we would use proper scoring rules for evaluation.) Loss functions like the MAE, the MSE and quantile losses evaluate single number summaries (Kolassa, 2020, IJF) of such modeling (or predictive) densities.
Now, by Stone (1977), the AIC will asymptotically be minimized by the true conditional density (provided it is in the candidate pool; more on this below). Once we have the true conditional density, we can extract the functional from it that minimizes the loss function (the conditional expectation for the MSE, the median for the MAE, the quantile for the quantile loss). Thus, the procedure of "pick the density that minimizes AIC, then extract the appropriate functional for our loss" will asymptotically yield the lowest loss.
Now, all this of course relies on a number of assumptions.
As F. Tusell writes, if the conditional density does not have an expectation, then the "extract the minimum MSE functional" part will not work, so the entire pipeline breaks down. (But if the true DGP follows a Cauchy distribution, what would be the optimal point prediction under the MSE, anyway?)
If the true conditional density is not in our candidate pool of possible models, the asymptotics results of Stone (1977) do not hold. AIC will still asymptotically find the model in the pool with minimal Kullback-Leibler distance from the true DGP, so it would still be a good start - although that one might have a worse expected loss than some other model.
As an example, your data may be $N(0,2)$ distributed, but our model pool may only contain all $N(\mu,1)$ distributions, so the key assumption of Stone (1977) is not satisfied. Assume we are interested in a 90% quantile prediction. The AIC will be optimized in our pool by $N(0,1)$ and report its quantile of $q_{90\%}(0,1)\approx 1.28$. A distribution-free approach that simply optimizes on quantile loss will yield the correct $1.81$. And of course, there is a model in our pool that would yield a lower loss, namely $N(0.54,1)$ with $q_{90\%}(0.54,1)\approx 1.81$, but the AIC won't like that one.
Finally, of course if the functional form differs between fitting and prediction, all bets are off. If you get hit by a world-wide pandemic, your AIC-optimal model based on 2019 data will not be very useful for a (point) forecast for toilet paper demand in Germany in early 2020.
And finally-finally, asymptotics may be a long way off - far enough for the DGP to indeed change, as per the previous bullet point.
|
Optimality of AIC w.r.t. loss functions used for evaluation
I have to disagree with F. Tusell's answer, which I believe reflects a confusion about what the AIC and other loss functions evaluate.
The AIC evaluates a "modeling" density. (I use quotes around "mod
|
47,029
|
Favored methods for overcoming selection bias (special attention to healthcare fields)?
|
There is no single magic bullet to estimate treatment effects in the context of confounding (note: "selection bias" can mean something else). There is also no agreement in the field about the best method, and the best method for a given problem may differ from the best method for another (and neither will be immediately apparent). My understanding is that some of the best performing methods are the "multiply robust" methods, which include targeted minimum loss-based estimation (TMLE) and Bayesian additive regression trees (BART) with a BART propensity score. I describe these methods with references in this post.
These methods are multiply robust in that there are numerous forms of misspecification that they are robust to (i.e., they will give you an unbiased or low-error estimate even if you get some things wrong about the relationships among variables). The more standard doubly robust methods are those that give you two chances to correctly specify a model in order to arrive at an unbiased estimate of the treatment effect. Augmented inverse probability weighting (AIPW) with parametric outcome and propensity score models is one such example; if either the outcome model or propensity score model is correct, the effect estimate is unbiased. Multiply robust methods are robust to these misspecifications but also to misspecifications of the functional form of the relationship between the covariates and the treatment or outcome. They gain this property through flexible nonparameteric modeling of these relationships. Such methods are highly preferred because they require fewer untestable assumptions to get the right answer, in contrast to propensity score matching or regression, which require strong assumptions about functional form.
I would check out the best performers of the annual Atlantic Causal Inference Conference competition, as these represent the cutting edge of causal inference methods and are demonstrated to perform well in a variety of conditions. TMLE and BART were two of the best performers, and are both accessible and easy to use.
I'm not going to write off the other methods you mention, but they do require many assumptions that cannot easily be assessed or they have been demonstrated to perform poorly in a number of contexts. They are still the standards in the health sciences, but that is slowly changing as the advanced methods become better studied and more accessible.
|
Favored methods for overcoming selection bias (special attention to healthcare fields)?
|
There is no single magic bullet to estimate treatment effects in the context of confounding (note: "selection bias" can mean something else). There is also no agreement in the field about the best met
|
Favored methods for overcoming selection bias (special attention to healthcare fields)?
There is no single magic bullet to estimate treatment effects in the context of confounding (note: "selection bias" can mean something else). There is also no agreement in the field about the best method, and the best method for a given problem may differ from the best method for another (and neither will be immediately apparent). My understanding is that some of the best performing methods are the "multiply robust" methods, which include targeted minimum loss-based estimation (TMLE) and Bayesian additive regression trees (BART) with a BART propensity score. I describe these methods with references in this post.
These methods are multiply robust in that there are numerous forms of misspecification that they are robust to (i.e., they will give you an unbiased or low-error estimate even if you get some things wrong about the relationships among variables). The more standard doubly robust methods are those that give you two chances to correctly specify a model in order to arrive at an unbiased estimate of the treatment effect. Augmented inverse probability weighting (AIPW) with parametric outcome and propensity score models is one such example; if either the outcome model or propensity score model is correct, the effect estimate is unbiased. Multiply robust methods are robust to these misspecifications but also to misspecifications of the functional form of the relationship between the covariates and the treatment or outcome. They gain this property through flexible nonparameteric modeling of these relationships. Such methods are highly preferred because they require fewer untestable assumptions to get the right answer, in contrast to propensity score matching or regression, which require strong assumptions about functional form.
I would check out the best performers of the annual Atlantic Causal Inference Conference competition, as these represent the cutting edge of causal inference methods and are demonstrated to perform well in a variety of conditions. TMLE and BART were two of the best performers, and are both accessible and easy to use.
I'm not going to write off the other methods you mention, but they do require many assumptions that cannot easily be assessed or they have been demonstrated to perform poorly in a number of contexts. They are still the standards in the health sciences, but that is slowly changing as the advanced methods become better studied and more accessible.
|
Favored methods for overcoming selection bias (special attention to healthcare fields)?
There is no single magic bullet to estimate treatment effects in the context of confounding (note: "selection bias" can mean something else). There is also no agreement in the field about the best met
|
47,030
|
Favored methods for overcoming selection bias (special attention to healthcare fields)?
|
I don't disagree with Noah's answer. I have never heard of Bayesian Additive Regression Trees or with targeted minimum-loss estimation, so I can't comment on those specifically. Methods involving weighting and propensity scores are well-accepted in epidemiological circles.
You should also consider instrumental variable and regression discontinuity approaches.
In the former, there are sometimes cases where you have a variable that influences the probability of receiving treatment but not the outcome. For example, McClellan et al (1994) noted that some hospitals treated acute myocardial infarction (the fancy term for heart attack) more intensively than others (i.e. they were more prone to use cardiac catheterization and revascularization, as opposed to what I guess is medical management). They used the differential distance as their instrument: for each patient, what was the distance to the nearest high-catheterization hospital minus the distance to the nearest low-catheterization hospital?
IVs are not without untestable assumptions - just like all observational methods, really. Also, they answer a subtly different question than a randomized trial would. Quoting McClellan et al
Thus, IV methods are ideally suited to address the question, "What would be the effect of reducing the use of invasive procedures after AMI in the elderly by, for example, one fourth?" They do not address the question, "What would be
the expected effect of treating a particular patient aggressively rather than with noninvasive therapies alone?" For clinical decisions involving treatment of individual patients, the answer to the latter question is more useful. For policy decisions affecting the treatment of patient populations, the answer to the former is likely to be more useful.
Alternatively, sometimes you have cases where treatment is given to people at or above a cutoff point on some sort of score, and withheld from everyone below the cutoff. You can exploit that in a regression discontinuity design. You'd compare people just above the cutoff to people just below it. The inherent assumption is that because all scores are measured with error, the people just above the cutoff and the people just below it are pretty similar. This does also require that the participants did not game the score - which is an assumption that you should really think about. In some ways, being above versus below the score is an instrument.
The issue is that it may be difficult to find an instrument, and that the treatments you're interested in may be not be assigned according to some score.
|
Favored methods for overcoming selection bias (special attention to healthcare fields)?
|
I don't disagree with Noah's answer. I have never heard of Bayesian Additive Regression Trees or with targeted minimum-loss estimation, so I can't comment on those specifically. Methods involving weig
|
Favored methods for overcoming selection bias (special attention to healthcare fields)?
I don't disagree with Noah's answer. I have never heard of Bayesian Additive Regression Trees or with targeted minimum-loss estimation, so I can't comment on those specifically. Methods involving weighting and propensity scores are well-accepted in epidemiological circles.
You should also consider instrumental variable and regression discontinuity approaches.
In the former, there are sometimes cases where you have a variable that influences the probability of receiving treatment but not the outcome. For example, McClellan et al (1994) noted that some hospitals treated acute myocardial infarction (the fancy term for heart attack) more intensively than others (i.e. they were more prone to use cardiac catheterization and revascularization, as opposed to what I guess is medical management). They used the differential distance as their instrument: for each patient, what was the distance to the nearest high-catheterization hospital minus the distance to the nearest low-catheterization hospital?
IVs are not without untestable assumptions - just like all observational methods, really. Also, they answer a subtly different question than a randomized trial would. Quoting McClellan et al
Thus, IV methods are ideally suited to address the question, "What would be the effect of reducing the use of invasive procedures after AMI in the elderly by, for example, one fourth?" They do not address the question, "What would be
the expected effect of treating a particular patient aggressively rather than with noninvasive therapies alone?" For clinical decisions involving treatment of individual patients, the answer to the latter question is more useful. For policy decisions affecting the treatment of patient populations, the answer to the former is likely to be more useful.
Alternatively, sometimes you have cases where treatment is given to people at or above a cutoff point on some sort of score, and withheld from everyone below the cutoff. You can exploit that in a regression discontinuity design. You'd compare people just above the cutoff to people just below it. The inherent assumption is that because all scores are measured with error, the people just above the cutoff and the people just below it are pretty similar. This does also require that the participants did not game the score - which is an assumption that you should really think about. In some ways, being above versus below the score is an instrument.
The issue is that it may be difficult to find an instrument, and that the treatments you're interested in may be not be assigned according to some score.
|
Favored methods for overcoming selection bias (special attention to healthcare fields)?
I don't disagree with Noah's answer. I have never heard of Bayesian Additive Regression Trees or with targeted minimum-loss estimation, so I can't comment on those specifically. Methods involving weig
|
47,031
|
Why is fisher transformation necessary?
|
The boundedness is not the real problem it just explains the skewness of the sampling distribution. Basically, the transformation approach is so established for historic reasons (just like the prevailing recommendation to log- or whatever-transform your skewed variables to make them more normal for a linear regression - only that Fisher's transformation is formally correct for large enough samples).
The reason for such simplifications is mainly to save computing power. Let's have a more detailed look:
First, of all, we need to establish, what the problem actually is. To derive a statistical test for a test statistic such as the correlation, I need to derive the sampling distribution of my statistic. This has been done for the correlation and it turns out that it highly depends on the population value of the correlation. Assuming that your variables follow a bivariate normal distribution, the full formula of the density of the correlation sampling distribution is:
Here you see that you need the Gamma function and the Gaussian hypergeometric function to continue calculating probabilities (i.e., areas under this curve). To derive an (asymptotically) exact statistical test, you need to work with this thing to get your p-values or critical values. Well... imagine good old Fisher in the early 20th century long before a calculator (let alone a computer) was a thing. This thing is just intractable for default usage. And basically, this thing just implies that your distribution gets more and more skewed the more you approach the boundaries (see below).
Well, it turns out that there are two lucky properties of this thing. First: if the population correlation (rho) is zero, this simplifies to the well-known central t-distribution. This is something, you can handle (and nearly everyone does in introductory statistics). So no problem for any test against the population value zero.
But what should Fisher do to test against any other value or to compare two sample correlations? Well, Fisher invented one of his famous tricks:
By transforming your correlations using Fisher's method, you get scores that approximately follow a normal distribution with mean Fisher-z(r) and variance 1/(n-3), looks like this:
Having approximate normality is a great thing from a computational perspective, because you may use a Z-test that is based on the normal distribution which is a well-behaved and easy to handle distribution (and hence, the favorite pet-distribution of nearly all statisticians ;)). Much easier than the exact distribution above which is not tractable without a computer.
To conclude, you are absolutely right that - on a theoretical level - Fisher's transformation is not necessary to conduct the test if you have a computer and a long breath to type this formula into a script that calculates integrals from this density, you can easily conduct your tests on it. If you are a historic statistician or a student in an exam with only a table of the normal distribution, Fisher's transformation is your way to go. Beyond that, I guess, it's as with many beloved traditions, if you have always used the transformation in your tests, you just continue to use it.
Hope this historic anecdote helped to ease your doubts. I hope I got the story right, if I missed something, just leave a comment.
|
Why is fisher transformation necessary?
|
The boundedness is not the real problem it just explains the skewness of the sampling distribution. Basically, the transformation approach is so established for historic reasons (just like the prevail
|
Why is fisher transformation necessary?
The boundedness is not the real problem it just explains the skewness of the sampling distribution. Basically, the transformation approach is so established for historic reasons (just like the prevailing recommendation to log- or whatever-transform your skewed variables to make them more normal for a linear regression - only that Fisher's transformation is formally correct for large enough samples).
The reason for such simplifications is mainly to save computing power. Let's have a more detailed look:
First, of all, we need to establish, what the problem actually is. To derive a statistical test for a test statistic such as the correlation, I need to derive the sampling distribution of my statistic. This has been done for the correlation and it turns out that it highly depends on the population value of the correlation. Assuming that your variables follow a bivariate normal distribution, the full formula of the density of the correlation sampling distribution is:
Here you see that you need the Gamma function and the Gaussian hypergeometric function to continue calculating probabilities (i.e., areas under this curve). To derive an (asymptotically) exact statistical test, you need to work with this thing to get your p-values or critical values. Well... imagine good old Fisher in the early 20th century long before a calculator (let alone a computer) was a thing. This thing is just intractable for default usage. And basically, this thing just implies that your distribution gets more and more skewed the more you approach the boundaries (see below).
Well, it turns out that there are two lucky properties of this thing. First: if the population correlation (rho) is zero, this simplifies to the well-known central t-distribution. This is something, you can handle (and nearly everyone does in introductory statistics). So no problem for any test against the population value zero.
But what should Fisher do to test against any other value or to compare two sample correlations? Well, Fisher invented one of his famous tricks:
By transforming your correlations using Fisher's method, you get scores that approximately follow a normal distribution with mean Fisher-z(r) and variance 1/(n-3), looks like this:
Having approximate normality is a great thing from a computational perspective, because you may use a Z-test that is based on the normal distribution which is a well-behaved and easy to handle distribution (and hence, the favorite pet-distribution of nearly all statisticians ;)). Much easier than the exact distribution above which is not tractable without a computer.
To conclude, you are absolutely right that - on a theoretical level - Fisher's transformation is not necessary to conduct the test if you have a computer and a long breath to type this formula into a script that calculates integrals from this density, you can easily conduct your tests on it. If you are a historic statistician or a student in an exam with only a table of the normal distribution, Fisher's transformation is your way to go. Beyond that, I guess, it's as with many beloved traditions, if you have always used the transformation in your tests, you just continue to use it.
Hope this historic anecdote helped to ease your doubts. I hope I got the story right, if I missed something, just leave a comment.
|
Why is fisher transformation necessary?
The boundedness is not the real problem it just explains the skewness of the sampling distribution. Basically, the transformation approach is so established for historic reasons (just like the prevail
|
47,032
|
Expanding initial sample when the result isn't significant
|
1.) Signal-to-Noise ratio has a well defined meaning in many engineering problems. In the posting, I was referring to the less formal way it is often used in statistical inference settings.
That is, there is a parameter we want to estimate we'll define as $\mu$. Through data collection and analysis, we get an estimator $\hat \mu$. Then the signal to noise ratio is defined as
$\frac{|\mu|}{S(\hat \mu)}$
where $S(\hat \mu)$ is the standard deviation of the estimator $\hat \mu$. Note that $S(\hat \mu)$ depends on both the variance of the observations and the number of samples in the data.
2.) Typically, we assume that our estimator follows a normal distribution and that we are doing something like a Wald statistic for our test, i.e.,
$t = \frac{|\hat \mu|}{ \hat{ S(\hat \mu)}}$
Under those assumptions, as the real signal to noise approaches 0, the distribution of the p-value approaches a uniform(0,1). As the real signal to noise get large, the distribution of the p-value becomes tightly concentrated around 0.
3.) As the sample size increases, $S(\hat \mu)$ gets smaller, thus increasing the signal to noise if we have an unbiased estimator of $\mu$.
4.) In short, a high Signal to Noise implies that it's easy to get a relatively good estimate of the parameter from the data we plan to obtain. Moreover, a high SNR implies that conditional on finding statistical significance, the probability that we actually have the direction correct is higher than a study with a lower SNR.
I'm baking quite a bit into that last point 4. If you're interested into the why, I think the concept is best represented in the literature with the idea of type S/M errors. This is looking at the probability that we got the sign of an effect incorrect (type S) or the magnitude of an effect (type M) conditional on us finding statistical significance. In short, as SNR $\rightarrow 0$, P(type S) $\rightarrow 0.5$ and P(type M) $\rightarrow 1$, where as when SNR gets large, both error rates approach 0.
If you're curious about this subject, here is a reasonable place to start.
Now, thinking back to our p-hacking problem. What happens when we fail to reject, so we collect more data and reanalyze? Well, it's true that we inflate our type I error rates. But we also reduce both our type S and type M error rates! So unless we believe that the null hypothesis could be true (and it appears that in the case of comparing two groups, Tukey did not), we shouldn't be as concerned about preserving our type I error rate as we should in minimizing our type S and M rates.
Finally, note that approaches that call for getting new data when our first experiment failed to find significance and not using the old observations increase the type S and M rates when compared with using the new data and the old data!
|
Expanding initial sample when the result isn't significant
|
1.) Signal-to-Noise ratio has a well defined meaning in many engineering problems. In the posting, I was referring to the less formal way it is often used in statistical inference settings.
That is,
|
Expanding initial sample when the result isn't significant
1.) Signal-to-Noise ratio has a well defined meaning in many engineering problems. In the posting, I was referring to the less formal way it is often used in statistical inference settings.
That is, there is a parameter we want to estimate we'll define as $\mu$. Through data collection and analysis, we get an estimator $\hat \mu$. Then the signal to noise ratio is defined as
$\frac{|\mu|}{S(\hat \mu)}$
where $S(\hat \mu)$ is the standard deviation of the estimator $\hat \mu$. Note that $S(\hat \mu)$ depends on both the variance of the observations and the number of samples in the data.
2.) Typically, we assume that our estimator follows a normal distribution and that we are doing something like a Wald statistic for our test, i.e.,
$t = \frac{|\hat \mu|}{ \hat{ S(\hat \mu)}}$
Under those assumptions, as the real signal to noise approaches 0, the distribution of the p-value approaches a uniform(0,1). As the real signal to noise get large, the distribution of the p-value becomes tightly concentrated around 0.
3.) As the sample size increases, $S(\hat \mu)$ gets smaller, thus increasing the signal to noise if we have an unbiased estimator of $\mu$.
4.) In short, a high Signal to Noise implies that it's easy to get a relatively good estimate of the parameter from the data we plan to obtain. Moreover, a high SNR implies that conditional on finding statistical significance, the probability that we actually have the direction correct is higher than a study with a lower SNR.
I'm baking quite a bit into that last point 4. If you're interested into the why, I think the concept is best represented in the literature with the idea of type S/M errors. This is looking at the probability that we got the sign of an effect incorrect (type S) or the magnitude of an effect (type M) conditional on us finding statistical significance. In short, as SNR $\rightarrow 0$, P(type S) $\rightarrow 0.5$ and P(type M) $\rightarrow 1$, where as when SNR gets large, both error rates approach 0.
If you're curious about this subject, here is a reasonable place to start.
Now, thinking back to our p-hacking problem. What happens when we fail to reject, so we collect more data and reanalyze? Well, it's true that we inflate our type I error rates. But we also reduce both our type S and type M error rates! So unless we believe that the null hypothesis could be true (and it appears that in the case of comparing two groups, Tukey did not), we shouldn't be as concerned about preserving our type I error rate as we should in minimizing our type S and M rates.
Finally, note that approaches that call for getting new data when our first experiment failed to find significance and not using the old observations increase the type S and M rates when compared with using the new data and the old data!
|
Expanding initial sample when the result isn't significant
1.) Signal-to-Noise ratio has a well defined meaning in many engineering problems. In the posting, I was referring to the less formal way it is often used in statistical inference settings.
That is,
|
47,033
|
Distribution of $XY$ when $(X,Y) \sim BVN(0,0,1,1,\rho)$
|
Your original question does not require you to find the distribution of $XY$ when $(X,Y)$ is jointly normal. Here is a hint for that question:
Let $Z_i=X_iY_i$, so that $Z_1,Z_2,\ldots,Z_n$ are i.i.d variables. Hence by classical CLT we have
$$\frac{\sqrt n(W_n-\operatorname E(Z_1))}{\sqrt{\operatorname{Var}(Z_1)}}\stackrel{L}\longrightarrow N(0,1)\tag{*}$$
, where $W_n=\frac{1}{n} \sum\limits_{i=1}^n Z_i$.
Since we know the conditional distributions of a bivariate normal distribution, use law of total expectation to find $\operatorname E(Z_1)$:
$$\operatorname E(Z_1)=\operatorname E\left[\operatorname E(X_1Y_1\mid Y_1)\right]=\operatorname E\left[Y_1 \operatorname E(X_1\mid Y_1)\right]$$
Do this similarly for $\operatorname E(Z_1^2)$ and hence find $\operatorname{Var}(Z_1)=\operatorname{E}(Z_1^2)-[\operatorname{E}(Z_1)]^2$
Now $(*)$ actually gives you a pivot for constructing an asymptotic confidence interval for $\rho$.
|
Distribution of $XY$ when $(X,Y) \sim BVN(0,0,1,1,\rho)$
|
Your original question does not require you to find the distribution of $XY$ when $(X,Y)$ is jointly normal. Here is a hint for that question:
Let $Z_i=X_iY_i$, so that $Z_1,Z_2,\ldots,Z_n$ are i.i.d
|
Distribution of $XY$ when $(X,Y) \sim BVN(0,0,1,1,\rho)$
Your original question does not require you to find the distribution of $XY$ when $(X,Y)$ is jointly normal. Here is a hint for that question:
Let $Z_i=X_iY_i$, so that $Z_1,Z_2,\ldots,Z_n$ are i.i.d variables. Hence by classical CLT we have
$$\frac{\sqrt n(W_n-\operatorname E(Z_1))}{\sqrt{\operatorname{Var}(Z_1)}}\stackrel{L}\longrightarrow N(0,1)\tag{*}$$
, where $W_n=\frac{1}{n} \sum\limits_{i=1}^n Z_i$.
Since we know the conditional distributions of a bivariate normal distribution, use law of total expectation to find $\operatorname E(Z_1)$:
$$\operatorname E(Z_1)=\operatorname E\left[\operatorname E(X_1Y_1\mid Y_1)\right]=\operatorname E\left[Y_1 \operatorname E(X_1\mid Y_1)\right]$$
Do this similarly for $\operatorname E(Z_1^2)$ and hence find $\operatorname{Var}(Z_1)=\operatorname{E}(Z_1^2)-[\operatorname{E}(Z_1)]^2$
Now $(*)$ actually gives you a pivot for constructing an asymptotic confidence interval for $\rho$.
|
Distribution of $XY$ when $(X,Y) \sim BVN(0,0,1,1,\rho)$
Your original question does not require you to find the distribution of $XY$ when $(X,Y)$ is jointly normal. Here is a hint for that question:
Let $Z_i=X_iY_i$, so that $Z_1,Z_2,\ldots,Z_n$ are i.i.d
|
47,034
|
Distribution of $XY$ when $(X,Y) \sim BVN(0,0,1,1,\rho)$
|
An exact answer is given in Probability Distributions Involving Gaussian Random Variables: A Handbook for Engineers, Scientists and Mathematicians (along with many other results.)
If $(X,Y)$ is bivariate normal distributed with zero means and correlation $\rho$, then the density function of the product $XY$ is given by
$$
f_{XY}(z)= \frac1{\pi \sigma_1 \sigma_2} \exp\left\{\frac{\rho z}{\sigma_1 \sigma_2 (1-\rho^2)}\right\} K_0\left( \frac{|z|}{\sigma_1\sigma_2 (1-\rho^2)} \right)
$$ where $K_0$ is the modified Bessel function of the second kind.
EDIT answer for additional question in comment
The reference book given gives the characteristic function. For the moment generating function I get $M_{XY}(t)= \left(1 - 2 t \rho - t^2(1-\rho^2)\right)^{-\frac{1}{2}}$ for $-1<t-1$ (so you missed on $t$.)
|
Distribution of $XY$ when $(X,Y) \sim BVN(0,0,1,1,\rho)$
|
An exact answer is given in Probability Distributions Involving Gaussian Random Variables: A Handbook for Engineers, Scientists and Mathematicians (along with many other results.)
If $(X,Y)$ is bivari
|
Distribution of $XY$ when $(X,Y) \sim BVN(0,0,1,1,\rho)$
An exact answer is given in Probability Distributions Involving Gaussian Random Variables: A Handbook for Engineers, Scientists and Mathematicians (along with many other results.)
If $(X,Y)$ is bivariate normal distributed with zero means and correlation $\rho$, then the density function of the product $XY$ is given by
$$
f_{XY}(z)= \frac1{\pi \sigma_1 \sigma_2} \exp\left\{\frac{\rho z}{\sigma_1 \sigma_2 (1-\rho^2)}\right\} K_0\left( \frac{|z|}{\sigma_1\sigma_2 (1-\rho^2)} \right)
$$ where $K_0$ is the modified Bessel function of the second kind.
EDIT answer for additional question in comment
The reference book given gives the characteristic function. For the moment generating function I get $M_{XY}(t)= \left(1 - 2 t \rho - t^2(1-\rho^2)\right)^{-\frac{1}{2}}$ for $-1<t-1$ (so you missed on $t$.)
|
Distribution of $XY$ when $(X,Y) \sim BVN(0,0,1,1,\rho)$
An exact answer is given in Probability Distributions Involving Gaussian Random Variables: A Handbook for Engineers, Scientists and Mathematicians (along with many other results.)
If $(X,Y)$ is bivari
|
47,035
|
Why we try to capture variability?
|
Statistics is the interface between math (models of the world) and our perception of reality. I suspect what you are looking for is not proof, but an understanding of the assumptions.
Math proofs are a formal logic system that works because it is self contained (in my background as a chemist this would be termed a adiabetic). All proofs rest on assumptions, and incompleteness theorems show that a system cannot prove its own consistency nor prove every statement true.
Data is percieved information about the world (even if technology has captured it). The underlying data generating processes are many and complex and no real world physical system is close to adiabetic,allowing external influences to perturb the system being investigated. Quantum theory tells us that we can never know every physical detail of a system perfectly.
There are uncertainties on both sides of the equation.
The question stats attempts to answer is what can data tell us about the model we have, or vice versa what our model can tell us about our data. The two won't match, so what we are interested in is how much they don't match, i.e. How much does our data vary outside the constraints of our model.
A popular saying on this site is that all models are wrong, but some are useful. Measuring variance explained allows us to assess one aspect of this usefulness, but it is far from the only one. The metric employed should be appropriate to the questions being asked.
So some basic assumptions in assessing variance (I'm sure it will be incomplete, so feel free to comment)
The model is not perfect but explains a maximal proportion of observed phenomena
The data is not pure, it contains noise and biases that are unrelated to the model
We need a model that explains as much of the data generating process as possible
We need a model able to ignore the noise
Processes external to the system under investigation have negligible influence.
Tools exist for assessing the validity of these assumptions, which is why stats is so complicated, but can reveal so much.
It is important to understand the purpose of statistics (something commonly misunderstood by both mathematicians and scientists). The point of statistics is not proof or truth, it is assessing risk.
|
Why we try to capture variability?
|
Statistics is the interface between math (models of the world) and our perception of reality. I suspect what you are looking for is not proof, but an understanding of the assumptions.
Math proofs are
|
Why we try to capture variability?
Statistics is the interface between math (models of the world) and our perception of reality. I suspect what you are looking for is not proof, but an understanding of the assumptions.
Math proofs are a formal logic system that works because it is self contained (in my background as a chemist this would be termed a adiabetic). All proofs rest on assumptions, and incompleteness theorems show that a system cannot prove its own consistency nor prove every statement true.
Data is percieved information about the world (even if technology has captured it). The underlying data generating processes are many and complex and no real world physical system is close to adiabetic,allowing external influences to perturb the system being investigated. Quantum theory tells us that we can never know every physical detail of a system perfectly.
There are uncertainties on both sides of the equation.
The question stats attempts to answer is what can data tell us about the model we have, or vice versa what our model can tell us about our data. The two won't match, so what we are interested in is how much they don't match, i.e. How much does our data vary outside the constraints of our model.
A popular saying on this site is that all models are wrong, but some are useful. Measuring variance explained allows us to assess one aspect of this usefulness, but it is far from the only one. The metric employed should be appropriate to the questions being asked.
So some basic assumptions in assessing variance (I'm sure it will be incomplete, so feel free to comment)
The model is not perfect but explains a maximal proportion of observed phenomena
The data is not pure, it contains noise and biases that are unrelated to the model
We need a model that explains as much of the data generating process as possible
We need a model able to ignore the noise
Processes external to the system under investigation have negligible influence.
Tools exist for assessing the validity of these assumptions, which is why stats is so complicated, but can reveal so much.
It is important to understand the purpose of statistics (something commonly misunderstood by both mathematicians and scientists). The point of statistics is not proof or truth, it is assessing risk.
|
Why we try to capture variability?
Statistics is the interface between math (models of the world) and our perception of reality. I suspect what you are looking for is not proof, but an understanding of the assumptions.
Math proofs are
|
47,036
|
Why we try to capture variability?
|
In many cases the reason we use regression is to explain variability. In that sense, how much variability is explained is one of the key measures of success.
This may be more clear with an example. I recently worked on a project where we created a regression model to explain employee performance. We did this because our stakeholders (senior management) wanted to know why some employees were performing well and others weren't. That is, why do we see variance in employee performance?
Phrased this way it should be clear that a key performance metric for our model is how much variability it correctly anticipates.
|
Why we try to capture variability?
|
In many cases the reason we use regression is to explain variability. In that sense, how much variability is explained is one of the key measures of success.
This may be more clear with an example. I
|
Why we try to capture variability?
In many cases the reason we use regression is to explain variability. In that sense, how much variability is explained is one of the key measures of success.
This may be more clear with an example. I recently worked on a project where we created a regression model to explain employee performance. We did this because our stakeholders (senior management) wanted to know why some employees were performing well and others weren't. That is, why do we see variance in employee performance?
Phrased this way it should be clear that a key performance metric for our model is how much variability it correctly anticipates.
|
Why we try to capture variability?
In many cases the reason we use regression is to explain variability. In that sense, how much variability is explained is one of the key measures of success.
This may be more clear with an example. I
|
47,037
|
Why we try to capture variability?
|
Here's my few cents..
Co-movement of independent and dependent variable is the key here. Let's say we want to find out how height changes with age and we have data for 100 people. Let's say we know that our independent variable (height) varies a lot across the 100 observations, but we want to find out how much of it comes from the co-movement of height and age. Hence, we fit a model and to estimate of how much of the variance in height can be explained from co-movement w.r.t. age.
If in our data, everyone has the same age, the model won't be able to explain ANY of the height's variance, we'll need to find something that explains the movement (variance) of the independent variable. Explaining the movement (variance) of independent variable is a good starting point for all predictive models.
In PCA, the objective is rotate the data to get the best axis for cleanest perspective. Using variance to change the basis is just a way to get this perspective on how data is scattered on a hyperplane.
|
Why we try to capture variability?
|
Here's my few cents..
Co-movement of independent and dependent variable is the key here. Let's say we want to find out how height changes with age and we have data for 100 people. Let's say we know t
|
Why we try to capture variability?
Here's my few cents..
Co-movement of independent and dependent variable is the key here. Let's say we want to find out how height changes with age and we have data for 100 people. Let's say we know that our independent variable (height) varies a lot across the 100 observations, but we want to find out how much of it comes from the co-movement of height and age. Hence, we fit a model and to estimate of how much of the variance in height can be explained from co-movement w.r.t. age.
If in our data, everyone has the same age, the model won't be able to explain ANY of the height's variance, we'll need to find something that explains the movement (variance) of the independent variable. Explaining the movement (variance) of independent variable is a good starting point for all predictive models.
In PCA, the objective is rotate the data to get the best axis for cleanest perspective. Using variance to change the basis is just a way to get this perspective on how data is scattered on a hyperplane.
|
Why we try to capture variability?
Here's my few cents..
Co-movement of independent and dependent variable is the key here. Let's say we want to find out how height changes with age and we have data for 100 people. Let's say we know t
|
47,038
|
Order Statistics of Poisson Distribution
|
Given: $(X_1, ...,X_n)$ denotes a random sample of size $n$ drawn on $X$, where $X \sim \text{Poisson}(\lambda)$ with pmf $f(x)$:
Then, the pmf of the $2^{\text{nd}}$ order statistic, in a sample of size $n$, is $g(x)$:
... where:
I am using the OrderStat function from the mathStatica package for Mathematica to automate the nitty-gritties, and
Beta[z,a,b] denotes the incomplete Beta function $\int _0^z t^{a-1} (1-t)^{b-1} dt$
Gamma[a,z] is the incomplete gamma function $\int _z^{\infty } t^{a-1} e^{-t} dt$
The exact desired probability $P(X_{(2)}=0)$ is simply:
The following diagram plots and compares:
the exact solution to $P(X_{(2)}=0)$ just derived (red curve)
to the bound $P(X_{(2)} = 0) ≥ 1 − n(1 − e^{−λ})^{n−1}$ proposed in the question
... plotted here when $\lambda =3$.
The bound appears useless for any proper purpose - even a drunk monkey could do better by simply choosing 0 than using the bound proposed that is negative over a huge chunk of the domain (and will get worse as $\lambda$ increases).
|
Order Statistics of Poisson Distribution
|
Given: $(X_1, ...,X_n)$ denotes a random sample of size $n$ drawn on $X$, where $X \sim \text{Poisson}(\lambda)$ with pmf $f(x)$:
Then, the pmf of the $2^{\text{nd}}$ order statistic, in a sample of
|
Order Statistics of Poisson Distribution
Given: $(X_1, ...,X_n)$ denotes a random sample of size $n$ drawn on $X$, where $X \sim \text{Poisson}(\lambda)$ with pmf $f(x)$:
Then, the pmf of the $2^{\text{nd}}$ order statistic, in a sample of size $n$, is $g(x)$:
... where:
I am using the OrderStat function from the mathStatica package for Mathematica to automate the nitty-gritties, and
Beta[z,a,b] denotes the incomplete Beta function $\int _0^z t^{a-1} (1-t)^{b-1} dt$
Gamma[a,z] is the incomplete gamma function $\int _z^{\infty } t^{a-1} e^{-t} dt$
The exact desired probability $P(X_{(2)}=0)$ is simply:
The following diagram plots and compares:
the exact solution to $P(X_{(2)}=0)$ just derived (red curve)
to the bound $P(X_{(2)} = 0) ≥ 1 − n(1 − e^{−λ})^{n−1}$ proposed in the question
... plotted here when $\lambda =3$.
The bound appears useless for any proper purpose - even a drunk monkey could do better by simply choosing 0 than using the bound proposed that is negative over a huge chunk of the domain (and will get worse as $\lambda$ increases).
|
Order Statistics of Poisson Distribution
Given: $(X_1, ...,X_n)$ denotes a random sample of size $n$ drawn on $X$, where $X \sim \text{Poisson}(\lambda)$ with pmf $f(x)$:
Then, the pmf of the $2^{\text{nd}}$ order statistic, in a sample of
|
47,039
|
Order Statistics of Poisson Distribution
|
$\mathbb{P}(X_{(2)} = 0)$ asked for the probability where the second least r.v. is zero. In other words, it asked for the probability where at least two of $X_1, \cdots X_n$ are zero.
The statement "there are at least two zeros among $X_1, \cdots, X_n$" is false when we have an event where "at least $n-1$ of $X_1, \cdots, X_n$ being greater than zero". The event happens with a probability of at most $$n(1 - e^{-\lambda})^{(n-1)}$$
where you have $n$ choices (which $n-1$ r.v.s to choose, or alternatively, which one to leave out), and for each choice you need all $n-1$ of them to be greater than zero, and assume nothing of the one you left out (i.e. adding another multiplier of $1$).
The quoted probability is the upper bound as the event is the least restrictive event among all events that falsify the statement, and any other events will be at least as, or more, restrictive. For example, one can condition on the one variate left out in the selection process, but that involve making more assumptions on the variate's value. Reducing the cardinality of an event (to its subset) will not increase the probability of that event happening, as shown in this Maths.SE question.
To obtain the required probability it is sufficient to exclude the event from the entire event space from consideration. The RHS of the question ($1 - n(1 - e^{-\lambda})^{(n-1)}$) thus forms the lower bound to the required probability.
|
Order Statistics of Poisson Distribution
|
$\mathbb{P}(X_{(2)} = 0)$ asked for the probability where the second least r.v. is zero. In other words, it asked for the probability where at least two of $X_1, \cdots X_n$ are zero.
The statement "t
|
Order Statistics of Poisson Distribution
$\mathbb{P}(X_{(2)} = 0)$ asked for the probability where the second least r.v. is zero. In other words, it asked for the probability where at least two of $X_1, \cdots X_n$ are zero.
The statement "there are at least two zeros among $X_1, \cdots, X_n$" is false when we have an event where "at least $n-1$ of $X_1, \cdots, X_n$ being greater than zero". The event happens with a probability of at most $$n(1 - e^{-\lambda})^{(n-1)}$$
where you have $n$ choices (which $n-1$ r.v.s to choose, or alternatively, which one to leave out), and for each choice you need all $n-1$ of them to be greater than zero, and assume nothing of the one you left out (i.e. adding another multiplier of $1$).
The quoted probability is the upper bound as the event is the least restrictive event among all events that falsify the statement, and any other events will be at least as, or more, restrictive. For example, one can condition on the one variate left out in the selection process, but that involve making more assumptions on the variate's value. Reducing the cardinality of an event (to its subset) will not increase the probability of that event happening, as shown in this Maths.SE question.
To obtain the required probability it is sufficient to exclude the event from the entire event space from consideration. The RHS of the question ($1 - n(1 - e^{-\lambda})^{(n-1)}$) thus forms the lower bound to the required probability.
|
Order Statistics of Poisson Distribution
$\mathbb{P}(X_{(2)} = 0)$ asked for the probability where the second least r.v. is zero. In other words, it asked for the probability where at least two of $X_1, \cdots X_n$ are zero.
The statement "t
|
47,040
|
Determining confidence interval with one observation (for Poisson distribution)
|
If $X \sim \mathsf{Pois}(\lambda).$ then $E(X) = \lambda$ and $SD(X) = \sqrt{\lambda}.$ For sufficiently large $\lambda,$ the random variable $X$ is approximately normally distributed. Then one says that $Z = \frac{X -\lambda}{\sqrt{\lambda}}$ is
approximately standard normal, so that
$$P\left(-1.96 < \frac{X -\lambda}{\sqrt{\lambda}} < 1.96\right) \approx 0.95.$$
This gives rise to $P(X - 1.96\sqrt{\lambda} < \lambda < X + 1.96\sqrt{\lambda})\approx0.95.$
Again, for sufficiently large $\lambda,$ one says that $1.96\sqrt{\lambda} \approx 1.96\sqrt{X}.$ So finally, an approximate 95% confidence interval
for $\lambda$ is of the form $$(X - 1.96\sqrt{X},\;X + 1.96\sqrt{X}).$$
This type of interval was proposed by Wald as asymptotically accurate for
$\lambda \rightarrow \infty.$ It works reasonably well for $\lambda > 50.$
For smaller $\lambda,$ a confidence interval with somewhat closer to 95% coverage is $$(X+2 - 1.96\sqrt{X+1},\; X+2 + 1.96\sqrt{X+1}).$$
Rationale: This adjusted 95% interval for smaller $\lambda$ is based on 'inverting' a
standard test for $H_0: \lambda = \lambda_0$ vs. $H_a: \lambda \ne \lambda_0,$ with test
statistic $Z = \frac{X - \lambda_0}{\sqrt{\lambda_0}},$ which rejects
at the 5% level for $|Z| \ge 1.96.$
Specifically for given $X,$ the adjusted interval
is found by solving a quadratic inequality for values $\lambda_0$
with $|Z| < 1.96$ and conflating $1.96$ with $2$ to obtain the terms with $X + 2$ and $X+ 1.$ In effect, the adjusted CI consists of non-rejectable hypothetical values of $\lambda_0.$ (One still assumes that $Z$ is approximately standard normal, but the additional assumption
that $1.96\sqrt{\lambda} \approx 1.96\sqrt{X}$ is no longer required.)
For both styles of CIs, an approximate 90% confidence interval is shorter, using $\pm 1.645$ instead of $\pm 1.96.$
Because a Poisson distribution is discrete, actual coverage probabilities can vary by a surprising amount with a small change in the value of $\lambda.$ Here is a graph that shows actual coverage probabilities of the second (small $\lambda)$ type of "95%" confidence interval given above, for many values of $\lambda$ between $0.5$ and $30.$ For $\lambda > 5,$ coverage probabilities are not far from 95%.
The figure was made using the following R code:
lam = seq(.5, 30, by=.0001); m = length(lam) # values of lambda
t = 0:200 # realistic values of T
LL = t+2 - 1.96*sqrt(t+1); UL = t+2 + 1.96*sqrt(t+1) # corresp. CIs
cov.pr = numeric(m)
for(i in 1:m) {
lam.i = lam[i] # pick a lambda
cov = (lam.i >= LL & lam.i <= UL) # TRUE if CI covers
cov.pr[i] = sum(dpois(t[cov], lam.i)) } # sum probs for covering T's
plot(lam, cov.pr, type="l", ylim=c(.8,1), lwd=2, xaxs="i")
abline(h=.95, col="green3")
Addendum: By contrast, making obvious minor changes in the program above, we have the following graph showing the true coverage probabilities of a "95%" Wald confidence interval for $\lambda.$
|
Determining confidence interval with one observation (for Poisson distribution)
|
If $X \sim \mathsf{Pois}(\lambda).$ then $E(X) = \lambda$ and $SD(X) = \sqrt{\lambda}.$ For sufficiently large $\lambda,$ the random variable $X$ is approximately normally distributed. Then one says t
|
Determining confidence interval with one observation (for Poisson distribution)
If $X \sim \mathsf{Pois}(\lambda).$ then $E(X) = \lambda$ and $SD(X) = \sqrt{\lambda}.$ For sufficiently large $\lambda,$ the random variable $X$ is approximately normally distributed. Then one says that $Z = \frac{X -\lambda}{\sqrt{\lambda}}$ is
approximately standard normal, so that
$$P\left(-1.96 < \frac{X -\lambda}{\sqrt{\lambda}} < 1.96\right) \approx 0.95.$$
This gives rise to $P(X - 1.96\sqrt{\lambda} < \lambda < X + 1.96\sqrt{\lambda})\approx0.95.$
Again, for sufficiently large $\lambda,$ one says that $1.96\sqrt{\lambda} \approx 1.96\sqrt{X}.$ So finally, an approximate 95% confidence interval
for $\lambda$ is of the form $$(X - 1.96\sqrt{X},\;X + 1.96\sqrt{X}).$$
This type of interval was proposed by Wald as asymptotically accurate for
$\lambda \rightarrow \infty.$ It works reasonably well for $\lambda > 50.$
For smaller $\lambda,$ a confidence interval with somewhat closer to 95% coverage is $$(X+2 - 1.96\sqrt{X+1},\; X+2 + 1.96\sqrt{X+1}).$$
Rationale: This adjusted 95% interval for smaller $\lambda$ is based on 'inverting' a
standard test for $H_0: \lambda = \lambda_0$ vs. $H_a: \lambda \ne \lambda_0,$ with test
statistic $Z = \frac{X - \lambda_0}{\sqrt{\lambda_0}},$ which rejects
at the 5% level for $|Z| \ge 1.96.$
Specifically for given $X,$ the adjusted interval
is found by solving a quadratic inequality for values $\lambda_0$
with $|Z| < 1.96$ and conflating $1.96$ with $2$ to obtain the terms with $X + 2$ and $X+ 1.$ In effect, the adjusted CI consists of non-rejectable hypothetical values of $\lambda_0.$ (One still assumes that $Z$ is approximately standard normal, but the additional assumption
that $1.96\sqrt{\lambda} \approx 1.96\sqrt{X}$ is no longer required.)
For both styles of CIs, an approximate 90% confidence interval is shorter, using $\pm 1.645$ instead of $\pm 1.96.$
Because a Poisson distribution is discrete, actual coverage probabilities can vary by a surprising amount with a small change in the value of $\lambda.$ Here is a graph that shows actual coverage probabilities of the second (small $\lambda)$ type of "95%" confidence interval given above, for many values of $\lambda$ between $0.5$ and $30.$ For $\lambda > 5,$ coverage probabilities are not far from 95%.
The figure was made using the following R code:
lam = seq(.5, 30, by=.0001); m = length(lam) # values of lambda
t = 0:200 # realistic values of T
LL = t+2 - 1.96*sqrt(t+1); UL = t+2 + 1.96*sqrt(t+1) # corresp. CIs
cov.pr = numeric(m)
for(i in 1:m) {
lam.i = lam[i] # pick a lambda
cov = (lam.i >= LL & lam.i <= UL) # TRUE if CI covers
cov.pr[i] = sum(dpois(t[cov], lam.i)) } # sum probs for covering T's
plot(lam, cov.pr, type="l", ylim=c(.8,1), lwd=2, xaxs="i")
abline(h=.95, col="green3")
Addendum: By contrast, making obvious minor changes in the program above, we have the following graph showing the true coverage probabilities of a "95%" Wald confidence interval for $\lambda.$
|
Determining confidence interval with one observation (for Poisson distribution)
If $X \sim \mathsf{Pois}(\lambda).$ then $E(X) = \lambda$ and $SD(X) = \sqrt{\lambda}.$ For sufficiently large $\lambda,$ the random variable $X$ is approximately normally distributed. Then one says t
|
47,041
|
Extending a neural network to classify new objects
|
I don't know of any method to do exactly what you're asking, but in general you may want to look at Transfer Learning. In deep learning. this technique consists of loading a network trained to predict images on a large dataset such as ImageNet and replace the last, fully connected layer with your own, then train on your images. Examples of such networks are AlexNet or VGGNet
In this way, the features extracted by the convolutional layers will be preserved, but you can use those features to predict a different task.
Here's a practical tutorial that explains the specifics for pytorch, and you can read more about it here
|
Extending a neural network to classify new objects
|
I don't know of any method to do exactly what you're asking, but in general you may want to look at Transfer Learning. In deep learning. this technique consists of loading a network trained to predict
|
Extending a neural network to classify new objects
I don't know of any method to do exactly what you're asking, but in general you may want to look at Transfer Learning. In deep learning. this technique consists of loading a network trained to predict images on a large dataset such as ImageNet and replace the last, fully connected layer with your own, then train on your images. Examples of such networks are AlexNet or VGGNet
In this way, the features extracted by the convolutional layers will be preserved, but you can use those features to predict a different task.
Here's a practical tutorial that explains the specifics for pytorch, and you can read more about it here
|
Extending a neural network to classify new objects
I don't know of any method to do exactly what you're asking, but in general you may want to look at Transfer Learning. In deep learning. this technique consists of loading a network trained to predict
|
47,042
|
Extending a neural network to classify new objects
|
This general area is called "continual", "incremental" or "life-long" learning, and it's quite an active area of research.
There are many approaches to continual learning, including different forms of regularization which penalize forgetting, dynamically expanding architectures, and explicit model memories. For more detail, I would refer you to this survey paper: Continual Lifelong Learning with Neural Networks: A Review
Methods such as fine-tuning and learning without forgetting seem to
require all objects in the new images annotated though.
Well, that is not always the case. Let me give an explicit continual learning approach to make this clear: you can train a classifier with a binary output for whether the image has pear or not, and apple or not. You can add a new binary output for whether it has orange or not. Then when you start training on your orange dataset, impose a regularization loss which penalizes the pear and apple predictions from changing much (freeze a copy of your model from before you started training on oranges, and penalize the MSE or cross-entropy between your old and new pear and apple predictions).
|
Extending a neural network to classify new objects
|
This general area is called "continual", "incremental" or "life-long" learning, and it's quite an active area of research.
There are many approaches to continual learning, including different forms o
|
Extending a neural network to classify new objects
This general area is called "continual", "incremental" or "life-long" learning, and it's quite an active area of research.
There are many approaches to continual learning, including different forms of regularization which penalize forgetting, dynamically expanding architectures, and explicit model memories. For more detail, I would refer you to this survey paper: Continual Lifelong Learning with Neural Networks: A Review
Methods such as fine-tuning and learning without forgetting seem to
require all objects in the new images annotated though.
Well, that is not always the case. Let me give an explicit continual learning approach to make this clear: you can train a classifier with a binary output for whether the image has pear or not, and apple or not. You can add a new binary output for whether it has orange or not. Then when you start training on your orange dataset, impose a regularization loss which penalizes the pear and apple predictions from changing much (freeze a copy of your model from before you started training on oranges, and penalize the MSE or cross-entropy between your old and new pear and apple predictions).
|
Extending a neural network to classify new objects
This general area is called "continual", "incremental" or "life-long" learning, and it's quite an active area of research.
There are many approaches to continual learning, including different forms o
|
47,043
|
Extending a neural network to classify new objects
|
EDIT: now that I understand your question a little better. I don't have enough rep to comment so using responses.
So the labels on the dataset you have are binary, pear = 1/0. And the no class contains oranges and bananas which you already have a model for.
What if you did a two-step approach where you classify an object as being a pear or not, and then you apply the frozen pretrained orange/banana model to images not classified as a pear? This would get you a prediction on each object as pear/banana/orange and you would be preserving the original model weights because it's frozen.
|
Extending a neural network to classify new objects
|
EDIT: now that I understand your question a little better. I don't have enough rep to comment so using responses.
So the labels on the dataset you have are binary, pear = 1/0. And the no class contai
|
Extending a neural network to classify new objects
EDIT: now that I understand your question a little better. I don't have enough rep to comment so using responses.
So the labels on the dataset you have are binary, pear = 1/0. And the no class contains oranges and bananas which you already have a model for.
What if you did a two-step approach where you classify an object as being a pear or not, and then you apply the frozen pretrained orange/banana model to images not classified as a pear? This would get you a prediction on each object as pear/banana/orange and you would be preserving the original model weights because it's frozen.
|
Extending a neural network to classify new objects
EDIT: now that I understand your question a little better. I don't have enough rep to comment so using responses.
So the labels on the dataset you have are binary, pear = 1/0. And the no class contai
|
47,044
|
Which is more numerically stable for OLS: pinv vs QR
|
Using the Moore-Penrose pseudo-inverse $X^{\dagger}$ of an matrix $X$ is more stable in the sense that can directly account for rank-deficient design matrices $X$.
$X^{\dagger}$ allows us to naturally employ the identities: $X^{\dagger} X X^{\dagger} = X$ and $X X^{\dagger} X= X^{\dagger}$; the matrix $X^{\dagger}$ can be used as "surrogate" the true inverse of the matrix $X$, even if the inverse matrix $X^{-1}$ does not exist. In addition, the "usual" way of computing $X^{\dagger}$ by employing the Singular Value Decomposition of matrix $X$, where $X = USV^T$, is straight-forward methodologically and computationally well-studied. We simply take the reciprocal of the non-zero singular values in the diagonal matrix $S$, and we are good to go. Moore-Penrose pseudo-inverses are common in many proofs because they "just exist" and greatly simplify many derivations.
That said, in most cases it is not good practice to use the Moore-Penrose Pseudo-inverse unless we have a very good reason (e.g. our procedure consistently employs small and potentially rank-degenerate covariance matrices). The reasons are that: 1. It can hide true underlying problems with our data (e.g. duplication of variables) and 2. it is unnecessarily expensive (we have better alternatives). Finally, note that the Moore-Penrose pseudo-inverse of a full rank $X$ can be directed computed through the QR factorization of $X$, $X = QR$, as: $X^{\dagger} = [R^{-1}_{1} 0] Q^T$ where $R_1$ is an upper triangular matrix, coming from the "thin/reduced/skinny" QR factorization of $X$. So we do not really gain much if $X$ is full rank anyway. (Gentle's Matrix Algebra: Theory, Computations and Applications in Statistics provides a wealth of information the matter if one wishes to explore this further - Sect. 3.6 on Generalised Inverses should be a relevant starting point.)
To elaborate my first point a bit: It is far more natural to use a penalised regression procedure like Ridge or LASSO if we have issues with collinearity or simply have a $p\gg n$ (i.e. more predictors than data-points) than hide the problem using $X^\dagger$. The condition of a system of equations solved through the employment of Moore-Penrose pseudo-inverses might still be prohibitorily bad, resulting to unstable solutions and/or misleading inference. Thus if numerical stability is an issue, I would suggest using regularisation directly instead of Moore-Penrose pseudo-inverses. Note that in terms of speed, computing $X^{\dagger}$ is also problematic; potentially iterative methods based on gradient descent methods or alternating least squares are far faster for large systems (e.g. in Recommender Systems literature, see Paterek (2008) Improving regularized singular value decomposition for collaborative filtering for something very concise).
|
Which is more numerically stable for OLS: pinv vs QR
|
Using the Moore-Penrose pseudo-inverse $X^{\dagger}$ of an matrix $X$ is more stable in the sense that can directly account for rank-deficient design matrices $X$.
$X^{\dagger}$ allows us to naturall
|
Which is more numerically stable for OLS: pinv vs QR
Using the Moore-Penrose pseudo-inverse $X^{\dagger}$ of an matrix $X$ is more stable in the sense that can directly account for rank-deficient design matrices $X$.
$X^{\dagger}$ allows us to naturally employ the identities: $X^{\dagger} X X^{\dagger} = X$ and $X X^{\dagger} X= X^{\dagger}$; the matrix $X^{\dagger}$ can be used as "surrogate" the true inverse of the matrix $X$, even if the inverse matrix $X^{-1}$ does not exist. In addition, the "usual" way of computing $X^{\dagger}$ by employing the Singular Value Decomposition of matrix $X$, where $X = USV^T$, is straight-forward methodologically and computationally well-studied. We simply take the reciprocal of the non-zero singular values in the diagonal matrix $S$, and we are good to go. Moore-Penrose pseudo-inverses are common in many proofs because they "just exist" and greatly simplify many derivations.
That said, in most cases it is not good practice to use the Moore-Penrose Pseudo-inverse unless we have a very good reason (e.g. our procedure consistently employs small and potentially rank-degenerate covariance matrices). The reasons are that: 1. It can hide true underlying problems with our data (e.g. duplication of variables) and 2. it is unnecessarily expensive (we have better alternatives). Finally, note that the Moore-Penrose pseudo-inverse of a full rank $X$ can be directed computed through the QR factorization of $X$, $X = QR$, as: $X^{\dagger} = [R^{-1}_{1} 0] Q^T$ where $R_1$ is an upper triangular matrix, coming from the "thin/reduced/skinny" QR factorization of $X$. So we do not really gain much if $X$ is full rank anyway. (Gentle's Matrix Algebra: Theory, Computations and Applications in Statistics provides a wealth of information the matter if one wishes to explore this further - Sect. 3.6 on Generalised Inverses should be a relevant starting point.)
To elaborate my first point a bit: It is far more natural to use a penalised regression procedure like Ridge or LASSO if we have issues with collinearity or simply have a $p\gg n$ (i.e. more predictors than data-points) than hide the problem using $X^\dagger$. The condition of a system of equations solved through the employment of Moore-Penrose pseudo-inverses might still be prohibitorily bad, resulting to unstable solutions and/or misleading inference. Thus if numerical stability is an issue, I would suggest using regularisation directly instead of Moore-Penrose pseudo-inverses. Note that in terms of speed, computing $X^{\dagger}$ is also problematic; potentially iterative methods based on gradient descent methods or alternating least squares are far faster for large systems (e.g. in Recommender Systems literature, see Paterek (2008) Improving regularized singular value decomposition for collaborative filtering for something very concise).
|
Which is more numerically stable for OLS: pinv vs QR
Using the Moore-Penrose pseudo-inverse $X^{\dagger}$ of an matrix $X$ is more stable in the sense that can directly account for rank-deficient design matrices $X$.
$X^{\dagger}$ allows us to naturall
|
47,045
|
The exact value of Welch's t test degrees of freedom
|
Short answer: There is no exact degrees-of-freedom because the variance estimator in this test does not follow an exact chi-squared distribution.
Longer answer: The Welch T-test gives an approximate solution to the Fisher-Behrens problem (comparing the means of two samples with different variances). It uses the studentised test statistic:
$$T = \frac{\bar{X}_1 - \bar{X}_2}{\sqrt{S_1^2/N_1 + S_2^2/N_2}}.$$
The denominator in this test statistic is the square-root of an estimator of the mean difference:
$$\hat{\mathbb{V}}(\bar{X}_1-\bar{X}_2) = \frac{S_1^2}{N_1} + \frac{S_2^2}{N_2} \sim \frac{\chi_{N_1-1}^2}{N_1} \cdot \sigma_1^2 + \frac{\chi_{N_2-1}^2}{N_2} \cdot \sigma_2^2.$$
This quantity is a weighted sum of independent chi-squared random variables. Its exact distribution is quite complicated (and is best represented through its moment generating function), but it is not an exact chi-squared distribution.
The test uses the Welch-Satterwaite approximation, which approximates the distribution of this quantity by a single scaled chi-squared distribution. In this approximation the degrees-of-freedom formula arises as the best approximation of the chi-squared distribution to the true distribution of this quantity. Without this approximation to the chi-squared distribution there is no single exact degrees-of-freedom. Instead, the exact distribution is of a weighted sum of chi-squared random variables with the above weights and degrees-of-freedom.
|
The exact value of Welch's t test degrees of freedom
|
Short answer: There is no exact degrees-of-freedom because the variance estimator in this test does not follow an exact chi-squared distribution.
Longer answer: The Welch T-test gives an approximate
|
The exact value of Welch's t test degrees of freedom
Short answer: There is no exact degrees-of-freedom because the variance estimator in this test does not follow an exact chi-squared distribution.
Longer answer: The Welch T-test gives an approximate solution to the Fisher-Behrens problem (comparing the means of two samples with different variances). It uses the studentised test statistic:
$$T = \frac{\bar{X}_1 - \bar{X}_2}{\sqrt{S_1^2/N_1 + S_2^2/N_2}}.$$
The denominator in this test statistic is the square-root of an estimator of the mean difference:
$$\hat{\mathbb{V}}(\bar{X}_1-\bar{X}_2) = \frac{S_1^2}{N_1} + \frac{S_2^2}{N_2} \sim \frac{\chi_{N_1-1}^2}{N_1} \cdot \sigma_1^2 + \frac{\chi_{N_2-1}^2}{N_2} \cdot \sigma_2^2.$$
This quantity is a weighted sum of independent chi-squared random variables. Its exact distribution is quite complicated (and is best represented through its moment generating function), but it is not an exact chi-squared distribution.
The test uses the Welch-Satterwaite approximation, which approximates the distribution of this quantity by a single scaled chi-squared distribution. In this approximation the degrees-of-freedom formula arises as the best approximation of the chi-squared distribution to the true distribution of this quantity. Without this approximation to the chi-squared distribution there is no single exact degrees-of-freedom. Instead, the exact distribution is of a weighted sum of chi-squared random variables with the above weights and degrees-of-freedom.
|
The exact value of Welch's t test degrees of freedom
Short answer: There is no exact degrees-of-freedom because the variance estimator in this test does not follow an exact chi-squared distribution.
Longer answer: The Welch T-test gives an approximate
|
47,046
|
The exact value of Welch's t test degrees of freedom
|
@Ben's answer is very clear about why an exact solution for the degrees of freedom isn't possible.
As for
The approximate degrees of freedom are rounded down to the nearest integer [citation needed]
This seems unusual. There is a section on the Talk page for the article that questions whether this is usual or not, and why one would round down rather than up.
This CV question discusses reporting non-integer degrees of freedom in much more detail, and gives a few sources saying it is "conventional" (mostly from the days when computations were done by hand and critical values of the $t$ distribution looked up in reference tables that gave values for integer df only).
|
The exact value of Welch's t test degrees of freedom
|
@Ben's answer is very clear about why an exact solution for the degrees of freedom isn't possible.
As for
The approximate degrees of freedom are rounded down to the nearest integer [citation needed]
|
The exact value of Welch's t test degrees of freedom
@Ben's answer is very clear about why an exact solution for the degrees of freedom isn't possible.
As for
The approximate degrees of freedom are rounded down to the nearest integer [citation needed]
This seems unusual. There is a section on the Talk page for the article that questions whether this is usual or not, and why one would round down rather than up.
This CV question discusses reporting non-integer degrees of freedom in much more detail, and gives a few sources saying it is "conventional" (mostly from the days when computations were done by hand and critical values of the $t$ distribution looked up in reference tables that gave values for integer df only).
|
The exact value of Welch's t test degrees of freedom
@Ben's answer is very clear about why an exact solution for the degrees of freedom isn't possible.
As for
The approximate degrees of freedom are rounded down to the nearest integer [citation needed]
|
47,047
|
Covariance of products of dependent random variables
|
If I did this correctly:
\begin{eqnarray}
\text{Cov}(AC,BD)
&=&E(ABCD) - E(AC)E(BD)\\
&=&E(AB)E(CD) - E(A)E(C)E(B)E(D)\\
&=&[E(AB)-E(A)E(B)][E(CD)-E(C)E(D)]+E(A)E(B)[E(CD)-E(C)E(D)]+E(C)E(D)[E(AB)-E(A)E(B)]\\
&=&\text{Cov}(A,B)\text{Cov}(C,D)+E(A)E(B)\text{Cov}(C,D)+E(C)E(D)\text{Cov}(A,B)\end{eqnarray}
|
Covariance of products of dependent random variables
|
If I did this correctly:
\begin{eqnarray}
\text{Cov}(AC,BD)
&=&E(ABCD) - E(AC)E(BD)\\
&=&E(AB)E(CD) - E(A)E(C)E(B)E(D)\\
&=&[E(AB)-E(A)E(B)][E(CD)-E(C)E(D)]+E(A)E(B)[E(CD)-E(C)E(D)]+E(C)E(D)[E(AB)-E(A
|
Covariance of products of dependent random variables
If I did this correctly:
\begin{eqnarray}
\text{Cov}(AC,BD)
&=&E(ABCD) - E(AC)E(BD)\\
&=&E(AB)E(CD) - E(A)E(C)E(B)E(D)\\
&=&[E(AB)-E(A)E(B)][E(CD)-E(C)E(D)]+E(A)E(B)[E(CD)-E(C)E(D)]+E(C)E(D)[E(AB)-E(A)E(B)]\\
&=&\text{Cov}(A,B)\text{Cov}(C,D)+E(A)E(B)\text{Cov}(C,D)+E(C)E(D)\text{Cov}(A,B)\end{eqnarray}
|
Covariance of products of dependent random variables
If I did this correctly:
\begin{eqnarray}
\text{Cov}(AC,BD)
&=&E(ABCD) - E(AC)E(BD)\\
&=&E(AB)E(CD) - E(A)E(C)E(B)E(D)\\
&=&[E(AB)-E(A)E(B)][E(CD)-E(C)E(D)]+E(A)E(B)[E(CD)-E(C)E(D)]+E(C)E(D)[E(AB)-E(A
|
47,048
|
Covariance of products of dependent random variables
|
From https://www.jstor.org/stable/2286081 (Exact Covariance of Products of Random Variables) provides the general formulae. Assuming multivariate normality it is:
$$ \mathrm{cov}(xy, uv) = \mathrm{E}(x)\,\mathrm{E}(u)\, \mathrm{cov}(y, v) +
\mathrm{E}(x)\,\mathrm{E}(v)\,\mathrm{cov}(y, u) + \\
\mathrm{E}(y)\,\mathrm{E}(u)\, \mathrm{cov}(x, v) +
\mathrm{E}(y)\,\mathrm{E}(v)\,\mathrm{cov}(x, u) + \\
\mathrm{cov}(x, u)\, \mathrm{cov}(y, v) + \mathrm{cov}(x, v)\,\mathrm{cov}(y, u)
$$
In your case: x = A, y=C, u=B, v =D and the only non cero covariances are
cov(A,B)= cov(x,u) and cov(C,D)=cov(y,v) so:
$$ \mathrm{cov}(AC, BD) = \mathrm{E}(A)\,\mathrm{E}(B)\, \mathrm{cov}(C, D) + \\
\mathrm{E}(C)\,\mathrm{E}(D)\,\mathrm{cov}(A, B) + \\
\mathrm{cov}(A, B)\, \mathrm{cov}(C, D)
$$
Which is the result of the previous post.
|
Covariance of products of dependent random variables
|
From https://www.jstor.org/stable/2286081 (Exact Covariance of Products of Random Variables) provides the general formulae. Assuming multivariate normality it is:
$$ \mathrm{cov}(xy, uv) = \mathrm{E
|
Covariance of products of dependent random variables
From https://www.jstor.org/stable/2286081 (Exact Covariance of Products of Random Variables) provides the general formulae. Assuming multivariate normality it is:
$$ \mathrm{cov}(xy, uv) = \mathrm{E}(x)\,\mathrm{E}(u)\, \mathrm{cov}(y, v) +
\mathrm{E}(x)\,\mathrm{E}(v)\,\mathrm{cov}(y, u) + \\
\mathrm{E}(y)\,\mathrm{E}(u)\, \mathrm{cov}(x, v) +
\mathrm{E}(y)\,\mathrm{E}(v)\,\mathrm{cov}(x, u) + \\
\mathrm{cov}(x, u)\, \mathrm{cov}(y, v) + \mathrm{cov}(x, v)\,\mathrm{cov}(y, u)
$$
In your case: x = A, y=C, u=B, v =D and the only non cero covariances are
cov(A,B)= cov(x,u) and cov(C,D)=cov(y,v) so:
$$ \mathrm{cov}(AC, BD) = \mathrm{E}(A)\,\mathrm{E}(B)\, \mathrm{cov}(C, D) + \\
\mathrm{E}(C)\,\mathrm{E}(D)\,\mathrm{cov}(A, B) + \\
\mathrm{cov}(A, B)\, \mathrm{cov}(C, D)
$$
Which is the result of the previous post.
|
Covariance of products of dependent random variables
From https://www.jstor.org/stable/2286081 (Exact Covariance of Products of Random Variables) provides the general formulae. Assuming multivariate normality it is:
$$ \mathrm{cov}(xy, uv) = \mathrm{E
|
47,049
|
Does it make sense to use the slope of trend line from a regression as a ratio between x and y
|
I presume $x$ is number of jobs and $y$ is number of hours to complete it. It's not correct to say that time for each job is 0.4 hours because you have a (pretty large) bias term. This means you have a fix cost. Performing one job takes $90.4$ hours, two jobs $90.8$ hours etc. So, you can say that each additional job takes 0.4 hours. And, time for each job asymptotically approaches $0.4$ hours, i.e. as $x\rightarrow \infty$.
|
Does it make sense to use the slope of trend line from a regression as a ratio between x and y
|
I presume $x$ is number of jobs and $y$ is number of hours to complete it. It's not correct to say that time for each job is 0.4 hours because you have a (pretty large) bias term. This means you have
|
Does it make sense to use the slope of trend line from a regression as a ratio between x and y
I presume $x$ is number of jobs and $y$ is number of hours to complete it. It's not correct to say that time for each job is 0.4 hours because you have a (pretty large) bias term. This means you have a fix cost. Performing one job takes $90.4$ hours, two jobs $90.8$ hours etc. So, you can say that each additional job takes 0.4 hours. And, time for each job asymptotically approaches $0.4$ hours, i.e. as $x\rightarrow \infty$.
|
Does it make sense to use the slope of trend line from a regression as a ratio between x and y
I presume $x$ is number of jobs and $y$ is number of hours to complete it. It's not correct to say that time for each job is 0.4 hours because you have a (pretty large) bias term. This means you have
|
47,050
|
Does it make sense to use the slope of trend line from a regression as a ratio between x and y
|
Not exactly. Assuming a simple linear model $y = \beta_0 + \beta_1 x + \epsilon$, the parameter $\beta_1$ (in this case $0.4$) represents the effect of a one-unit change in the corresponding $x$ (here jobs) covariate on the mean value of the dependent variable, $y$ (here hours), assuming that any other covariates remain constant at some value.
As the $\beta_0$ (the intercept) is $90$, probably there are some other factors that require on average $90$ hours to be taken into account.
It is more relevant to say that each additional job requires an additional $0.4$ hours.
|
Does it make sense to use the slope of trend line from a regression as a ratio between x and y
|
Not exactly. Assuming a simple linear model $y = \beta_0 + \beta_1 x + \epsilon$, the parameter $\beta_1$ (in this case $0.4$) represents the effect of a one-unit change in the corresponding $x$ (here
|
Does it make sense to use the slope of trend line from a regression as a ratio between x and y
Not exactly. Assuming a simple linear model $y = \beta_0 + \beta_1 x + \epsilon$, the parameter $\beta_1$ (in this case $0.4$) represents the effect of a one-unit change in the corresponding $x$ (here jobs) covariate on the mean value of the dependent variable, $y$ (here hours), assuming that any other covariates remain constant at some value.
As the $\beta_0$ (the intercept) is $90$, probably there are some other factors that require on average $90$ hours to be taken into account.
It is more relevant to say that each additional job requires an additional $0.4$ hours.
|
Does it make sense to use the slope of trend line from a regression as a ratio between x and y
Not exactly. Assuming a simple linear model $y = \beta_0 + \beta_1 x + \epsilon$, the parameter $\beta_1$ (in this case $0.4$) represents the effect of a one-unit change in the corresponding $x$ (here
|
47,051
|
Independence of ratios of independent variates
|
It is a "well-known" property of the Gamma distributions that $x_1/(x_1+x_2)$ and $(x_1+x_2)$ are independent, and that $x_1+x_2+x_3$ and $Y= (x_1+x_2)/(x_1+x_2+x_3)$ are independent. For instance, writing
\begin{align*}
x_1&=\{\varrho \sin(\theta)\}^2\\
x_1&=\{\varrho \cos(\theta)\}^2\\
\end{align*}
we get that
$$X=\frac{\{\varrho \sin(\theta)\}^2}{\{\varrho \sin(\theta)\}^2+\{\varrho \cos(\theta)\}^2}=\sin(\theta)^2$$
and
$$Y=\frac{\varrho^2}{\varrho^2+x_3}$$
are indeed functions of different variates (although the independence between $\varrho$ and $\theta$ has to be established).
|
Independence of ratios of independent variates
|
It is a "well-known" property of the Gamma distributions that $x_1/(x_1+x_2)$ and $(x_1+x_2)$ are independent, and that $x_1+x_2+x_3$ and $Y= (x_1+x_2)/(x_1+x_2+x_3)$ are independent. For instance, wr
|
Independence of ratios of independent variates
It is a "well-known" property of the Gamma distributions that $x_1/(x_1+x_2)$ and $(x_1+x_2)$ are independent, and that $x_1+x_2+x_3$ and $Y= (x_1+x_2)/(x_1+x_2+x_3)$ are independent. For instance, writing
\begin{align*}
x_1&=\{\varrho \sin(\theta)\}^2\\
x_1&=\{\varrho \cos(\theta)\}^2\\
\end{align*}
we get that
$$X=\frac{\{\varrho \sin(\theta)\}^2}{\{\varrho \sin(\theta)\}^2+\{\varrho \cos(\theta)\}^2}=\sin(\theta)^2$$
and
$$Y=\frac{\varrho^2}{\varrho^2+x_3}$$
are indeed functions of different variates (although the independence between $\varrho$ and $\theta$ has to be established).
|
Independence of ratios of independent variates
It is a "well-known" property of the Gamma distributions that $x_1/(x_1+x_2)$ and $(x_1+x_2)$ are independent, and that $x_1+x_2+x_3$ and $Y= (x_1+x_2)/(x_1+x_2+x_3)$ are independent. For instance, wr
|
47,052
|
Independence of ratios of independent variates
|
A geometrical interpretation/intuition
You could view the chi-squared variables $x_1,x_2,x_3$ as relating to independent standard normal distributed variables which in it's turn relates to uniformly distributed variables on a n-sphere https://en.wikipedia.org/wiki/N-sphere#Generating_random_points
In the same way as you can cut up a regular sphere into circles of different sizes you can cut up the hyper-sphere into hyper-spheres of lower dimension.
The distribution of $\frac{x_1}{x_1+x_2}$ "the point/angle on a circle" is independent from $\frac{x_1+x_2}{x_1+x_2+x_3}$ "the (relative) squared radius of the circle" or $x_1+x_2+x_3$ "the squared radius of the sphere in which that circle is embedded".
You could take a n-sphere (embedded in dimension $n_1+n_2+n_3$) and compute explicitly the value for $f_X(x)$ by computing the relative ratio of the areas of sub-sphere, the $(n_1-1)$-sphere with radius $\sqrt{x_1}$ and the $(n_1-n_2-1)$-sphere with radius $\sqrt{x_1+x_2}$. The result should only depend on the fraction $X=\frac{x_1}{x_1+x_2}$ and be independent from $x_1+x_2$ or $x_1+x_2+x_3$.
See here a similar (but much simpler) calculation.
|
Independence of ratios of independent variates
|
A geometrical interpretation/intuition
You could view the chi-squared variables $x_1,x_2,x_3$ as relating to independent standard normal distributed variables which in it's turn relates to uniformly d
|
Independence of ratios of independent variates
A geometrical interpretation/intuition
You could view the chi-squared variables $x_1,x_2,x_3$ as relating to independent standard normal distributed variables which in it's turn relates to uniformly distributed variables on a n-sphere https://en.wikipedia.org/wiki/N-sphere#Generating_random_points
In the same way as you can cut up a regular sphere into circles of different sizes you can cut up the hyper-sphere into hyper-spheres of lower dimension.
The distribution of $\frac{x_1}{x_1+x_2}$ "the point/angle on a circle" is independent from $\frac{x_1+x_2}{x_1+x_2+x_3}$ "the (relative) squared radius of the circle" or $x_1+x_2+x_3$ "the squared radius of the sphere in which that circle is embedded".
You could take a n-sphere (embedded in dimension $n_1+n_2+n_3$) and compute explicitly the value for $f_X(x)$ by computing the relative ratio of the areas of sub-sphere, the $(n_1-1)$-sphere with radius $\sqrt{x_1}$ and the $(n_1-n_2-1)$-sphere with radius $\sqrt{x_1+x_2}$. The result should only depend on the fraction $X=\frac{x_1}{x_1+x_2}$ and be independent from $x_1+x_2$ or $x_1+x_2+x_3$.
See here a similar (but much simpler) calculation.
|
Independence of ratios of independent variates
A geometrical interpretation/intuition
You could view the chi-squared variables $x_1,x_2,x_3$ as relating to independent standard normal distributed variables which in it's turn relates to uniformly d
|
47,053
|
Should log-likelihood values increase when the sample size of a simulation increases?
|
It depends. More importantly though, it doesn't really matter.
Remember, in an iid setting, the Likelihood is the product of PDFs (or PMFs) as a function of $\theta$. If each $f(x_i|\theta) < 1$ then the Likelihood will get smaller for each additional point. Uniform distributions make this point clear.
Let $X_1, \cdots X_n \sim U(0, \theta)$, then clearly
$$L(\theta|{\bf X}) = \prod_{i=1}^n \frac{I(x_i < \theta)}{\theta} = \begin{cases}
\frac{1}{\theta^{n}} & ,\max(x_1, \cdots x_n) \leq \theta \\
0 & ,\max(x_1, \cdots x_n) >\theta
\end{cases}$$
or if you prefer
$$\log L(\theta|{\bf x}) = \begin{cases}
-n\log(\theta) & ,\max(x_1, \cdots x_n) \leq\theta \\
-\infty & ,\max(x_1, \cdots x_n) > \theta
\end{cases}$$
For values $\theta < 1$, the non-degenerate part of the likelihood gets arbitrarily big as $n$ increases. For value of $\theta > 1$, it gets arbitrarily small. But this doesn't really matter, since values of Likelihood aren't really interpretable. The important thing is that the Likelihood gets steeper around the likely values of $\theta$.
Here is a quick example.
Assume $X_1, X_2, \cdots X_n \stackrel{iid}{\sim} N(\mu, 1)$. Then
\begin{align*}L(\mu|{\bf X}) &= \left(\frac{1}{\sqrt{2\pi}}\right)^n\exp\left\{\frac{-1}{2}\sum_{i=1}^n(x_i - \mu)^2 \right\} \\
&= \left(\frac{1}{\sqrt{2\pi}}\right)^n\exp\left\{\frac{-\sum_{i=1}^n x_i^2}{2}\right\}\exp\left\{n\mu (\bar{x} - \mu/2)\right\}
\end{align*}
For illustration purposes, we set $\bar{x} = 0$ and $\sum_{i=1}^n x_i^2 = n$ (this is what we "expect" if $\mu=0$).
Focusing on the vertical axis illustrates this point. The value of the likelihood itself doesn't really matter, it is the value of $L(\theta_1|{\bf x})$ relative to $L(\theta_2|{\bf x})$ that determines the likely values of $\theta$.
|
Should log-likelihood values increase when the sample size of a simulation increases?
|
It depends. More importantly though, it doesn't really matter.
Remember, in an iid setting, the Likelihood is the product of PDFs (or PMFs) as a function of $\theta$. If each $f(x_i|\theta) < 1$ then
|
Should log-likelihood values increase when the sample size of a simulation increases?
It depends. More importantly though, it doesn't really matter.
Remember, in an iid setting, the Likelihood is the product of PDFs (or PMFs) as a function of $\theta$. If each $f(x_i|\theta) < 1$ then the Likelihood will get smaller for each additional point. Uniform distributions make this point clear.
Let $X_1, \cdots X_n \sim U(0, \theta)$, then clearly
$$L(\theta|{\bf X}) = \prod_{i=1}^n \frac{I(x_i < \theta)}{\theta} = \begin{cases}
\frac{1}{\theta^{n}} & ,\max(x_1, \cdots x_n) \leq \theta \\
0 & ,\max(x_1, \cdots x_n) >\theta
\end{cases}$$
or if you prefer
$$\log L(\theta|{\bf x}) = \begin{cases}
-n\log(\theta) & ,\max(x_1, \cdots x_n) \leq\theta \\
-\infty & ,\max(x_1, \cdots x_n) > \theta
\end{cases}$$
For values $\theta < 1$, the non-degenerate part of the likelihood gets arbitrarily big as $n$ increases. For value of $\theta > 1$, it gets arbitrarily small. But this doesn't really matter, since values of Likelihood aren't really interpretable. The important thing is that the Likelihood gets steeper around the likely values of $\theta$.
Here is a quick example.
Assume $X_1, X_2, \cdots X_n \stackrel{iid}{\sim} N(\mu, 1)$. Then
\begin{align*}L(\mu|{\bf X}) &= \left(\frac{1}{\sqrt{2\pi}}\right)^n\exp\left\{\frac{-1}{2}\sum_{i=1}^n(x_i - \mu)^2 \right\} \\
&= \left(\frac{1}{\sqrt{2\pi}}\right)^n\exp\left\{\frac{-\sum_{i=1}^n x_i^2}{2}\right\}\exp\left\{n\mu (\bar{x} - \mu/2)\right\}
\end{align*}
For illustration purposes, we set $\bar{x} = 0$ and $\sum_{i=1}^n x_i^2 = n$ (this is what we "expect" if $\mu=0$).
Focusing on the vertical axis illustrates this point. The value of the likelihood itself doesn't really matter, it is the value of $L(\theta_1|{\bf x})$ relative to $L(\theta_2|{\bf x})$ that determines the likely values of $\theta$.
|
Should log-likelihood values increase when the sample size of a simulation increases?
It depends. More importantly though, it doesn't really matter.
Remember, in an iid setting, the Likelihood is the product of PDFs (or PMFs) as a function of $\theta$. If each $f(x_i|\theta) < 1$ then
|
47,054
|
Distribution of difference of two random variables with chi-squared distribution
|
This is not a chi-squared density, $X-Y$ will have support on $(-\infty, +\infty)$.
If the two variables are independent, it has mean 0 and variance $4k$.
If $k$ is large, its density is well approximated a normal variable with 0 mean and $4k$ variance. In the general case, its MGF has a closed form:
$$E(\exp(t(X-Y))) = (1-4t^2)^{-k/2}$$
If the 2 variables have dependence, the nature of that dependence needs to be explicited.
|
Distribution of difference of two random variables with chi-squared distribution
|
This is not a chi-squared density, $X-Y$ will have support on $(-\infty, +\infty)$.
If the two variables are independent, it has mean 0 and variance $4k$.
If $k$ is large, its density is well approxi
|
Distribution of difference of two random variables with chi-squared distribution
This is not a chi-squared density, $X-Y$ will have support on $(-\infty, +\infty)$.
If the two variables are independent, it has mean 0 and variance $4k$.
If $k$ is large, its density is well approximated a normal variable with 0 mean and $4k$ variance. In the general case, its MGF has a closed form:
$$E(\exp(t(X-Y))) = (1-4t^2)^{-k/2}$$
If the 2 variables have dependence, the nature of that dependence needs to be explicited.
|
Distribution of difference of two random variables with chi-squared distribution
This is not a chi-squared density, $X-Y$ will have support on $(-\infty, +\infty)$.
If the two variables are independent, it has mean 0 and variance $4k$.
If $k$ is large, its density is well approxi
|
47,055
|
Distribution of difference of two random variables with chi-squared distribution
|
Since $X$ and $Y$ can also be considered to be Gamma random variables with (order, rate) parameters $\left(\frac k2, \frac 12\right)$, then, as Sebapi points out, $X-Y$ has support $(-\infty,\infty)$. Furthermore, if $X$ and $Y$ are assumed to be independent, then the pdf of $X-Y$ is also symmetric about $0$ and has mean zero.
For independent $X$ and $Y$, the pdf of their difference $X-Y$ is the cross-correlation of the pdfs of $X$ and $Y$ (not the convolution of the pdfs as happens for the sum $X+Y$) and in this case, since the pdfs are identical, the cross-correlation is actually an autocorrelation and so the pdf of $X-Y$ is symmetric about $0$ as claimed. Furthermore, for the case here of $X$ and $Y$ being Gamma random variables, an explicit form can be deduced from this answer of mine here on stats.SE.
When $k$ is an odd number, then, as noted in my answer cited above, it is possible to write the pdf $f_{X-Y}(z)$ of $X-Y$ in terms of polynomial, exponential, and Bessel functions of $z$. However when $k$ is an even number, then for $z \geq 0$, $f_{X-Y}(z)$ is proportional to a mixture of Gamma pdfs with (order, rate) parameters $\Gamma\left(1, \frac 12\right), \Gamma\left(2, \frac 12\right), \ldots, \Gamma\left(\frac k2, \frac 12\right)$ pdfs (equivalently, $\chi_2^2, \chi_4^2, \ldots, \chi_{k}^2$ pdfs) and of course, since $f_{X-Y}(z)$ is an even function of $z$, the same curve "flipped over" is the pdf curve on the negative axis.
Those worried that Gamma pdfs have value $0$ at the origin whereas autocorrelation functions have a maximum at the origin and so something is awry in the above claims should relax. A $\chi_2^2$ pdf is an exponential pdf which has nonzero value (or a limiting value that is nonzero at the origin for those whose exponential random variables take on values only on the positive real line) and so that mixture pdf is indeed nonzero at the origin, and because of the weights in the mixture, indeed a maximum at the origin.
|
Distribution of difference of two random variables with chi-squared distribution
|
Since $X$ and $Y$ can also be considered to be Gamma random variables with (order, rate) parameters $\left(\frac k2, \frac 12\right)$, then, as Sebapi points out, $X-Y$ has support $(-\infty,\infty)$.
|
Distribution of difference of two random variables with chi-squared distribution
Since $X$ and $Y$ can also be considered to be Gamma random variables with (order, rate) parameters $\left(\frac k2, \frac 12\right)$, then, as Sebapi points out, $X-Y$ has support $(-\infty,\infty)$. Furthermore, if $X$ and $Y$ are assumed to be independent, then the pdf of $X-Y$ is also symmetric about $0$ and has mean zero.
For independent $X$ and $Y$, the pdf of their difference $X-Y$ is the cross-correlation of the pdfs of $X$ and $Y$ (not the convolution of the pdfs as happens for the sum $X+Y$) and in this case, since the pdfs are identical, the cross-correlation is actually an autocorrelation and so the pdf of $X-Y$ is symmetric about $0$ as claimed. Furthermore, for the case here of $X$ and $Y$ being Gamma random variables, an explicit form can be deduced from this answer of mine here on stats.SE.
When $k$ is an odd number, then, as noted in my answer cited above, it is possible to write the pdf $f_{X-Y}(z)$ of $X-Y$ in terms of polynomial, exponential, and Bessel functions of $z$. However when $k$ is an even number, then for $z \geq 0$, $f_{X-Y}(z)$ is proportional to a mixture of Gamma pdfs with (order, rate) parameters $\Gamma\left(1, \frac 12\right), \Gamma\left(2, \frac 12\right), \ldots, \Gamma\left(\frac k2, \frac 12\right)$ pdfs (equivalently, $\chi_2^2, \chi_4^2, \ldots, \chi_{k}^2$ pdfs) and of course, since $f_{X-Y}(z)$ is an even function of $z$, the same curve "flipped over" is the pdf curve on the negative axis.
Those worried that Gamma pdfs have value $0$ at the origin whereas autocorrelation functions have a maximum at the origin and so something is awry in the above claims should relax. A $\chi_2^2$ pdf is an exponential pdf which has nonzero value (or a limiting value that is nonzero at the origin for those whose exponential random variables take on values only on the positive real line) and so that mixture pdf is indeed nonzero at the origin, and because of the weights in the mixture, indeed a maximum at the origin.
|
Distribution of difference of two random variables with chi-squared distribution
Since $X$ and $Y$ can also be considered to be Gamma random variables with (order, rate) parameters $\left(\frac k2, \frac 12\right)$, then, as Sebapi points out, $X-Y$ has support $(-\infty,\infty)$.
|
47,056
|
Distribution of difference of two random variables with chi-squared distribution
|
Using the following links and parameter correspondence between the characteristic function(chf) of difference of $\Gamma(\alpha,\nu_{\Gamma})$ and $VG(\sigma,\nu)$ symm. variance gamma rvs we can obtain density of $X-Y$ indirectly, alternative to the method of chf inversion,
\begin{equation}
\phi_{VG}(u,\sigma,\nu)=\left(\frac{1}{1+\frac{\nu u^{2}\sigma^{2}}{2}}\right)^{\frac{1}{\nu}}
\end{equation}
\begin{equation}
\phi_{\Gamma}(u,\alpha,\nu_{G})=\left(\frac{1}{1+\nu_{\Gamma}^{2}}\right)^{\alpha}
\end{equation}
\begin{equation}
\sigma=\nu_{G}\sqrt{2\alpha}\\
\nu=\frac{1}{\alpha}
\end{equation}
and the fact that $\chi^{2}(k)\sim\Gamma(\frac{k}{2},2)$, we can see that final density will be almost the same as @whuber's formula above with minor differences.
\begin{equation}
f_{X-Y}=\frac{2^{-k}|x|^{\frac{k-1}{2}}K_{k-\frac{1}{2}}\left(\frac{|x|}{2} \right)}{\sqrt{\pi}\Gamma\left(\frac{k}{2}\right)}
\end{equation}
Following MC experiments with 2 and 10 df and 100K simulations respectively, provides a good match.
|
Distribution of difference of two random variables with chi-squared distribution
|
Using the following links and parameter correspondence between the characteristic function(chf) of difference of $\Gamma(\alpha,\nu_{\Gamma})$ and $VG(\sigma,\nu)$ symm. variance gamma rvs we can obta
|
Distribution of difference of two random variables with chi-squared distribution
Using the following links and parameter correspondence between the characteristic function(chf) of difference of $\Gamma(\alpha,\nu_{\Gamma})$ and $VG(\sigma,\nu)$ symm. variance gamma rvs we can obtain density of $X-Y$ indirectly, alternative to the method of chf inversion,
\begin{equation}
\phi_{VG}(u,\sigma,\nu)=\left(\frac{1}{1+\frac{\nu u^{2}\sigma^{2}}{2}}\right)^{\frac{1}{\nu}}
\end{equation}
\begin{equation}
\phi_{\Gamma}(u,\alpha,\nu_{G})=\left(\frac{1}{1+\nu_{\Gamma}^{2}}\right)^{\alpha}
\end{equation}
\begin{equation}
\sigma=\nu_{G}\sqrt{2\alpha}\\
\nu=\frac{1}{\alpha}
\end{equation}
and the fact that $\chi^{2}(k)\sim\Gamma(\frac{k}{2},2)$, we can see that final density will be almost the same as @whuber's formula above with minor differences.
\begin{equation}
f_{X-Y}=\frac{2^{-k}|x|^{\frac{k-1}{2}}K_{k-\frac{1}{2}}\left(\frac{|x|}{2} \right)}{\sqrt{\pi}\Gamma\left(\frac{k}{2}\right)}
\end{equation}
Following MC experiments with 2 and 10 df and 100K simulations respectively, provides a good match.
|
Distribution of difference of two random variables with chi-squared distribution
Using the following links and parameter correspondence between the characteristic function(chf) of difference of $\Gamma(\alpha,\nu_{\Gamma})$ and $VG(\sigma,\nu)$ symm. variance gamma rvs we can obta
|
47,057
|
Who invented the hazard function?
|
The term for it seems to be relatively recent but the notion is considerably older.
Jeff Miller's Earliest Known Uses of Some of the Words of Mathematics discusses the use of the term 'hazard rate', and it looks like that's from the 50s and 60s. It reports that the term "death-hazard rate" occurs in D. J. Davis "An Analysis of Some Failure Data," Journal of the American Statistical Association, 47, (1952), 113-150, and "hazard rate" occurs in R. E. Barlow; A. W. Marshall & F. Proschan "Properties of Probability Distributions with Monotone Hazard Rate," Annals of Mathematical Statistics, 34, (1963), 375-389.
It turns out that hazard functions occur (without that specific term hazard) in the early work on "laws of mortality" - for example, the notion occurs in the writing of Gompertz. This might not be the very first use of a hazard function, but it's the earliest I have found so far. Here's Gompertz in 1825:
If the average exhaustions of a man's power to avoid death were such
that at the end of equal infinitely smaIl intervals of time, he lost
equal portions of his remaining power to oppose destruction which he
had at the commencement of those intervals, then at the age $x$, his
power to avoid death, or the intensity of his mortality might be
denoted by $a\,q^x$, $a$ and $q$ being constant quantities; and if
$L_x$, be the number of living at the age $x$, we shall have
$a L_x \times q^x.\dot{x}$ for the fluxion of the number of deaths $= -(L_x)^{^ \bullet};\:\therefore abq^x = -\frac{\dot{L}_x}{L_x}$,
(NB I am unsure that the "$a L_x \times q^x.\dot{x}$" is accurately reproduced; Gompertz may originally have written something slightly different, but that's what it looks like in the pdf image)
Noting that $L_x$ here represents a scaled $S(x)$ ($L_x=N S(x)$, where $L_0=N$), so $-\frac{\dot{L}_x}{L_x}=\frac{f(x)}{S(x)}$, we can see that he describes the hazard function in words (an instantaneous intensity of mortality) and then at the end gives a formula that corresponds to our definition of the hazard function.
Milller, Jeff,
Earliest Known Uses of Some of the Words of Mathematics
https://mathshistory.st-andrews.ac.uk/Miller/mathword/
Gompertz, B. (1825),
"On the Nature of the Function Expressive of the Law of Human Mortality, and on a New Mode of Determining the Value of Life Contingencies."
Philosophical Transactions of the Royal Society of London 115: 513–583. doi:10.1098/rstl.1825.0026
|
Who invented the hazard function?
|
The term for it seems to be relatively recent but the notion is considerably older.
Jeff Miller's Earliest Known Uses of Some of the Words of Mathematics discusses the use of the term 'hazard rate', a
|
Who invented the hazard function?
The term for it seems to be relatively recent but the notion is considerably older.
Jeff Miller's Earliest Known Uses of Some of the Words of Mathematics discusses the use of the term 'hazard rate', and it looks like that's from the 50s and 60s. It reports that the term "death-hazard rate" occurs in D. J. Davis "An Analysis of Some Failure Data," Journal of the American Statistical Association, 47, (1952), 113-150, and "hazard rate" occurs in R. E. Barlow; A. W. Marshall & F. Proschan "Properties of Probability Distributions with Monotone Hazard Rate," Annals of Mathematical Statistics, 34, (1963), 375-389.
It turns out that hazard functions occur (without that specific term hazard) in the early work on "laws of mortality" - for example, the notion occurs in the writing of Gompertz. This might not be the very first use of a hazard function, but it's the earliest I have found so far. Here's Gompertz in 1825:
If the average exhaustions of a man's power to avoid death were such
that at the end of equal infinitely smaIl intervals of time, he lost
equal portions of his remaining power to oppose destruction which he
had at the commencement of those intervals, then at the age $x$, his
power to avoid death, or the intensity of his mortality might be
denoted by $a\,q^x$, $a$ and $q$ being constant quantities; and if
$L_x$, be the number of living at the age $x$, we shall have
$a L_x \times q^x.\dot{x}$ for the fluxion of the number of deaths $= -(L_x)^{^ \bullet};\:\therefore abq^x = -\frac{\dot{L}_x}{L_x}$,
(NB I am unsure that the "$a L_x \times q^x.\dot{x}$" is accurately reproduced; Gompertz may originally have written something slightly different, but that's what it looks like in the pdf image)
Noting that $L_x$ here represents a scaled $S(x)$ ($L_x=N S(x)$, where $L_0=N$), so $-\frac{\dot{L}_x}{L_x}=\frac{f(x)}{S(x)}$, we can see that he describes the hazard function in words (an instantaneous intensity of mortality) and then at the end gives a formula that corresponds to our definition of the hazard function.
Milller, Jeff,
Earliest Known Uses of Some of the Words of Mathematics
https://mathshistory.st-andrews.ac.uk/Miller/mathword/
Gompertz, B. (1825),
"On the Nature of the Function Expressive of the Law of Human Mortality, and on a New Mode of Determining the Value of Life Contingencies."
Philosophical Transactions of the Royal Society of London 115: 513–583. doi:10.1098/rstl.1825.0026
|
Who invented the hazard function?
The term for it seems to be relatively recent but the notion is considerably older.
Jeff Miller's Earliest Known Uses of Some of the Words of Mathematics discusses the use of the term 'hazard rate', a
|
47,058
|
Machine Learning - Prediction Interval - Cheating?
|
In general, prediction intervals are considered better than point estimates. While it's great to have a good estimate for what a stock price will be tomorrow, it's much better to be able to be able to give a range of values that the stock price is very likely to be in.
That being said, it's generally more difficult to produce reliable prediction intervals than merely produce point estimates that have good prediction properties. For example, in many cases we can show that with non-constant variance, we can still produce a consistent estimator of the mean of the new value even if we ignore the non-constant variance issue. However, we definitely need a reliable estimate of the variance function to produce prediction intervals.
I've heard of people just treating this as another level of a machine learning problem: the first level is to produce a function $\hat f(x_i) = E[\hat y_i | x_i] $, the estimates of the values and the second level is to produce a function $\hat V(x_i) = E[(y_i - \hat y_i)^2 | x_i]$, the estimates of the variance of the function given the inputs. In theory, this should work (given enough data with a stable function), but in practice, it must be handled with a lot of care, as variance estimates are inherently much less stable than mean estimates. In short, you should expect to need much more data to accurately estimate $\hat V(x_i)$ than $\hat f(x_i)$.
So there's definitely nothing about prediction intervals that is "cheating" compared with just producing point estimates. It's just harder to do. As an empirical example, in the M4 forecasting competition, only 2 of the 15 methods that produced 95% prediction intervals had nearly correct coverage; most of the other prediction intervals had coverage in the 80-90% range (see slide 35 in the link).
|
Machine Learning - Prediction Interval - Cheating?
|
In general, prediction intervals are considered better than point estimates. While it's great to have a good estimate for what a stock price will be tomorrow, it's much better to be able to be able to
|
Machine Learning - Prediction Interval - Cheating?
In general, prediction intervals are considered better than point estimates. While it's great to have a good estimate for what a stock price will be tomorrow, it's much better to be able to be able to give a range of values that the stock price is very likely to be in.
That being said, it's generally more difficult to produce reliable prediction intervals than merely produce point estimates that have good prediction properties. For example, in many cases we can show that with non-constant variance, we can still produce a consistent estimator of the mean of the new value even if we ignore the non-constant variance issue. However, we definitely need a reliable estimate of the variance function to produce prediction intervals.
I've heard of people just treating this as another level of a machine learning problem: the first level is to produce a function $\hat f(x_i) = E[\hat y_i | x_i] $, the estimates of the values and the second level is to produce a function $\hat V(x_i) = E[(y_i - \hat y_i)^2 | x_i]$, the estimates of the variance of the function given the inputs. In theory, this should work (given enough data with a stable function), but in practice, it must be handled with a lot of care, as variance estimates are inherently much less stable than mean estimates. In short, you should expect to need much more data to accurately estimate $\hat V(x_i)$ than $\hat f(x_i)$.
So there's definitely nothing about prediction intervals that is "cheating" compared with just producing point estimates. It's just harder to do. As an empirical example, in the M4 forecasting competition, only 2 of the 15 methods that produced 95% prediction intervals had nearly correct coverage; most of the other prediction intervals had coverage in the 80-90% range (see slide 35 in the link).
|
Machine Learning - Prediction Interval - Cheating?
In general, prediction intervals are considered better than point estimates. While it's great to have a good estimate for what a stock price will be tomorrow, it's much better to be able to be able to
|
47,059
|
Machine Learning - Prediction Interval - Cheating?
|
I don't understand your manager's attitude. If the model predicts that the stock will be 173.56, and it's actually 173.55, will they consider that a "failure"? If you're trying to make money from the stock market, you shouldn't be depending on getting the price exactly right. Stock investment is all about reducing variance, so knowing which predictions have the smallest error bars is key.
The basic regression model is that $Y = mX+b+\epsilon$, where $\epsilon$ is a normally distributed error term with mean 0 and standard deviation $\sigma$. In training the model, we find the $m$ and $b$ that minimize $\sigma$. When we use the model for prediction, we predict that given a particular $x$, the $y$ will be normally distributed with mean $mx+b$ and standard deviation $\sigma$. Thus, we are not predicting the value of $y$, we are predicting the distribution of $y$.
In this model, the exact value $y$ does not deterministically depend on $x$. If the depedance were both deterministic and linear, one wouldn't need linear regression to begin with; one could simply solve for $m$ and $b$. One can have different models, and those models could be nonlinear and/or deterministic. But generally speaking, regression models are built around the idea that you're going to have some error, and there should be some loss function quantifying how much a particular error matters, and that loss function is then minimized over the training set. If your manager is trying to create a model that incorporates all the factors that deterministically determine stock prices, that is incredibly ambitious.
|
Machine Learning - Prediction Interval - Cheating?
|
I don't understand your manager's attitude. If the model predicts that the stock will be 173.56, and it's actually 173.55, will they consider that a "failure"? If you're trying to make money from the
|
Machine Learning - Prediction Interval - Cheating?
I don't understand your manager's attitude. If the model predicts that the stock will be 173.56, and it's actually 173.55, will they consider that a "failure"? If you're trying to make money from the stock market, you shouldn't be depending on getting the price exactly right. Stock investment is all about reducing variance, so knowing which predictions have the smallest error bars is key.
The basic regression model is that $Y = mX+b+\epsilon$, where $\epsilon$ is a normally distributed error term with mean 0 and standard deviation $\sigma$. In training the model, we find the $m$ and $b$ that minimize $\sigma$. When we use the model for prediction, we predict that given a particular $x$, the $y$ will be normally distributed with mean $mx+b$ and standard deviation $\sigma$. Thus, we are not predicting the value of $y$, we are predicting the distribution of $y$.
In this model, the exact value $y$ does not deterministically depend on $x$. If the depedance were both deterministic and linear, one wouldn't need linear regression to begin with; one could simply solve for $m$ and $b$. One can have different models, and those models could be nonlinear and/or deterministic. But generally speaking, regression models are built around the idea that you're going to have some error, and there should be some loss function quantifying how much a particular error matters, and that loss function is then minimized over the training set. If your manager is trying to create a model that incorporates all the factors that deterministically determine stock prices, that is incredibly ambitious.
|
Machine Learning - Prediction Interval - Cheating?
I don't understand your manager's attitude. If the model predicts that the stock will be 173.56, and it's actually 173.55, will they consider that a "failure"? If you're trying to make money from the
|
47,060
|
question about MSE mean square error
|
I will try to give an intuitive example to understand why the arithmetic mean
\begin{equation} \overline x_1 = \sum_{i=1}^{n} \frac{x_i}{n}
\end{equation}
is not as good as
\begin{equation} \overline x_2 = \frac{a + b}{2}
\end{equation}
In the case where $X \sim \mathrm{unif}(\alpha,\beta)$
Imagine that you have 10 observations from $\mathrm{unif}(1,11)$
(There is a candy factory that puts a candy of 1cm, 2cm, ..., 11cm, 1cm, 2cm,..., 11cm,... in separate bags). We know from the above information that the real mean is 6 (For the factory example, the factory would have spend the same amount of sugar if each candy was 6cm)
Now, if you don't know any of the above and take a random sample to estimate that, then $\bar x_2$ would only require the smallest and the highest number to appear in your sample and that's it! It would always guess the correct answer with 0 error!
$\bar x_1$ on the other hand, would be sensitive to every single value that you get and it will "fluctuate" around the real value. Furthermore, if the highest (or equivalently the lowest) value doesn't appear in your sample, then again $\bar x_2$ will almost always be closer to the real mean compared to $\bar x_1$. $\bar x_1$ will be better only if your sample is already centralized around 6 which is less likely to happen compared to the other possible scenarios.
For the candy factory example. If you try to predict the "average candy" that is in each bag, it's better to get the average between the smallest and the largest candy you had so far than averaging the candies in every single bag you open and change your prediction (and thus error) after every bag.
|
question about MSE mean square error
|
I will try to give an intuitive example to understand why the arithmetic mean
\begin{equation} \overline x_1 = \sum_{i=1}^{n} \frac{x_i}{n}
\end{equation}
is not as good as
\begin{equation} \overlin
|
question about MSE mean square error
I will try to give an intuitive example to understand why the arithmetic mean
\begin{equation} \overline x_1 = \sum_{i=1}^{n} \frac{x_i}{n}
\end{equation}
is not as good as
\begin{equation} \overline x_2 = \frac{a + b}{2}
\end{equation}
In the case where $X \sim \mathrm{unif}(\alpha,\beta)$
Imagine that you have 10 observations from $\mathrm{unif}(1,11)$
(There is a candy factory that puts a candy of 1cm, 2cm, ..., 11cm, 1cm, 2cm,..., 11cm,... in separate bags). We know from the above information that the real mean is 6 (For the factory example, the factory would have spend the same amount of sugar if each candy was 6cm)
Now, if you don't know any of the above and take a random sample to estimate that, then $\bar x_2$ would only require the smallest and the highest number to appear in your sample and that's it! It would always guess the correct answer with 0 error!
$\bar x_1$ on the other hand, would be sensitive to every single value that you get and it will "fluctuate" around the real value. Furthermore, if the highest (or equivalently the lowest) value doesn't appear in your sample, then again $\bar x_2$ will almost always be closer to the real mean compared to $\bar x_1$. $\bar x_1$ will be better only if your sample is already centralized around 6 which is less likely to happen compared to the other possible scenarios.
For the candy factory example. If you try to predict the "average candy" that is in each bag, it's better to get the average between the smallest and the largest candy you had so far than averaging the candies in every single bag you open and change your prediction (and thus error) after every bag.
|
question about MSE mean square error
I will try to give an intuitive example to understand why the arithmetic mean
\begin{equation} \overline x_1 = \sum_{i=1}^{n} \frac{x_i}{n}
\end{equation}
is not as good as
\begin{equation} \overlin
|
47,061
|
question about MSE mean square error
|
Note firstly that MSE, unlike the related measurement; variance (Var), is a biased estimator of a sample variability, which is one source of confusion in the text quoted. For a normal distribution (only) the relationship is $MSE(\bar{X})=\frac{n-1}{n}Var(\bar{X})$, with a more general relationship given through excess kurtosis correction. This confusion arises because as a sample MSE becomes a population MSE and a population Var, as $\lim_{n\to\infty}\frac{n-1}{n}=1$, that is, MSE is unbiased for a (very large) population, but is biased for $n$ small. The Wikipedia entry is admixing $\mu$ with $\bar{X}$ and $s^2$ with $\sigma^2$, and this is confusing, but is clearly referring to the population (very large $n$) case only. The entry attempts to gloss over this difficulty using the sentence "Suppose the sample units were chosen with replacement.", which is a curt description of bootstrap somewhat unconvincingly implying that we can make $n$ appear to be very large, using $n$ small. Also, note that there are limitations that apply to MSE usage.
More confusion arises not from MSE itself, but from a consideration of what to best use as the estimator of location for the individual distributions that MSE is applied to, as follows. For a normal distribution the mean value is a minimum variance unbiased estimator MVUE for location. However, for a uniform distribution (UD) the mean value is not MVUE for location. The UD mean value is unbiased, no problem there.
However, for a uniform distribution the midrange value, i.e., $\dfrac{\mathrm{max}-\mathrm{min}}{2}$, is also unbiased and is a better estimator of location than the mean value because the variance for the midrange value is less than the variance of the mean. To put it another way, for $n$ increasing, the UD midrange value converges faster to the central value than the mean value does.
Finally, Harter (1942) cites that Fisher (1922) "...has shown (p. 321) that the distribution of the mean of a sample of any size from a Cauchy distribution that same as that of a single observation and (pp. 348-351) that for a sample from a rectangular distribution the extreme observations contain the whole of the relevant information in the
sample; as the sample size $n$ increases, the mean square error of the midrange decreases like $n^{-1}$ and that of the mean only like $n^{-\frac{1}{2}}$."
So, in other words, for a uniform distribution, MSE of midrange, $MSE\left(\dfrac{\mathrm{max}-\mathrm{min}}{2}\right)$ is preferred to MSE of the mean, $MSE(\bar{X})$ .
|
question about MSE mean square error
|
Note firstly that MSE, unlike the related measurement; variance (Var), is a biased estimator of a sample variability, which is one source of confusion in the text quoted. For a normal distribution (on
|
question about MSE mean square error
Note firstly that MSE, unlike the related measurement; variance (Var), is a biased estimator of a sample variability, which is one source of confusion in the text quoted. For a normal distribution (only) the relationship is $MSE(\bar{X})=\frac{n-1}{n}Var(\bar{X})$, with a more general relationship given through excess kurtosis correction. This confusion arises because as a sample MSE becomes a population MSE and a population Var, as $\lim_{n\to\infty}\frac{n-1}{n}=1$, that is, MSE is unbiased for a (very large) population, but is biased for $n$ small. The Wikipedia entry is admixing $\mu$ with $\bar{X}$ and $s^2$ with $\sigma^2$, and this is confusing, but is clearly referring to the population (very large $n$) case only. The entry attempts to gloss over this difficulty using the sentence "Suppose the sample units were chosen with replacement.", which is a curt description of bootstrap somewhat unconvincingly implying that we can make $n$ appear to be very large, using $n$ small. Also, note that there are limitations that apply to MSE usage.
More confusion arises not from MSE itself, but from a consideration of what to best use as the estimator of location for the individual distributions that MSE is applied to, as follows. For a normal distribution the mean value is a minimum variance unbiased estimator MVUE for location. However, for a uniform distribution (UD) the mean value is not MVUE for location. The UD mean value is unbiased, no problem there.
However, for a uniform distribution the midrange value, i.e., $\dfrac{\mathrm{max}-\mathrm{min}}{2}$, is also unbiased and is a better estimator of location than the mean value because the variance for the midrange value is less than the variance of the mean. To put it another way, for $n$ increasing, the UD midrange value converges faster to the central value than the mean value does.
Finally, Harter (1942) cites that Fisher (1922) "...has shown (p. 321) that the distribution of the mean of a sample of any size from a Cauchy distribution that same as that of a single observation and (pp. 348-351) that for a sample from a rectangular distribution the extreme observations contain the whole of the relevant information in the
sample; as the sample size $n$ increases, the mean square error of the midrange decreases like $n^{-1}$ and that of the mean only like $n^{-\frac{1}{2}}$."
So, in other words, for a uniform distribution, MSE of midrange, $MSE\left(\dfrac{\mathrm{max}-\mathrm{min}}{2}\right)$ is preferred to MSE of the mean, $MSE(\bar{X})$ .
|
question about MSE mean square error
Note firstly that MSE, unlike the related measurement; variance (Var), is a biased estimator of a sample variability, which is one source of confusion in the text quoted. For a normal distribution (on
|
47,062
|
Profile Likelihood: why optimize all other parameters while tracing a profile for a partitcular one?
|
You can think of the profile confidence interval as an inversion of the likelihood ratio test; you are comparing a model in which your parameter of interest is allowed to vary against a set of nested models in which the parameter of interest is fixed. Your confidence interval is the set of values for which the parameter is fixed and the likelihood ratio fails to reject. In the likelihood ratio test, you compare the likelihood at the MLE for each model. Therefore, you must optimize all free parameters of both the full model and the nested model. If you change one parameter, then it is very likely that the values of the other parameters at the optimum will change, so you can't just "recycle" them from the full model.
To further explore this, consider something like a regression model in which two covariates are highly collinear. From what we learned from studying linear regression, we should know that confidence interval for either individual predictor should be very wide, since it is hard to differentiate between the effect of the first and second variable, given their collinearity. Now, if we tried to make a profile confidence interval for predictor one, but fixed predictor two, we would (mistakenly) get a very narrow confidence interval; this would be the equivalent to fixing the second coefficient, subtracting out it's effect and then computing the confidence interval for the first coefficient without including the second covariate in your model.
In a nutshell, you need to allow the other parameters to vary to account for the fact that the uncertainty in your parameter of interest may be tied to the uncertainty in other parameters in your model.
|
Profile Likelihood: why optimize all other parameters while tracing a profile for a partitcular one?
|
You can think of the profile confidence interval as an inversion of the likelihood ratio test; you are comparing a model in which your parameter of interest is allowed to vary against a set of nested
|
Profile Likelihood: why optimize all other parameters while tracing a profile for a partitcular one?
You can think of the profile confidence interval as an inversion of the likelihood ratio test; you are comparing a model in which your parameter of interest is allowed to vary against a set of nested models in which the parameter of interest is fixed. Your confidence interval is the set of values for which the parameter is fixed and the likelihood ratio fails to reject. In the likelihood ratio test, you compare the likelihood at the MLE for each model. Therefore, you must optimize all free parameters of both the full model and the nested model. If you change one parameter, then it is very likely that the values of the other parameters at the optimum will change, so you can't just "recycle" them from the full model.
To further explore this, consider something like a regression model in which two covariates are highly collinear. From what we learned from studying linear regression, we should know that confidence interval for either individual predictor should be very wide, since it is hard to differentiate between the effect of the first and second variable, given their collinearity. Now, if we tried to make a profile confidence interval for predictor one, but fixed predictor two, we would (mistakenly) get a very narrow confidence interval; this would be the equivalent to fixing the second coefficient, subtracting out it's effect and then computing the confidence interval for the first coefficient without including the second covariate in your model.
In a nutshell, you need to allow the other parameters to vary to account for the fact that the uncertainty in your parameter of interest may be tied to the uncertainty in other parameters in your model.
|
Profile Likelihood: why optimize all other parameters while tracing a profile for a partitcular one?
You can think of the profile confidence interval as an inversion of the likelihood ratio test; you are comparing a model in which your parameter of interest is allowed to vary against a set of nested
|
47,063
|
Value Iteration For Terminal States in MDP
|
The point of visiting a state in value iteration is in order to update its value, using the update:
$$v(s) \leftarrow \text{max}_a[\sum_{r,s'} p(s', r|s,a)(r + \gamma v(s'))]$$
First thing to note is that the state value of terminal state $s^T$ is $v(s^T) = 0$, always, since by definition there are no future rewards to accumulate. It definitely would not be a valid calculation that found a possible reward or different next state after a terminal state and updated the value to be non-zero.
You can define things so that it is valid to run the update. If you implement terminal states as "absorbing states" then this means $p(s^T, 0|s^T,*)=1$, and probability of any other state, reward pair is zero, so running the update as above results in updating $0$ to $0$.
In general there is no point updating the value function of a terminal state, although with correct definitions of transition and reward functions there is no harm to do so, it is just wasted calculations.
|
Value Iteration For Terminal States in MDP
|
The point of visiting a state in value iteration is in order to update its value, using the update:
$$v(s) \leftarrow \text{max}_a[\sum_{r,s'} p(s', r|s,a)(r + \gamma v(s'))]$$
First thing to note is
|
Value Iteration For Terminal States in MDP
The point of visiting a state in value iteration is in order to update its value, using the update:
$$v(s) \leftarrow \text{max}_a[\sum_{r,s'} p(s', r|s,a)(r + \gamma v(s'))]$$
First thing to note is that the state value of terminal state $s^T$ is $v(s^T) = 0$, always, since by definition there are no future rewards to accumulate. It definitely would not be a valid calculation that found a possible reward or different next state after a terminal state and updated the value to be non-zero.
You can define things so that it is valid to run the update. If you implement terminal states as "absorbing states" then this means $p(s^T, 0|s^T,*)=1$, and probability of any other state, reward pair is zero, so running the update as above results in updating $0$ to $0$.
In general there is no point updating the value function of a terminal state, although with correct definitions of transition and reward functions there is no harm to do so, it is just wasted calculations.
|
Value Iteration For Terminal States in MDP
The point of visiting a state in value iteration is in order to update its value, using the update:
$$v(s) \leftarrow \text{max}_a[\sum_{r,s'} p(s', r|s,a)(r + \gamma v(s'))]$$
First thing to note is
|
47,064
|
Training one model to work for many time series
|
Yes, there are ways of doing this. You could apply some kind of meta learning to adapt the learning process to each separate time series, or use transfer learning to transfer the knowledge learned from one series to another. I don't have pointers, since this is certainly not the first thing I would do, see below.
You could also try calculating seasonal indices to groups of products and deseasonalize them all together, then apply simpler non-seasonal models to the deseasonalized series. A simple paper on this is "The Application of Product-Group Seasonal Indexes to Individual Products" by Mohammadipour, Boylan & Syntetos, Foresight, 2012. A similar process should also work for other drivers, like trend, calendar events or promotions.
Alternatively, do consider fitting simple models to all your series, e.g., exponential smoothing. This will fit extremely quickly. Alternatively, invest a little time in some feature engineering and consider a very simple linear model - see Varmerdam's PyData presentation on the benefits of simple models; he even discusses time series models. If nothing else, the simpler models will serve as a useful benchmark. After you have invested one day in training the simple models and two weeks in meta and transfer learning the more complex ones, you may very well find that the simple models outperformed the more complex ones. (And that they are easier to interpret and communicate, and to maintain in production.)
|
Training one model to work for many time series
|
Yes, there are ways of doing this. You could apply some kind of meta learning to adapt the learning process to each separate time series, or use transfer learning to transfer the knowledge learned fro
|
Training one model to work for many time series
Yes, there are ways of doing this. You could apply some kind of meta learning to adapt the learning process to each separate time series, or use transfer learning to transfer the knowledge learned from one series to another. I don't have pointers, since this is certainly not the first thing I would do, see below.
You could also try calculating seasonal indices to groups of products and deseasonalize them all together, then apply simpler non-seasonal models to the deseasonalized series. A simple paper on this is "The Application of Product-Group Seasonal Indexes to Individual Products" by Mohammadipour, Boylan & Syntetos, Foresight, 2012. A similar process should also work for other drivers, like trend, calendar events or promotions.
Alternatively, do consider fitting simple models to all your series, e.g., exponential smoothing. This will fit extremely quickly. Alternatively, invest a little time in some feature engineering and consider a very simple linear model - see Varmerdam's PyData presentation on the benefits of simple models; he even discusses time series models. If nothing else, the simpler models will serve as a useful benchmark. After you have invested one day in training the simple models and two weeks in meta and transfer learning the more complex ones, you may very well find that the simple models outperformed the more complex ones. (And that they are easier to interpret and communicate, and to maintain in production.)
|
Training one model to work for many time series
Yes, there are ways of doing this. You could apply some kind of meta learning to adapt the learning process to each separate time series, or use transfer learning to transfer the knowledge learned fro
|
47,065
|
Training one model to work for many time series
|
Is there some sort of methodology for training a model to make predictions on many (seemingly unrelated) time series data?
The closest thing to an actual methodology for this is hierarchical forecasting.
On my team (I work in demand forecasting) we use a type of hierarchical forecasting to generate forecasts for product/location groups (for example for an entire class of products across an individual region). However we don't do any sort of clustering or scientific similarity analysis, instead we have a pre-defined product similarity matrix defined by the business (according to product type, supplier, etc...). The approach is similar in spirit to the paper that Dr. Kolassa mentioned, in the sense that the group level forecast provides the seasonality and the shape of the forecast - and then individual product histories are used simply to adjust the height of the signal.
Train a model (maybe a neural network or LSTM) on all the different time series at the same time, with the hope that this model would then be capable of producing 'good' predictions per time series fed to it.
On the other hand, the approach you describe in (2) is what Amazon uses with their DeepAR model. It is a gigantic LSTM that takes in all products at the same time, and then tries to learn the correlations between the different products to give one big model that is used for all the products. Although even with DeepAR, you still have to provide with product attribute features so that it correctly estimate product similarity.
|
Training one model to work for many time series
|
Is there some sort of methodology for training a model to make predictions on many (seemingly unrelated) time series data?
The closest thing to an actual methodology for this is hierarchical forecast
|
Training one model to work for many time series
Is there some sort of methodology for training a model to make predictions on many (seemingly unrelated) time series data?
The closest thing to an actual methodology for this is hierarchical forecasting.
On my team (I work in demand forecasting) we use a type of hierarchical forecasting to generate forecasts for product/location groups (for example for an entire class of products across an individual region). However we don't do any sort of clustering or scientific similarity analysis, instead we have a pre-defined product similarity matrix defined by the business (according to product type, supplier, etc...). The approach is similar in spirit to the paper that Dr. Kolassa mentioned, in the sense that the group level forecast provides the seasonality and the shape of the forecast - and then individual product histories are used simply to adjust the height of the signal.
Train a model (maybe a neural network or LSTM) on all the different time series at the same time, with the hope that this model would then be capable of producing 'good' predictions per time series fed to it.
On the other hand, the approach you describe in (2) is what Amazon uses with their DeepAR model. It is a gigantic LSTM that takes in all products at the same time, and then tries to learn the correlations between the different products to give one big model that is used for all the products. Although even with DeepAR, you still have to provide with product attribute features so that it correctly estimate product similarity.
|
Training one model to work for many time series
Is there some sort of methodology for training a model to make predictions on many (seemingly unrelated) time series data?
The closest thing to an actual methodology for this is hierarchical forecast
|
47,066
|
What is the actual significance of a difference in AIC or BIC values?
|
The difference in AIC (or BIC) for two models is twice the log-likelihood ratio minus a constant: it follows immediately that in any particular case selecting the AIC corresponds to performing a likelihood-ratio test, but that in different cases it corresponds to tests of different significance levels.
With nested models, the null hypothesis has to be that the smaller model holds. Given some regularity conditions, Wilks' theorem applies; so if $p$ is the difference in the number of free parameters between the models, asymptotically the probability of AIC's selecting the larger model when the smaller one in fact holds is the probability that a chi-squared r.v. with $p$ degrees of freedom exceeds $2p$. For $p=1$ the significance of the test is 0.157; for $p=2$, 0.135; & so on. When exact tests are possible the distribution of the log-likelihood ratio of course depends on precisely what the models are.
With non-nested models, even finding an asymptotic distribution for the log-likelihood ratio involves the calculation of rather complicated expectations under the null (see Cox's or Vuong's papers referenced in Generalized log likelihood ratio test for non-nested models & Comparison of log-likelihood of two non-nested models). I doubt much can be said in general about the significance of a difference in AIC.
The moral has already been given, pithily, by @RichardHardy:
How do you define what is a "correct model"? Is it the data generating process (DGP)? If so, why would you be using AIC trying to identify the DGP? The question AIC is answering is not "Which of the models is the DGP?". Try asking a different question, such as "Which model will give better predictions under a certain type of loss (associated with the likelihood being used)?", and you might find that AIC is answering "correctly" (or perhaps not?). That is, use a hammer for hammering nails
Problems with the AIC include its accuracy in small samples (the bias-correction term is only to first order) & when neither model is particularly close (in the sense of Kullback–Leibler divergence) to the true model; but it can't fairly be criticized for not doing what it wasn't made for: there are hypothesis tests for that.
|
What is the actual significance of a difference in AIC or BIC values?
|
The difference in AIC (or BIC) for two models is twice the log-likelihood ratio minus a constant: it follows immediately that in any particular case selecting the AIC corresponds to performing a likel
|
What is the actual significance of a difference in AIC or BIC values?
The difference in AIC (or BIC) for two models is twice the log-likelihood ratio minus a constant: it follows immediately that in any particular case selecting the AIC corresponds to performing a likelihood-ratio test, but that in different cases it corresponds to tests of different significance levels.
With nested models, the null hypothesis has to be that the smaller model holds. Given some regularity conditions, Wilks' theorem applies; so if $p$ is the difference in the number of free parameters between the models, asymptotically the probability of AIC's selecting the larger model when the smaller one in fact holds is the probability that a chi-squared r.v. with $p$ degrees of freedom exceeds $2p$. For $p=1$ the significance of the test is 0.157; for $p=2$, 0.135; & so on. When exact tests are possible the distribution of the log-likelihood ratio of course depends on precisely what the models are.
With non-nested models, even finding an asymptotic distribution for the log-likelihood ratio involves the calculation of rather complicated expectations under the null (see Cox's or Vuong's papers referenced in Generalized log likelihood ratio test for non-nested models & Comparison of log-likelihood of two non-nested models). I doubt much can be said in general about the significance of a difference in AIC.
The moral has already been given, pithily, by @RichardHardy:
How do you define what is a "correct model"? Is it the data generating process (DGP)? If so, why would you be using AIC trying to identify the DGP? The question AIC is answering is not "Which of the models is the DGP?". Try asking a different question, such as "Which model will give better predictions under a certain type of loss (associated with the likelihood being used)?", and you might find that AIC is answering "correctly" (or perhaps not?). That is, use a hammer for hammering nails
Problems with the AIC include its accuracy in small samples (the bias-correction term is only to first order) & when neither model is particularly close (in the sense of Kullback–Leibler divergence) to the true model; but it can't fairly be criticized for not doing what it wasn't made for: there are hypothesis tests for that.
|
What is the actual significance of a difference in AIC or BIC values?
The difference in AIC (or BIC) for two models is twice the log-likelihood ratio minus a constant: it follows immediately that in any particular case selecting the AIC corresponds to performing a likel
|
47,067
|
What is the actual significance of a difference in AIC or BIC values?
|
Suppose one generates values from a standard normal distribution, $\mathcal{N}(0,1)$. If we have only generated two values, $n=2$, then we have a discrete uniform distribution, not a convincingly discrete approximation of a normal distribution. Indeed, this is true for any $n=2$, no matter which generating distribution gave rise to those values, a discrete uniform distribution is a default result. Normal and uniform distributions are non-nested with respected to each other. Indeed, they have very different shapes. If we generate $\mathcal{N}(0,1)$ for increasing $n$ and examine AIC for fitting with a normal distribution versus a uniform distribution, even though we know that our generating function is $\mathcal{N}(0,1)$, AIC will not always be lesser for a normal distribution fit than for a uniform distribution fit. The plot below shows how many times out of 1000 repetitions AIC for a normal distribution model was better (less than) AIC for a uniform distribution model for $n$ varying from $n=5$ to $n=100$.
As can be seen in the image, AIC for a normal distribution (i.e., the correct answer) was only selected to be better than a uniform distribution 395 times out of 1000 trials or 39.5% of the time for $n=5$. This increased to 949 times out of 1000 trials for $n=100$, a value still having an error rate of slightly more than 5%. It is said that AIC is asymptotically correct, and that appears to be correct. BTW, BIC makes the same choices for both 2 parameter models as AIC. But is that useful for small to moderately sized values of $n$?
Above is an example of observed probability of model selection. It is claimed that the likelihood of AIC choosing a correct model is as follows:
The quantity $\exp\frac{\text{AIC}_{min} − \text{AIC}_i}{2}$ is known as the relative likelihood of model $i$. It is closely related to the likelihood ratio used in the likelihood-ratio test. Indeed, if all the models in the candidate set have the same number of parameters, then using AIC might at first appear to be very similar to using the likelihood-ratio test. There are, however, important distinctions. In particular, the likelihood-ratio test is valid only for nested models, whereas AIC (and AICc) has no such restriction.
Now note that the likelihood above can be reciprocated. That is, if model A is twice as likely as model B, then model B is one-half as likely as model A. In the current context, we are not dealing with likelihoods, we created a Monte Carlo simulation with truth data, such that we observed the probability of making the correct choices. We have observed in this simulation that the likelihood of making the correct choice is heavily influenced by $n$, the number of observations, and that unless $n$ is large, we did not seem to get reliable answers.
About the program: lists are initialized as normal distribution (nd) AIC (ndAlist), nd BIC (ndBlist), uniform distribution (ud) AIC and BIC (udAlist, udBlist). Two do loops are used. The outer do loop increments $n$ from 5 to 100 in increments of $n=5$. The inner do loop (1) creates $n$ random variates (named dat) from an $\mathcal{N}(0,1)$. Then (2) creates an emperical CDF named edistdata from dat. (3) Defines cdfn and cdfu functions for fitting from the CDFs of nd and ud. (4) Best fits by variation of parameters of cdfn and cdfu to edistdata. Note: Fitting to CDFs rather than PDFs markedly decreases noise and is a common procedure. This is done, rather than, for example, using mean and variance to calculate nd or min and max to calculate ud because the fitting uses a single algorithm for both nd and ud and that NonlinearModelFit routine outputs AIC and BIC for the models as well as parameters as options for the output nlmn and nlmu fit outputs, e.g., as nlmn["AIC"]. Note: it is assumed that the AIC and BIC fit parameters are correctly calculated using ML as the contrary case would be meaningless.
(*Mathematica Program*)
ndAlist = {};
ndBlist = {};
udAlist = {};
udBlist = {};
Do[
AICndlist = {};
BICndlist = {};
AICudlist = {};
BICudlist = {};
Do[dat =
RandomVariate[NormalDistribution[0, 1], n, WorkingPrecision -> 40];
edistdata = Table[{x, CDF[EmpiricalDistribution[dat], x]}, {x, dat}];
cdfn[a1_, a2_, x_] := CDF[NormalDistribution[a1, a2], x];
cdfu[b1_, b2_, x_] := CDF[UniformDistribution[{b1, b2}], x];
nlmn = NonlinearModelFit[edistdata, cdfn[a1, a2, x], {{a1, 0}, {a2, 1}}, x];
nlmu = NonlinearModelFit[edistdata, cdfu[b1, b2, x], {{b1, -2}, {b2, 2}}, x];
AICndlist = AppendTo[AICndlist, nlmn["AIC"]];
BICndlist = AppendTo[BICndlist, nlmn["BIC"]];
AICudlist = AppendTo[AICudlist, nlmu["AIC"]];
BICudlist = AppendTo[BICudlist, nlmu["BIC"]],
{i, 1, 1000}];
ndA = 0.; udA = 0.; ndB = 0.; udB = 0.;
Do[If[AICndlist[[j]] < AICudlist[[j]], ndA = ndA + 1, udA = udA + 1],
{j, 1, 1000}];
Do[If[BICndlist[[j]] < BICudlist[[j]], ndB = ndB + 1, udB = udB + 1],
{j, 1, 1000}];
Print["n: ", n, "\nAIC nd/1000: ", ndA, "\tAIC ud/1000: ", udA, "\nBIC nd/1000: ", ndB, "\tBIC ud/1000: ", udB];
ndAlist = AppendTo[ndAlist, {n, ndB}];
ndBlist = AppendTo[ndBlist, {n, ndB}], {n, 5, 100, 5}]
Print[ndAlist]
ListPlot[ndAlist, AxesLabel -> {"n", "AIC ND < AIC UD"}, PlotRange -> {{0, 100}, {0, 1000}}, PlotRangePadding -> {{0, 1}, {0, 0}}]
(Numerical Output)
n: 5
AIC nd/1000: 395. AIC ud/1000: 605.
BIC nd/1000: 395. BIC ud/1000: 605.
n: 10
AIC nd/1000: 572. AIC ud/1000: 428.
BIC nd/1000: 572. BIC ud/1000: 428.
n: 15
AIC nd/1000: 684. AIC ud/1000: 316.
BIC nd/1000: 684. BIC ud/1000: 316.
n: 20
AIC nd/1000: 725. AIC ud/1000: 275.
BIC nd/1000: 725. BIC ud/1000: 275.
n: 25
AIC nd/1000: 769. AIC ud/1000: 231.
BIC nd/1000: 769. BIC ud/1000: 231.
n: 30
AIC nd/1000: 777. AIC ud/1000: 223.
BIC nd/1000: 777. BIC ud/1000: 223.
n: 35
AIC nd/1000: 811. AIC ud/1000: 189.
BIC nd/1000: 811. BIC ud/1000: 189.
n: 40
AIC nd/1000: 841. AIC ud/1000: 159.
BIC nd/1000: 841. BIC ud/1000: 159.
n: 45
AIC nd/1000: 848. AIC ud/1000: 152.
BIC nd/1000: 848. BIC ud/1000: 152.
n: 50
AIC nd/1000: 848. AIC ud/1000: 152.
BIC nd/1000: 848. BIC ud/1000: 152.
n: 55
AIC nd/1000: 877. AIC ud/1000: 123.
BIC nd/1000: 877. BIC ud/1000: 123.
n: 60
AIC nd/1000: 886. AIC ud/1000: 114.
BIC nd/1000: 886. BIC ud/1000: 114.
n: 65
AIC nd/1000: 900. AIC ud/1000: 100.
BIC nd/1000: 900. BIC ud/1000: 100.
n: 70
AIC nd/1000: 901. AIC ud/1000: 99.
BIC nd/1000: 901. BIC ud/1000: 99.
n: 75
AIC nd/1000: 914. AIC ud/1000: 86.
BIC nd/1000: 914. BIC ud/1000: 86.
n: 80
AIC nd/1000: 932. AIC ud/1000: 68.
BIC nd/1000: 932. BIC ud/1000: 68.
n: 85
AIC nd/1000: 935. AIC ud/1000: 65.
BIC nd/1000: 935. BIC ud/1000: 65.
n: 90
AIC nd/1000: 946. AIC ud/1000: 54.
BIC nd/1000: 946. BIC ud/1000: 54.
n: 95
AIC nd/1000: 952. AIC ud/1000: 48.
BIC nd/1000: 952. BIC ud/1000: 48.
n: 100
AIC nd/1000: 949. AIC ud/1000: 51.
BIC nd/1000: 949. BIC ud/1000: 51.
{{5,395.},{10,572.},{15,684.},{20,725.},{25,769.},{30,777.},{35,811.},{40,841.},{45,848.},{50,848.},{55,877.},{60,886.},{65,900.},{70,901.},{75,914.},{80,932.},{85,935.},{90,946.},{95,952.},{100,949.}}
Plot of output was shown above.
The answer here echos the results of a recent paper by Yafune et al. A Note on Sample Size Determination for Akaike Information Criterion (AIC) Approach to Clinical Data Analysis, which unfortunately is behind a paywall. Those authors state in their discussion that "AIC is generally used without paying attention to the probabilities corresponding to the power of statistical tests. Since AIC is usually used for exploratory analysis, it is often difficult to determine the sample sizes in advance. For such cases, it is desirable to investigate afterwards whether the sample sizes are large enough by checking the probabilities corresponding to the power of statistical tests. If the sample sizes are not large enough, it is possible that the AIC approach does not lead us to the conclusions which we seek."
To this we would only add that the sample sizes indicated in that paper can easily exceed 100 for a power of 0.8.
|
What is the actual significance of a difference in AIC or BIC values?
|
Suppose one generates values from a standard normal distribution, $\mathcal{N}(0,1)$. If we have only generated two values, $n=2$, then we have a discrete uniform distribution, not a convincingly disc
|
What is the actual significance of a difference in AIC or BIC values?
Suppose one generates values from a standard normal distribution, $\mathcal{N}(0,1)$. If we have only generated two values, $n=2$, then we have a discrete uniform distribution, not a convincingly discrete approximation of a normal distribution. Indeed, this is true for any $n=2$, no matter which generating distribution gave rise to those values, a discrete uniform distribution is a default result. Normal and uniform distributions are non-nested with respected to each other. Indeed, they have very different shapes. If we generate $\mathcal{N}(0,1)$ for increasing $n$ and examine AIC for fitting with a normal distribution versus a uniform distribution, even though we know that our generating function is $\mathcal{N}(0,1)$, AIC will not always be lesser for a normal distribution fit than for a uniform distribution fit. The plot below shows how many times out of 1000 repetitions AIC for a normal distribution model was better (less than) AIC for a uniform distribution model for $n$ varying from $n=5$ to $n=100$.
As can be seen in the image, AIC for a normal distribution (i.e., the correct answer) was only selected to be better than a uniform distribution 395 times out of 1000 trials or 39.5% of the time for $n=5$. This increased to 949 times out of 1000 trials for $n=100$, a value still having an error rate of slightly more than 5%. It is said that AIC is asymptotically correct, and that appears to be correct. BTW, BIC makes the same choices for both 2 parameter models as AIC. But is that useful for small to moderately sized values of $n$?
Above is an example of observed probability of model selection. It is claimed that the likelihood of AIC choosing a correct model is as follows:
The quantity $\exp\frac{\text{AIC}_{min} − \text{AIC}_i}{2}$ is known as the relative likelihood of model $i$. It is closely related to the likelihood ratio used in the likelihood-ratio test. Indeed, if all the models in the candidate set have the same number of parameters, then using AIC might at first appear to be very similar to using the likelihood-ratio test. There are, however, important distinctions. In particular, the likelihood-ratio test is valid only for nested models, whereas AIC (and AICc) has no such restriction.
Now note that the likelihood above can be reciprocated. That is, if model A is twice as likely as model B, then model B is one-half as likely as model A. In the current context, we are not dealing with likelihoods, we created a Monte Carlo simulation with truth data, such that we observed the probability of making the correct choices. We have observed in this simulation that the likelihood of making the correct choice is heavily influenced by $n$, the number of observations, and that unless $n$ is large, we did not seem to get reliable answers.
About the program: lists are initialized as normal distribution (nd) AIC (ndAlist), nd BIC (ndBlist), uniform distribution (ud) AIC and BIC (udAlist, udBlist). Two do loops are used. The outer do loop increments $n$ from 5 to 100 in increments of $n=5$. The inner do loop (1) creates $n$ random variates (named dat) from an $\mathcal{N}(0,1)$. Then (2) creates an emperical CDF named edistdata from dat. (3) Defines cdfn and cdfu functions for fitting from the CDFs of nd and ud. (4) Best fits by variation of parameters of cdfn and cdfu to edistdata. Note: Fitting to CDFs rather than PDFs markedly decreases noise and is a common procedure. This is done, rather than, for example, using mean and variance to calculate nd or min and max to calculate ud because the fitting uses a single algorithm for both nd and ud and that NonlinearModelFit routine outputs AIC and BIC for the models as well as parameters as options for the output nlmn and nlmu fit outputs, e.g., as nlmn["AIC"]. Note: it is assumed that the AIC and BIC fit parameters are correctly calculated using ML as the contrary case would be meaningless.
(*Mathematica Program*)
ndAlist = {};
ndBlist = {};
udAlist = {};
udBlist = {};
Do[
AICndlist = {};
BICndlist = {};
AICudlist = {};
BICudlist = {};
Do[dat =
RandomVariate[NormalDistribution[0, 1], n, WorkingPrecision -> 40];
edistdata = Table[{x, CDF[EmpiricalDistribution[dat], x]}, {x, dat}];
cdfn[a1_, a2_, x_] := CDF[NormalDistribution[a1, a2], x];
cdfu[b1_, b2_, x_] := CDF[UniformDistribution[{b1, b2}], x];
nlmn = NonlinearModelFit[edistdata, cdfn[a1, a2, x], {{a1, 0}, {a2, 1}}, x];
nlmu = NonlinearModelFit[edistdata, cdfu[b1, b2, x], {{b1, -2}, {b2, 2}}, x];
AICndlist = AppendTo[AICndlist, nlmn["AIC"]];
BICndlist = AppendTo[BICndlist, nlmn["BIC"]];
AICudlist = AppendTo[AICudlist, nlmu["AIC"]];
BICudlist = AppendTo[BICudlist, nlmu["BIC"]],
{i, 1, 1000}];
ndA = 0.; udA = 0.; ndB = 0.; udB = 0.;
Do[If[AICndlist[[j]] < AICudlist[[j]], ndA = ndA + 1, udA = udA + 1],
{j, 1, 1000}];
Do[If[BICndlist[[j]] < BICudlist[[j]], ndB = ndB + 1, udB = udB + 1],
{j, 1, 1000}];
Print["n: ", n, "\nAIC nd/1000: ", ndA, "\tAIC ud/1000: ", udA, "\nBIC nd/1000: ", ndB, "\tBIC ud/1000: ", udB];
ndAlist = AppendTo[ndAlist, {n, ndB}];
ndBlist = AppendTo[ndBlist, {n, ndB}], {n, 5, 100, 5}]
Print[ndAlist]
ListPlot[ndAlist, AxesLabel -> {"n", "AIC ND < AIC UD"}, PlotRange -> {{0, 100}, {0, 1000}}, PlotRangePadding -> {{0, 1}, {0, 0}}]
(Numerical Output)
n: 5
AIC nd/1000: 395. AIC ud/1000: 605.
BIC nd/1000: 395. BIC ud/1000: 605.
n: 10
AIC nd/1000: 572. AIC ud/1000: 428.
BIC nd/1000: 572. BIC ud/1000: 428.
n: 15
AIC nd/1000: 684. AIC ud/1000: 316.
BIC nd/1000: 684. BIC ud/1000: 316.
n: 20
AIC nd/1000: 725. AIC ud/1000: 275.
BIC nd/1000: 725. BIC ud/1000: 275.
n: 25
AIC nd/1000: 769. AIC ud/1000: 231.
BIC nd/1000: 769. BIC ud/1000: 231.
n: 30
AIC nd/1000: 777. AIC ud/1000: 223.
BIC nd/1000: 777. BIC ud/1000: 223.
n: 35
AIC nd/1000: 811. AIC ud/1000: 189.
BIC nd/1000: 811. BIC ud/1000: 189.
n: 40
AIC nd/1000: 841. AIC ud/1000: 159.
BIC nd/1000: 841. BIC ud/1000: 159.
n: 45
AIC nd/1000: 848. AIC ud/1000: 152.
BIC nd/1000: 848. BIC ud/1000: 152.
n: 50
AIC nd/1000: 848. AIC ud/1000: 152.
BIC nd/1000: 848. BIC ud/1000: 152.
n: 55
AIC nd/1000: 877. AIC ud/1000: 123.
BIC nd/1000: 877. BIC ud/1000: 123.
n: 60
AIC nd/1000: 886. AIC ud/1000: 114.
BIC nd/1000: 886. BIC ud/1000: 114.
n: 65
AIC nd/1000: 900. AIC ud/1000: 100.
BIC nd/1000: 900. BIC ud/1000: 100.
n: 70
AIC nd/1000: 901. AIC ud/1000: 99.
BIC nd/1000: 901. BIC ud/1000: 99.
n: 75
AIC nd/1000: 914. AIC ud/1000: 86.
BIC nd/1000: 914. BIC ud/1000: 86.
n: 80
AIC nd/1000: 932. AIC ud/1000: 68.
BIC nd/1000: 932. BIC ud/1000: 68.
n: 85
AIC nd/1000: 935. AIC ud/1000: 65.
BIC nd/1000: 935. BIC ud/1000: 65.
n: 90
AIC nd/1000: 946. AIC ud/1000: 54.
BIC nd/1000: 946. BIC ud/1000: 54.
n: 95
AIC nd/1000: 952. AIC ud/1000: 48.
BIC nd/1000: 952. BIC ud/1000: 48.
n: 100
AIC nd/1000: 949. AIC ud/1000: 51.
BIC nd/1000: 949. BIC ud/1000: 51.
{{5,395.},{10,572.},{15,684.},{20,725.},{25,769.},{30,777.},{35,811.},{40,841.},{45,848.},{50,848.},{55,877.},{60,886.},{65,900.},{70,901.},{75,914.},{80,932.},{85,935.},{90,946.},{95,952.},{100,949.}}
Plot of output was shown above.
The answer here echos the results of a recent paper by Yafune et al. A Note on Sample Size Determination for Akaike Information Criterion (AIC) Approach to Clinical Data Analysis, which unfortunately is behind a paywall. Those authors state in their discussion that "AIC is generally used without paying attention to the probabilities corresponding to the power of statistical tests. Since AIC is usually used for exploratory analysis, it is often difficult to determine the sample sizes in advance. For such cases, it is desirable to investigate afterwards whether the sample sizes are large enough by checking the probabilities corresponding to the power of statistical tests. If the sample sizes are not large enough, it is possible that the AIC approach does not lead us to the conclusions which we seek."
To this we would only add that the sample sizes indicated in that paper can easily exceed 100 for a power of 0.8.
|
What is the actual significance of a difference in AIC or BIC values?
Suppose one generates values from a standard normal distribution, $\mathcal{N}(0,1)$. If we have only generated two values, $n=2$, then we have a discrete uniform distribution, not a convincingly disc
|
47,068
|
Inconsistent mgcv gam.check results
|
The issue is due to the basis dimension test used in gam.check() being based on permutations of model residuals. These permutations are computed using a pseudo random number generator; by design each time you call gam.check() (or directly k.check() itself), a different set of permutations are produced, which subtly alters the p-value of the permutation tests performed.
If you set the seed of the pseudo random number generator before calling gam.check() or k.check(), the results become consistent:
library(mgcv)
set.seed(0)
dat <- gamSim(1,n=200)
b <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat)
set.seed(1)
k.check(b)
set.seed(1)
k.check(b)
which produces:
> set.seed(1)
> k.check(b)
k' edf k-index p-value
s(x0) 9 2.318172 0.9959628 0.4950
s(x1) 9 2.305695 0.9693887 0.3225
s(x2) 9 7.654740 0.9605490 0.2825
s(x3) 9 1.232618 1.0372831 0.6850
> set.seed(1)
> k.check(b)
k' edf k-index p-value
s(x0) 9 2.318172 0.9959628 0.4950
s(x1) 9 2.305695 0.9693887 0.3225
s(x2) 9 7.654740 0.9605490 0.2825
s(x3) 9 1.232618 1.0372831 0.6850
If you do a greater number of permutations than the default n.rep = 400, then all else equal the p-value should start to stabilise, but this comes at much greater computational cost.
I would also tret the output from this test (certainly the p-value) as just a guide. In your instance, the EDF of the smooth is almost at it's maximum possible value. Regardless of what the p-value of the simple, heuristic test is, I'd want to increase k (double it to k = 20 in the s(...)` call in the formula) and see if the estimated smooth changes at all; does it use a larger EDF than the original fit?
|
Inconsistent mgcv gam.check results
|
The issue is due to the basis dimension test used in gam.check() being based on permutations of model residuals. These permutations are computed using a pseudo random number generator; by design each
|
Inconsistent mgcv gam.check results
The issue is due to the basis dimension test used in gam.check() being based on permutations of model residuals. These permutations are computed using a pseudo random number generator; by design each time you call gam.check() (or directly k.check() itself), a different set of permutations are produced, which subtly alters the p-value of the permutation tests performed.
If you set the seed of the pseudo random number generator before calling gam.check() or k.check(), the results become consistent:
library(mgcv)
set.seed(0)
dat <- gamSim(1,n=200)
b <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat)
set.seed(1)
k.check(b)
set.seed(1)
k.check(b)
which produces:
> set.seed(1)
> k.check(b)
k' edf k-index p-value
s(x0) 9 2.318172 0.9959628 0.4950
s(x1) 9 2.305695 0.9693887 0.3225
s(x2) 9 7.654740 0.9605490 0.2825
s(x3) 9 1.232618 1.0372831 0.6850
> set.seed(1)
> k.check(b)
k' edf k-index p-value
s(x0) 9 2.318172 0.9959628 0.4950
s(x1) 9 2.305695 0.9693887 0.3225
s(x2) 9 7.654740 0.9605490 0.2825
s(x3) 9 1.232618 1.0372831 0.6850
If you do a greater number of permutations than the default n.rep = 400, then all else equal the p-value should start to stabilise, but this comes at much greater computational cost.
I would also tret the output from this test (certainly the p-value) as just a guide. In your instance, the EDF of the smooth is almost at it's maximum possible value. Regardless of what the p-value of the simple, heuristic test is, I'd want to increase k (double it to k = 20 in the s(...)` call in the formula) and see if the estimated smooth changes at all; does it use a larger EDF than the original fit?
|
Inconsistent mgcv gam.check results
The issue is due to the basis dimension test used in gam.check() being based on permutations of model residuals. These permutations are computed using a pseudo random number generator; by design each
|
47,069
|
Deriving the canonical link for a binomial distribution
|
You're almost right, and it's such an easy fix:
$$\mu_i = p_i n$$ so $$\log(\frac{\mu_i}{n - \mu_i}) = \log(\frac{np_i}{n - np_i}) = ...$$
So, the $n$ can be a 1, as long as you swap out $\mu_i$ for $p_i$.
|
Deriving the canonical link for a binomial distribution
|
You're almost right, and it's such an easy fix:
$$\mu_i = p_i n$$ so $$\log(\frac{\mu_i}{n - \mu_i}) = \log(\frac{np_i}{n - np_i}) = ...$$
So, the $n$ can be a 1, as long as you swap out $\mu_i$ for $
|
Deriving the canonical link for a binomial distribution
You're almost right, and it's such an easy fix:
$$\mu_i = p_i n$$ so $$\log(\frac{\mu_i}{n - \mu_i}) = \log(\frac{np_i}{n - np_i}) = ...$$
So, the $n$ can be a 1, as long as you swap out $\mu_i$ for $p_i$.
|
Deriving the canonical link for a binomial distribution
You're almost right, and it's such an easy fix:
$$\mu_i = p_i n$$ so $$\log(\frac{\mu_i}{n - \mu_i}) = \log(\frac{np_i}{n - np_i}) = ...$$
So, the $n$ can be a 1, as long as you swap out $\mu_i$ for $
|
47,070
|
Autoregression in nlme - undestanding how to specify corAR1
|
The AR1 structure specifies that the correlations between the repeated measurements of each subject decrease with the time lag, i.e., the distance in time between the measurements.
When you specify lme(..., correlation = corAR1()) this is equivalent to lme(..., correlation = corAR1(form = ~ 1 | id)) and assumes that the measurements are equally spaced.
When instead you specify lme(..., correlation = corAR1(form = ~ time | id)) you use the time variable time to determine how far apart the measurements are, and define the time lag. Note, however, that corAR1() works with discrete time. There is also corCAR1() that works with continuous time.
|
Autoregression in nlme - undestanding how to specify corAR1
|
The AR1 structure specifies that the correlations between the repeated measurements of each subject decrease with the time lag, i.e., the distance in time between the measurements.
When you specify l
|
Autoregression in nlme - undestanding how to specify corAR1
The AR1 structure specifies that the correlations between the repeated measurements of each subject decrease with the time lag, i.e., the distance in time between the measurements.
When you specify lme(..., correlation = corAR1()) this is equivalent to lme(..., correlation = corAR1(form = ~ 1 | id)) and assumes that the measurements are equally spaced.
When instead you specify lme(..., correlation = corAR1(form = ~ time | id)) you use the time variable time to determine how far apart the measurements are, and define the time lag. Note, however, that corAR1() works with discrete time. There is also corCAR1() that works with continuous time.
|
Autoregression in nlme - undestanding how to specify corAR1
The AR1 structure specifies that the correlations between the repeated measurements of each subject decrease with the time lag, i.e., the distance in time between the measurements.
When you specify l
|
47,071
|
How to handle too many categorical features with too many categories for XGBoost?
|
There are possibly many ways to tackle this, depending on your data, feature cardinality, etc.:
After one-hot-encoding, it may turn out some new features are almost always zero and have negligible statistical significance and you can just drop them
Whole features (before encoding) may turn out to be insignificant
For some of your categorical features, ordering may actually make sense, like "small,medium,big". In such case, you can just use numerical encoding without increasing number of features
You can use binary encoding to reduce dimensionality. There already is an answered question that deals with a somehow similar topic: Binary Encoding vs One hot Encoding
Please refer for this great article for in-depth analysis of different encoding schemes and their performance: https://medium.com/data-design/visiting-categorical-features-and-encoding-in-decision-trees-53400fa65931
|
How to handle too many categorical features with too many categories for XGBoost?
|
There are possibly many ways to tackle this, depending on your data, feature cardinality, etc.:
After one-hot-encoding, it may turn out some new features are almost always zero and have negligible st
|
How to handle too many categorical features with too many categories for XGBoost?
There are possibly many ways to tackle this, depending on your data, feature cardinality, etc.:
After one-hot-encoding, it may turn out some new features are almost always zero and have negligible statistical significance and you can just drop them
Whole features (before encoding) may turn out to be insignificant
For some of your categorical features, ordering may actually make sense, like "small,medium,big". In such case, you can just use numerical encoding without increasing number of features
You can use binary encoding to reduce dimensionality. There already is an answered question that deals with a somehow similar topic: Binary Encoding vs One hot Encoding
Please refer for this great article for in-depth analysis of different encoding schemes and their performance: https://medium.com/data-design/visiting-categorical-features-and-encoding-in-decision-trees-53400fa65931
|
How to handle too many categorical features with too many categories for XGBoost?
There are possibly many ways to tackle this, depending on your data, feature cardinality, etc.:
After one-hot-encoding, it may turn out some new features are almost always zero and have negligible st
|
47,072
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
|
Almost two years later comes the longer answer: This is not a rigorous explanation but hopefully gives some intuition that the variance of the ML-estimator increases with the curvature of the log-likelihood (at least in the following simple example).
Assume that we have $m$ samples of size $n$ from $N(0, \sigma_1^2)$ and from $N(0, \sigma_2^2)$ where I pick $\sigma_1^2 = 1$ and $\sigma_2^2 = 2$.
The following graphs depict the log-likelihoods for these samples for $n = 20$ and $m=10$ (assuming we know the variance). The left side shows the samples for $\sigma_1^2$ and the right graph for
$\sigma_2^2$
Now the ML-estimator for one of these samples is the argmax of the respective function.
We can observe that:
The ML-estimators on the left side have less variance than the ML-estimators on the right side
The curvature of the graphs on the left side is considerable higher than the curvature on the right side.
So it seems to be that the curvature of the log-likelihood is inversely proportional to the variability of the ML-estimator.
So how can we make sense of this on an intuitive level?
If we consider the unimodal shape of the log-likelihood (which eventuall happens for most distributions once we have enough samples) the curvature of the log-likelihood gives an indication of how far away we can move from the best explanation of our current sample (i.e. the ML-estimate) and still get an almost as good as explanation (meaning a log-likelihood not much different). When we can move far away from our ML-estimate and still get a similarly good explanation, we should not be surprised to find out that in our next sample the best explanation is a very different one as in our current sample. If the curvature is very high and changes in paramters lead to a greater degree of explaindness (meaning log-likelihood) we would expect the best-guesses in other samples to be rather close to the best explanation for the current situation.
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
|
Almost two years later comes the longer answer: This is not a rigorous explanation but hopefully gives some intuition that the variance of the ML-estimator increases with the curvature of the log-like
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
Almost two years later comes the longer answer: This is not a rigorous explanation but hopefully gives some intuition that the variance of the ML-estimator increases with the curvature of the log-likelihood (at least in the following simple example).
Assume that we have $m$ samples of size $n$ from $N(0, \sigma_1^2)$ and from $N(0, \sigma_2^2)$ where I pick $\sigma_1^2 = 1$ and $\sigma_2^2 = 2$.
The following graphs depict the log-likelihoods for these samples for $n = 20$ and $m=10$ (assuming we know the variance). The left side shows the samples for $\sigma_1^2$ and the right graph for
$\sigma_2^2$
Now the ML-estimator for one of these samples is the argmax of the respective function.
We can observe that:
The ML-estimators on the left side have less variance than the ML-estimators on the right side
The curvature of the graphs on the left side is considerable higher than the curvature on the right side.
So it seems to be that the curvature of the log-likelihood is inversely proportional to the variability of the ML-estimator.
So how can we make sense of this on an intuitive level?
If we consider the unimodal shape of the log-likelihood (which eventuall happens for most distributions once we have enough samples) the curvature of the log-likelihood gives an indication of how far away we can move from the best explanation of our current sample (i.e. the ML-estimate) and still get an almost as good as explanation (meaning a log-likelihood not much different). When we can move far away from our ML-estimate and still get a similarly good explanation, we should not be surprised to find out that in our next sample the best explanation is a very different one as in our current sample. If the curvature is very high and changes in paramters lead to a greater degree of explaindness (meaning log-likelihood) we would expect the best-guesses in other samples to be rather close to the best explanation for the current situation.
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
Almost two years later comes the longer answer: This is not a rigorous explanation but hopefully gives some intuition that the variance of the ML-estimator increases with the curvature of the log-like
|
47,073
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
|
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
I think this video gives a neat intuition, as it discusses the Cramer Rao Bound and Fisher information in a simple case in which geometric intuitions still work.
https://www.youtube.com/watch?v=i0JiSddCXMM
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
|
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
I think this video gives a neat intuition, as it discusses the Cramer Rao Bound and Fisher information in a simple case in which geometric intuitions still work.
https://www.youtube.com/watch?v=i0JiSddCXMM
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
|
47,074
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
|
There is a certain correspondence between the variance of the estimator and the variance of the score or derivative of the likelihood. This becomes possibly more clear when we slightly rewrite the expression for the Cramer Rao bound instead of $\text{var}( \hat{\theta} ) \geq \frac{1}{I(\theta)}$ we can write it also as
$$\text{var}\left( \hat{\theta} \right) \cdot I(\theta) = \text{var}\left( \hat{\theta} \right) \cdot \text{var}\left( \frac{f^\prime({\bf x}; \theta)}{f({\bf x}; \theta)} \right) \geq 1 $$
where we use the notation with a prime to denote a derivative with $\theta$, ie. $f^\prime(x,\theta) = \partial f(x,\theta)/\partial \theta$
from this expression it might become clear where from this inverse gets into the equation. We can derive it as a limit for the product of the estimator variance and the score variance.
The background of the above inequality is more precisely related to how the change in the expectation value of the estimator relates to the variance of the estimator and the Fisher information matrix
$$\text{var}\left( \hat{\theta}({\bf x}) \right) \cdot \text{var}\left( \frac{f^\prime({\bf x}; \theta)}{f({\bf x}; \theta)} \right) \geq \left(\text{cov}\left(\hat\theta({\bf x}) , \frac{f^\prime({\bf x}; \theta)}{f({\bf x}; \theta)} \right)\right)^2 = \left(\frac{\partial E[\hat{\theta}]}{\partial\theta}\right)^2\underbrace{ = 1 \vphantom{\frac{\partial E[\hat{\theta}]}{\partial\theta}}}_{\substack{\llap{\text{for unbiased estima}} \rlap{\text{tors we have $E[\hat{\theta}] = \theta$}} \\ \llap{\text{and the deriv}} \rlap{\text{ative equals 1}}} }$$
This interaction between the $\hat{\theta}({\bf x})$ and the score $\frac{f^\prime({\bf x}; \theta)}{f({\bf x}; \theta)}$ can be seen as analogous to a torque in physics. The change of the estimator $\frac{\partial E[\hat{\theta}]}{\partial\theta}$ relates to the change of the density function (the force in the torque analogy) and the place where this change occurs (the distance/arm in the torque analogy).
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
|
There is a certain correspondence between the variance of the estimator and the variance of the score or derivative of the likelihood. This becomes possibly more clear when we slightly rewrite the exp
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
There is a certain correspondence between the variance of the estimator and the variance of the score or derivative of the likelihood. This becomes possibly more clear when we slightly rewrite the expression for the Cramer Rao bound instead of $\text{var}( \hat{\theta} ) \geq \frac{1}{I(\theta)}$ we can write it also as
$$\text{var}\left( \hat{\theta} \right) \cdot I(\theta) = \text{var}\left( \hat{\theta} \right) \cdot \text{var}\left( \frac{f^\prime({\bf x}; \theta)}{f({\bf x}; \theta)} \right) \geq 1 $$
where we use the notation with a prime to denote a derivative with $\theta$, ie. $f^\prime(x,\theta) = \partial f(x,\theta)/\partial \theta$
from this expression it might become clear where from this inverse gets into the equation. We can derive it as a limit for the product of the estimator variance and the score variance.
The background of the above inequality is more precisely related to how the change in the expectation value of the estimator relates to the variance of the estimator and the Fisher information matrix
$$\text{var}\left( \hat{\theta}({\bf x}) \right) \cdot \text{var}\left( \frac{f^\prime({\bf x}; \theta)}{f({\bf x}; \theta)} \right) \geq \left(\text{cov}\left(\hat\theta({\bf x}) , \frac{f^\prime({\bf x}; \theta)}{f({\bf x}; \theta)} \right)\right)^2 = \left(\frac{\partial E[\hat{\theta}]}{\partial\theta}\right)^2\underbrace{ = 1 \vphantom{\frac{\partial E[\hat{\theta}]}{\partial\theta}}}_{\substack{\llap{\text{for unbiased estima}} \rlap{\text{tors we have $E[\hat{\theta}] = \theta$}} \\ \llap{\text{and the deriv}} \rlap{\text{ative equals 1}}} }$$
This interaction between the $\hat{\theta}({\bf x})$ and the score $\frac{f^\prime({\bf x}; \theta)}{f({\bf x}; \theta)}$ can be seen as analogous to a torque in physics. The change of the estimator $\frac{\partial E[\hat{\theta}]}{\partial\theta}$ relates to the change of the density function (the force in the torque analogy) and the place where this change occurs (the distance/arm in the torque analogy).
|
Statistics : Why is the Cramer-Rao Lower Bound (CRLB) inverse of the Fisher Information I(θ) ?
There is a certain correspondence between the variance of the estimator and the variance of the score or derivative of the likelihood. This becomes possibly more clear when we slightly rewrite the exp
|
47,075
|
How to estimate probability density function (pdf) from empirical cumulative distribution function (ecdf)?
|
This is an outline rather than a complete answer. There are two main issues: (a) finding the data values used to make the ECDF plot, and (b) using a histogram and KDE methods to estimate the PDF.
Data for an example: Here is a simple demo in R for a sample with $n=100$ unique values from
$\mathsf{Norm}(\mu=50,\, \sigma = 7):$
set.seed(918); x = runif(25, 50, 7); sort(x)
set.seed(1234); x = rnorm(100, 50, 7); sort(x)
[1] 33.58012 34.73972 37.35778 38.59635 39.86257 40.26509 40.39389 40.61305 41.23610 41.55054
[11] 41.63830 41.82667 41.89534 42.02975 42.05774 42.23777 42.24877 42.51950 42.83441 42.89527
[21] 43.01129 43.03962 43.22040 43.44836 43.62163 43.76974 44.01245 44.13980 44.56622 44.58653
[31] 44.93493 45.03392 45.14396 45.31256 45.92547 45.97682 46.04884 46.17358 46.33320 46.42293
[41] 46.49119 46.52205 46.53092 46.56520 46.65965 46.67085 46.73872 46.81172 46.91616 47.18088
[51] 47.43433 47.78059 47.93994 48.03564 48.65884 48.75547 48.78349 48.81004 48.86383 48.92621
[61] 49.22800 49.62789 49.75668 49.89403 49.94677 50.04825 50.45121 50.93862 51.78637 51.80783
[71] 51.94200 52.35531 52.48885 53.00387 53.21713 53.54239 53.84998 53.94139 54.02329 54.53801
[81] 54.59612 54.88326 55.95163 56.14743 56.71646 56.81042 57.01059 57.59109 57.71608 59.30695
[91] 59.57479 60.14647 61.24137 61.53472 61.94175 62.43959 64.49190 64.84782 66.91085 67.84294
The ECDF plot is shown below:
plot.ecdf(x)
Finding data values. The fundamental idea is to reclaim the individual data values ('knots') at which the ECDF has jumps. If the ECDF was made using R, the knots can be found as follows:
Fn = ecdf(x); xr = knots(Fn); xr
[1] 33.58012 34.73972 37.35778 38.59635 39.86257 40.26509 40.39389 40.61305 41.23610 41.55054
[11] 41.63830 41.82667 41.89534 42.02975 42.05774 42.23777 42.24877 42.51950 42.83441 42.89527
[21] 43.01129 43.03962 43.22040 43.44836 43.62163 43.76974 44.01245 44.13980 44.56622 44.58653
..
[91] 59.57479 60.14647 61.24137 61.53472 61.94175 62.43959 64.49190 64.84782 66.91085 67.84294
If the information for the ECDF is not already in R, presumably you can find or estimate the individual values from the information you do have about the ECDF. If there are ties, a knot may represent multiple observations and the value should be repeated the appropriate number of times. [If you search online
with key words such as 'values of empirical distribution function' or 'finding ECDF values', you will find a variety of methods for reclaiming the original data values.]
Density estimation: Once the individual values are reclaimed or estimated, you can make a histogram on a density scale (so that the sum of the areas of the bars is unity), and
use 'kernel density estimation' (KDE) to 'smooth' the histogram.
hist(xr, prob=T, col="skyblue2")
lines(density(xr), type="l", col="red", lwd=2) # type is 'ell', not 'one'
curve(dnorm(x, 50, 7), add=T, lty="dotted")
The red curve in plot below shows the default KDE in R (at the default 'window' value). You can look at R documentation and the Wikipedia article for more
information on 'kernel density estimation'. [I have found the cited publications
of Bernard Silverman to be especially helpful.] The dotted line shows the
density of the normal distribution from which the data were sampled. [Generally speaking, for
very large samples the two density curves would be in better agreement.]
The figure below was made using a sample of 1000 from a normal distribution.
set.seed(918); y = rnorm(1000, 50, 7)
hist(y, prob=T, col="skyblue2")
lines(density(y), type="l", col="red", lwd=2)
curve(dnorm(x, 50, 7), add=T, lty="dotted")
|
How to estimate probability density function (pdf) from empirical cumulative distribution function (
|
This is an outline rather than a complete answer. There are two main issues: (a) finding the data values used to make the ECDF plot, and (b) using a histogram and KDE methods to estimate the PDF.
Data
|
How to estimate probability density function (pdf) from empirical cumulative distribution function (ecdf)?
This is an outline rather than a complete answer. There are two main issues: (a) finding the data values used to make the ECDF plot, and (b) using a histogram and KDE methods to estimate the PDF.
Data for an example: Here is a simple demo in R for a sample with $n=100$ unique values from
$\mathsf{Norm}(\mu=50,\, \sigma = 7):$
set.seed(918); x = runif(25, 50, 7); sort(x)
set.seed(1234); x = rnorm(100, 50, 7); sort(x)
[1] 33.58012 34.73972 37.35778 38.59635 39.86257 40.26509 40.39389 40.61305 41.23610 41.55054
[11] 41.63830 41.82667 41.89534 42.02975 42.05774 42.23777 42.24877 42.51950 42.83441 42.89527
[21] 43.01129 43.03962 43.22040 43.44836 43.62163 43.76974 44.01245 44.13980 44.56622 44.58653
[31] 44.93493 45.03392 45.14396 45.31256 45.92547 45.97682 46.04884 46.17358 46.33320 46.42293
[41] 46.49119 46.52205 46.53092 46.56520 46.65965 46.67085 46.73872 46.81172 46.91616 47.18088
[51] 47.43433 47.78059 47.93994 48.03564 48.65884 48.75547 48.78349 48.81004 48.86383 48.92621
[61] 49.22800 49.62789 49.75668 49.89403 49.94677 50.04825 50.45121 50.93862 51.78637 51.80783
[71] 51.94200 52.35531 52.48885 53.00387 53.21713 53.54239 53.84998 53.94139 54.02329 54.53801
[81] 54.59612 54.88326 55.95163 56.14743 56.71646 56.81042 57.01059 57.59109 57.71608 59.30695
[91] 59.57479 60.14647 61.24137 61.53472 61.94175 62.43959 64.49190 64.84782 66.91085 67.84294
The ECDF plot is shown below:
plot.ecdf(x)
Finding data values. The fundamental idea is to reclaim the individual data values ('knots') at which the ECDF has jumps. If the ECDF was made using R, the knots can be found as follows:
Fn = ecdf(x); xr = knots(Fn); xr
[1] 33.58012 34.73972 37.35778 38.59635 39.86257 40.26509 40.39389 40.61305 41.23610 41.55054
[11] 41.63830 41.82667 41.89534 42.02975 42.05774 42.23777 42.24877 42.51950 42.83441 42.89527
[21] 43.01129 43.03962 43.22040 43.44836 43.62163 43.76974 44.01245 44.13980 44.56622 44.58653
..
[91] 59.57479 60.14647 61.24137 61.53472 61.94175 62.43959 64.49190 64.84782 66.91085 67.84294
If the information for the ECDF is not already in R, presumably you can find or estimate the individual values from the information you do have about the ECDF. If there are ties, a knot may represent multiple observations and the value should be repeated the appropriate number of times. [If you search online
with key words such as 'values of empirical distribution function' or 'finding ECDF values', you will find a variety of methods for reclaiming the original data values.]
Density estimation: Once the individual values are reclaimed or estimated, you can make a histogram on a density scale (so that the sum of the areas of the bars is unity), and
use 'kernel density estimation' (KDE) to 'smooth' the histogram.
hist(xr, prob=T, col="skyblue2")
lines(density(xr), type="l", col="red", lwd=2) # type is 'ell', not 'one'
curve(dnorm(x, 50, 7), add=T, lty="dotted")
The red curve in plot below shows the default KDE in R (at the default 'window' value). You can look at R documentation and the Wikipedia article for more
information on 'kernel density estimation'. [I have found the cited publications
of Bernard Silverman to be especially helpful.] The dotted line shows the
density of the normal distribution from which the data were sampled. [Generally speaking, for
very large samples the two density curves would be in better agreement.]
The figure below was made using a sample of 1000 from a normal distribution.
set.seed(918); y = rnorm(1000, 50, 7)
hist(y, prob=T, col="skyblue2")
lines(density(y), type="l", col="red", lwd=2)
curve(dnorm(x, 50, 7), add=T, lty="dotted")
|
How to estimate probability density function (pdf) from empirical cumulative distribution function (
This is an outline rather than a complete answer. There are two main issues: (a) finding the data values used to make the ECDF plot, and (b) using a histogram and KDE methods to estimate the PDF.
Data
|
47,076
|
Interpreting a matrix calculation
|
Consider the random variable $$y = c^T x$$Then the mean of $y$ is
$$E(y) = c^T E(x) = c^T \mu$$
and variance of $y$ is
$$var(y) = E(y - c^T \mu)^2 = E(y^2) - (c^T \mu)^2 = E(y^2) + c^T \mu\mu^T c \tag{*}$$
But
$$y^2 = (c^Tx)^2 = c^Tx c^Tx= c^Txx^Tc$$
So $$E(y^2) = c^TE(xx^T)c = c^T(\Sigma - \mu\mu^T)c \tag{**}$$
Replace $(**)$ is $(*)$, we get
$$var(y) = c^T\Sigma c$$
Let $z$ be a standard version of $y$, i.e.
$$z = \frac{y - E(y)}{var(y)} = \frac{c^Tx - c^T\mu}{c^T\Sigma c} = c^T(x - \mu)(c^T\Sigma c)^{-1} $$
So, you have computed the $z$ here.
|
Interpreting a matrix calculation
|
Consider the random variable $$y = c^T x$$Then the mean of $y$ is
$$E(y) = c^T E(x) = c^T \mu$$
and variance of $y$ is
$$var(y) = E(y - c^T \mu)^2 = E(y^2) - (c^T \mu)^2 = E(y^2) + c^T \mu\mu^T c \ta
|
Interpreting a matrix calculation
Consider the random variable $$y = c^T x$$Then the mean of $y$ is
$$E(y) = c^T E(x) = c^T \mu$$
and variance of $y$ is
$$var(y) = E(y - c^T \mu)^2 = E(y^2) - (c^T \mu)^2 = E(y^2) + c^T \mu\mu^T c \tag{*}$$
But
$$y^2 = (c^Tx)^2 = c^Tx c^Tx= c^Txx^Tc$$
So $$E(y^2) = c^TE(xx^T)c = c^T(\Sigma - \mu\mu^T)c \tag{**}$$
Replace $(**)$ is $(*)$, we get
$$var(y) = c^T\Sigma c$$
Let $z$ be a standard version of $y$, i.e.
$$z = \frac{y - E(y)}{var(y)} = \frac{c^Tx - c^T\mu}{c^T\Sigma c} = c^T(x - \mu)(c^T\Sigma c)^{-1} $$
So, you have computed the $z$ here.
|
Interpreting a matrix calculation
Consider the random variable $$y = c^T x$$Then the mean of $y$ is
$$E(y) = c^T E(x) = c^T \mu$$
and variance of $y$ is
$$var(y) = E(y - c^T \mu)^2 = E(y^2) - (c^T \mu)^2 = E(y^2) + c^T \mu\mu^T c \ta
|
47,077
|
How to test if two RMSE are significantly different?
|
To test whether two (root) mean squared prediction errors are significantly different, the standard test is the Diebold-Mariano test (Diebold & Mariano, 1995, Journal of Business and Econonomic Statistics). We have a diebold-mariano tag, which may be useful. I also recommend Diebold's (2015, Journal of Business and Econonomic Statistics) personal perspective on uses and abuses twenty years later.
|
How to test if two RMSE are significantly different?
|
To test whether two (root) mean squared prediction errors are significantly different, the standard test is the Diebold-Mariano test (Diebold & Mariano, 1995, Journal of Business and Econonomic Statis
|
How to test if two RMSE are significantly different?
To test whether two (root) mean squared prediction errors are significantly different, the standard test is the Diebold-Mariano test (Diebold & Mariano, 1995, Journal of Business and Econonomic Statistics). We have a diebold-mariano tag, which may be useful. I also recommend Diebold's (2015, Journal of Business and Econonomic Statistics) personal perspective on uses and abuses twenty years later.
|
How to test if two RMSE are significantly different?
To test whether two (root) mean squared prediction errors are significantly different, the standard test is the Diebold-Mariano test (Diebold & Mariano, 1995, Journal of Business and Econonomic Statis
|
47,078
|
RNN vs Convolution 1D
|
Yes the interpretation of the dimensions is pretty similar in both cases.
An important case where RNNs are easier to use is with data of unknown lengths. For example, in sentence translation (e.g. translating Chinese to Icelandic) both the input and output sizes are dynamic. In this case, it is easier and more intuitive to use RNNs than to try and shoehorn in CNNs.
If instead your task is closer to classification of fixed length sequences your intuition seems correct. In my experience, usually 1D CNNs are faster to train and perform better in this case.
|
RNN vs Convolution 1D
|
Yes the interpretation of the dimensions is pretty similar in both cases.
An important case where RNNs are easier to use is with data of unknown lengths. For example, in sentence translation (e.g. tr
|
RNN vs Convolution 1D
Yes the interpretation of the dimensions is pretty similar in both cases.
An important case where RNNs are easier to use is with data of unknown lengths. For example, in sentence translation (e.g. translating Chinese to Icelandic) both the input and output sizes are dynamic. In this case, it is easier and more intuitive to use RNNs than to try and shoehorn in CNNs.
If instead your task is closer to classification of fixed length sequences your intuition seems correct. In my experience, usually 1D CNNs are faster to train and perform better in this case.
|
RNN vs Convolution 1D
Yes the interpretation of the dimensions is pretty similar in both cases.
An important case where RNNs are easier to use is with data of unknown lengths. For example, in sentence translation (e.g. tr
|
47,079
|
Bootstrap confidence intervals - how many replications to choose?
|
Why does it make sense to perform a bootstrap procedure before calculating the confidence intervals? Will they be more precise? And if so, can anyone explain why?
You can calculate bootstrap confidence intervals for complex situations, i.e. properties ("statistics") that are not easily accessible analytically. I'm thinking of things like bootstrapping generalization error of a predictive model*.
In other words, bootstrapping may still be possible in situations where you have no good assumption which distribution to base your confidence intervals on.
The choice parametric (analytical confidence interval based on known distribution) vs. non-parametric bootstrap is a trade-off:
good parametric statistics will be more precise. But they may be totally off if the assumptions are violated (i.e. the distribution you chose was not appropriate).
bootstrap is less precise (for a given number of original cases) but does not rely on particular distribution assumptions, so there's less danger of getting that part wrong*.
How can I decide which number of replications is a good number for calculating confidence intervalls? 100? 1000? 10000?
@MartenBuuis already gave you some idea how to approach this question. Here's another, very pragmatic one:
Bootstrap, say, with nboot = 100 replications.
repeat this 10 times
check variability of the bootstrap results.
if the variation you observe over the repetitions of the bootstrapping calculation is acceptable for your application, fuse the 10x100 calculations and use the result of that nboot = 10x100 = 1000 replications.
If they are not sufficiently precise, fuse the 10x100 calculations, go back to step 1 and 2 with nboot = 1000 replications.
You get the idea.
|
Bootstrap confidence intervals - how many replications to choose?
|
Why does it make sense to perform a bootstrap procedure before calculating the confidence intervals? Will they be more precise? And if so, can anyone explain why?
You can calculate bootstrap confide
|
Bootstrap confidence intervals - how many replications to choose?
Why does it make sense to perform a bootstrap procedure before calculating the confidence intervals? Will they be more precise? And if so, can anyone explain why?
You can calculate bootstrap confidence intervals for complex situations, i.e. properties ("statistics") that are not easily accessible analytically. I'm thinking of things like bootstrapping generalization error of a predictive model*.
In other words, bootstrapping may still be possible in situations where you have no good assumption which distribution to base your confidence intervals on.
The choice parametric (analytical confidence interval based on known distribution) vs. non-parametric bootstrap is a trade-off:
good parametric statistics will be more precise. But they may be totally off if the assumptions are violated (i.e. the distribution you chose was not appropriate).
bootstrap is less precise (for a given number of original cases) but does not rely on particular distribution assumptions, so there's less danger of getting that part wrong*.
How can I decide which number of replications is a good number for calculating confidence intervalls? 100? 1000? 10000?
@MartenBuuis already gave you some idea how to approach this question. Here's another, very pragmatic one:
Bootstrap, say, with nboot = 100 replications.
repeat this 10 times
check variability of the bootstrap results.
if the variation you observe over the repetitions of the bootstrapping calculation is acceptable for your application, fuse the 10x100 calculations and use the result of that nboot = 10x100 = 1000 replications.
If they are not sufficiently precise, fuse the 10x100 calculations, go back to step 1 and 2 with nboot = 1000 replications.
You get the idea.
|
Bootstrap confidence intervals - how many replications to choose?
Why does it make sense to perform a bootstrap procedure before calculating the confidence intervals? Will they be more precise? And if so, can anyone explain why?
You can calculate bootstrap confide
|
47,080
|
Bootstrap confidence intervals - how many replications to choose?
|
Let's take the simplest case of using just the percentiles to compute the confidence interval. In that case you repeatedly sample with replacement from your data, compute your statistic in each of these samples and store those estimates. The 2.5th percentile of those stored estimates represents the lower bound and the 97.5th percentile the upper bound of a 95% confidence interval.
If you have 200 replications that lower bound will be based on the 5th smallest estimate and the highest on the 5th highest. That will be way too small for my taste. My default is 20,000 replications, so the lower bound would be based on the 500th smallest estimate and the upper bound on the 500th largest estimate. The default is nothing but a starting point, and I will often choose another number depending on the exact circumstances.
|
Bootstrap confidence intervals - how many replications to choose?
|
Let's take the simplest case of using just the percentiles to compute the confidence interval. In that case you repeatedly sample with replacement from your data, compute your statistic in each of the
|
Bootstrap confidence intervals - how many replications to choose?
Let's take the simplest case of using just the percentiles to compute the confidence interval. In that case you repeatedly sample with replacement from your data, compute your statistic in each of these samples and store those estimates. The 2.5th percentile of those stored estimates represents the lower bound and the 97.5th percentile the upper bound of a 95% confidence interval.
If you have 200 replications that lower bound will be based on the 5th smallest estimate and the highest on the 5th highest. That will be way too small for my taste. My default is 20,000 replications, so the lower bound would be based on the 500th smallest estimate and the upper bound on the 500th largest estimate. The default is nothing but a starting point, and I will often choose another number depending on the exact circumstances.
|
Bootstrap confidence intervals - how many replications to choose?
Let's take the simplest case of using just the percentiles to compute the confidence interval. In that case you repeatedly sample with replacement from your data, compute your statistic in each of the
|
47,081
|
Bootstrap confidence intervals - how many replications to choose?
|
According to Efron (the "inventor" of the boostrap technique), you should make 1600 replicas. I have no other clue about where this number comes from, except that its square root is 40, an easy number to divide by. I suggest you go like in any other Monte-Carlo. Try 1600, then increase the bootstrap samples until it stabilizes.
The bootstrap was introduced to compute confidence intervals in case the distribution of the v.a.r is unknown or not technically computable, because of outliers or skew. The bootstrap replaces the theoretical computations of the confidence interval by a measure of simulated samples. So the confidence intervals should be the same.
Note however that all statistical indicators are not equal in front of he boostrap. A average (or a mean) will require less samples than a maximum, or a 1% percentile for example.
|
Bootstrap confidence intervals - how many replications to choose?
|
According to Efron (the "inventor" of the boostrap technique), you should make 1600 replicas. I have no other clue about where this number comes from, except that its square root is 40, an easy number
|
Bootstrap confidence intervals - how many replications to choose?
According to Efron (the "inventor" of the boostrap technique), you should make 1600 replicas. I have no other clue about where this number comes from, except that its square root is 40, an easy number to divide by. I suggest you go like in any other Monte-Carlo. Try 1600, then increase the bootstrap samples until it stabilizes.
The bootstrap was introduced to compute confidence intervals in case the distribution of the v.a.r is unknown or not technically computable, because of outliers or skew. The bootstrap replaces the theoretical computations of the confidence interval by a measure of simulated samples. So the confidence intervals should be the same.
Note however that all statistical indicators are not equal in front of he boostrap. A average (or a mean) will require less samples than a maximum, or a 1% percentile for example.
|
Bootstrap confidence intervals - how many replications to choose?
According to Efron (the "inventor" of the boostrap technique), you should make 1600 replicas. I have no other clue about where this number comes from, except that its square root is 40, an easy number
|
47,082
|
Bootstrap confidence intervals - how many replications to choose?
|
1. Bootstrap before calculating CIs
Not sure if I understood your question correctly, but if you were asking, ‘Should I be using bootstrap to compute the CIs’, then, the missing part of the question is, ‘bootstrap instead of what’, ‘more precise’ – ‘precise compared to what and in which sense’.
There are multiple ways to construct the CIs:
Make an assumption about the sampling distribution of the estimator the for every sample size $n$. This is a very strong assumption; however, people have done it many times in the past: they often assume the $t$ distribution (for sample sizes at least 2). This is the classical frequentist (Fisher) inference.
Assume that nothing is known anything about the sampling distribution for any given $n$, but as $n \to\infty$, you know the distribution: $n^q (\hat \theta_n - \theta_0) \xrightarrow[n\to\infty]{d} \mathcal{N}(0, V)$, where $q$ is the rate of convergence ($q=1/2$ for most parametric estimators, $q = 1/5$ or lower for non-parametric ones, $q=2/5$ for the smoothed Manski estimator etc.). Then, you just look up the table of Gaussian critical values. The problem is, estimating $V$ is sometimes non-trivial.
Estimate the critical value by bootstrapping. This is where the consistency of bootstrap is required (i.e. no parameter on the boundary of the parameter space, the same rate of convergence of the original and bootstrap estimators etc. – in general, the failure of $\sup_{u\in \mathbb{R}} |\mathrm{CDF}_{\sqrt{n}(\hat\theta^*_n - \hat\theta_n)} (u) - \mathrm{CDF}_{\sqrt{n}(\hat\theta_n - \theta_0)} (u)| \xrightarrow[n\to\infty]{\mathbb{P}} 0$ (in Efron’s notation), which can happen due to a multitude of reasons).
So if bootstrap works in the sense of the (rather technical) condition described above, then, depending on some extra conditions (such as requiring finite estimator variances), it can beat the asymptotic confidence intervals (as well as the variance estimators, $p$-values – basically, any functional of the estimator distribution) in the sense of the approximation error. Assume that $\mathbb{E} (\hat\theta_n - \theta_0)^2 < \infty$ (which rules out certain estimators, like the IV estimator that is the ratio of two Gaussians) and that the sampling distribution of $\hat\theta_n$ is symmetrical. Then, bootstrap is ‘better’ in the following sense:
$$\sup_{u\in \mathbb{R}} |\mathrm{CDF}_{\sqrt{n}(\hat\theta_n - \hat\theta_0) / \mathrm{SE} \hat\theta_n} (u) - \Phi(u)| = O(1/\sqrt{n}),$$
$$\sup_{u\in \mathbb{R}} |\mathrm{CDF}_{\sqrt{n}(\hat\theta_n^* - \hat\theta_n) / \mathrm{SE}^* \hat\theta^*_n} (u) - \mathrm{CDF}_{\sqrt{n}(\hat\theta_n - \theta_0) / \mathrm{SE} \hat\theta_n} (u)| = O_p(1/n),$$
where $\Phi$ is the CDF of the standard normal distribution.
Or course it does not guarantee that the capital O in a specific given application is not going to bring the refinement, and of course, depending on the smoothness of the bootstrapped quantity (bias, or variance, or CI, or p-value) and the bootstrap type, the refinement may or may not exist – however, if you are worrying that the bootstrap is going to be less reliable than asymptotic confidence intervals – probably not. Bootstrap does a much better job on reproducing the shape of the sampling distribution (on which one should really be doing inference), which is why if your method belongs to a broad class of estimators for which bootstrap works and you can afford running the bootstrap sufficiently many times, then, bootstrap should be more trustworthy in the sense of capturing the extra moments of the sampling distribution uncertainty (as opposed to the first 2 moments of the asymptotic Gaussian approximation). Depending on how poorly the Weak Law of Large Numbers is working when the numbers are not large enough, bootstrap may simply unveil it to the researcher.
NB. Bootstrap is an asymptotic method in the sense that it still relies in most aspects on the number of observations $n \to \infty$. Bootstrap does not improve theoretical properties of statistical tests, and if $n=8$, the question would be, ‘is scientific method really applicable?’ or ‘aren’t we making conclusions about random data features, not the true underlying relationships?’. If the theoretical power of one’s test is low or there are extra complications in the form of departures from the ‘randomised controlled trial’ setting (as well as ‘independent identically distributed’), bootstrap won’t help, and the paper will be rejected.
2.1 Number of replications (practical advice)
A large number of replications B is required to say that the finite-sample Monte-Carlo approximation replicates the asymptotic (in B) bootstrap distribution of the object of interest closely enough. This means that there is no penalty (other than increased computation time) to doing more replications in one experimental setting. Unless one is studying the theoretical properties of bootstrap (e.g. nested bootstrap, second-order bootstrap, bootstrapping new estimators etc.), then, the infallible rule is ‘more is better’.
In case one does not have deep bootstrap knowledge, here is a quick recommendation (that should hopefully stay relevant for another decade).
B >= 1000, otherwise your paper will be rejected with something like ‘We are not in the Pentium-II era’ from Referee 2.
Ideally, B >= 10000; try to do it if your computer can handle it.
Here is where most researchers may stop. However, if the researcher suspects that their sampling distribution may be irregular and discrepancies between the true and simulated distribution are large, then, we may check some features of the bootstrap distribution to determine how close we are to it (as a function of $B$). The seminal paper is Andrews & Buchinsky (2000, Econometrica). Here are the extra steps to make any picky referee shut up:
You could check if your B yields the desired probability $1-\tau$ of achieving the desired relative accuracy $r$ of the bootstrapped quantity of interest for some common level (e.g. $r= 5\%$ and $\tau=5\%$).
If not, increase B to the value dictated by the A&B 3-stage procedure described below.
In general, for any actual accuracy of your bootstrapped quantity, to increase the desired relative accuracy by a factor of k, increase B by a factor of $k^2$.
2.2 A data-driven theory-backed procedure
There is a data-driven method of choosing B: do some small number of bootstrap replications, see how stable or noisy the estimator is, and then, based on some target accuracy measure, increase the number of replications until you are sure that this resampling-related error has reached a certain lower bound with a chosen certainty. Our helper here is the Weak Law of Large Numbers where the asymptotics are in B. To be more specific, B is chosen depending on the user-chosen bound on the relative deviation measure of the Monte-Carlo approximation of the quantity of interest based on B simulations. This quantity can be standard error, p-value, confidence interval, or bias correction. The closeness is the relative deviation $R^*$ of the B-replication bootstrap quantity from the infinite-replication quantity (or, to be more precise, the one that requires $n^n$ replications): $R^* := (\hat\lambda_B - \hat\lambda_\infty)/\hat\lambda_\infty$. The idea is, find such B that the actual relative deviation of the statistic of interest be less than a chosen bound (usually 5%, 10%, 15%) with a specified high probability $1-\tau$ (usually $\tau = 5\%$ or $10\%$). Then,
$$\sqrt{B} \cdot R^* \xrightarrow{d} \mathcal{N}(0, \omega),$$
where $\omega$ can be estimated using a relatively small (usually 200–300) preliminary bootstrap sample that one should be doing in any case.
Here is the general formula for the number of necessary bootstrap replications $B$:
$$B \ge \omega \cdot (Q_{\mathcal{N}(0, 1)}(1-\tau/2) / r)^2,$$
where r is the maximum allowed relative discrepancy (i.e. accuracy), $1-\tau$ is the probability that this desired relative accuracy bound has been achieved, $Q_{\mathcal{N}(0, 1)}$ is the quantile function of the standard Gaussian distribution, and $\omega$ is the asymptotic variance of $R$*. The only unknown quantity here is $\omega$ that represents the variance due to simulation randomness.
The general 3-step procedure for choosing B is like this:
Compute the approximate preliminary number $B_1 := \lceil \omega_1 (Q_{\mathcal{N}(0, 1)}(1-\tau/2) / r)^2 \rceil$, where $\omega_1$ is a very simple theoretical formula from Table III in Andrews & Buchinsky (2000, Econometrica).
Using these $B_1$ samples, compute an improved estimate $\hat\omega_{B_1}$ using a formula from Table IV (ibid.).
With this $\hat\omega_{B_1}$ compute $B_2 := \lceil\hat\omega_{B_1} (Q_{\mathcal{N}(0, 1)}(1-\tau/2) / r)^2 \rceil$ and take $B_{\mathrm{opt}} := \max(B_1, B_2)$.
If necessary, this procedure can be iterated to improve the estimate of $\omega$, but this 3-step procedure as it is tends to yield already conservative estimates that ensure that the desired accuracy has been achieved. This approach can be vulgarised by taking some fixed $B_1 = 1000$, doing 1000 bootstrap replications in any case, and then, doing steps 2 and 3 to compute $\hat\omega_{B_1}$ and $B_2$.
Example (Table V, ibid.): to compute a bootstrap 95% CI for the linear regression coefficients, in most practical settings, to be 90% sure that the relative CI length discrepancy does not exceed 10%, 700 replications are sufficient in half of the cases, and to be 95% sure, 850 replications. However, requiring a smaller relative error (5%) increases B to 2000 for $\tau=10\%$ and to 2700 for $\tau=5\%$.
This agrees with the formula for B above. If one seeks to reduce the relative discrepancy r, by a factor of k, the optimal B goes up roughly by a factor of $k^2$, whilst increasing the confidence level that the desired closeness is reached merely changes the critical value of the standard normal (1.96 → 2.57 for 95% → 99% confidence).
|
Bootstrap confidence intervals - how many replications to choose?
|
1. Bootstrap before calculating CIs
Not sure if I understood your question correctly, but if you were asking, ‘Should I be using bootstrap to compute the CIs’, then, the missing part of the question i
|
Bootstrap confidence intervals - how many replications to choose?
1. Bootstrap before calculating CIs
Not sure if I understood your question correctly, but if you were asking, ‘Should I be using bootstrap to compute the CIs’, then, the missing part of the question is, ‘bootstrap instead of what’, ‘more precise’ – ‘precise compared to what and in which sense’.
There are multiple ways to construct the CIs:
Make an assumption about the sampling distribution of the estimator the for every sample size $n$. This is a very strong assumption; however, people have done it many times in the past: they often assume the $t$ distribution (for sample sizes at least 2). This is the classical frequentist (Fisher) inference.
Assume that nothing is known anything about the sampling distribution for any given $n$, but as $n \to\infty$, you know the distribution: $n^q (\hat \theta_n - \theta_0) \xrightarrow[n\to\infty]{d} \mathcal{N}(0, V)$, where $q$ is the rate of convergence ($q=1/2$ for most parametric estimators, $q = 1/5$ or lower for non-parametric ones, $q=2/5$ for the smoothed Manski estimator etc.). Then, you just look up the table of Gaussian critical values. The problem is, estimating $V$ is sometimes non-trivial.
Estimate the critical value by bootstrapping. This is where the consistency of bootstrap is required (i.e. no parameter on the boundary of the parameter space, the same rate of convergence of the original and bootstrap estimators etc. – in general, the failure of $\sup_{u\in \mathbb{R}} |\mathrm{CDF}_{\sqrt{n}(\hat\theta^*_n - \hat\theta_n)} (u) - \mathrm{CDF}_{\sqrt{n}(\hat\theta_n - \theta_0)} (u)| \xrightarrow[n\to\infty]{\mathbb{P}} 0$ (in Efron’s notation), which can happen due to a multitude of reasons).
So if bootstrap works in the sense of the (rather technical) condition described above, then, depending on some extra conditions (such as requiring finite estimator variances), it can beat the asymptotic confidence intervals (as well as the variance estimators, $p$-values – basically, any functional of the estimator distribution) in the sense of the approximation error. Assume that $\mathbb{E} (\hat\theta_n - \theta_0)^2 < \infty$ (which rules out certain estimators, like the IV estimator that is the ratio of two Gaussians) and that the sampling distribution of $\hat\theta_n$ is symmetrical. Then, bootstrap is ‘better’ in the following sense:
$$\sup_{u\in \mathbb{R}} |\mathrm{CDF}_{\sqrt{n}(\hat\theta_n - \hat\theta_0) / \mathrm{SE} \hat\theta_n} (u) - \Phi(u)| = O(1/\sqrt{n}),$$
$$\sup_{u\in \mathbb{R}} |\mathrm{CDF}_{\sqrt{n}(\hat\theta_n^* - \hat\theta_n) / \mathrm{SE}^* \hat\theta^*_n} (u) - \mathrm{CDF}_{\sqrt{n}(\hat\theta_n - \theta_0) / \mathrm{SE} \hat\theta_n} (u)| = O_p(1/n),$$
where $\Phi$ is the CDF of the standard normal distribution.
Or course it does not guarantee that the capital O in a specific given application is not going to bring the refinement, and of course, depending on the smoothness of the bootstrapped quantity (bias, or variance, or CI, or p-value) and the bootstrap type, the refinement may or may not exist – however, if you are worrying that the bootstrap is going to be less reliable than asymptotic confidence intervals – probably not. Bootstrap does a much better job on reproducing the shape of the sampling distribution (on which one should really be doing inference), which is why if your method belongs to a broad class of estimators for which bootstrap works and you can afford running the bootstrap sufficiently many times, then, bootstrap should be more trustworthy in the sense of capturing the extra moments of the sampling distribution uncertainty (as opposed to the first 2 moments of the asymptotic Gaussian approximation). Depending on how poorly the Weak Law of Large Numbers is working when the numbers are not large enough, bootstrap may simply unveil it to the researcher.
NB. Bootstrap is an asymptotic method in the sense that it still relies in most aspects on the number of observations $n \to \infty$. Bootstrap does not improve theoretical properties of statistical tests, and if $n=8$, the question would be, ‘is scientific method really applicable?’ or ‘aren’t we making conclusions about random data features, not the true underlying relationships?’. If the theoretical power of one’s test is low or there are extra complications in the form of departures from the ‘randomised controlled trial’ setting (as well as ‘independent identically distributed’), bootstrap won’t help, and the paper will be rejected.
2.1 Number of replications (practical advice)
A large number of replications B is required to say that the finite-sample Monte-Carlo approximation replicates the asymptotic (in B) bootstrap distribution of the object of interest closely enough. This means that there is no penalty (other than increased computation time) to doing more replications in one experimental setting. Unless one is studying the theoretical properties of bootstrap (e.g. nested bootstrap, second-order bootstrap, bootstrapping new estimators etc.), then, the infallible rule is ‘more is better’.
In case one does not have deep bootstrap knowledge, here is a quick recommendation (that should hopefully stay relevant for another decade).
B >= 1000, otherwise your paper will be rejected with something like ‘We are not in the Pentium-II era’ from Referee 2.
Ideally, B >= 10000; try to do it if your computer can handle it.
Here is where most researchers may stop. However, if the researcher suspects that their sampling distribution may be irregular and discrepancies between the true and simulated distribution are large, then, we may check some features of the bootstrap distribution to determine how close we are to it (as a function of $B$). The seminal paper is Andrews & Buchinsky (2000, Econometrica). Here are the extra steps to make any picky referee shut up:
You could check if your B yields the desired probability $1-\tau$ of achieving the desired relative accuracy $r$ of the bootstrapped quantity of interest for some common level (e.g. $r= 5\%$ and $\tau=5\%$).
If not, increase B to the value dictated by the A&B 3-stage procedure described below.
In general, for any actual accuracy of your bootstrapped quantity, to increase the desired relative accuracy by a factor of k, increase B by a factor of $k^2$.
2.2 A data-driven theory-backed procedure
There is a data-driven method of choosing B: do some small number of bootstrap replications, see how stable or noisy the estimator is, and then, based on some target accuracy measure, increase the number of replications until you are sure that this resampling-related error has reached a certain lower bound with a chosen certainty. Our helper here is the Weak Law of Large Numbers where the asymptotics are in B. To be more specific, B is chosen depending on the user-chosen bound on the relative deviation measure of the Monte-Carlo approximation of the quantity of interest based on B simulations. This quantity can be standard error, p-value, confidence interval, or bias correction. The closeness is the relative deviation $R^*$ of the B-replication bootstrap quantity from the infinite-replication quantity (or, to be more precise, the one that requires $n^n$ replications): $R^* := (\hat\lambda_B - \hat\lambda_\infty)/\hat\lambda_\infty$. The idea is, find such B that the actual relative deviation of the statistic of interest be less than a chosen bound (usually 5%, 10%, 15%) with a specified high probability $1-\tau$ (usually $\tau = 5\%$ or $10\%$). Then,
$$\sqrt{B} \cdot R^* \xrightarrow{d} \mathcal{N}(0, \omega),$$
where $\omega$ can be estimated using a relatively small (usually 200–300) preliminary bootstrap sample that one should be doing in any case.
Here is the general formula for the number of necessary bootstrap replications $B$:
$$B \ge \omega \cdot (Q_{\mathcal{N}(0, 1)}(1-\tau/2) / r)^2,$$
where r is the maximum allowed relative discrepancy (i.e. accuracy), $1-\tau$ is the probability that this desired relative accuracy bound has been achieved, $Q_{\mathcal{N}(0, 1)}$ is the quantile function of the standard Gaussian distribution, and $\omega$ is the asymptotic variance of $R$*. The only unknown quantity here is $\omega$ that represents the variance due to simulation randomness.
The general 3-step procedure for choosing B is like this:
Compute the approximate preliminary number $B_1 := \lceil \omega_1 (Q_{\mathcal{N}(0, 1)}(1-\tau/2) / r)^2 \rceil$, where $\omega_1$ is a very simple theoretical formula from Table III in Andrews & Buchinsky (2000, Econometrica).
Using these $B_1$ samples, compute an improved estimate $\hat\omega_{B_1}$ using a formula from Table IV (ibid.).
With this $\hat\omega_{B_1}$ compute $B_2 := \lceil\hat\omega_{B_1} (Q_{\mathcal{N}(0, 1)}(1-\tau/2) / r)^2 \rceil$ and take $B_{\mathrm{opt}} := \max(B_1, B_2)$.
If necessary, this procedure can be iterated to improve the estimate of $\omega$, but this 3-step procedure as it is tends to yield already conservative estimates that ensure that the desired accuracy has been achieved. This approach can be vulgarised by taking some fixed $B_1 = 1000$, doing 1000 bootstrap replications in any case, and then, doing steps 2 and 3 to compute $\hat\omega_{B_1}$ and $B_2$.
Example (Table V, ibid.): to compute a bootstrap 95% CI for the linear regression coefficients, in most practical settings, to be 90% sure that the relative CI length discrepancy does not exceed 10%, 700 replications are sufficient in half of the cases, and to be 95% sure, 850 replications. However, requiring a smaller relative error (5%) increases B to 2000 for $\tau=10\%$ and to 2700 for $\tau=5\%$.
This agrees with the formula for B above. If one seeks to reduce the relative discrepancy r, by a factor of k, the optimal B goes up roughly by a factor of $k^2$, whilst increasing the confidence level that the desired closeness is reached merely changes the critical value of the standard normal (1.96 → 2.57 for 95% → 99% confidence).
|
Bootstrap confidence intervals - how many replications to choose?
1. Bootstrap before calculating CIs
Not sure if I understood your question correctly, but if you were asking, ‘Should I be using bootstrap to compute the CIs’, then, the missing part of the question i
|
47,083
|
In a linear regression, should I include independent variables that is already known to be predictive of the dependent variable?
|
$$ \text{profit} = (\text{price}-\text{cost})\times\text{sales}. $$
I don't think it makes sense to regress profit on price or cost. Or sales, for that matter. We know the relationship above.
Instead, work on understanding the three drivers above. For instance, as a first approximation, you can treat cost as fixed, since you may only get to negotiate it in the medium term. That leaves us with your selling price and sales.
And of course price will have an impact on sales.
So I would recommend forecasting future sales, using price as a driver, e.g., using regression. Play around with different possible price points and find the one that maximized profit per the formula above. Feel free to include other drivers like your competitors' prices in the sales forecast (but note that you will of course need to forecast future competitors' prices).
The problem: if you are running this analysis to determine if you should or should not sell a certain merchandise, then you will most likely not yet have any data on the particular product you are looking at. So a straightforward regression approach won't help. Instead, look for "similar" products with known historical sales to train your models.
|
In a linear regression, should I include independent variables that is already known to be predictiv
|
$$ \text{profit} = (\text{price}-\text{cost})\times\text{sales}. $$
I don't think it makes sense to regress profit on price or cost. Or sales, for that matter. We know the relationship above.
Instead,
|
In a linear regression, should I include independent variables that is already known to be predictive of the dependent variable?
$$ \text{profit} = (\text{price}-\text{cost})\times\text{sales}. $$
I don't think it makes sense to regress profit on price or cost. Or sales, for that matter. We know the relationship above.
Instead, work on understanding the three drivers above. For instance, as a first approximation, you can treat cost as fixed, since you may only get to negotiate it in the medium term. That leaves us with your selling price and sales.
And of course price will have an impact on sales.
So I would recommend forecasting future sales, using price as a driver, e.g., using regression. Play around with different possible price points and find the one that maximized profit per the formula above. Feel free to include other drivers like your competitors' prices in the sales forecast (but note that you will of course need to forecast future competitors' prices).
The problem: if you are running this analysis to determine if you should or should not sell a certain merchandise, then you will most likely not yet have any data on the particular product you are looking at. So a straightforward regression approach won't help. Instead, look for "similar" products with known historical sales to train your models.
|
In a linear regression, should I include independent variables that is already known to be predictiv
$$ \text{profit} = (\text{price}-\text{cost})\times\text{sales}. $$
I don't think it makes sense to regress profit on price or cost. Or sales, for that matter. We know the relationship above.
Instead,
|
47,084
|
In a linear regression, should I include independent variables that is already known to be predictive of the dependent variable?
|
I think something that might help is slightly rephrase the question. I agree for profitability, the largest difference in buying vs selling price would be a good indicator (or perhaps the only indicator you might need), but that's hardly insightful. What I would do is to normalize the profit by the buying or selling prices. For example for each product, compute something like
Profit/(Buying Price) or Profit/(selling price)
And regress on the other facts. So a large coefficient would now tell you what is important for getting more profit for each dollar in the buying/selling price.
|
In a linear regression, should I include independent variables that is already known to be predictiv
|
I think something that might help is slightly rephrase the question. I agree for profitability, the largest difference in buying vs selling price would be a good indicator (or perhaps the only indicat
|
In a linear regression, should I include independent variables that is already known to be predictive of the dependent variable?
I think something that might help is slightly rephrase the question. I agree for profitability, the largest difference in buying vs selling price would be a good indicator (or perhaps the only indicator you might need), but that's hardly insightful. What I would do is to normalize the profit by the buying or selling prices. For example for each product, compute something like
Profit/(Buying Price) or Profit/(selling price)
And regress on the other facts. So a large coefficient would now tell you what is important for getting more profit for each dollar in the buying/selling price.
|
In a linear regression, should I include independent variables that is already known to be predictiv
I think something that might help is slightly rephrase the question. I agree for profitability, the largest difference in buying vs selling price would be a good indicator (or perhaps the only indicat
|
47,085
|
Question about Xgboost paper weights and decision-rules
|
The basic idea is behind boosting with (regression) trees is that we are learning functions $f$ (here in the form of trees $w_{q(x)}$). The weights $w$ at the $T$ leafs of the tree are representing the prediction of the $k$-th tree.
$q$ is the tree structure (e.g. that of stump with only a root node, or that of an elaborate tree going 12 levels deep); $q$ is independent of the actual boosting procedure but it can affect our ensemble's performance (that's why for example we use parameters like max_depth to control it).
Through the structure defined by $q$ our $m$-dimensional $x_i$ is mapped to the leaf containing the weight $w$. Within a tree $q$, $w$ itself can take $T$ different values, where $T$ is the number of leaves in the tree. Adding up all the $w_k$ from our $K$ tree learners provides us with our final estimate $\hat{y}$.
If it helps we can continue expanding Equation 1 as:
\begin{align}
\hat{y}_i = \sum_{k=1}^K w_{q_k(x_i)}, \quad w_q \in R^{T_k}
\end{align}
where it is clear that to get our final prediction, we are adding up weights $w_k$ as dictated by the tree structure $q_k$.
Finally, please note that while we are examining regression trees, based on the objective function we try to minimize we are able to use regression trees for many diverse tasks. For example using logistic loss lends itself naturally to classification tasks and discounted cumulative gain leads to ranking applications.
|
Question about Xgboost paper weights and decision-rules
|
The basic idea is behind boosting with (regression) trees is that we are learning functions $f$ (here in the form of trees $w_{q(x)}$). The weights $w$ at the $T$ leafs of the tree are representing th
|
Question about Xgboost paper weights and decision-rules
The basic idea is behind boosting with (regression) trees is that we are learning functions $f$ (here in the form of trees $w_{q(x)}$). The weights $w$ at the $T$ leafs of the tree are representing the prediction of the $k$-th tree.
$q$ is the tree structure (e.g. that of stump with only a root node, or that of an elaborate tree going 12 levels deep); $q$ is independent of the actual boosting procedure but it can affect our ensemble's performance (that's why for example we use parameters like max_depth to control it).
Through the structure defined by $q$ our $m$-dimensional $x_i$ is mapped to the leaf containing the weight $w$. Within a tree $q$, $w$ itself can take $T$ different values, where $T$ is the number of leaves in the tree. Adding up all the $w_k$ from our $K$ tree learners provides us with our final estimate $\hat{y}$.
If it helps we can continue expanding Equation 1 as:
\begin{align}
\hat{y}_i = \sum_{k=1}^K w_{q_k(x_i)}, \quad w_q \in R^{T_k}
\end{align}
where it is clear that to get our final prediction, we are adding up weights $w_k$ as dictated by the tree structure $q_k$.
Finally, please note that while we are examining regression trees, based on the objective function we try to minimize we are able to use regression trees for many diverse tasks. For example using logistic loss lends itself naturally to classification tasks and discounted cumulative gain leads to ranking applications.
|
Question about Xgboost paper weights and decision-rules
The basic idea is behind boosting with (regression) trees is that we are learning functions $f$ (here in the form of trees $w_{q(x)}$). The weights $w$ at the $T$ leafs of the tree are representing th
|
47,086
|
Build a regression model with multiple small time series
|
I'd consider a mixed model with an effect of time-in-career (maybe an additive/smooth term to allow for nonlinear effects) and a random effect of (time-in-career|player), which allows for variation in the pattern for different players. That doesn't explicitly consider number of points in the previous year, but it seems like a reasonable start, and handles the temporal aspect and the grouping of data within players.
this example model of rat growth curves is somewhat different from your example (focus on inference about treatments rather than prediction of individuals; small number of subjects, large number of points per subject relative to your data) but suggests that
mgcv::gam(points~careertime+s(careertime)+
s(careertime,player,bs='fs'),
data=dd, method="REML")
would be a plausible first model. You might want to add s(year,bs="re") to include a random effect of calendar year, and I'd encourage you to use any other covariate/grouping information you have (team, age, ...)
|
Build a regression model with multiple small time series
|
I'd consider a mixed model with an effect of time-in-career (maybe an additive/smooth term to allow for nonlinear effects) and a random effect of (time-in-career|player), which allows for variation in
|
Build a regression model with multiple small time series
I'd consider a mixed model with an effect of time-in-career (maybe an additive/smooth term to allow for nonlinear effects) and a random effect of (time-in-career|player), which allows for variation in the pattern for different players. That doesn't explicitly consider number of points in the previous year, but it seems like a reasonable start, and handles the temporal aspect and the grouping of data within players.
this example model of rat growth curves is somewhat different from your example (focus on inference about treatments rather than prediction of individuals; small number of subjects, large number of points per subject relative to your data) but suggests that
mgcv::gam(points~careertime+s(careertime)+
s(careertime,player,bs='fs'),
data=dd, method="REML")
would be a plausible first model. You might want to add s(year,bs="re") to include a random effect of calendar year, and I'd encourage you to use any other covariate/grouping information you have (team, age, ...)
|
Build a regression model with multiple small time series
I'd consider a mixed model with an effect of time-in-career (maybe an additive/smooth term to allow for nonlinear effects) and a random effect of (time-in-career|player), which allows for variation in
|
47,087
|
Marginal density of $X_1$ given that $X_1 + X_2 = d$ where $X_1$ and $X_2$ are iid Weibull?
|
Let's apply Bayes theorem:
$$f(X_1 \vert X_1+X_2 = d) = \frac{f(X_1+X_2 = d \vert X_1)f(X_1)}{f(X_1+X_2 = d)} = cte \cdot f(X_2=d-X_1)f(X_1)$$
Substituting expressions for Weibull distributions:
$$f(X_1 \vert X_1+X_2 = d) = cte \cdot \left(\frac{k}{\lambda}\right) \left(\frac{d-x_1}{\lambda}\right)^{k-1} e^{((d-x_1)/\lambda)^k}\left(\frac{k}{\lambda}\right) \left(\frac{x_1}{\lambda}\right)^{k-1} e^{(x_1/\lambda)^k}$$
for $0<x_1<d$, otherwise $f(x)=0$
Where $cte$ can be easily evaluated.
I provide a .m code to generate that figure.
Code in .m:
k = 0.5;
lambda = 1;
d = 10
eps = 0.1;
vX = eps:eps:d-eps;
vK = 0.4:0.4:2;
figure(1)
for i=1:length(vK)
k=vK(i);
p_x1_x2 = (k/lambda)^2*(vX.*(d-vX)/(lambda^2)).^(k-1).*exp(-(vX.^k+(d-vX).^k)/lambda^k);
aux = sum(p_x1_x2*eps);
plot(vX, p_x1_x2/aux)
hold on;
end;
For more accurate graph results, reduce the value of eps
|
Marginal density of $X_1$ given that $X_1 + X_2 = d$ where $X_1$ and $X_2$ are iid Weibull?
|
Let's apply Bayes theorem:
$$f(X_1 \vert X_1+X_2 = d) = \frac{f(X_1+X_2 = d \vert X_1)f(X_1)}{f(X_1+X_2 = d)} = cte \cdot f(X_2=d-X_1)f(X_1)$$
Substituting expressions for Weibull distributions:
$$f(X
|
Marginal density of $X_1$ given that $X_1 + X_2 = d$ where $X_1$ and $X_2$ are iid Weibull?
Let's apply Bayes theorem:
$$f(X_1 \vert X_1+X_2 = d) = \frac{f(X_1+X_2 = d \vert X_1)f(X_1)}{f(X_1+X_2 = d)} = cte \cdot f(X_2=d-X_1)f(X_1)$$
Substituting expressions for Weibull distributions:
$$f(X_1 \vert X_1+X_2 = d) = cte \cdot \left(\frac{k}{\lambda}\right) \left(\frac{d-x_1}{\lambda}\right)^{k-1} e^{((d-x_1)/\lambda)^k}\left(\frac{k}{\lambda}\right) \left(\frac{x_1}{\lambda}\right)^{k-1} e^{(x_1/\lambda)^k}$$
for $0<x_1<d$, otherwise $f(x)=0$
Where $cte$ can be easily evaluated.
I provide a .m code to generate that figure.
Code in .m:
k = 0.5;
lambda = 1;
d = 10
eps = 0.1;
vX = eps:eps:d-eps;
vK = 0.4:0.4:2;
figure(1)
for i=1:length(vK)
k=vK(i);
p_x1_x2 = (k/lambda)^2*(vX.*(d-vX)/(lambda^2)).^(k-1).*exp(-(vX.^k+(d-vX).^k)/lambda^k);
aux = sum(p_x1_x2*eps);
plot(vX, p_x1_x2/aux)
hold on;
end;
For more accurate graph results, reduce the value of eps
|
Marginal density of $X_1$ given that $X_1 + X_2 = d$ where $X_1$ and $X_2$ are iid Weibull?
Let's apply Bayes theorem:
$$f(X_1 \vert X_1+X_2 = d) = \frac{f(X_1+X_2 = d \vert X_1)f(X_1)}{f(X_1+X_2 = d)} = cte \cdot f(X_2=d-X_1)f(X_1)$$
Substituting expressions for Weibull distributions:
$$f(X
|
47,088
|
Cross-entropy for comparing images
|
The cross-entropy between a single label and prediction would be
$$L = -\sum_{c \in C} y_{c} \log \hat y_{c}$$
where $C$ is the set of all classes. This is the first expression in your post. However, we need to sum over all pixels in an image to apply this:
$$L = -\sum_{i \in I} \sum_{c \in C} y_{i,c} \log \hat y_{i,c}$$
where $I$ is the set of pixels in an image and with $y_{i,c}$ being an indicator variable for whether the $i$th pixel is in class $c$.
In the binary case, we only have two classes: $0$ and $1$.
$$L = -\sum_{i \in I} \left( y_{i,0} \log \hat y_{i,0} + y_{i,1} \log \hat y_{i,1} \right)$$
Since $y_{i,0} + y_{i,1}$ must necessarily sum to 1, we can also just drop the class indices and denote $y_i = y_{i,0}$ and $1-y_i = y_{i,1}$.
$$L = -\sum_{i \in I} \left( y_i \log \hat{y_i} + (1-y_i) \log (1-\hat y_i) \right)$$
This is where the second equation in your post comes from.
|
Cross-entropy for comparing images
|
The cross-entropy between a single label and prediction would be
$$L = -\sum_{c \in C} y_{c} \log \hat y_{c}$$
where $C$ is the set of all classes. This is the first expression in your post. However,
|
Cross-entropy for comparing images
The cross-entropy between a single label and prediction would be
$$L = -\sum_{c \in C} y_{c} \log \hat y_{c}$$
where $C$ is the set of all classes. This is the first expression in your post. However, we need to sum over all pixels in an image to apply this:
$$L = -\sum_{i \in I} \sum_{c \in C} y_{i,c} \log \hat y_{i,c}$$
where $I$ is the set of pixels in an image and with $y_{i,c}$ being an indicator variable for whether the $i$th pixel is in class $c$.
In the binary case, we only have two classes: $0$ and $1$.
$$L = -\sum_{i \in I} \left( y_{i,0} \log \hat y_{i,0} + y_{i,1} \log \hat y_{i,1} \right)$$
Since $y_{i,0} + y_{i,1}$ must necessarily sum to 1, we can also just drop the class indices and denote $y_i = y_{i,0}$ and $1-y_i = y_{i,1}$.
$$L = -\sum_{i \in I} \left( y_i \log \hat{y_i} + (1-y_i) \log (1-\hat y_i) \right)$$
This is where the second equation in your post comes from.
|
Cross-entropy for comparing images
The cross-entropy between a single label and prediction would be
$$L = -\sum_{c \in C} y_{c} \log \hat y_{c}$$
where $C$ is the set of all classes. This is the first expression in your post. However,
|
47,089
|
Distribution of $\sum_{j=1}^n\ln\left(\frac{X_{(j)}}{X_{(1)}}\right)$ when $X_i$'s are i.i.d Pareto variables
|
A simpler approach might be to use the fact that if $x \sim \text{Pareto}(\theta,a)$, then conditioning upon $x \geq b$ results in $x \sim \text{Pareto}(b,a)$. Consequently, $x | x_{(1)} \sim \text{Pareto}(x_{(1)}, a)$, except for the single observation corresponding to $x_{(1)}$. When we then take the ratio $x/x_{(1)}$, we are rescaling $x$ by its minimum value, and the resulting variate has a $\text{Pareto}(1, a)$ distribution, independent of $x_{(1)}$.
Therefore, if we don't pay attention to the rank of the $x_i$ in the sample, the ratios $x_i/x_{(1)} \sim \text{Pareto}(1,a)$ and are independent (except for the observation corresponding to $x_{(1)}$, which is equal to 1.)
This, combined with the fact that the log of a $\text{Pareto}(1,a)$ variate is distributed $\text{Exponential}(a)$, and the sum of $n-1$ i.i.d. variates $\sim \text{Exponential}(a)$ is $\sim \text{Gamma}(n-1,a)$, leads directly to the result that the sum
$$\sum_{j=1}^n \ln\left(\frac{X_{(j)}}{X_{(1)}}\right) \sim \text{Gamma}(n-1,a)$$
where the $n-1$ comes from the fact that exactly one of the ratios will have value $1$, hence $\log(\cdot) = 0$, leaving $n-1$ nonzero terms in the sum.
|
Distribution of $\sum_{j=1}^n\ln\left(\frac{X_{(j)}}{X_{(1)}}\right)$ when $X_i$'s are i.i.d Pareto
|
A simpler approach might be to use the fact that if $x \sim \text{Pareto}(\theta,a)$, then conditioning upon $x \geq b$ results in $x \sim \text{Pareto}(b,a)$. Consequently, $x | x_{(1)} \sim \text{P
|
Distribution of $\sum_{j=1}^n\ln\left(\frac{X_{(j)}}{X_{(1)}}\right)$ when $X_i$'s are i.i.d Pareto variables
A simpler approach might be to use the fact that if $x \sim \text{Pareto}(\theta,a)$, then conditioning upon $x \geq b$ results in $x \sim \text{Pareto}(b,a)$. Consequently, $x | x_{(1)} \sim \text{Pareto}(x_{(1)}, a)$, except for the single observation corresponding to $x_{(1)}$. When we then take the ratio $x/x_{(1)}$, we are rescaling $x$ by its minimum value, and the resulting variate has a $\text{Pareto}(1, a)$ distribution, independent of $x_{(1)}$.
Therefore, if we don't pay attention to the rank of the $x_i$ in the sample, the ratios $x_i/x_{(1)} \sim \text{Pareto}(1,a)$ and are independent (except for the observation corresponding to $x_{(1)}$, which is equal to 1.)
This, combined with the fact that the log of a $\text{Pareto}(1,a)$ variate is distributed $\text{Exponential}(a)$, and the sum of $n-1$ i.i.d. variates $\sim \text{Exponential}(a)$ is $\sim \text{Gamma}(n-1,a)$, leads directly to the result that the sum
$$\sum_{j=1}^n \ln\left(\frac{X_{(j)}}{X_{(1)}}\right) \sim \text{Gamma}(n-1,a)$$
where the $n-1$ comes from the fact that exactly one of the ratios will have value $1$, hence $\log(\cdot) = 0$, leaving $n-1$ nonzero terms in the sum.
|
Distribution of $\sum_{j=1}^n\ln\left(\frac{X_{(j)}}{X_{(1)}}\right)$ when $X_i$'s are i.i.d Pareto
A simpler approach might be to use the fact that if $x \sim \text{Pareto}(\theta,a)$, then conditioning upon $x \geq b$ results in $x \sim \text{Pareto}(b,a)$. Consequently, $x | x_{(1)} \sim \text{P
|
47,090
|
Likelihood comparable across different distributions
|
To get a sense of the problem, contemplate that density functions used to define likelihood functions are defined with respect to some dominating measure. So if we change the dominating measure, the likelihood function will change.
With more details (but informally) let the statistical model be given as a family of probability measures $P(\cdot; \theta)$ where $\theta$ indexes a family of probability measures. We must assume that all this measures are absolutely continuous with respect to some dominating measure $\mu$. Then we can write
$$
P(A;\theta) = \int_A f(x;\theta) \mu(dx)
$$
where $f(\cdot;\theta)$ is the Radon-Nikodym derivative of $P(\cdot;\theta)$ with respect to $\mu$. But the dominating measure $\mu$ will not be unique, suppose we change to define densities with respect to some other dominating measure $\lambda$, equivalent to $\mu$ (meaning that they have the same null sets). The likelihood function defined with respect to $\mu$ is
$$
f(x;\theta)
$$
(viewed as a function of $\theta$ for given $x$). The likelihood function with respect to $\lambda$ becomes
$$
f(x;\theta) \frac{\mu}{\lambda}(x)
$$
where $\frac{\mu}{\lambda}$ is the Radon-Nikodym derivative of $\mu$ with respect to $\lambda$.
So by changing the dominating measure can we get many different versions of the likelihood functions, but they will all be proportional (as functions of $\theta$), since the factor $\frac{\mu}{\lambda}(x)$ do not depend on $\theta$. See also What does "likelihood is only defined up to a multiplicative constant of proportionality" mean in practice?.
One consequence of this is that to be able to compare likelihoods (and then AIC) for different models, the likelihoods must be defined with respect to the same dominating measure. This also implies that they must be defined for exactly the same data. Sometimes one uses continuous models as approximations for discrete data. If one contemplates both continuous and discrete models, these two kinds of models cannot be compared with AIC, since they use different dominating measures (Lebesgue measure, counting measure).
A point raised in one comment is about nested models. Some theoreticians hold that AIC can only be used to compare nested models. Others disagree. But, if you want to use AIC to compare non-nested model classes, you have to be careful. AIC as implemented in R, for instance, is based on likelihoods where "irrelevant constants" are neglected. That have the effect of making this AIC's noncomparable! So, if you still want to do it, you must program the AIC calculations yourself.
|
Likelihood comparable across different distributions
|
To get a sense of the problem, contemplate that density functions used to define likelihood functions are defined with respect to some dominating measure. So if we change the dominating measure, the l
|
Likelihood comparable across different distributions
To get a sense of the problem, contemplate that density functions used to define likelihood functions are defined with respect to some dominating measure. So if we change the dominating measure, the likelihood function will change.
With more details (but informally) let the statistical model be given as a family of probability measures $P(\cdot; \theta)$ where $\theta$ indexes a family of probability measures. We must assume that all this measures are absolutely continuous with respect to some dominating measure $\mu$. Then we can write
$$
P(A;\theta) = \int_A f(x;\theta) \mu(dx)
$$
where $f(\cdot;\theta)$ is the Radon-Nikodym derivative of $P(\cdot;\theta)$ with respect to $\mu$. But the dominating measure $\mu$ will not be unique, suppose we change to define densities with respect to some other dominating measure $\lambda$, equivalent to $\mu$ (meaning that they have the same null sets). The likelihood function defined with respect to $\mu$ is
$$
f(x;\theta)
$$
(viewed as a function of $\theta$ for given $x$). The likelihood function with respect to $\lambda$ becomes
$$
f(x;\theta) \frac{\mu}{\lambda}(x)
$$
where $\frac{\mu}{\lambda}$ is the Radon-Nikodym derivative of $\mu$ with respect to $\lambda$.
So by changing the dominating measure can we get many different versions of the likelihood functions, but they will all be proportional (as functions of $\theta$), since the factor $\frac{\mu}{\lambda}(x)$ do not depend on $\theta$. See also What does "likelihood is only defined up to a multiplicative constant of proportionality" mean in practice?.
One consequence of this is that to be able to compare likelihoods (and then AIC) for different models, the likelihoods must be defined with respect to the same dominating measure. This also implies that they must be defined for exactly the same data. Sometimes one uses continuous models as approximations for discrete data. If one contemplates both continuous and discrete models, these two kinds of models cannot be compared with AIC, since they use different dominating measures (Lebesgue measure, counting measure).
A point raised in one comment is about nested models. Some theoreticians hold that AIC can only be used to compare nested models. Others disagree. But, if you want to use AIC to compare non-nested model classes, you have to be careful. AIC as implemented in R, for instance, is based on likelihoods where "irrelevant constants" are neglected. That have the effect of making this AIC's noncomparable! So, if you still want to do it, you must program the AIC calculations yourself.
|
Likelihood comparable across different distributions
To get a sense of the problem, contemplate that density functions used to define likelihood functions are defined with respect to some dominating measure. So if we change the dominating measure, the l
|
47,091
|
What to do for AUC less than 0.5?
|
"Reversing" the AUC by taking AUC = 1 - AUC would be appropriate if you had no a priori information about whether to expect larger or lower values for the positive group. For instance if you were measuring a molecular biomarker, it could be present with a decreased concentration in the cancer patients. Unless and until you know more about it, you can absolutely reverse it.
However it is not your case. You trained a model to detect cancer patients. I assume that you are probably obtaining as an output the probability that the patient belongs to the cancer group. This probability has to be higher for the cancer group, otherwise you have a problem.
What you are looking at is a confounding factor that you haven't identified yet. You model learned to identify risk factors that weren't present in the healthy group, but are now in your "at risk" group, just as they were in the "cancer" group or even more strongly so.
Inference is hard and your model just isn't quite good enough at it. Finding differences to a "healthy" group is easy in my experience, although usually quite useless in practice. In the future, try to collect a training sample that is as close to your target clinical question as possible. Until then, please do not state that your AUC = 0.6.
|
What to do for AUC less than 0.5?
|
"Reversing" the AUC by taking AUC = 1 - AUC would be appropriate if you had no a priori information about whether to expect larger or lower values for the positive group. For instance if you were meas
|
What to do for AUC less than 0.5?
"Reversing" the AUC by taking AUC = 1 - AUC would be appropriate if you had no a priori information about whether to expect larger or lower values for the positive group. For instance if you were measuring a molecular biomarker, it could be present with a decreased concentration in the cancer patients. Unless and until you know more about it, you can absolutely reverse it.
However it is not your case. You trained a model to detect cancer patients. I assume that you are probably obtaining as an output the probability that the patient belongs to the cancer group. This probability has to be higher for the cancer group, otherwise you have a problem.
What you are looking at is a confounding factor that you haven't identified yet. You model learned to identify risk factors that weren't present in the healthy group, but are now in your "at risk" group, just as they were in the "cancer" group or even more strongly so.
Inference is hard and your model just isn't quite good enough at it. Finding differences to a "healthy" group is easy in my experience, although usually quite useless in practice. In the future, try to collect a training sample that is as close to your target clinical question as possible. Until then, please do not state that your AUC = 0.6.
|
What to do for AUC less than 0.5?
"Reversing" the AUC by taking AUC = 1 - AUC would be appropriate if you had no a priori information about whether to expect larger or lower values for the positive group. For instance if you were meas
|
47,092
|
What to do for AUC less than 0.5?
|
How large are your training and test samples ? You have to keep in mind that, when training a classifier, there is some variance over the estimation of your model and you may achieve an accuracy which is lower than one of a constant classifier (or an AUC which is lower than 0.5). If you work with a small sample, this is even more likely.
Edit.
The training dataset is 300 cancer patients and 130 controls. The test dataset is 79 who stayed healthy and 20 who later got cancer
Given this information, the training data set has much less cancer patients than the test set (in terms of ratio).
Most learning algorithms rely on the fact that training and testing set have a similar distributions (of the target variable, and the features). Here, this assumption is violated (since having a similar distribution would imply having the same ratio of positive examples in the target value).
However, this does not justify "reversing" the predictions.
Imagine the following scenario (in the case of a linear model) : $\hat{y}(x)= a + b\tanh(x)$. $\hat{y}$ is the probability of an event, $a$ is the probability of this event given $x=0$ and $b$ describes the impact of a certain predictor $x$.
If, for some reason, this classifier performs poorly and $\tilde{y}=1-\hat{y}$ yields better result, then note that $\tilde{y}(x)= (1-a) - b\tanh(x)$
Now the conclusion about the role of $x$ is reversed as well! If $b>0$, then higher $x$ increase the likelihood of a cancer. But this conclusion does not hold any more !
|
What to do for AUC less than 0.5?
|
How large are your training and test samples ? You have to keep in mind that, when training a classifier, there is some variance over the estimation of your model and you may achieve an accuracy which
|
What to do for AUC less than 0.5?
How large are your training and test samples ? You have to keep in mind that, when training a classifier, there is some variance over the estimation of your model and you may achieve an accuracy which is lower than one of a constant classifier (or an AUC which is lower than 0.5). If you work with a small sample, this is even more likely.
Edit.
The training dataset is 300 cancer patients and 130 controls. The test dataset is 79 who stayed healthy and 20 who later got cancer
Given this information, the training data set has much less cancer patients than the test set (in terms of ratio).
Most learning algorithms rely on the fact that training and testing set have a similar distributions (of the target variable, and the features). Here, this assumption is violated (since having a similar distribution would imply having the same ratio of positive examples in the target value).
However, this does not justify "reversing" the predictions.
Imagine the following scenario (in the case of a linear model) : $\hat{y}(x)= a + b\tanh(x)$. $\hat{y}$ is the probability of an event, $a$ is the probability of this event given $x=0$ and $b$ describes the impact of a certain predictor $x$.
If, for some reason, this classifier performs poorly and $\tilde{y}=1-\hat{y}$ yields better result, then note that $\tilde{y}(x)= (1-a) - b\tanh(x)$
Now the conclusion about the role of $x$ is reversed as well! If $b>0$, then higher $x$ increase the likelihood of a cancer. But this conclusion does not hold any more !
|
What to do for AUC less than 0.5?
How large are your training and test samples ? You have to keep in mind that, when training a classifier, there is some variance over the estimation of your model and you may achieve an accuracy which
|
47,093
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
|
The effect size statistic Z/sqrt(N) --- sometimes called r --- in the paired observations case, is related to the probability that one group is larger than the other, or if you'd rather, that the differences are consistently greater than zero.
It doesn't measure the difference in values between the two groups. Other effect size statistics like Cohen's d is related to the differences in means.
To me, the most practical approach is to consider the practical importance of the results. If the mean difference is 1 meter, is this large enough to matter? This is subjective, but honestly, the practical conclusions from any research have to be subjective. You can report p and r, and then leave the hard work of thinking about what the results actually mean to your brain.
Another approach using effect size statistics would be to use Cohen's d, or something you create akin to Cohen's d. Cohen's d is essentially the difference in means divided by the standard deviation of the observations. There are some variants; you can look up their precise calculations if you want. The interpretation here is that a Cohen's d of 1 indicates that the means differ by one standard deviation. If you are comfortable using means and standard deviations with your data, you could use this statistic. Otherwise, if you prefer you could create some effect size statistic like the difference in medians divided by the median value (which is a percent), or the median divided by the IRQ as @GreggH suggests.
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
|
The effect size statistic Z/sqrt(N) --- sometimes called r --- in the paired observations case, is related to the probability that one group is larger than the other, or if you'd rather, that the diff
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
The effect size statistic Z/sqrt(N) --- sometimes called r --- in the paired observations case, is related to the probability that one group is larger than the other, or if you'd rather, that the differences are consistently greater than zero.
It doesn't measure the difference in values between the two groups. Other effect size statistics like Cohen's d is related to the differences in means.
To me, the most practical approach is to consider the practical importance of the results. If the mean difference is 1 meter, is this large enough to matter? This is subjective, but honestly, the practical conclusions from any research have to be subjective. You can report p and r, and then leave the hard work of thinking about what the results actually mean to your brain.
Another approach using effect size statistics would be to use Cohen's d, or something you create akin to Cohen's d. Cohen's d is essentially the difference in means divided by the standard deviation of the observations. There are some variants; you can look up their precise calculations if you want. The interpretation here is that a Cohen's d of 1 indicates that the means differ by one standard deviation. If you are comfortable using means and standard deviations with your data, you could use this statistic. Otherwise, if you prefer you could create some effect size statistic like the difference in medians divided by the median value (which is a percent), or the median divided by the IRQ as @GreggH suggests.
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
The effect size statistic Z/sqrt(N) --- sometimes called r --- in the paired observations case, is related to the probability that one group is larger than the other, or if you'd rather, that the diff
|
47,094
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
|
After some digging and talking to my professor I came up with a solution for further reference.
The problem was, that I had the wrong idea about the Wilcoxon signed-rank test. The purpose of the test is to indicate if there is a shift between the two variables. The p-value suggests, that there is a statistically significant shift.
As nowadays, p-values are not as meaningful as they used to be (due to large sample sizes) there is need for an effect size measure (e.g. Wasserstein et al. (2016)). The calculated effect size only indicates, if there is a constant shift in one direction. It does however not imply, how strong this shift in terms of values is.
To get an understanding how strong the shift is, there are currently no widely accepted effect size measures. In general, there is a lack of effect size measures for non-parametric tests e.g. Leech & Onwuegbuzie (2002). Effect measures for non-parametric tests to exist though (as the one suggested by Gregg H for example).
Other tests such as two-sample Kolmogorov-Smirnov or Anderson-Darling might help to get a better understanding of the distribution shift. Otherwise, with increasing sample sizes, it is also possible to use a t-test according to the central limit theorem. Then, the calculation of other effect measures are possible (e.g. Pearson's d).
This answer is along the lines of what Sal Mangiafico explained in some other words. I hope it could help someone else while trying to figure this out.
Happy to edit if anyone has any supplement or whatsoever.
References:
Leech, Nancy L.; Onwuegbuzie, Anthony J. (2002). A Call for Greater Use of Nonparametric Statistics.
Wasserstein, Ronald L.; Lazar, Nicole A. (2016). The ASA's Statement on p -Values: Context, Process, and Purpose. In The American Statistician 70(2).
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
|
After some digging and talking to my professor I came up with a solution for further reference.
The problem was, that I had the wrong idea about the Wilcoxon signed-rank test. The purpose of the test
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
After some digging and talking to my professor I came up with a solution for further reference.
The problem was, that I had the wrong idea about the Wilcoxon signed-rank test. The purpose of the test is to indicate if there is a shift between the two variables. The p-value suggests, that there is a statistically significant shift.
As nowadays, p-values are not as meaningful as they used to be (due to large sample sizes) there is need for an effect size measure (e.g. Wasserstein et al. (2016)). The calculated effect size only indicates, if there is a constant shift in one direction. It does however not imply, how strong this shift in terms of values is.
To get an understanding how strong the shift is, there are currently no widely accepted effect size measures. In general, there is a lack of effect size measures for non-parametric tests e.g. Leech & Onwuegbuzie (2002). Effect measures for non-parametric tests to exist though (as the one suggested by Gregg H for example).
Other tests such as two-sample Kolmogorov-Smirnov or Anderson-Darling might help to get a better understanding of the distribution shift. Otherwise, with increasing sample sizes, it is also possible to use a t-test according to the central limit theorem. Then, the calculation of other effect measures are possible (e.g. Pearson's d).
This answer is along the lines of what Sal Mangiafico explained in some other words. I hope it could help someone else while trying to figure this out.
Happy to edit if anyone has any supplement or whatsoever.
References:
Leech, Nancy L.; Onwuegbuzie, Anthony J. (2002). A Call for Greater Use of Nonparametric Statistics.
Wasserstein, Ronald L.; Lazar, Nicole A. (2016). The ASA's Statement on p -Values: Context, Process, and Purpose. In The American Statistician 70(2).
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
After some digging and talking to my professor I came up with a solution for further reference.
The problem was, that I had the wrong idea about the Wilcoxon signed-rank test. The purpose of the test
|
47,095
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
|
If you have this many data, you really could have used a $t$-test with no problems. It's worth noting that the Wilcoxon signed-rank test is really testing a slightly different null hypothesis1,2. Often the reason for choosing the Wilcoxon signed-rank test is that people are not willing to assume the numbers are equal interval. In your case, it seems you think they are.
Another issue is that I would not focus on the individual boxplots. They are more likely to mislead than illuminate. At a minimum, consider plotting a boxplot of differences along with the boxplots of the original data3.
In general, measures of effect size are designed to unconflate the magnitude of the effect from the amount of data we have (a statistical test necessarily combines the two), and to thereby communicate the size of the shift in a manner that is intuitive and simple (i.e., typically a single number). Thus, the effect size you list is not trying to "normalize by the sample size", but to extract the sample size from the test statistic (although in this case that is totally opaque).
Since you believe the units are reliable, some version of a mean difference should be fine. If you believe your audience will be sufficiently familiar with the units, a raw mean difference would be appropriate. (Consider that when people talk about weight loss or stunted growth, they always use the everyday measures, say, pounds or kilograms.) If your audience wouldn't be conversant with these units, a standardized mean difference is needed to give it an interpretable context. The typical way to do this is to divide the mean difference by a standard deviation (computed in one of several ways). In fact, this procedure has become the meaning of 'standardized mean difference'. The notion of standardization is much broader than that, of course, and there is no reason you need to be bound by that procedure. If the mean differences that are possible in your situation are limited (e.g., by some physical constraints) and they can be defined, you could divide your observed mean difference by the possible range and present that. You just need to be sure you explain what you did clearly. I would probably combine this with the common effect size4 and say something like:
The rasters showed significant improvement due to the manipulation (z=-30, p<0.001). One hundred percent of the differences between paired pixels were negative, with the mean shift, -0.49, constituting an improvement equal to X% of what is physically possible.
References:
Why would parametric statistics ever be preferred over nonparametric?
What exactly does a non-parametric test accomplish & What do you do with the results?
Is using error bars for means in a within-subjects study wrong?
Effect size to Wilcoxon signed rank test?
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
|
If you have this many data, you really could have used a $t$-test with no problems. It's worth noting that the Wilcoxon signed-rank test is really testing a slightly different null hypothesis1,2. Ofte
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
If you have this many data, you really could have used a $t$-test with no problems. It's worth noting that the Wilcoxon signed-rank test is really testing a slightly different null hypothesis1,2. Often the reason for choosing the Wilcoxon signed-rank test is that people are not willing to assume the numbers are equal interval. In your case, it seems you think they are.
Another issue is that I would not focus on the individual boxplots. They are more likely to mislead than illuminate. At a minimum, consider plotting a boxplot of differences along with the boxplots of the original data3.
In general, measures of effect size are designed to unconflate the magnitude of the effect from the amount of data we have (a statistical test necessarily combines the two), and to thereby communicate the size of the shift in a manner that is intuitive and simple (i.e., typically a single number). Thus, the effect size you list is not trying to "normalize by the sample size", but to extract the sample size from the test statistic (although in this case that is totally opaque).
Since you believe the units are reliable, some version of a mean difference should be fine. If you believe your audience will be sufficiently familiar with the units, a raw mean difference would be appropriate. (Consider that when people talk about weight loss or stunted growth, they always use the everyday measures, say, pounds or kilograms.) If your audience wouldn't be conversant with these units, a standardized mean difference is needed to give it an interpretable context. The typical way to do this is to divide the mean difference by a standard deviation (computed in one of several ways). In fact, this procedure has become the meaning of 'standardized mean difference'. The notion of standardization is much broader than that, of course, and there is no reason you need to be bound by that procedure. If the mean differences that are possible in your situation are limited (e.g., by some physical constraints) and they can be defined, you could divide your observed mean difference by the possible range and present that. You just need to be sure you explain what you did clearly. I would probably combine this with the common effect size4 and say something like:
The rasters showed significant improvement due to the manipulation (z=-30, p<0.001). One hundred percent of the differences between paired pixels were negative, with the mean shift, -0.49, constituting an improvement equal to X% of what is physically possible.
References:
Why would parametric statistics ever be preferred over nonparametric?
What exactly does a non-parametric test accomplish & What do you do with the results?
Is using error bars for means in a within-subjects study wrong?
Effect size to Wilcoxon signed rank test?
|
Effect size for Wilcoxon signed rank test that incorporates the possible range of the attribute
If you have this many data, you really could have used a $t$-test with no problems. It's worth noting that the Wilcoxon signed-rank test is really testing a slightly different null hypothesis1,2. Ofte
|
47,096
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
|
I think the following will answer both of your questions.
First of all, you select the model that has the minimum value when using such criteria, therefore n has the opposite effect than you wrote down since increase in n alone will decrease the value.
Secondly, the information criteria is used to select between different models, not to select between different samples. The reason for these criteria to be used is the fact that adding more parameters will always increase the fit however it does not necessarily mean that the model is better due parsimony and degrees of freedom concerns in academy and overfitting concerns in practice.
A criterion such as BIC will be used to compare models that have different variables, where n will be the same. Therefore n is not there to penalize or favor the sample size. I am guessing it is there to normalize RSS, since RSS will increase indefinitely with n. On contrast, adding more parameters is penalized as it increases the value of the criteria.
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
|
I think the following will answer both of your questions.
First of all, you select the model that has the minimum value when using such criteria, therefore n has the opposite effect than you wrote dow
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
I think the following will answer both of your questions.
First of all, you select the model that has the minimum value when using such criteria, therefore n has the opposite effect than you wrote down since increase in n alone will decrease the value.
Secondly, the information criteria is used to select between different models, not to select between different samples. The reason for these criteria to be used is the fact that adding more parameters will always increase the fit however it does not necessarily mean that the model is better due parsimony and degrees of freedom concerns in academy and overfitting concerns in practice.
A criterion such as BIC will be used to compare models that have different variables, where n will be the same. Therefore n is not there to penalize or favor the sample size. I am guessing it is there to normalize RSS, since RSS will increase indefinitely with n. On contrast, adding more parameters is penalized as it increases the value of the criteria.
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
I think the following will answer both of your questions.
First of all, you select the model that has the minimum value when using such criteria, therefore n has the opposite effect than you wrote dow
|
47,097
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
|
$C_p$ (and AIC) penalize each parameter with a factor of 2. BIC penalizes each parameter with a factor $\ln(n)$ which, for $n>7$ is greater than two, as stated in the paragraph you quote. Therefore, BIC places a greater penalty on each parameter and will tend to select more parsimonious models than AIC or $C_p$.
As you have been told, these criteria are meant to compare models fitted to the same sample with different numbers of parameters. All boils down to "correcting" a goodness-of-fit statistic (minus log likelihood, sum of residuals, or functions thereof) with the "cost" of the parameters fitted. BIC simply places (for $n>7$) a higher price tag to each parameter, and one that increases slightly with $n$.
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
|
$C_p$ (and AIC) penalize each parameter with a factor of 2. BIC penalizes each parameter with a factor $\ln(n)$ which, for $n>7$ is greater than two, as stated in the paragraph you quote. Therefore, B
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
$C_p$ (and AIC) penalize each parameter with a factor of 2. BIC penalizes each parameter with a factor $\ln(n)$ which, for $n>7$ is greater than two, as stated in the paragraph you quote. Therefore, BIC places a greater penalty on each parameter and will tend to select more parsimonious models than AIC or $C_p$.
As you have been told, these criteria are meant to compare models fitted to the same sample with different numbers of parameters. All boils down to "correcting" a goodness-of-fit statistic (minus log likelihood, sum of residuals, or functions thereof) with the "cost" of the parameters fitted. BIC simply places (for $n>7$) a higher price tag to each parameter, and one that increases slightly with $n$.
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
$C_p$ (and AIC) penalize each parameter with a factor of 2. BIC penalizes each parameter with a factor $\ln(n)$ which, for $n>7$ is greater than two, as stated in the paragraph you quote. Therefore, B
|
47,098
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
|
There is a mistake in your inference. BIC does not penalize more data. The actual dependence on n is $\frac{\ln(n)}{n}$ which is a monotonically decreasing function for n>2 and thus, decreases (not increases) the penalty when n increases. When compared to AIC which is simply $\frac{1}{n}$, the decrease in penalty due to a large n is lesser. In summary, it does decrease the penalty with an increase in n but the amount of decrease is smaller than that in AIC.
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
|
There is a mistake in your inference. BIC does not penalize more data. The actual dependence on n is $\frac{\ln(n)}{n}$ which is a monotonically decreasing function for n>2 and thus, decreases (not in
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
There is a mistake in your inference. BIC does not penalize more data. The actual dependence on n is $\frac{\ln(n)}{n}$ which is a monotonically decreasing function for n>2 and thus, decreases (not increases) the penalty when n increases. When compared to AIC which is simply $\frac{1}{n}$, the decrease in penalty due to a large n is lesser. In summary, it does decrease the penalty with an increase in n but the amount of decrease is smaller than that in AIC.
|
In Bayesian Information Criterion (BIC), why does having bigger n get penalized?
There is a mistake in your inference. BIC does not penalize more data. The actual dependence on n is $\frac{\ln(n)}{n}$ which is a monotonically decreasing function for n>2 and thus, decreases (not in
|
47,099
|
Why is $L(z)=\phi(z) - z \left(1 - \Phi(z)\right) \ge 0$? Why is it (sorta) linear?
|
Since on the interval $x \in [z, \infty)$ it is clear that $x \ge z,$ use the fact that $\phi^\prime(x) = -x \phi(x)$ to conclude
$$\phi(z) = \int_z^\infty (-\phi^\prime(x))dx = \int_{z}^\infty x \phi(x) dx \ge z \int_z^\infty \phi(x) dx = z(1-\Phi(z)),$$
QED.
Concerning the second question, observe that $$L^\prime(z) = \phi^\prime(z) + z\phi(z) - (1-\Phi(z)) = 1-\Phi(z),$$ yielding $L$ as an integral $$L(z)=\int_{\infty}^z (1-\Phi(x))dx \gt 0,$$ which provides another solution to the first question. Since $1-\Phi(z) \approx 1$ for $z\ll 0,$ $L$ approaches an asymptote with slope $-1$ as $z\to-\infty.$
|
Why is $L(z)=\phi(z) - z \left(1 - \Phi(z)\right) \ge 0$? Why is it (sorta) linear?
|
Since on the interval $x \in [z, \infty)$ it is clear that $x \ge z,$ use the fact that $\phi^\prime(x) = -x \phi(x)$ to conclude
$$\phi(z) = \int_z^\infty (-\phi^\prime(x))dx = \int_{z}^\infty x \phi
|
Why is $L(z)=\phi(z) - z \left(1 - \Phi(z)\right) \ge 0$? Why is it (sorta) linear?
Since on the interval $x \in [z, \infty)$ it is clear that $x \ge z,$ use the fact that $\phi^\prime(x) = -x \phi(x)$ to conclude
$$\phi(z) = \int_z^\infty (-\phi^\prime(x))dx = \int_{z}^\infty x \phi(x) dx \ge z \int_z^\infty \phi(x) dx = z(1-\Phi(z)),$$
QED.
Concerning the second question, observe that $$L^\prime(z) = \phi^\prime(z) + z\phi(z) - (1-\Phi(z)) = 1-\Phi(z),$$ yielding $L$ as an integral $$L(z)=\int_{\infty}^z (1-\Phi(x))dx \gt 0,$$ which provides another solution to the first question. Since $1-\Phi(z) \approx 1$ for $z\ll 0,$ $L$ approaches an asymptote with slope $-1$ as $z\to-\infty.$
|
Why is $L(z)=\phi(z) - z \left(1 - \Phi(z)\right) \ge 0$? Why is it (sorta) linear?
Since on the interval $x \in [z, \infty)$ it is clear that $x \ge z,$ use the fact that $\phi^\prime(x) = -x \phi(x)$ to conclude
$$\phi(z) = \int_z^\infty (-\phi^\prime(x))dx = \int_{z}^\infty x \phi
|
47,100
|
General hints regarding the use of the binomial distribution in conditional probabilty problems
|
Specifically, why is $$P(Y=k|X=15, B)=P(Y=k|B)$$
The expression P(Y=k|X=15,B) = P(Y=k|B) is allowed because
$$P(Y=k|X=i,B) = {{20}\choose {k}} 0.6^k0.4^{20-k} $$
independent from $X=i$, so it can be left out
This logic is indeed not generally true, ie $P(a|b,c)$ may be different from $P(a|c)$, and is just true for this specific case where the experiments are independent (new random patients) and it is assumed that the result have no correlation other than that they are both defined by the condition $B$ or $B^c$.
Comparable expression with a dice roll for any $k$ and $l$: $$P(\text{next roll} =k \, | \,\text{ last roll} = l, \text{ dice = fair })=\frac{1}{6}$$
when we assume the rolls are independent. For that dice roll you are allowed to write $P(k|l,fair) = P(k|fair) = 1/6$
Before I looked at the answer, I didn't think that the answer to (a) would be found using a binomial distribution. But after I read the answer I was convinced by it. So, is there a kind of "general hint" when to use a binomial distribution?
Effectively you have a mixture distribution of two binomial distributions
$$ p \underbrace{ {{20} \choose {k}} 0.6^k0.4^{20-k}}_{\text{Binom$(20,0.6)$}} + (1-p) \underbrace{ {{20} \choose {k}} 0.5^k0.5^{20-k}}_{\text{Binom$(20,0.5)$}} $$
being equivalent to a probability $p$ that the medicine works on 60% of the people and a probability $1-p$ that the medicine works on 50% of the people.
This logic may not seem so correct. How could one, based on question 'a', believe that you have the medicine working on only either 50% or 60%? That is a false dichotomy.
However, note that this is created due to the weird prior believe that it
is either working on 50% or 60% (probabilities 2/3 vs 1/3) and
nothing else (so the posterior distribution will stick to this weird
believe and only change these ratios 2/3 and 1/3 into $p$ and $1-p$).
It is not a realistic question, what one would get in practice. But it illustrates a more complicated principle (see next point).
Eventually (a better alternative to the question problem statement which may occur later in your course), one could use a beta-binomial distribution in which every probability has an assigned value (not just 2/3 60% and 1/3 50%, or $p$ 60% and $1-p$ 50%). Then the posterior distribution for $f$, the fraction of people on which the medicine works (which could be modeled as a beta distribution), is a spectrum instead of just two values. This spectrum of probabilities for different $f$ is then used to write out the beta-binomial distribution.
note that the letter $p$ is often a parameter for the binomial distribution, the probability that the medicine works. Here it is used differently for the probabilities $p$ and $1-p$ that the medicine works with 60% or 50%. This might be confusing.
|
General hints regarding the use of the binomial distribution in conditional probabilty problems
|
Specifically, why is $$P(Y=k|X=15, B)=P(Y=k|B)$$
The expression P(Y=k|X=15,B) = P(Y=k|B) is allowed because
$$P(Y=k|X=i,B) = {{20}\choose {k}} 0.6^k0.4^{20-k} $$
independent from $X=i$, so it can b
|
General hints regarding the use of the binomial distribution in conditional probabilty problems
Specifically, why is $$P(Y=k|X=15, B)=P(Y=k|B)$$
The expression P(Y=k|X=15,B) = P(Y=k|B) is allowed because
$$P(Y=k|X=i,B) = {{20}\choose {k}} 0.6^k0.4^{20-k} $$
independent from $X=i$, so it can be left out
This logic is indeed not generally true, ie $P(a|b,c)$ may be different from $P(a|c)$, and is just true for this specific case where the experiments are independent (new random patients) and it is assumed that the result have no correlation other than that they are both defined by the condition $B$ or $B^c$.
Comparable expression with a dice roll for any $k$ and $l$: $$P(\text{next roll} =k \, | \,\text{ last roll} = l, \text{ dice = fair })=\frac{1}{6}$$
when we assume the rolls are independent. For that dice roll you are allowed to write $P(k|l,fair) = P(k|fair) = 1/6$
Before I looked at the answer, I didn't think that the answer to (a) would be found using a binomial distribution. But after I read the answer I was convinced by it. So, is there a kind of "general hint" when to use a binomial distribution?
Effectively you have a mixture distribution of two binomial distributions
$$ p \underbrace{ {{20} \choose {k}} 0.6^k0.4^{20-k}}_{\text{Binom$(20,0.6)$}} + (1-p) \underbrace{ {{20} \choose {k}} 0.5^k0.5^{20-k}}_{\text{Binom$(20,0.5)$}} $$
being equivalent to a probability $p$ that the medicine works on 60% of the people and a probability $1-p$ that the medicine works on 50% of the people.
This logic may not seem so correct. How could one, based on question 'a', believe that you have the medicine working on only either 50% or 60%? That is a false dichotomy.
However, note that this is created due to the weird prior believe that it
is either working on 50% or 60% (probabilities 2/3 vs 1/3) and
nothing else (so the posterior distribution will stick to this weird
believe and only change these ratios 2/3 and 1/3 into $p$ and $1-p$).
It is not a realistic question, what one would get in practice. But it illustrates a more complicated principle (see next point).
Eventually (a better alternative to the question problem statement which may occur later in your course), one could use a beta-binomial distribution in which every probability has an assigned value (not just 2/3 60% and 1/3 50%, or $p$ 60% and $1-p$ 50%). Then the posterior distribution for $f$, the fraction of people on which the medicine works (which could be modeled as a beta distribution), is a spectrum instead of just two values. This spectrum of probabilities for different $f$ is then used to write out the beta-binomial distribution.
note that the letter $p$ is often a parameter for the binomial distribution, the probability that the medicine works. Here it is used differently for the probabilities $p$ and $1-p$ that the medicine works with 60% or 50%. This might be confusing.
|
General hints regarding the use of the binomial distribution in conditional probabilty problems
Specifically, why is $$P(Y=k|X=15, B)=P(Y=k|B)$$
The expression P(Y=k|X=15,B) = P(Y=k|B) is allowed because
$$P(Y=k|X=i,B) = {{20}\choose {k}} 0.6^k0.4^{20-k} $$
independent from $X=i$, so it can b
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.