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
|
|---|---|---|---|---|---|---|
48,201
|
What is the difference between lifetime risk, lifetime morbid risk, and lifetime prevalence, and lifetime cumulative incidence?
|
Point prevalence: The proportion of individuals who manifest a disorder at a given point in time.
Period prevalence: The proportion of individuals who manifest a disorder over a specific period of time (e.g., over one year).
Lifetime prevalence: The proportion of individuals in the population who have ever manifested a disorder, who are alive on a given day.
Lifetime morbid risk: The probability of a person developing the disorder during a specified period of their life or up to a specified age (lifetime morbid risk differs from lifetime prevalence in that it attempts to include the entire lifetime of a birth cohort both past and future, and includes those deceased at the time of the survey).
|
What is the difference between lifetime risk, lifetime morbid risk, and lifetime prevalence, and lif
|
Point prevalence: The proportion of individuals who manifest a disorder at a given point in time.
Period prevalence: The proportion of individuals who manifest a disorder over a specific period of tim
|
What is the difference between lifetime risk, lifetime morbid risk, and lifetime prevalence, and lifetime cumulative incidence?
Point prevalence: The proportion of individuals who manifest a disorder at a given point in time.
Period prevalence: The proportion of individuals who manifest a disorder over a specific period of time (e.g., over one year).
Lifetime prevalence: The proportion of individuals in the population who have ever manifested a disorder, who are alive on a given day.
Lifetime morbid risk: The probability of a person developing the disorder during a specified period of their life or up to a specified age (lifetime morbid risk differs from lifetime prevalence in that it attempts to include the entire lifetime of a birth cohort both past and future, and includes those deceased at the time of the survey).
|
What is the difference between lifetime risk, lifetime morbid risk, and lifetime prevalence, and lif
Point prevalence: The proportion of individuals who manifest a disorder at a given point in time.
Period prevalence: The proportion of individuals who manifest a disorder over a specific period of tim
|
48,202
|
What is the difference between lifetime risk, lifetime morbid risk, and lifetime prevalence, and lifetime cumulative incidence?
|
From Kessler et al, 2012:
In studies of lifetime disorders, furthermore, some researchers report estimates of lifetime prevalence (i.e. the proportion of people who have had the disorder at sometime in their life), while others report estimates of lifetime morbid risk (LMR) (i.e. the proportion of people who will eventually develop the disorder at some time in their life whether or not they have a lifetime history at the time of assessment). While LMR is reported much less frequently than lifetime prevalence (Oakley Browneet al., 2006), it is important to appreciate that measures of LMR tell us not only about the proportion of the population that has so far experienced the disorder, but also about the additional proportion of the population that is expected (based on a projection from a survival model) to experience the disorder at some time in the future. The combined information about current and future cases is sometimes more important for policy planning purposes than information about cases that have occurred to date.
Full reference:
Kessler, R.C., Petukhova, M., Sampson, N.A., Zaslavsky, A.M. & Wittchen, H.U. Twelve-month and lifetime prevalence and lifetime morbid risk of anxiety and mood disorders in the United States. Int J Methods Psychiatr Res 21, 169-84 (2012).
|
What is the difference between lifetime risk, lifetime morbid risk, and lifetime prevalence, and lif
|
From Kessler et al, 2012:
In studies of lifetime disorders, furthermore, some researchers report estimates of lifetime prevalence (i.e. the proportion of people who have had the disorder at sometime
|
What is the difference between lifetime risk, lifetime morbid risk, and lifetime prevalence, and lifetime cumulative incidence?
From Kessler et al, 2012:
In studies of lifetime disorders, furthermore, some researchers report estimates of lifetime prevalence (i.e. the proportion of people who have had the disorder at sometime in their life), while others report estimates of lifetime morbid risk (LMR) (i.e. the proportion of people who will eventually develop the disorder at some time in their life whether or not they have a lifetime history at the time of assessment). While LMR is reported much less frequently than lifetime prevalence (Oakley Browneet al., 2006), it is important to appreciate that measures of LMR tell us not only about the proportion of the population that has so far experienced the disorder, but also about the additional proportion of the population that is expected (based on a projection from a survival model) to experience the disorder at some time in the future. The combined information about current and future cases is sometimes more important for policy planning purposes than information about cases that have occurred to date.
Full reference:
Kessler, R.C., Petukhova, M., Sampson, N.A., Zaslavsky, A.M. & Wittchen, H.U. Twelve-month and lifetime prevalence and lifetime morbid risk of anxiety and mood disorders in the United States. Int J Methods Psychiatr Res 21, 169-84 (2012).
|
What is the difference between lifetime risk, lifetime morbid risk, and lifetime prevalence, and lif
From Kessler et al, 2012:
In studies of lifetime disorders, furthermore, some researchers report estimates of lifetime prevalence (i.e. the proportion of people who have had the disorder at sometime
|
48,203
|
Sophisticated models for classifying short pieces of texts
|
Is your SVM implementation parallel? One simple idea would be to split your 10-fold CV across 10 machines (or cores). This should reduce the algorithm's runtime to almost 1/10 of its current running time.
What do you mean by "info gain?" Have you tried applying LibLINEAR on a dataset with no features removed?
|
Sophisticated models for classifying short pieces of texts
|
Is your SVM implementation parallel? One simple idea would be to split your 10-fold CV across 10 machines (or cores). This should reduce the algorithm's runtime to almost 1/10 of its current running
|
Sophisticated models for classifying short pieces of texts
Is your SVM implementation parallel? One simple idea would be to split your 10-fold CV across 10 machines (or cores). This should reduce the algorithm's runtime to almost 1/10 of its current running time.
What do you mean by "info gain?" Have you tried applying LibLINEAR on a dataset with no features removed?
|
Sophisticated models for classifying short pieces of texts
Is your SVM implementation parallel? One simple idea would be to split your 10-fold CV across 10 machines (or cores). This should reduce the algorithm's runtime to almost 1/10 of its current running
|
48,204
|
Sophisticated models for classifying short pieces of texts
|
The first thing you need to do is to figure out is the source of your generalization error. Is it "bias" or is it "variance"? (or perhaps something else?) If it is variance, your training set might be small for what you are trying to accomplish, and you might need more training data. If it is bias, then changing to a different model, or changing the parameters of your SVM might help you get a better result.
|
Sophisticated models for classifying short pieces of texts
|
The first thing you need to do is to figure out is the source of your generalization error. Is it "bias" or is it "variance"? (or perhaps something else?) If it is variance, your training set might b
|
Sophisticated models for classifying short pieces of texts
The first thing you need to do is to figure out is the source of your generalization error. Is it "bias" or is it "variance"? (or perhaps something else?) If it is variance, your training set might be small for what you are trying to accomplish, and you might need more training data. If it is bias, then changing to a different model, or changing the parameters of your SVM might help you get a better result.
|
Sophisticated models for classifying short pieces of texts
The first thing you need to do is to figure out is the source of your generalization error. Is it "bias" or is it "variance"? (or perhaps something else?) If it is variance, your training set might b
|
48,205
|
Sample size for a variable number of answers
|
You should consider modeling the situation using the multinomial distribution. I am going to change variables as I would prefer to reserve $n$ for sample size and denote the number of choices by $K$ (i.e., $K$ represents the number of colors, answers etc).
Let $p_k$ be the true proportion of people in the population who would choose the $k^\text{th}$ choice when presented with $K$ choices. You can re-interpret $p_k$ as the probability that a random person would choose the $k^\text{th}$ choice when presented with $K$ choices. Thus, by definition, we have:
$$\sum_{k=1}^K p_k = 1$$
Let $x_k$ stand for the number of people who choose the $k^\text{th}$ object when we sample the choices of $n$ people. Then the density function of ${x_k}$ is given by the multinomial pdf:
$$f(x_1,...x_K|-) = \begin{cases} \frac{n!}{x_1! ... x_K!} p_1^{x_1} ... p_K^{x_K} \quad \text{if} \quad \sum_kx_k=n \\ 0 \quad \text{otherwise}\end{cases}$$
You can then use maximum likelihood theory to estimate $\{p_1,p_2,...p_K\}$ and compute confidence intervals for these estimates.
Computing the confidence intervals would also enable you to compute margin of errors associated with your estimates for a given sample size. These margin of errors will help you calculate the necessary sample sizes to attain a margin of error of 5% with 95% confidence.
MLE, Margin of error and Sample Size Computations
It is not difficult to show that the MLE estimate for $p_k$ is given by:
$$\hat{p}_k = \frac{x_k}{n}$$
The above estimator is unbiased as:
$$E(\hat{p}_k) = \frac{E(x_k)}{n} = \frac{n p_k}{n}=p_k$$
The variance of the estimator is:
$$V(\hat{p}_k) = \frac{V(x_k)}{n^2} = \frac{n p_k (1-p_k)}{n^2}=\frac{p_k (1-p_k)}{n}$$
Assuming that $n$ is sufficiently high, we can use the central limit theorem to approximate the distribution of $\hat{p}_k$ as a normal with the mean at $p_k$ and with variance $\frac{p_k (1-p_k)}{n}$.
Thus, the margin of error is given for a 95% confidence interval is given by:
$$1.96 \sqrt{\frac{p_k (1-p_k)}{n}}$$
We do not know $p_k$ apriori. However, a conservative estimate for $p_k$ would be that it equals $K^{-1}$ (i.e., we assume that all choices are equally likely). The above argument is a bit ad-hoc but perhaps serves the OP's purpose.
Therefore, we have the requirement that:
$$1.96 \sqrt{\frac{K^{-1} (1-K^{-1})}{n}} = 0.05$$
If we let $K=3$ we get the required sample size as $n=341.475$.
PS: The past question on Asymptotic distribution of multinomial seems relevant in the above context and may suggest ways to lend rigor to the above ideas.
|
Sample size for a variable number of answers
|
You should consider modeling the situation using the multinomial distribution. I am going to change variables as I would prefer to reserve $n$ for sample size and denote the number of choices by $K$ (
|
Sample size for a variable number of answers
You should consider modeling the situation using the multinomial distribution. I am going to change variables as I would prefer to reserve $n$ for sample size and denote the number of choices by $K$ (i.e., $K$ represents the number of colors, answers etc).
Let $p_k$ be the true proportion of people in the population who would choose the $k^\text{th}$ choice when presented with $K$ choices. You can re-interpret $p_k$ as the probability that a random person would choose the $k^\text{th}$ choice when presented with $K$ choices. Thus, by definition, we have:
$$\sum_{k=1}^K p_k = 1$$
Let $x_k$ stand for the number of people who choose the $k^\text{th}$ object when we sample the choices of $n$ people. Then the density function of ${x_k}$ is given by the multinomial pdf:
$$f(x_1,...x_K|-) = \begin{cases} \frac{n!}{x_1! ... x_K!} p_1^{x_1} ... p_K^{x_K} \quad \text{if} \quad \sum_kx_k=n \\ 0 \quad \text{otherwise}\end{cases}$$
You can then use maximum likelihood theory to estimate $\{p_1,p_2,...p_K\}$ and compute confidence intervals for these estimates.
Computing the confidence intervals would also enable you to compute margin of errors associated with your estimates for a given sample size. These margin of errors will help you calculate the necessary sample sizes to attain a margin of error of 5% with 95% confidence.
MLE, Margin of error and Sample Size Computations
It is not difficult to show that the MLE estimate for $p_k$ is given by:
$$\hat{p}_k = \frac{x_k}{n}$$
The above estimator is unbiased as:
$$E(\hat{p}_k) = \frac{E(x_k)}{n} = \frac{n p_k}{n}=p_k$$
The variance of the estimator is:
$$V(\hat{p}_k) = \frac{V(x_k)}{n^2} = \frac{n p_k (1-p_k)}{n^2}=\frac{p_k (1-p_k)}{n}$$
Assuming that $n$ is sufficiently high, we can use the central limit theorem to approximate the distribution of $\hat{p}_k$ as a normal with the mean at $p_k$ and with variance $\frac{p_k (1-p_k)}{n}$.
Thus, the margin of error is given for a 95% confidence interval is given by:
$$1.96 \sqrt{\frac{p_k (1-p_k)}{n}}$$
We do not know $p_k$ apriori. However, a conservative estimate for $p_k$ would be that it equals $K^{-1}$ (i.e., we assume that all choices are equally likely). The above argument is a bit ad-hoc but perhaps serves the OP's purpose.
Therefore, we have the requirement that:
$$1.96 \sqrt{\frac{K^{-1} (1-K^{-1})}{n}} = 0.05$$
If we let $K=3$ we get the required sample size as $n=341.475$.
PS: The past question on Asymptotic distribution of multinomial seems relevant in the above context and may suggest ways to lend rigor to the above ideas.
|
Sample size for a variable number of answers
You should consider modeling the situation using the multinomial distribution. I am going to change variables as I would prefer to reserve $n$ for sample size and denote the number of choices by $K$ (
|
48,206
|
Sample size for a variable number of answers
|
How is this different than asking independent questions on a survey such as who will you vote for - red, yellow, etc. If I've read the question correct, your answer is 364 observations. This will provide +/-5% at the 95% level of confidence given a normal distribution.
Dr. Doug
|
Sample size for a variable number of answers
|
How is this different than asking independent questions on a survey such as who will you vote for - red, yellow, etc. If I've read the question correct, your answer is 364 observations. This will pr
|
Sample size for a variable number of answers
How is this different than asking independent questions on a survey such as who will you vote for - red, yellow, etc. If I've read the question correct, your answer is 364 observations. This will provide +/-5% at the 95% level of confidence given a normal distribution.
Dr. Doug
|
Sample size for a variable number of answers
How is this different than asking independent questions on a survey such as who will you vote for - red, yellow, etc. If I've read the question correct, your answer is 364 observations. This will pr
|
48,207
|
Data sets and problems for learning hypothesis testing
|
You are supposed to form your hypotheses before seeing any of the actual data. These hypotheses come from some sort of conceptual frame work. Your best bet may be to form a hypothesis on a topic of interest to you and then try to find a data set to test that hypothesis.
|
Data sets and problems for learning hypothesis testing
|
You are supposed to form your hypotheses before seeing any of the actual data. These hypotheses come from some sort of conceptual frame work. Your best bet may be to form a hypothesis on a topic of
|
Data sets and problems for learning hypothesis testing
You are supposed to form your hypotheses before seeing any of the actual data. These hypotheses come from some sort of conceptual frame work. Your best bet may be to form a hypothesis on a topic of interest to you and then try to find a data set to test that hypothesis.
|
Data sets and problems for learning hypothesis testing
You are supposed to form your hypotheses before seeing any of the actual data. These hypotheses come from some sort of conceptual frame work. Your best bet may be to form a hypothesis on a topic of
|
48,208
|
Data sets and problems for learning hypothesis testing
|
R has a whole bunch of datasets built in - they're used by all the examples for each function. Some are quite detailed, and you could do some really interesting stuff with them. The Quick-R site uses these datasets (the cars set especially) for most of their examples.
|
Data sets and problems for learning hypothesis testing
|
R has a whole bunch of datasets built in - they're used by all the examples for each function. Some are quite detailed, and you could do some really interesting stuff with them. The Quick-R site uses
|
Data sets and problems for learning hypothesis testing
R has a whole bunch of datasets built in - they're used by all the examples for each function. Some are quite detailed, and you could do some really interesting stuff with them. The Quick-R site uses these datasets (the cars set especially) for most of their examples.
|
Data sets and problems for learning hypothesis testing
R has a whole bunch of datasets built in - they're used by all the examples for each function. Some are quite detailed, and you could do some really interesting stuff with them. The Quick-R site uses
|
48,209
|
How to sample randomly from a population?
|
It's a fine method in theory. To see why, we need to check two things.
Are all individuals selected with equal chances? Yes, because the distributions of floats assigned to each individual are identical (they are uniform in $[0,1)$).
Are the selections independent? Yes, because the floats assigned to the individuals are independent (presumably: that's part of what it means to be a "high quality" random number generator).
However, this method tends to be inefficient both in terms of computation time and memory resources. It takes $O(n\log(n))$ time and $O(n)$ memory for selecting from a population of $n$. Both can often be improved, sometimes greatly.
A general-purpose algorithm starts by considering how much of the population you need to sample. If it's more than half the population, then identify the individuals not in the sample and select the rest (at a cost of $O(n)$ time). This leaves us to identify no more than half the population, say $k$ out of $n$ individuals (with $2k \le n$). Let their identifiers be in an array population[0..n-1]:
i = 0
selection = new set
while (i < k) {
x = random float in [0,1)
j = int(x * (n-i))
adjoin population[j] to selection
population[j] = population[n-1-i]
i++
}
return selection
The key step--copying the last individual at population[n-i-i] into the space vacated by the recently selected individual, population[j]--doesn't actually require the entire population[] array to be in RAM: you can do it with a dictionary of $k$ pointers instead. This makes the computation time $O(k \log(k))$ rather than $O(k)$ but reduces the storage requirements from $O(n)$ to $O(k)$, which can be substantial for small selections from huge populations stored offline.
The proof that this algorithm works is inductive. Obviously it works for $n=1$. For general $n\gt 1$, and assuming the random float procedure is a good one, then at the first step (a) each individual is chosen with equal probability and (b) that choice is independent of the next step, which selects $k-1$ individuals from a population of $n-1$. Because this (inductively) is assumed to be correct, we are done.
|
How to sample randomly from a population?
|
It's a fine method in theory. To see why, we need to check two things.
Are all individuals selected with equal chances? Yes, because the distributions of floats assigned to each individual are iden
|
How to sample randomly from a population?
It's a fine method in theory. To see why, we need to check two things.
Are all individuals selected with equal chances? Yes, because the distributions of floats assigned to each individual are identical (they are uniform in $[0,1)$).
Are the selections independent? Yes, because the floats assigned to the individuals are independent (presumably: that's part of what it means to be a "high quality" random number generator).
However, this method tends to be inefficient both in terms of computation time and memory resources. It takes $O(n\log(n))$ time and $O(n)$ memory for selecting from a population of $n$. Both can often be improved, sometimes greatly.
A general-purpose algorithm starts by considering how much of the population you need to sample. If it's more than half the population, then identify the individuals not in the sample and select the rest (at a cost of $O(n)$ time). This leaves us to identify no more than half the population, say $k$ out of $n$ individuals (with $2k \le n$). Let their identifiers be in an array population[0..n-1]:
i = 0
selection = new set
while (i < k) {
x = random float in [0,1)
j = int(x * (n-i))
adjoin population[j] to selection
population[j] = population[n-1-i]
i++
}
return selection
The key step--copying the last individual at population[n-i-i] into the space vacated by the recently selected individual, population[j]--doesn't actually require the entire population[] array to be in RAM: you can do it with a dictionary of $k$ pointers instead. This makes the computation time $O(k \log(k))$ rather than $O(k)$ but reduces the storage requirements from $O(n)$ to $O(k)$, which can be substantial for small selections from huge populations stored offline.
The proof that this algorithm works is inductive. Obviously it works for $n=1$. For general $n\gt 1$, and assuming the random float procedure is a good one, then at the first step (a) each individual is chosen with equal probability and (b) that choice is independent of the next step, which selects $k-1$ individuals from a population of $n-1$. Because this (inductively) is assumed to be correct, we are done.
|
How to sample randomly from a population?
It's a fine method in theory. To see why, we need to check two things.
Are all individuals selected with equal chances? Yes, because the distributions of floats assigned to each individual are iden
|
48,210
|
How to find P(X > F) in ANOVA F-test?
|
The answer can not be retrieved without the aid of computation.
If you look at the F distribution table for F(3,19), you'll see that (for F(3,20):
...
.050 | 3.10
.025 | 3.86
...
Which means 0.025 < p < 0.05.
I'm guessing that they "cheated" with MATLAB or something.
|
How to find P(X > F) in ANOVA F-test?
|
The answer can not be retrieved without the aid of computation.
If you look at the F distribution table for F(3,19), you'll see that (for F(3,20):
...
.050 | 3.10
.025 | 3.86
...
Which means 0.025 < p
|
How to find P(X > F) in ANOVA F-test?
The answer can not be retrieved without the aid of computation.
If you look at the F distribution table for F(3,19), you'll see that (for F(3,20):
...
.050 | 3.10
.025 | 3.86
...
Which means 0.025 < p < 0.05.
I'm guessing that they "cheated" with MATLAB or something.
|
How to find P(X > F) in ANOVA F-test?
The answer can not be retrieved without the aid of computation.
If you look at the F distribution table for F(3,19), you'll see that (for F(3,20):
...
.050 | 3.10
.025 | 3.86
...
Which means 0.025 < p
|
48,211
|
How to find P(X > F) in ANOVA F-test?
|
Since the test statistics follows F-ratio distribution, the $\mathbb{P}(X>z)$ is known in closed form.
Let $X \sim F(n,m)$. Then
$$
\mathbb{P}(X > z) = \tilde{B}_{\frac{m}{m+ n z}}\left( \frac{m}{2}, \frac{n}{2} \right)
$$
For $n=3$ and $m=19$ and $z=3.77$, Wolfram Alpha produces the answer of $0.0280768$.
|
How to find P(X > F) in ANOVA F-test?
|
Since the test statistics follows F-ratio distribution, the $\mathbb{P}(X>z)$ is known in closed form.
Let $X \sim F(n,m)$. Then
$$
\mathbb{P}(X > z) = \tilde{B}_{\frac{m}{m+ n z}}\left( \frac{m}{
|
How to find P(X > F) in ANOVA F-test?
Since the test statistics follows F-ratio distribution, the $\mathbb{P}(X>z)$ is known in closed form.
Let $X \sim F(n,m)$. Then
$$
\mathbb{P}(X > z) = \tilde{B}_{\frac{m}{m+ n z}}\left( \frac{m}{2}, \frac{n}{2} \right)
$$
For $n=3$ and $m=19$ and $z=3.77$, Wolfram Alpha produces the answer of $0.0280768$.
|
How to find P(X > F) in ANOVA F-test?
Since the test statistics follows F-ratio distribution, the $\mathbb{P}(X>z)$ is known in closed form.
Let $X \sim F(n,m)$. Then
$$
\mathbb{P}(X > z) = \tilde{B}_{\frac{m}{m+ n z}}\left( \frac{m}{
|
48,212
|
What are the sampling distributions of higher moments of the normal distribution?
|
I'm interested in the width of the distribution of $Y_m$. How does its variance scale with the sample size $N$?
$\text{var}(X_i^m) = E[X_i^{2m}] - (E[X_i^m])^2$ is easily evaluated from the moment-generating function $\exp(\sigma^2t^2/2 + \mu t)$ of the $N(\mu, \sigma^2)$ random variable $X_i$ (or from the characteristic function as suggested in the comment by mpiktas). Since this variance does not depend on $i$,
let us denote it by $\text{var}(X^m)$. Then, since the $X_i^m$'s are independent random variables (they are functions of independent random variables), we have
$$\text{var}(Y_m) = \text{var}\left(\frac{1}{N}\sum_{i=1}^N X_i^m\right)
= \frac{1}{N^2}\left(\sum_{i=1}^N \text{var}(X_i^m)\right)
= \frac{1}{N}\text{var}(X^m)$$
Note that the displayed equation above does not require that the $X_i$ be
normal random variables. For i.i.d. random variables $Z_i$ (with finite
second moment), the
variance of $N^{-1}\sum_i Z_i$, the average of $N$ variables, is always
$N^{-1}\text{var}(Z)$, that is the variance always scales as $1/N$.
For general distributions, the Chebyshev inequality can be used to obtain
a weak bound on the width of the distribution. See here for a related discussion.
|
What are the sampling distributions of higher moments of the normal distribution?
|
I'm interested in the width of the distribution of $Y_m$. How does its variance scale with the sample size $N$?
$\text{var}(X_i^m) = E[X_i^{2m}] - (E[X_i^m])^2$ is easily evaluated from the moment-ge
|
What are the sampling distributions of higher moments of the normal distribution?
I'm interested in the width of the distribution of $Y_m$. How does its variance scale with the sample size $N$?
$\text{var}(X_i^m) = E[X_i^{2m}] - (E[X_i^m])^2$ is easily evaluated from the moment-generating function $\exp(\sigma^2t^2/2 + \mu t)$ of the $N(\mu, \sigma^2)$ random variable $X_i$ (or from the characteristic function as suggested in the comment by mpiktas). Since this variance does not depend on $i$,
let us denote it by $\text{var}(X^m)$. Then, since the $X_i^m$'s are independent random variables (they are functions of independent random variables), we have
$$\text{var}(Y_m) = \text{var}\left(\frac{1}{N}\sum_{i=1}^N X_i^m\right)
= \frac{1}{N^2}\left(\sum_{i=1}^N \text{var}(X_i^m)\right)
= \frac{1}{N}\text{var}(X^m)$$
Note that the displayed equation above does not require that the $X_i$ be
normal random variables. For i.i.d. random variables $Z_i$ (with finite
second moment), the
variance of $N^{-1}\sum_i Z_i$, the average of $N$ variables, is always
$N^{-1}\text{var}(Z)$, that is the variance always scales as $1/N$.
For general distributions, the Chebyshev inequality can be used to obtain
a weak bound on the width of the distribution. See here for a related discussion.
|
What are the sampling distributions of higher moments of the normal distribution?
I'm interested in the width of the distribution of $Y_m$. How does its variance scale with the sample size $N$?
$\text{var}(X_i^m) = E[X_i^{2m}] - (E[X_i^m])^2$ is easily evaluated from the moment-ge
|
48,213
|
Parallel solving Ax=b?
|
You can decompose this operation into a set of smaller operations that are easy to parallelize.
Suppose you wish to solve $\mathbf{m}\mathbf{v}=\mathbf{u}$ for an $N$ by $N$ matrix $\mathbf{m}$ and $N$-vector $\mathbf{u}$. Writing $N=n+m$ (intending $n\approx m$), decompose $\mathbf{m}$ into four blocks $\mathbf{a}_{n \times n}$, $\mathbf{b}_{n \times m}$, $\mathbf{c}_{m\times n}$, and $\mathbf{d}_{m \times m}$, and also decompose $\mathbf{u}$ into its first $n$ components $\mathbf{e}_n$ and its last $m$ components $\mathbf{f}_m$ while similarly expressing $\mathbf{v}$ as the concatenation of the $n$-vector $\mathbf{x}$ and the $m$-vector $\mathbf{y}$. The original system is readily seen to be equivalent to the sequence
$$\eqalign{
\mathbf{a} \mathbf{z} &= \mathbf{e} \\
\mathbf{a} \mathbf{w} &= \mathbf{b} \\
\left(\mathbf{d}-\mathbf{c}\mathbf{w}\right)\mathbf{y}& = \mathbf{f} - \mathbf{c}\mathbf{z} \\
\mathbf{a}\mathbf{x} &= \mathbf{e} - \mathbf{b}\mathbf{y}
}$$
The first two form $m+1$ systems of $n$ equations (having a common matrix); the third is a single system of $m$ equations (depending on the solutions to the first two); and the last is a single system of $n$ equations (depending on the solution to the third). By choosing $m \approx n \approx N/2$, you have reduced the sizes of the matrices involved and you have created an opportunity to run the first $m+1$ systems in parallel. If this is not enough, the technique can be applied recursively.
This approach works no matter what algorithm for solving a linear system you may favor.
|
Parallel solving Ax=b?
|
You can decompose this operation into a set of smaller operations that are easy to parallelize.
Suppose you wish to solve $\mathbf{m}\mathbf{v}=\mathbf{u}$ for an $N$ by $N$ matrix $\mathbf{m}$ and $N
|
Parallel solving Ax=b?
You can decompose this operation into a set of smaller operations that are easy to parallelize.
Suppose you wish to solve $\mathbf{m}\mathbf{v}=\mathbf{u}$ for an $N$ by $N$ matrix $\mathbf{m}$ and $N$-vector $\mathbf{u}$. Writing $N=n+m$ (intending $n\approx m$), decompose $\mathbf{m}$ into four blocks $\mathbf{a}_{n \times n}$, $\mathbf{b}_{n \times m}$, $\mathbf{c}_{m\times n}$, and $\mathbf{d}_{m \times m}$, and also decompose $\mathbf{u}$ into its first $n$ components $\mathbf{e}_n$ and its last $m$ components $\mathbf{f}_m$ while similarly expressing $\mathbf{v}$ as the concatenation of the $n$-vector $\mathbf{x}$ and the $m$-vector $\mathbf{y}$. The original system is readily seen to be equivalent to the sequence
$$\eqalign{
\mathbf{a} \mathbf{z} &= \mathbf{e} \\
\mathbf{a} \mathbf{w} &= \mathbf{b} \\
\left(\mathbf{d}-\mathbf{c}\mathbf{w}\right)\mathbf{y}& = \mathbf{f} - \mathbf{c}\mathbf{z} \\
\mathbf{a}\mathbf{x} &= \mathbf{e} - \mathbf{b}\mathbf{y}
}$$
The first two form $m+1$ systems of $n$ equations (having a common matrix); the third is a single system of $m$ equations (depending on the solutions to the first two); and the last is a single system of $n$ equations (depending on the solution to the third). By choosing $m \approx n \approx N/2$, you have reduced the sizes of the matrices involved and you have created an opportunity to run the first $m+1$ systems in parallel. If this is not enough, the technique can be applied recursively.
This approach works no matter what algorithm for solving a linear system you may favor.
|
Parallel solving Ax=b?
You can decompose this operation into a set of smaller operations that are easy to parallelize.
Suppose you wish to solve $\mathbf{m}\mathbf{v}=\mathbf{u}$ for an $N$ by $N$ matrix $\mathbf{m}$ and $N
|
48,214
|
Parallel solving Ax=b?
|
Have you tried QR decomposition? See Theorem 3 here for solving $Ax=b$.
Finding the inverse of a matrix (even a small one) is a slow process. Methods such as QR or Cholesky decomposition are used in practice when 'inverting' is needed (at least in my experience in statistical programming).
|
Parallel solving Ax=b?
|
Have you tried QR decomposition? See Theorem 3 here for solving $Ax=b$.
Finding the inverse of a matrix (even a small one) is a slow process. Methods such as QR or Cholesky decomposition are used in
|
Parallel solving Ax=b?
Have you tried QR decomposition? See Theorem 3 here for solving $Ax=b$.
Finding the inverse of a matrix (even a small one) is a slow process. Methods such as QR or Cholesky decomposition are used in practice when 'inverting' is needed (at least in my experience in statistical programming).
|
Parallel solving Ax=b?
Have you tried QR decomposition? See Theorem 3 here for solving $Ax=b$.
Finding the inverse of a matrix (even a small one) is a slow process. Methods such as QR or Cholesky decomposition are used in
|
48,215
|
Odd problem with a histogram in R with a relative frequency axis
|
One explanation is that the standard deviation of your data is much less than one, and the histogram is giving something like the probability density.
For example, see how the density on the histogram changes when I divide a uniform random variable with range (0, 1) by 1000:
set.seed(4444)
x <- runif(100)
y <- x / 1000
par(mfrow=c(2,1))
hist(x, prob=TRUE)
hist(y, prob=TRUE)
If you want more intuitive looking density values, you could possibly change the units of the variable.
|
Odd problem with a histogram in R with a relative frequency axis
|
One explanation is that the standard deviation of your data is much less than one, and the histogram is giving something like the probability density.
For example, see how the density on the histogram
|
Odd problem with a histogram in R with a relative frequency axis
One explanation is that the standard deviation of your data is much less than one, and the histogram is giving something like the probability density.
For example, see how the density on the histogram changes when I divide a uniform random variable with range (0, 1) by 1000:
set.seed(4444)
x <- runif(100)
y <- x / 1000
par(mfrow=c(2,1))
hist(x, prob=TRUE)
hist(y, prob=TRUE)
If you want more intuitive looking density values, you could possibly change the units of the variable.
|
Odd problem with a histogram in R with a relative frequency axis
One explanation is that the standard deviation of your data is much less than one, and the histogram is giving something like the probability density.
For example, see how the density on the histogram
|
48,216
|
Odd problem with a histogram in R with a relative frequency axis
|
As other have noted, frequency=FALSE only makes the integral over the histogram equal to 1, not the sum over all values. (The parameter probability=TRUE is only there for S compatibility, by the way, and probably therefore a misnomer. Probability density would be better.)
Here is some code to relabel the y axis to plot probabilities as tick marks.
my.data <- rnorm(2000)
my.hist <- hist(my.data, breaks=100, yaxt='n', ylab="Probability")
ticks <- seq(par("yaxp")[1], par("yaxp")[2], length.out=par("yaxp")[3]+1)
l <- length(my.data)
max.prob <- max(my.hist$counts)/l
tick.labels <- head(pretty(c(0, max.prob)), -1)
ticks <- tick.labels * l
print(tick.labels)
print(sum(my.hist$counts/l))
axis(2, at=ticks, labels=tick.labels)
See this image for an example output:
|
Odd problem with a histogram in R with a relative frequency axis
|
As other have noted, frequency=FALSE only makes the integral over the histogram equal to 1, not the sum over all values. (The parameter probability=TRUE is only there for S compatibility, by the way,
|
Odd problem with a histogram in R with a relative frequency axis
As other have noted, frequency=FALSE only makes the integral over the histogram equal to 1, not the sum over all values. (The parameter probability=TRUE is only there for S compatibility, by the way, and probably therefore a misnomer. Probability density would be better.)
Here is some code to relabel the y axis to plot probabilities as tick marks.
my.data <- rnorm(2000)
my.hist <- hist(my.data, breaks=100, yaxt='n', ylab="Probability")
ticks <- seq(par("yaxp")[1], par("yaxp")[2], length.out=par("yaxp")[3]+1)
l <- length(my.data)
max.prob <- max(my.hist$counts)/l
tick.labels <- head(pretty(c(0, max.prob)), -1)
ticks <- tick.labels * l
print(tick.labels)
print(sum(my.hist$counts/l))
axis(2, at=ticks, labels=tick.labels)
See this image for an example output:
|
Odd problem with a histogram in R with a relative frequency axis
As other have noted, frequency=FALSE only makes the integral over the histogram equal to 1, not the sum over all values. (The parameter probability=TRUE is only there for S compatibility, by the way,
|
48,217
|
Odd problem with a histogram in R with a relative frequency axis
|
If you pass probability=TRUE (or frequency=FALSE) you should indeed see densities on the plot.
Note that this does not make it impossible for them to be above 1 if your number of breaks is relatively low and your bin widths are small (way below 1). Looking at the code of hist.default you can see that the densities are calculated as dens <- counts/(n * diff(breaks)).
What goes wrong in your case is hard to say without a look at the data itself (certainly the bin widths are broad enough to warrant small density values, per your explanation). However, I seem to recall that there were issues with hist in some relatively recent version of R. So maybe you can update to the latest version and try again?
|
Odd problem with a histogram in R with a relative frequency axis
|
If you pass probability=TRUE (or frequency=FALSE) you should indeed see densities on the plot.
Note that this does not make it impossible for them to be above 1 if your number of breaks is relatively
|
Odd problem with a histogram in R with a relative frequency axis
If you pass probability=TRUE (or frequency=FALSE) you should indeed see densities on the plot.
Note that this does not make it impossible for them to be above 1 if your number of breaks is relatively low and your bin widths are small (way below 1). Looking at the code of hist.default you can see that the densities are calculated as dens <- counts/(n * diff(breaks)).
What goes wrong in your case is hard to say without a look at the data itself (certainly the bin widths are broad enough to warrant small density values, per your explanation). However, I seem to recall that there were issues with hist in some relatively recent version of R. So maybe you can update to the latest version and try again?
|
Odd problem with a histogram in R with a relative frequency axis
If you pass probability=TRUE (or frequency=FALSE) you should indeed see densities on the plot.
Note that this does not make it impossible for them to be above 1 if your number of breaks is relatively
|
48,218
|
How to report general precision in estimating correlations within a context of justifying sample size?
|
I do think constructing confidence intervals around parameter estimates (such as correlations, among other kinds) is a good thing to do. I strongly recommend it. Moreover, I don't think it should matter if the observed value is 0 or any other focal value. If someone claims that they did a study and found that the correlation was 0, you would want to know something about how confident we can be regarding that answer, and confidence intervals help to provide that information. There is a big difference between $r=0\pm.5$ and $r=0\pm.05$.
The concept of statistical power is defined within the Neyman-Pearson framework. (The Neyman-Pearson framework is often easiest to understand when contrasted with the Fisherian approach; you can find a nice, quick overview of NP from that perspective here.) If you can specify a type I error rate ($\alpha$), a sample size ($N$), and a candidate effect size ($r$), you can calculate the probability of making a type II error ($\beta$) or the probability of correctly rejecting the null hypothesis ($1-\beta$). But if you're not interested in significance testing, I recognize that this conception of power does become less appealing.
However, I gather your criticism is that $r$ will never truly equal 0 within your domain. That is pretty common with observational research as Meehl (1990) famously pointed out. Thus, testing to see if $r=0$ is testing if the underlying network of causal forces is perfectly balanced, which is typically very unlikely (but see here and here for some counterexamples). Nonetheless, you can take any point value as your null (although this almost never happens in practice). For example, you could do a one-tailed test to see if $r>.3$ (or $< -.3$), which Meehl gestimated is the level of "ambient correlational noise".
I say these things for the sake of completeness; I'm not trying to push you towards significance testing. You state that "[i]t's the relative amount that matters", a sentiment with which I agree wholeheartedly (see my answer here, for instance). There is another concept, related to power, that would better suit your needs. The framework you are looking for is known as Accuracy in Parameter Estimation, or AIPE (Maxwell et al., 2008), which I recommend. You will want to take a look at the work by Ken Kelly, he describes AIPE thusly:
Accuracy in parameter estimation in this sense is operationalized by
obtaining confidence intervals that are sufficiently narrow. A narrow
confidence interval provides more information about the population
parameter of interest than does a wide interval or a null hypothesis
significance test, as the interval reveals whether or not some null
value (generally zero) can be rejected and it defines the range of
plausible values for the parameter at some specified level of
confidence.
References:
Maxwell, S.E., Kelley, K., & Rausch, J.R. (2008). Sample Size Planning for Statistical Power and Accuracy in Parameter Estimation. Annual Review of Psychology, Vol. 59: 537-563.
Meehl, P.E. (1990). Why summaries of research on psychological theories are often uninterpretable. Psychological Reports, 66, 195-244.
|
How to report general precision in estimating correlations within a context of justifying sample siz
|
I do think constructing confidence intervals around parameter estimates (such as correlations, among other kinds) is a good thing to do. I strongly recommend it. Moreover, I don't think it should ma
|
How to report general precision in estimating correlations within a context of justifying sample size?
I do think constructing confidence intervals around parameter estimates (such as correlations, among other kinds) is a good thing to do. I strongly recommend it. Moreover, I don't think it should matter if the observed value is 0 or any other focal value. If someone claims that they did a study and found that the correlation was 0, you would want to know something about how confident we can be regarding that answer, and confidence intervals help to provide that information. There is a big difference between $r=0\pm.5$ and $r=0\pm.05$.
The concept of statistical power is defined within the Neyman-Pearson framework. (The Neyman-Pearson framework is often easiest to understand when contrasted with the Fisherian approach; you can find a nice, quick overview of NP from that perspective here.) If you can specify a type I error rate ($\alpha$), a sample size ($N$), and a candidate effect size ($r$), you can calculate the probability of making a type II error ($\beta$) or the probability of correctly rejecting the null hypothesis ($1-\beta$). But if you're not interested in significance testing, I recognize that this conception of power does become less appealing.
However, I gather your criticism is that $r$ will never truly equal 0 within your domain. That is pretty common with observational research as Meehl (1990) famously pointed out. Thus, testing to see if $r=0$ is testing if the underlying network of causal forces is perfectly balanced, which is typically very unlikely (but see here and here for some counterexamples). Nonetheless, you can take any point value as your null (although this almost never happens in practice). For example, you could do a one-tailed test to see if $r>.3$ (or $< -.3$), which Meehl gestimated is the level of "ambient correlational noise".
I say these things for the sake of completeness; I'm not trying to push you towards significance testing. You state that "[i]t's the relative amount that matters", a sentiment with which I agree wholeheartedly (see my answer here, for instance). There is another concept, related to power, that would better suit your needs. The framework you are looking for is known as Accuracy in Parameter Estimation, or AIPE (Maxwell et al., 2008), which I recommend. You will want to take a look at the work by Ken Kelly, he describes AIPE thusly:
Accuracy in parameter estimation in this sense is operationalized by
obtaining confidence intervals that are sufficiently narrow. A narrow
confidence interval provides more information about the population
parameter of interest than does a wide interval or a null hypothesis
significance test, as the interval reveals whether or not some null
value (generally zero) can be rejected and it defines the range of
plausible values for the parameter at some specified level of
confidence.
References:
Maxwell, S.E., Kelley, K., & Rausch, J.R. (2008). Sample Size Planning for Statistical Power and Accuracy in Parameter Estimation. Annual Review of Psychology, Vol. 59: 537-563.
Meehl, P.E. (1990). Why summaries of research on psychological theories are often uninterpretable. Psychological Reports, 66, 195-244.
|
How to report general precision in estimating correlations within a context of justifying sample siz
I do think constructing confidence intervals around parameter estimates (such as correlations, among other kinds) is a good thing to do. I strongly recommend it. Moreover, I don't think it should ma
|
48,219
|
How to report general precision in estimating correlations within a context of justifying sample size?
|
You can construct a confidence interval for the correlation; see here and here.
I don't understand what you mean by "... 95% confidence intervals on correlations when the correlation is zero, or perhaps some other focal value."
|
How to report general precision in estimating correlations within a context of justifying sample siz
|
You can construct a confidence interval for the correlation; see here and here.
I don't understand what you mean by "... 95% confidence intervals on correlations when the correlation is zero, or perh
|
How to report general precision in estimating correlations within a context of justifying sample size?
You can construct a confidence interval for the correlation; see here and here.
I don't understand what you mean by "... 95% confidence intervals on correlations when the correlation is zero, or perhaps some other focal value."
|
How to report general precision in estimating correlations within a context of justifying sample siz
You can construct a confidence interval for the correlation; see here and here.
I don't understand what you mean by "... 95% confidence intervals on correlations when the correlation is zero, or perh
|
48,220
|
Maximum likelihood estimation procedures for state-space linear models
|
If you consider gaussian state-space models, maximum likelihood is conceptually straightforward, and several packages in R (including dlm, kfas, or FKF, to name a few)
include routines for doing so: you can find a short review here (disclaimer: I am the author) and a monographic issue of the Journal of Statistical Software covering state-space models and their estimation here.
Newton-Raphson methods are generally used and have been found to be generally faster (and are indeed used in the packages mentioned). The EM algorithm is quite well suited to the problem, but slower (see e.g. Shumway and Stoffer(2010), Sec. 6.3).
A particular topic which is sometimes neglected is the instability of the
most naive implementations of the Kalman filter: on this it is useful (although very old) this monography by Bierman and you may find useful books like
Grewal. There are also quite a lot of papers, that you will find easily googling for "square root filters" or similar expressions.
|
Maximum likelihood estimation procedures for state-space linear models
|
If you consider gaussian state-space models, maximum likelihood is conceptually straightforward, and several packages in R (including dlm, kfas, or FKF, to name a few)
include routines for doing so: y
|
Maximum likelihood estimation procedures for state-space linear models
If you consider gaussian state-space models, maximum likelihood is conceptually straightforward, and several packages in R (including dlm, kfas, or FKF, to name a few)
include routines for doing so: you can find a short review here (disclaimer: I am the author) and a monographic issue of the Journal of Statistical Software covering state-space models and their estimation here.
Newton-Raphson methods are generally used and have been found to be generally faster (and are indeed used in the packages mentioned). The EM algorithm is quite well suited to the problem, but slower (see e.g. Shumway and Stoffer(2010), Sec. 6.3).
A particular topic which is sometimes neglected is the instability of the
most naive implementations of the Kalman filter: on this it is useful (although very old) this monography by Bierman and you may find useful books like
Grewal. There are also quite a lot of papers, that you will find easily googling for "square root filters" or similar expressions.
|
Maximum likelihood estimation procedures for state-space linear models
If you consider gaussian state-space models, maximum likelihood is conceptually straightforward, and several packages in R (including dlm, kfas, or FKF, to name a few)
include routines for doing so: y
|
48,221
|
Calculating standard error and attaching an error bar on ggplot2 bar chart
|
Here's an example from the ggplot2 homepage: https://ggplot2.tidyverse.org/reference/geom_errorbarh.html as others have mentioned in the comments, you have to calculate SE on your own and append this information to the data.frame
df <- data.frame(
trt = factor(c(1, 1, 2, 2)),
resp = c(1, 5, 3, 4),
group = factor(c(1, 2, 1, 2)),
se = c(0.1, 0.3, 0.3, 0.2)
)
df2 <- df[c(1,3),]
p <- ggplot(df, aes(fill=group, y=resp, x=trt))
p + geom_bar(position="dodge", stat="identity")
dodge <- position_dodge(width=0.9)
p + geom_bar(position=dodge, stat="identity") + geom_errorbar(aes(ymax = resp + se, ymin=resp - se), position=dodge, width=0.25)
As a pointer, SE @ 95% CI usually looks something like this:
df$se <- 1.96*(sd(your_data, na.rm=T)/sqrt(your_n))
Your upper and lower CI bounds will just be df$se +/- the response (as shown in the aes() for geom_errorbar(), above)
|
Calculating standard error and attaching an error bar on ggplot2 bar chart
|
Here's an example from the ggplot2 homepage: https://ggplot2.tidyverse.org/reference/geom_errorbarh.html as others have mentioned in the comments, you have to calculate SE on your own and append this
|
Calculating standard error and attaching an error bar on ggplot2 bar chart
Here's an example from the ggplot2 homepage: https://ggplot2.tidyverse.org/reference/geom_errorbarh.html as others have mentioned in the comments, you have to calculate SE on your own and append this information to the data.frame
df <- data.frame(
trt = factor(c(1, 1, 2, 2)),
resp = c(1, 5, 3, 4),
group = factor(c(1, 2, 1, 2)),
se = c(0.1, 0.3, 0.3, 0.2)
)
df2 <- df[c(1,3),]
p <- ggplot(df, aes(fill=group, y=resp, x=trt))
p + geom_bar(position="dodge", stat="identity")
dodge <- position_dodge(width=0.9)
p + geom_bar(position=dodge, stat="identity") + geom_errorbar(aes(ymax = resp + se, ymin=resp - se), position=dodge, width=0.25)
As a pointer, SE @ 95% CI usually looks something like this:
df$se <- 1.96*(sd(your_data, na.rm=T)/sqrt(your_n))
Your upper and lower CI bounds will just be df$se +/- the response (as shown in the aes() for geom_errorbar(), above)
|
Calculating standard error and attaching an error bar on ggplot2 bar chart
Here's an example from the ggplot2 homepage: https://ggplot2.tidyverse.org/reference/geom_errorbarh.html as others have mentioned in the comments, you have to calculate SE on your own and append this
|
48,222
|
Trend analysis with three time points in a repeated measures design
|
If you have a constant term in your model, the midpoint is not being ignored, even though it is given a value of zero in this coding. The value equal to the mean of the two other values indicates to the software that the time spacings are equal. You can code your time as 1, 2 and 3, but then it will be collinear with the constant/intercept, resulting in somewhat less efficient estimates, while what you have is mean-centered coding. You can even do a one d.f. test for linearity by including a quadratic term.
The two approaches you are contemplating are nested within one another: by restricting the variance of the random effects to zero, you will obtain the simple trend model. With 15 subjects, however, your power is likely to be very low, and the estimates of the variance components, very imprecise.
Trying both approaches is a matter of three lines:
lm(outcome ~ time)
library(lme4)
lmer(outcome ~ time + (1|subject))
lmer(outcome ~ time + (time|subject))
Why don't you just do this and post the results? May be we'd see clearly what's going on, and whether it is worth bothering working with the mixed effects model.
|
Trend analysis with three time points in a repeated measures design
|
If you have a constant term in your model, the midpoint is not being ignored, even though it is given a value of zero in this coding. The value equal to the mean of the two other values indicates to t
|
Trend analysis with three time points in a repeated measures design
If you have a constant term in your model, the midpoint is not being ignored, even though it is given a value of zero in this coding. The value equal to the mean of the two other values indicates to the software that the time spacings are equal. You can code your time as 1, 2 and 3, but then it will be collinear with the constant/intercept, resulting in somewhat less efficient estimates, while what you have is mean-centered coding. You can even do a one d.f. test for linearity by including a quadratic term.
The two approaches you are contemplating are nested within one another: by restricting the variance of the random effects to zero, you will obtain the simple trend model. With 15 subjects, however, your power is likely to be very low, and the estimates of the variance components, very imprecise.
Trying both approaches is a matter of three lines:
lm(outcome ~ time)
library(lme4)
lmer(outcome ~ time + (1|subject))
lmer(outcome ~ time + (time|subject))
Why don't you just do this and post the results? May be we'd see clearly what's going on, and whether it is worth bothering working with the mixed effects model.
|
Trend analysis with three time points in a repeated measures design
If you have a constant term in your model, the midpoint is not being ignored, even though it is given a value of zero in this coding. The value equal to the mean of the two other values indicates to t
|
48,223
|
Trend analysis with three time points in a repeated measures design
|
Sorry to disappoint, but I would NOT try to categorize this as trend analysis, at least not in the usual time series sense.
That said, you can still do productive modeling. You look at testing the hypothesis that the difference between (t1,t2) is non-zero (i.e. test against the null hypothesis). You could do the same for (t2,t3).
Where this gets tricky is that the intervals (t2 - t1) and (t3 - t2) are not well defined in your question. There may be a constant interval, but is the response believed to have a linear relationship with the interval? Try examining students' math scores in January, May, and September, and you may see that the second interval drops a lot relative to the gain made in the first interval. Students' math scores croak in the summer.
So, I would first begin with two separate tests.
Second, what I would try is sign-testing of the deltas for the two periods. For this, you can do simple binomial hypothesis testing. (NB: If all values change monotonically, regardless of the factor being studied, then de-trending will be a little hard, but you could center with the sample mean at each timepoint.)
|
Trend analysis with three time points in a repeated measures design
|
Sorry to disappoint, but I would NOT try to categorize this as trend analysis, at least not in the usual time series sense.
That said, you can still do productive modeling. You look at testing the hy
|
Trend analysis with three time points in a repeated measures design
Sorry to disappoint, but I would NOT try to categorize this as trend analysis, at least not in the usual time series sense.
That said, you can still do productive modeling. You look at testing the hypothesis that the difference between (t1,t2) is non-zero (i.e. test against the null hypothesis). You could do the same for (t2,t3).
Where this gets tricky is that the intervals (t2 - t1) and (t3 - t2) are not well defined in your question. There may be a constant interval, but is the response believed to have a linear relationship with the interval? Try examining students' math scores in January, May, and September, and you may see that the second interval drops a lot relative to the gain made in the first interval. Students' math scores croak in the summer.
So, I would first begin with two separate tests.
Second, what I would try is sign-testing of the deltas for the two periods. For this, you can do simple binomial hypothesis testing. (NB: If all values change monotonically, regardless of the factor being studied, then de-trending will be a little hard, but you could center with the sample mean at each timepoint.)
|
Trend analysis with three time points in a repeated measures design
Sorry to disappoint, but I would NOT try to categorize this as trend analysis, at least not in the usual time series sense.
That said, you can still do productive modeling. You look at testing the hy
|
48,224
|
Estimating standard deviation in Poisson regression
|
Poisson regression finds a value $\hat{\beta}$ maximizing the likelihood of the data. For any value of $x$, you would then suppose $Y$ has a Poisson($\exp(x \hat{\beta})$) distribution. The standard deviation of that distribution equals $\exp(x \hat{\beta}/2)$. This appears to be what you mean by $\sqrt{\widehat{\mu}}$.
There are, of course, other ways to estimate the standard deviation of $Y|x$. However, staying within the context of Poisson regression, $\exp(x \hat{\beta}/2)$ is the ML estimator of SD($Y|x$) for the simple reason that the ML estimator of a function of the parameters is the same function of the ML estimator of those parameters. The function in this case is the one sending $\hat{\beta}$ to $\exp(x \hat{\beta}/2)$ (for any fixed value of $x$). This theorem will appear in any full account of maximum likelihood estimation. Its proof is straightforward. Conceptually, the function is a way to re-express the parameters, but re-expressing them doesn't change the fact that they maximize (or fail to maximize, depending on their values) the likelihood.
|
Estimating standard deviation in Poisson regression
|
Poisson regression finds a value $\hat{\beta}$ maximizing the likelihood of the data. For any value of $x$, you would then suppose $Y$ has a Poisson($\exp(x \hat{\beta})$) distribution. The standard
|
Estimating standard deviation in Poisson regression
Poisson regression finds a value $\hat{\beta}$ maximizing the likelihood of the data. For any value of $x$, you would then suppose $Y$ has a Poisson($\exp(x \hat{\beta})$) distribution. The standard deviation of that distribution equals $\exp(x \hat{\beta}/2)$. This appears to be what you mean by $\sqrt{\widehat{\mu}}$.
There are, of course, other ways to estimate the standard deviation of $Y|x$. However, staying within the context of Poisson regression, $\exp(x \hat{\beta}/2)$ is the ML estimator of SD($Y|x$) for the simple reason that the ML estimator of a function of the parameters is the same function of the ML estimator of those parameters. The function in this case is the one sending $\hat{\beta}$ to $\exp(x \hat{\beta}/2)$ (for any fixed value of $x$). This theorem will appear in any full account of maximum likelihood estimation. Its proof is straightforward. Conceptually, the function is a way to re-express the parameters, but re-expressing them doesn't change the fact that they maximize (or fail to maximize, depending on their values) the likelihood.
|
Estimating standard deviation in Poisson regression
Poisson regression finds a value $\hat{\beta}$ maximizing the likelihood of the data. For any value of $x$, you would then suppose $Y$ has a Poisson($\exp(x \hat{\beta})$) distribution. The standard
|
48,225
|
Estimating standard deviation in Poisson regression
|
You are thinking too much in terms of "normally distributed" here. For a normal distribution, you have two parameters then mean $\mu$ and the variance, $\sigma^2$. So you require two pieces of information to characterize the probability distribution for the normal case.
However, in the Poisson distributed case, there is only one parameter, and that is the rate $\lambda$ (I relabeled to avoid confusion with normal). This characterizes the Poisson distribution, and so there is no need to refer to other quantities.
This is why probably why don't hear standard deviation "estimation" mentioned in Poisson regression. Asking for a standard deviation estimator for a Poisson random variable is analogous to asking for a kurtosis estimator for a normally distributed random variable. You can get one, but why bother? By estimating the rate parameter $\lambda$, you have all the information you need.
|
Estimating standard deviation in Poisson regression
|
You are thinking too much in terms of "normally distributed" here. For a normal distribution, you have two parameters then mean $\mu$ and the variance, $\sigma^2$. So you require two pieces of infor
|
Estimating standard deviation in Poisson regression
You are thinking too much in terms of "normally distributed" here. For a normal distribution, you have two parameters then mean $\mu$ and the variance, $\sigma^2$. So you require two pieces of information to characterize the probability distribution for the normal case.
However, in the Poisson distributed case, there is only one parameter, and that is the rate $\lambda$ (I relabeled to avoid confusion with normal). This characterizes the Poisson distribution, and so there is no need to refer to other quantities.
This is why probably why don't hear standard deviation "estimation" mentioned in Poisson regression. Asking for a standard deviation estimator for a Poisson random variable is analogous to asking for a kurtosis estimator for a normally distributed random variable. You can get one, but why bother? By estimating the rate parameter $\lambda$, you have all the information you need.
|
Estimating standard deviation in Poisson regression
You are thinking too much in terms of "normally distributed" here. For a normal distribution, you have two parameters then mean $\mu$ and the variance, $\sigma^2$. So you require two pieces of infor
|
48,226
|
Testing the importance of an item among a finite set of items
|
The naive approach would be to compute the marginal distribution of rankings (e.g., mean score for each item), but it would throw away a lot of information as it does not account for the within-person relationship between ranks.
As an extension to paired preference model (e.g., the Bradley-Terry model, described in Agresti's CDA pp. 436-439), there exist model for ordinal or likert-type comparison data with or without subject covariates, as well as model for ranking data (baiscally, it relies on the use of log-linear model). Here is a short intro to the package, and a mathematical explanation in this technical report: Fitting Paired Comparison Models in R. You will find everything you need in the prefmod R package, see the pattR.fit() function which expects data in the form you described:
The responses have to be coded as consecutive integers starting
with 1. The value of 1 means highest rank according to the
underlying scale. Each column in the data file corresponds to one
of the ranked objects. For example, if we have 3 objects denoted
by ‘A’,‘B’,and ‘C’, with corresponding columns in the data matrix,
the response pattern ‘(3,1,2)’ represents: object ‘B’ ranked
highest, ‘C’ ranked second, and ‘A’ ranked lowest. Missing values
are coded as ‘NA’, ties are not allowed (in that case use
‘pattL.fit’. Rows with less than 2 ranked objects are removed
from the fit and a message is printed.
For additional information (about and beyond your particular study), you might find useful the following papers:
Böckenholt, U. and Dillon, W.R. (1997). Modelling within-subject dependencies in ordinal paired comparison data. Psychometrika, 62, p.411-434
Dittrich, R., Francis, B., Hatzinger, R., and Katzenbeisser, W. (2006). Modelling dependency in multivariate paired comparisons: A log-linear approach. Mathematical Social Sciences, 52, 197-209.
Maydeu-Olivares, A. (2004). Thurstone's Case V model: A structural equations modeling perspective. In K.van Montfort et al. (eds), Recent Developments on Structural Equation Models, 41-67.
|
Testing the importance of an item among a finite set of items
|
The naive approach would be to compute the marginal distribution of rankings (e.g., mean score for each item), but it would throw away a lot of information as it does not account for the within-person
|
Testing the importance of an item among a finite set of items
The naive approach would be to compute the marginal distribution of rankings (e.g., mean score for each item), but it would throw away a lot of information as it does not account for the within-person relationship between ranks.
As an extension to paired preference model (e.g., the Bradley-Terry model, described in Agresti's CDA pp. 436-439), there exist model for ordinal or likert-type comparison data with or without subject covariates, as well as model for ranking data (baiscally, it relies on the use of log-linear model). Here is a short intro to the package, and a mathematical explanation in this technical report: Fitting Paired Comparison Models in R. You will find everything you need in the prefmod R package, see the pattR.fit() function which expects data in the form you described:
The responses have to be coded as consecutive integers starting
with 1. The value of 1 means highest rank according to the
underlying scale. Each column in the data file corresponds to one
of the ranked objects. For example, if we have 3 objects denoted
by ‘A’,‘B’,and ‘C’, with corresponding columns in the data matrix,
the response pattern ‘(3,1,2)’ represents: object ‘B’ ranked
highest, ‘C’ ranked second, and ‘A’ ranked lowest. Missing values
are coded as ‘NA’, ties are not allowed (in that case use
‘pattL.fit’. Rows with less than 2 ranked objects are removed
from the fit and a message is printed.
For additional information (about and beyond your particular study), you might find useful the following papers:
Böckenholt, U. and Dillon, W.R. (1997). Modelling within-subject dependencies in ordinal paired comparison data. Psychometrika, 62, p.411-434
Dittrich, R., Francis, B., Hatzinger, R., and Katzenbeisser, W. (2006). Modelling dependency in multivariate paired comparisons: A log-linear approach. Mathematical Social Sciences, 52, 197-209.
Maydeu-Olivares, A. (2004). Thurstone's Case V model: A structural equations modeling perspective. In K.van Montfort et al. (eds), Recent Developments on Structural Equation Models, 41-67.
|
Testing the importance of an item among a finite set of items
The naive approach would be to compute the marginal distribution of rankings (e.g., mean score for each item), but it would throw away a lot of information as it does not account for the within-person
|
48,227
|
Two poisson random variables and likelihood ratio test
|
The Bayesian test for your question is based on the integrated (rather than maximised) likelihood. So for Poisson we have:
$$\begin{array}{c|c}
H_{1}:\lambda_{1}=\lambda_{2} & H_{2}:\lambda_{1}\neq\lambda_{2}
\end{array}
$$
Now neither hypothesis says what the parameters are, so the actual values are nuisance parameters to be integrated out with respect to their prior probabilities.
$$P(H_{1}|D,I)=P(H_{1}|I)\frac{P(D|H_{1},I)}{P(D|I)}$$
The model likelihood is given by:
$$P(D|H_{1},I)=\int_{0}^{\infty} P(D,\lambda|H_{1},I)d\lambda=\int_{0}^{\infty} P(\lambda|H_{1},I)P(D|\lambda,H_{1},I)\,d\lambda$$
$$=\int_{0}^{\infty} P(\lambda|H_{1},I)\frac{\lambda^{x_1+x_2}\exp(-2\lambda)}{\Gamma(x_1+1)\Gamma(x_2+1)}\,d\lambda$$
where $P(\lambda|H_{1},I)$ is the prior for lambda. A convenient mathematical choice is the gamma prior, which gives:
$$P(D|H_{1},I)=\int_{0}^{\infty} \frac{\beta^{\alpha}}{\Gamma(\alpha)}\lambda^{\alpha-1}\exp(-\beta \lambda)\frac{\lambda^{x_1+x_2}exp(-2\lambda)}{\Gamma(x_1+1)\Gamma(x_2+1)}\,d\lambda$$
$$=\frac{\beta^{\alpha}\Gamma(x_1+x_2+\alpha)}{(2+\beta)^{x_1+x_2+\alpha}\Gamma(\alpha)\Gamma(x_1+1)\Gamma(x_2+1)}$$
And for the alternative hypothesis we have:
$$P(D|H_{2},I)=\frac{\beta_{1}^{\alpha_{1}}\beta_{2}^{\alpha_{2}}\Gamma(x_1+\alpha_{1})\Gamma(x_2+\alpha_{2})}{(1+\beta_{1})^{x_1+\alpha_{1}}(1+\beta_{2})^{x_2+\alpha_{2}}\Gamma(\alpha_{1})\Gamma(\alpha_{2})\Gamma(x_1+1)\Gamma(x_2+1)}$$
Now if we assume that all hyper-parameters are equal (not an unreasonable assumption, given that you are testing for equality), then we have an integrated likelihood ratio of:
$$\frac{P(D|H_{1},I)}{P(D|H_{2},I)}=
\frac{(1+\beta)^{x_1+x_2+2\alpha}\Gamma(x_1+x_2+\alpha)\Gamma(\alpha)}
{(2+\beta)^{x_1+x_2+\alpha}\beta^{\alpha}\Gamma(x_1+\alpha)\Gamma(x_2+\alpha)}
$$
Which you can see that the prior information is still very important. We can't set $\alpha$ or $\beta$ equal to zero (Jeffrey's prior), or else $H_{1}$ will always be favored, regardless of the data. One way to get values for them is to specify prior estimates for $E[\lambda]$ and $E[\log(\lambda)]$ and solve for the parameters - this cannot be based on $x_1$ or $x_2$ but can be based on any other relevant information. You can also put in a few different (reasonable) values for the parameters and see what difference it makes to the conclusion. The numerical value of this statistic tells you how much the data and your prior information about the rates in each hypothesis support the hypothesis of equal rates. This explains why the likelihood ratio test is not always reliable - because it essentially ignores prior information, which is usually equivalent to specifying Jeffrey's prior. Note that you could also specify upper and lower limits for the rate parameters (this is usually not too hard to do given some common sense thinking about the real world problem). Then you would use a prior of the form:
$$p(\lambda|I)=\frac{I(L<\lambda<U)}{\log\left(\frac{U}{L}\right)\lambda}$$
And you would be left with a similar equation to that above but in terms of incomplete, instead of complete gamma functions.
For the binomial case things are much simpler, because the non-informative prior (uniform) is proper. The procedure is similar to that above, and the integrated likelihood for $H_{1}:p_{1}=p_{2}$ is given by:
$$P(D|H_{1},I)={n_1 \choose x_1}{n_2 \choose x_2}\int_{0}^{1}p^{x_1+x_2}(1-p)^{n_1+n_2-x_1-x_2}\,dp$$
$$={n_1 \choose x_1}{n_2 \choose x_2}B(x_1+x_2+1,n_1+n_2-x_1-x_2+1)$$
And similarly for $H_{2}:p_{1}\neq p_{2}$
$$P(D|H_{2},I)={n_1 \choose x_1}{n_2 \choose x_2}\int_{0}^{1}p_{1}^{x_1}p_{2}^{x_2}(1-p_{1})^{n_1-x_1}(1-p_{2})^{n_{2}-x_{2}}\,dp_{1}\,dp_{2}$$
$$={n_1 \choose x_1}{n_2 \choose x_2}B(x_1+1,n_1-x_1+1)B(x_2+1,n_2-x_2+1)$$
And so taking ratios gives:
$$\frac{P(D|H_{1},I)}{P(D|H_{2},I)}=
\frac{B(x_1+x_2+1,n_1+n_2-x_1-x_2+1)}
{B(x_1+1,n_1-x_1+1)B(x_2+1,n_2-x_2+1)}
$$
$$=\frac{{x_1+x_2 \choose x_1}{n_1+n_2-x_1-x_2 \choose n_1-x_1}(n_1+1)(n_2+1)}{{n_1+n_2 \choose n_1}(n_1+n_2+1)}$$
And the choose functions can be calculated using the hypergeometric($r$,$n$,$R$,$N$) distribution where $N=n_1+n_2$, $R=x_1+x_2$, $n=n_1$, $r=x_1$
And this tells you how much the data support the hypothesis of equal probabilities, given that you don't have much information about which particular value this may be.
|
Two poisson random variables and likelihood ratio test
|
The Bayesian test for your question is based on the integrated (rather than maximised) likelihood. So for Poisson we have:
$$\begin{array}{c|c}
H_{1}:\lambda_{1}=\lambda_{2} & H_{2}:\lambda_{1}\neq\l
|
Two poisson random variables and likelihood ratio test
The Bayesian test for your question is based on the integrated (rather than maximised) likelihood. So for Poisson we have:
$$\begin{array}{c|c}
H_{1}:\lambda_{1}=\lambda_{2} & H_{2}:\lambda_{1}\neq\lambda_{2}
\end{array}
$$
Now neither hypothesis says what the parameters are, so the actual values are nuisance parameters to be integrated out with respect to their prior probabilities.
$$P(H_{1}|D,I)=P(H_{1}|I)\frac{P(D|H_{1},I)}{P(D|I)}$$
The model likelihood is given by:
$$P(D|H_{1},I)=\int_{0}^{\infty} P(D,\lambda|H_{1},I)d\lambda=\int_{0}^{\infty} P(\lambda|H_{1},I)P(D|\lambda,H_{1},I)\,d\lambda$$
$$=\int_{0}^{\infty} P(\lambda|H_{1},I)\frac{\lambda^{x_1+x_2}\exp(-2\lambda)}{\Gamma(x_1+1)\Gamma(x_2+1)}\,d\lambda$$
where $P(\lambda|H_{1},I)$ is the prior for lambda. A convenient mathematical choice is the gamma prior, which gives:
$$P(D|H_{1},I)=\int_{0}^{\infty} \frac{\beta^{\alpha}}{\Gamma(\alpha)}\lambda^{\alpha-1}\exp(-\beta \lambda)\frac{\lambda^{x_1+x_2}exp(-2\lambda)}{\Gamma(x_1+1)\Gamma(x_2+1)}\,d\lambda$$
$$=\frac{\beta^{\alpha}\Gamma(x_1+x_2+\alpha)}{(2+\beta)^{x_1+x_2+\alpha}\Gamma(\alpha)\Gamma(x_1+1)\Gamma(x_2+1)}$$
And for the alternative hypothesis we have:
$$P(D|H_{2},I)=\frac{\beta_{1}^{\alpha_{1}}\beta_{2}^{\alpha_{2}}\Gamma(x_1+\alpha_{1})\Gamma(x_2+\alpha_{2})}{(1+\beta_{1})^{x_1+\alpha_{1}}(1+\beta_{2})^{x_2+\alpha_{2}}\Gamma(\alpha_{1})\Gamma(\alpha_{2})\Gamma(x_1+1)\Gamma(x_2+1)}$$
Now if we assume that all hyper-parameters are equal (not an unreasonable assumption, given that you are testing for equality), then we have an integrated likelihood ratio of:
$$\frac{P(D|H_{1},I)}{P(D|H_{2},I)}=
\frac{(1+\beta)^{x_1+x_2+2\alpha}\Gamma(x_1+x_2+\alpha)\Gamma(\alpha)}
{(2+\beta)^{x_1+x_2+\alpha}\beta^{\alpha}\Gamma(x_1+\alpha)\Gamma(x_2+\alpha)}
$$
Which you can see that the prior information is still very important. We can't set $\alpha$ or $\beta$ equal to zero (Jeffrey's prior), or else $H_{1}$ will always be favored, regardless of the data. One way to get values for them is to specify prior estimates for $E[\lambda]$ and $E[\log(\lambda)]$ and solve for the parameters - this cannot be based on $x_1$ or $x_2$ but can be based on any other relevant information. You can also put in a few different (reasonable) values for the parameters and see what difference it makes to the conclusion. The numerical value of this statistic tells you how much the data and your prior information about the rates in each hypothesis support the hypothesis of equal rates. This explains why the likelihood ratio test is not always reliable - because it essentially ignores prior information, which is usually equivalent to specifying Jeffrey's prior. Note that you could also specify upper and lower limits for the rate parameters (this is usually not too hard to do given some common sense thinking about the real world problem). Then you would use a prior of the form:
$$p(\lambda|I)=\frac{I(L<\lambda<U)}{\log\left(\frac{U}{L}\right)\lambda}$$
And you would be left with a similar equation to that above but in terms of incomplete, instead of complete gamma functions.
For the binomial case things are much simpler, because the non-informative prior (uniform) is proper. The procedure is similar to that above, and the integrated likelihood for $H_{1}:p_{1}=p_{2}$ is given by:
$$P(D|H_{1},I)={n_1 \choose x_1}{n_2 \choose x_2}\int_{0}^{1}p^{x_1+x_2}(1-p)^{n_1+n_2-x_1-x_2}\,dp$$
$$={n_1 \choose x_1}{n_2 \choose x_2}B(x_1+x_2+1,n_1+n_2-x_1-x_2+1)$$
And similarly for $H_{2}:p_{1}\neq p_{2}$
$$P(D|H_{2},I)={n_1 \choose x_1}{n_2 \choose x_2}\int_{0}^{1}p_{1}^{x_1}p_{2}^{x_2}(1-p_{1})^{n_1-x_1}(1-p_{2})^{n_{2}-x_{2}}\,dp_{1}\,dp_{2}$$
$$={n_1 \choose x_1}{n_2 \choose x_2}B(x_1+1,n_1-x_1+1)B(x_2+1,n_2-x_2+1)$$
And so taking ratios gives:
$$\frac{P(D|H_{1},I)}{P(D|H_{2},I)}=
\frac{B(x_1+x_2+1,n_1+n_2-x_1-x_2+1)}
{B(x_1+1,n_1-x_1+1)B(x_2+1,n_2-x_2+1)}
$$
$$=\frac{{x_1+x_2 \choose x_1}{n_1+n_2-x_1-x_2 \choose n_1-x_1}(n_1+1)(n_2+1)}{{n_1+n_2 \choose n_1}(n_1+n_2+1)}$$
And the choose functions can be calculated using the hypergeometric($r$,$n$,$R$,$N$) distribution where $N=n_1+n_2$, $R=x_1+x_2$, $n=n_1$, $r=x_1$
And this tells you how much the data support the hypothesis of equal probabilities, given that you don't have much information about which particular value this may be.
|
Two poisson random variables and likelihood ratio test
The Bayesian test for your question is based on the integrated (rather than maximised) likelihood. So for Poisson we have:
$$\begin{array}{c|c}
H_{1}:\lambda_{1}=\lambda_{2} & H_{2}:\lambda_{1}\neq\l
|
48,228
|
Two poisson random variables and likelihood ratio test
|
Did your reading suggest that the likelihood ratio test statistic had problems? or that the chi-squared approximation was not very good?
I expect that most of the problems are more likely the latter, the test statistic is fine, but we don't know the distribution of it under the null hypothesis. With modern computers we can estimate the distribution fairly easily and compare to that (R works great for this).
Just generate data that looks like yours but assuming the null hypothesis to be true, compute the LR statistic (or other statistic) for each simulated dataset. Now compare the same statistic for your real data to the set of simulated statistics.
Another option, depending on the nature of your data and question, is to use permutation tests where the null hypothesis is that there is no difference between your groups, they are just samples from the same population. So you mix them together and recreate the samples over and over again and compare the test statistic of interest from the original samples to the permuted samples. Fisher's exact test is actualy a permutation test.
|
Two poisson random variables and likelihood ratio test
|
Did your reading suggest that the likelihood ratio test statistic had problems? or that the chi-squared approximation was not very good?
I expect that most of the problems are more likely the latter,
|
Two poisson random variables and likelihood ratio test
Did your reading suggest that the likelihood ratio test statistic had problems? or that the chi-squared approximation was not very good?
I expect that most of the problems are more likely the latter, the test statistic is fine, but we don't know the distribution of it under the null hypothesis. With modern computers we can estimate the distribution fairly easily and compare to that (R works great for this).
Just generate data that looks like yours but assuming the null hypothesis to be true, compute the LR statistic (or other statistic) for each simulated dataset. Now compare the same statistic for your real data to the set of simulated statistics.
Another option, depending on the nature of your data and question, is to use permutation tests where the null hypothesis is that there is no difference between your groups, they are just samples from the same population. So you mix them together and recreate the samples over and over again and compare the test statistic of interest from the original samples to the permuted samples. Fisher's exact test is actualy a permutation test.
|
Two poisson random variables and likelihood ratio test
Did your reading suggest that the likelihood ratio test statistic had problems? or that the chi-squared approximation was not very good?
I expect that most of the problems are more likely the latter,
|
48,229
|
What do "real values" refer to in supervised classification?
|
Regarding the "Real Values"
The "Real Values" are better called "confidences" or (from my pov the most common term) "scores".
Such scores are often normalized so that they sum up to 1 for all classes. They represent a measure how, well, confident the model is that the presented example belongs to a certain class. They are highly dependent on the general strategy and the properties of the algorithm. For example in KNN the score for a class i is calculated by averaging the distance to those examples which both belong to the k-nearest-neighbors and have class i. Then the score is sum-normalized across all classes.
Regarding your question
I suppose with "converting into confidences" you actually mean "probability estimates". E.g. if an example has probability 0.3 for class "1", then 30% of all examples with similar values should belong to class "1" and 70% should not.
As far as I know, his task is called "calibration". For this purpose some general methods exist (e.g. binning the scores and mapping them to the class-fraction of the corresponding bin) and some classifier-dependent (like e.g. Platt Scaling which has been invented for SVMs). A good point to start is:
Bianca Zadrozny, Charles Elkan: Transforming Classifier Scores into Accurate Multiclass Probability Estimates
EDIT after Question-Edit:
@Thomas wrote: Does it seem right the answers with the highest real values be the ones that are most confidently categorized in the True group?
Yes, in general this is correct (with the same argument as above). I suggest to create a ROC - plot to see if this also applies to mlpy - package. I suggest ROCR for this purpose.
|
What do "real values" refer to in supervised classification?
|
Regarding the "Real Values"
The "Real Values" are better called "confidences" or (from my pov the most common term) "scores".
Such scores are often normalized so that they sum up to 1 for all classes
|
What do "real values" refer to in supervised classification?
Regarding the "Real Values"
The "Real Values" are better called "confidences" or (from my pov the most common term) "scores".
Such scores are often normalized so that they sum up to 1 for all classes. They represent a measure how, well, confident the model is that the presented example belongs to a certain class. They are highly dependent on the general strategy and the properties of the algorithm. For example in KNN the score for a class i is calculated by averaging the distance to those examples which both belong to the k-nearest-neighbors and have class i. Then the score is sum-normalized across all classes.
Regarding your question
I suppose with "converting into confidences" you actually mean "probability estimates". E.g. if an example has probability 0.3 for class "1", then 30% of all examples with similar values should belong to class "1" and 70% should not.
As far as I know, his task is called "calibration". For this purpose some general methods exist (e.g. binning the scores and mapping them to the class-fraction of the corresponding bin) and some classifier-dependent (like e.g. Platt Scaling which has been invented for SVMs). A good point to start is:
Bianca Zadrozny, Charles Elkan: Transforming Classifier Scores into Accurate Multiclass Probability Estimates
EDIT after Question-Edit:
@Thomas wrote: Does it seem right the answers with the highest real values be the ones that are most confidently categorized in the True group?
Yes, in general this is correct (with the same argument as above). I suggest to create a ROC - plot to see if this also applies to mlpy - package. I suggest ROCR for this purpose.
|
What do "real values" refer to in supervised classification?
Regarding the "Real Values"
The "Real Values" are better called "confidences" or (from my pov the most common term) "scores".
Such scores are often normalized so that they sum up to 1 for all classes
|
48,230
|
Making a heatmap with a precomputed distance matrix and data matrix in R
|
Ok, so you can just look at the code by typing the name of the function at the R prompt, or use edit(pheatmap) to see it in your default editor.
Around line 14 and 23, you'll see that another function is called for computing the distance matrices (for rows and columns), given a distance function (R dist) and a method (compatible with hclust for hierarchical clustering in R). What does this function do? Use getAnywhere("cluster_mat") to print it on screen, and you soon notice that it does nothing more than returning an hclust object, that is your dendrogram computed from the specified distance and linkage options.
So, if you already have your distance matrix, change line 14 (rows) or 23 (columns) so that it reads, e.g.
tree_row = hclust(my.dist.mat, method="complete")
where my.dist.mat is your own distance function, and complete is one of the many methods available in hclust (see help(hclust)). Here, it is important to use fix(pheatmap) and not edit(pheatmap); otherwise, the edited function will not be callable in the correct environment/namespace.
This is a quick and dirty hack that I would not recommend with larger package. It seems to work for me at least, that is I can use a custom distance matrix with complete linkage for the rows.
In sum, assuming your distance matrix is stored in a variable named dd,
library(pheatmap)
fix(pheatmap)
# 1. change the function as you see fit
# 2. save and go back to R
# 3. if your custom distance matrix was simply read as a matrix, make sure
# it is read as a distance matrix
my.dist.map <- dd # or as.dist(dd)
Then, you can call pheatmap as you did but now it will use the results of hclust applied to my.dist.map with complete linkage. Please note that you just have to ensure that cluster_rows=TRUE (which is the default). Now, you may be able to change
the linkage method
choose between rows or columns
by editing the package function appropriately.
|
Making a heatmap with a precomputed distance matrix and data matrix in R
|
Ok, so you can just look at the code by typing the name of the function at the R prompt, or use edit(pheatmap) to see it in your default editor.
Around line 14 and 23, you'll see that another function
|
Making a heatmap with a precomputed distance matrix and data matrix in R
Ok, so you can just look at the code by typing the name of the function at the R prompt, or use edit(pheatmap) to see it in your default editor.
Around line 14 and 23, you'll see that another function is called for computing the distance matrices (for rows and columns), given a distance function (R dist) and a method (compatible with hclust for hierarchical clustering in R). What does this function do? Use getAnywhere("cluster_mat") to print it on screen, and you soon notice that it does nothing more than returning an hclust object, that is your dendrogram computed from the specified distance and linkage options.
So, if you already have your distance matrix, change line 14 (rows) or 23 (columns) so that it reads, e.g.
tree_row = hclust(my.dist.mat, method="complete")
where my.dist.mat is your own distance function, and complete is one of the many methods available in hclust (see help(hclust)). Here, it is important to use fix(pheatmap) and not edit(pheatmap); otherwise, the edited function will not be callable in the correct environment/namespace.
This is a quick and dirty hack that I would not recommend with larger package. It seems to work for me at least, that is I can use a custom distance matrix with complete linkage for the rows.
In sum, assuming your distance matrix is stored in a variable named dd,
library(pheatmap)
fix(pheatmap)
# 1. change the function as you see fit
# 2. save and go back to R
# 3. if your custom distance matrix was simply read as a matrix, make sure
# it is read as a distance matrix
my.dist.map <- dd # or as.dist(dd)
Then, you can call pheatmap as you did but now it will use the results of hclust applied to my.dist.map with complete linkage. Please note that you just have to ensure that cluster_rows=TRUE (which is the default). Now, you may be able to change
the linkage method
choose between rows or columns
by editing the package function appropriately.
|
Making a heatmap with a precomputed distance matrix and data matrix in R
Ok, so you can just look at the code by typing the name of the function at the R prompt, or use edit(pheatmap) to see it in your default editor.
Around line 14 and 23, you'll see that another function
|
48,231
|
Making a heatmap with a precomputed distance matrix and data matrix in R
|
As of version 1.0.10, the input parameter clustering_distance_rows and clustering_distance_cols can take a dist object to impose the precomputed distance for clustering.
|
Making a heatmap with a precomputed distance matrix and data matrix in R
|
As of version 1.0.10, the input parameter clustering_distance_rows and clustering_distance_cols can take a dist object to impose the precomputed distance for clustering.
|
Making a heatmap with a precomputed distance matrix and data matrix in R
As of version 1.0.10, the input parameter clustering_distance_rows and clustering_distance_cols can take a dist object to impose the precomputed distance for clustering.
|
Making a heatmap with a precomputed distance matrix and data matrix in R
As of version 1.0.10, the input parameter clustering_distance_rows and clustering_distance_cols can take a dist object to impose the precomputed distance for clustering.
|
48,232
|
Learning a univariate transform (kernel?) for novelty detection
|
Your setting is pretty hard. I have no solution, but a couple of points.
Energy based models can give you a scalar corresponding to a "grade of belief" that an input is generated by the distribution of your data. It comes down to chosing a model and a good loss function. Check out Yann Lecun's tutorial on energy based models. Also, there is Ranzato's energy based unsupervised framework paper where they use sparse autoencoders. Sparseness is generally desirable given your tiny dataset, I guess.
A restricted Boltzmann machine might work. You can train your RBM on the data with less than 25 hidden features (which you might anyway because of your lack of data) enabling you to write down the probability of any new input to belong to the data given by your distribution. Actually, an RBM is a energy based model as well.
I have a feeling that SVM with Kernels might be a too complex model for what you are doing. Do you get acceptable scores on a test set?
|
Learning a univariate transform (kernel?) for novelty detection
|
Your setting is pretty hard. I have no solution, but a couple of points.
Energy based models can give you a scalar corresponding to a "grade of belief" that an input is generated by the distribution
|
Learning a univariate transform (kernel?) for novelty detection
Your setting is pretty hard. I have no solution, but a couple of points.
Energy based models can give you a scalar corresponding to a "grade of belief" that an input is generated by the distribution of your data. It comes down to chosing a model and a good loss function. Check out Yann Lecun's tutorial on energy based models. Also, there is Ranzato's energy based unsupervised framework paper where they use sparse autoencoders. Sparseness is generally desirable given your tiny dataset, I guess.
A restricted Boltzmann machine might work. You can train your RBM on the data with less than 25 hidden features (which you might anyway because of your lack of data) enabling you to write down the probability of any new input to belong to the data given by your distribution. Actually, an RBM is a energy based model as well.
I have a feeling that SVM with Kernels might be a too complex model for what you are doing. Do you get acceptable scores on a test set?
|
Learning a univariate transform (kernel?) for novelty detection
Your setting is pretty hard. I have no solution, but a couple of points.
Energy based models can give you a scalar corresponding to a "grade of belief" that an input is generated by the distribution
|
48,233
|
Learning a univariate transform (kernel?) for novelty detection
|
Would the nearest-neighbor distance distribution help ?
For each of the 150 observations, you have distances
$d_1\ d_2$ ... to its nearest, 2nd nearest ... neighbors,
and an averaged distance distribution, call it DD.
A query point gives you the distribution $d_1 .. d_{150}$:
compare that to DD.
The metric between points is crucial, but I have no recipe.
Try the fractional or near-Hamming metric $\sum |a_j - b_j|^q$
(with no outer $\frac{1}{q}$).
For small $q$, say .1,
this up-weights close matches in a few features, which make sense;
otherwise a sum of 500 terms is just normally distributed
with no contrast at all / distance whiteout.
(Yes near-Hamming is not a norm,
but it is a metric, satisfies the triangle inequality.)
Take a look at Omercevic et al.,
High-dimensional feature matching: employing the concept of meaningful nearest neighbors 2007 8p,
who do this:
find ~ 100 nearest neighbors to a query point
fit $\lambda$ to exponential background noise
weight the 100 neighbors: don't understand this bit, looks ad hoc
pick ~ 10 outliers as "signal".
(However they're matching 128-d SIFT vectors,
whose distance distribution and noise model may be very different from yours.)
|
Learning a univariate transform (kernel?) for novelty detection
|
Would the nearest-neighbor distance distribution help ?
For each of the 150 observations, you have distances
$d_1\ d_2$ ... to its nearest, 2nd nearest ... neighbors,
and an averaged distance distribu
|
Learning a univariate transform (kernel?) for novelty detection
Would the nearest-neighbor distance distribution help ?
For each of the 150 observations, you have distances
$d_1\ d_2$ ... to its nearest, 2nd nearest ... neighbors,
and an averaged distance distribution, call it DD.
A query point gives you the distribution $d_1 .. d_{150}$:
compare that to DD.
The metric between points is crucial, but I have no recipe.
Try the fractional or near-Hamming metric $\sum |a_j - b_j|^q$
(with no outer $\frac{1}{q}$).
For small $q$, say .1,
this up-weights close matches in a few features, which make sense;
otherwise a sum of 500 terms is just normally distributed
with no contrast at all / distance whiteout.
(Yes near-Hamming is not a norm,
but it is a metric, satisfies the triangle inequality.)
Take a look at Omercevic et al.,
High-dimensional feature matching: employing the concept of meaningful nearest neighbors 2007 8p,
who do this:
find ~ 100 nearest neighbors to a query point
fit $\lambda$ to exponential background noise
weight the 100 neighbors: don't understand this bit, looks ad hoc
pick ~ 10 outliers as "signal".
(However they're matching 128-d SIFT vectors,
whose distance distribution and noise model may be very different from yours.)
|
Learning a univariate transform (kernel?) for novelty detection
Would the nearest-neighbor distance distribution help ?
For each of the 150 observations, you have distances
$d_1\ d_2$ ... to its nearest, 2nd nearest ... neighbors,
and an averaged distance distribu
|
48,234
|
Correct specification of longitudinal model in lme4
|
I'll imagine a concrete example, with more context, to make things easy. Assume you measure the score on test of 3k students of 200 schools and you measured each student at 4 time points (say, at each quarter). You have a covariate at student level that doesn't vary by time (like sex), that you called pred1.obs and a covariate by school that vary by time (say the number of meetings between teachers and parents until that moment in time). If this example resembles your study, than I think you have to set up a three level model (individual level, group level and time level for the groups):
i = 1 ... 3000 individuals
t = 1... 4 periods
g = 1... 200 groups
The model would be:
y_i ~ N(a + b_[groups_g] + b.ind*pred.obs1_i, sigma^2) # 1st level
b_g = N(gamma + gamma_[time] + gamma.g[time_t]*pred2.grp, sigma.b^2) # 2nd level
gamma.g_t = N(0, sigma.gamma^2) # 3rd level
Note that you would have the slope at the second level (group level) varying by time, which makes sense, since you expect that the effect of schools on the perfomance of students may vary by time, depending of the valu of the covariate at the level of schools.
I'm not that sure how to estimate this with lmer (I know how to estimate a Bayesian model using WinBugs or Jags, calling them by R). In any case, here is my suggestion.
In lme4, I'd try:
First, expand pred2.grp (the covariate at group level that vary by time) to the individual level, then you would have repetead measures by individuals at the group and time level. Then:
lmer(outcome ~ pred1.obs + pred2.grp + (1|group))
|
Correct specification of longitudinal model in lme4
|
I'll imagine a concrete example, with more context, to make things easy. Assume you measure the score on test of 3k students of 200 schools and you measured each student at 4 time points (say, at each
|
Correct specification of longitudinal model in lme4
I'll imagine a concrete example, with more context, to make things easy. Assume you measure the score on test of 3k students of 200 schools and you measured each student at 4 time points (say, at each quarter). You have a covariate at student level that doesn't vary by time (like sex), that you called pred1.obs and a covariate by school that vary by time (say the number of meetings between teachers and parents until that moment in time). If this example resembles your study, than I think you have to set up a three level model (individual level, group level and time level for the groups):
i = 1 ... 3000 individuals
t = 1... 4 periods
g = 1... 200 groups
The model would be:
y_i ~ N(a + b_[groups_g] + b.ind*pred.obs1_i, sigma^2) # 1st level
b_g = N(gamma + gamma_[time] + gamma.g[time_t]*pred2.grp, sigma.b^2) # 2nd level
gamma.g_t = N(0, sigma.gamma^2) # 3rd level
Note that you would have the slope at the second level (group level) varying by time, which makes sense, since you expect that the effect of schools on the perfomance of students may vary by time, depending of the valu of the covariate at the level of schools.
I'm not that sure how to estimate this with lmer (I know how to estimate a Bayesian model using WinBugs or Jags, calling them by R). In any case, here is my suggestion.
In lme4, I'd try:
First, expand pred2.grp (the covariate at group level that vary by time) to the individual level, then you would have repetead measures by individuals at the group and time level. Then:
lmer(outcome ~ pred1.obs + pred2.grp + (1|group))
|
Correct specification of longitudinal model in lme4
I'll imagine a concrete example, with more context, to make things easy. Assume you measure the score on test of 3k students of 200 schools and you measured each student at 4 time points (say, at each
|
48,235
|
Correct specification of longitudinal model in lme4
|
You have a large number of groups, so I speculate that (depending on the setting) you may think about group as a random effect, so your (…|grp) terms are probably justified. It may also be reasonable to associate random effects with individuals ((…|id) terms). However you have time as a covariate in all your models, so I assume you are looking for a linear time effect. In the same time having the (1|grp:time)) term or any kind of (…|time)) terms in the model makes the interpretation of the time covariate difficult.
The (1|…) terms correspond to random intercepts, e.g. including (1|grp) would estimate a “mean” outcome at time=0 for each group expressed as deviation from the grand intercept; (1|id) would estimate an individual intercept.
The (time|…) terms correspond to random slopes of the time covariate, e.g. including (time|grp) would estimate a deviation from the grand slope for each group; (time|id) would estimate individual slopes. [Edit: Please note the difference between the (time|id) and (0 + time|id) expressions, see ?lmer]
In your model specifications you are using both random intercepts and random slopes. Whether you need them or which you need depends on the relationships among the variables you study. If you know the relationship, you should specify the corresponding model. Alternatively you can fit multiple models and explain the differences among the results.
|
Correct specification of longitudinal model in lme4
|
You have a large number of groups, so I speculate that (depending on the setting) you may think about group as a random effect, so your (…|grp) terms are probably justified. It may also be reasonable
|
Correct specification of longitudinal model in lme4
You have a large number of groups, so I speculate that (depending on the setting) you may think about group as a random effect, so your (…|grp) terms are probably justified. It may also be reasonable to associate random effects with individuals ((…|id) terms). However you have time as a covariate in all your models, so I assume you are looking for a linear time effect. In the same time having the (1|grp:time)) term or any kind of (…|time)) terms in the model makes the interpretation of the time covariate difficult.
The (1|…) terms correspond to random intercepts, e.g. including (1|grp) would estimate a “mean” outcome at time=0 for each group expressed as deviation from the grand intercept; (1|id) would estimate an individual intercept.
The (time|…) terms correspond to random slopes of the time covariate, e.g. including (time|grp) would estimate a deviation from the grand slope for each group; (time|id) would estimate individual slopes. [Edit: Please note the difference between the (time|id) and (0 + time|id) expressions, see ?lmer]
In your model specifications you are using both random intercepts and random slopes. Whether you need them or which you need depends on the relationships among the variables you study. If you know the relationship, you should specify the corresponding model. Alternatively you can fit multiple models and explain the differences among the results.
|
Correct specification of longitudinal model in lme4
You have a large number of groups, so I speculate that (depending on the setting) you may think about group as a random effect, so your (…|grp) terms are probably justified. It may also be reasonable
|
48,236
|
Review of case control matching algorithms?
|
For an overview of some matching algorithms as well as clear examples of applications in everything from education to medical experiments, I would suggest:
Paul R. Rosenbaum (2010). Design of Observational Studies. Springer.
Rosenbaum's earlier book provides a more technical review, though because matching is such a hot topic at the moment, it may not cover the most current techniques:
Paul R. Rosenbaum (2002). Observational Studies, Second Edition. Springer.
Even if Rosenbaum doesn't hit on a particular topic of interest, his chapter bibliographies are an excellent resource (particularly those in Design). He has also done some very valuable work on matching sensitivity analyses, which are covered extensively in these books.
Of course, you would probably also be served by going directly to the source (I haven't read this myself):
Donald B. Rubin (2006). Matched Sampling for Causal Effects. Cambridge University Press.
As mentioned above, matching is something of a hot topic. So, generally, I would look through the citations of more recent books and articles. Besides work by Donald Rubin and Paul Rosenbaum, I would look for work by Alberto Abadie and Guido Imbens (both at Harvard) and James Heckman (Chicago), probably in that order. Of course, depending on your particular research interests, others may be equally as important.
|
Review of case control matching algorithms?
|
For an overview of some matching algorithms as well as clear examples of applications in everything from education to medical experiments, I would suggest:
Paul R. Rosenbaum (2010). Design of Observa
|
Review of case control matching algorithms?
For an overview of some matching algorithms as well as clear examples of applications in everything from education to medical experiments, I would suggest:
Paul R. Rosenbaum (2010). Design of Observational Studies. Springer.
Rosenbaum's earlier book provides a more technical review, though because matching is such a hot topic at the moment, it may not cover the most current techniques:
Paul R. Rosenbaum (2002). Observational Studies, Second Edition. Springer.
Even if Rosenbaum doesn't hit on a particular topic of interest, his chapter bibliographies are an excellent resource (particularly those in Design). He has also done some very valuable work on matching sensitivity analyses, which are covered extensively in these books.
Of course, you would probably also be served by going directly to the source (I haven't read this myself):
Donald B. Rubin (2006). Matched Sampling for Causal Effects. Cambridge University Press.
As mentioned above, matching is something of a hot topic. So, generally, I would look through the citations of more recent books and articles. Besides work by Donald Rubin and Paul Rosenbaum, I would look for work by Alberto Abadie and Guido Imbens (both at Harvard) and James Heckman (Chicago), probably in that order. Of course, depending on your particular research interests, others may be equally as important.
|
Review of case control matching algorithms?
For an overview of some matching algorithms as well as clear examples of applications in everything from education to medical experiments, I would suggest:
Paul R. Rosenbaum (2010). Design of Observa
|
48,237
|
Review of case control matching algorithms?
|
Try the What's New in Econometrics section by Imbens and Wooldridge here:
http://www.nber.org/WNE/lect_1_match_fig.pdf
There is a section on matching and it is aimed at the informed practitioner, not suitable for the complete novice.
|
Review of case control matching algorithms?
|
Try the What's New in Econometrics section by Imbens and Wooldridge here:
http://www.nber.org/WNE/lect_1_match_fig.pdf
There is a section on matching and it is aimed at the informed practitioner, not
|
Review of case control matching algorithms?
Try the What's New in Econometrics section by Imbens and Wooldridge here:
http://www.nber.org/WNE/lect_1_match_fig.pdf
There is a section on matching and it is aimed at the informed practitioner, not suitable for the complete novice.
|
Review of case control matching algorithms?
Try the What's New in Econometrics section by Imbens and Wooldridge here:
http://www.nber.org/WNE/lect_1_match_fig.pdf
There is a section on matching and it is aimed at the informed practitioner, not
|
48,238
|
Modelling the effect of a 2 by 4 mixed design on a three-level nominal dependent variable
|
A log-linear model or any model that fails to model the dependence of responses could underestimate (or overestimate) standard errors because they do not take into account potential subject-level association of responses. For example, if some subjects are likely to have responses patterns like (A,A,A,A) and others like (C,C,C,C), treating responses as independent is problematic.
An appropriate model would be the multinomial logit with subject-level random intercepts.
Depending on your colleague's modeling goals, another approach might be latent class regression, which estimates class probabilities and class-conditional responses probabilities for k latent classes. If you expect strong clustering in subjects' responses, this might be a particularly nice approach because you get regression estimates for each of $k$ fuzzy classes, which might have meaningful psychological labels. Identifiability is an issue here because of the large number of parameters. See poLCA in R and the PDF write-up here.
drm in R is another package which is supposed to be able to model clustered categorical responses, but I have not tried it.
Finally, for very specific applications/hypotheses, you could implement resampling methods by resampling entire vectors of responses -- e.g., a permutation test on odds ratios across groups by permuting group labels without replacement.
|
Modelling the effect of a 2 by 4 mixed design on a three-level nominal dependent variable
|
A log-linear model or any model that fails to model the dependence of responses could underestimate (or overestimate) standard errors because they do not take into account potential subject-level asso
|
Modelling the effect of a 2 by 4 mixed design on a three-level nominal dependent variable
A log-linear model or any model that fails to model the dependence of responses could underestimate (or overestimate) standard errors because they do not take into account potential subject-level association of responses. For example, if some subjects are likely to have responses patterns like (A,A,A,A) and others like (C,C,C,C), treating responses as independent is problematic.
An appropriate model would be the multinomial logit with subject-level random intercepts.
Depending on your colleague's modeling goals, another approach might be latent class regression, which estimates class probabilities and class-conditional responses probabilities for k latent classes. If you expect strong clustering in subjects' responses, this might be a particularly nice approach because you get regression estimates for each of $k$ fuzzy classes, which might have meaningful psychological labels. Identifiability is an issue here because of the large number of parameters. See poLCA in R and the PDF write-up here.
drm in R is another package which is supposed to be able to model clustered categorical responses, but I have not tried it.
Finally, for very specific applications/hypotheses, you could implement resampling methods by resampling entire vectors of responses -- e.g., a permutation test on odds ratios across groups by permuting group labels without replacement.
|
Modelling the effect of a 2 by 4 mixed design on a three-level nominal dependent variable
A log-linear model or any model that fails to model the dependence of responses could underestimate (or overestimate) standard errors because they do not take into account potential subject-level asso
|
48,239
|
Variance of a distribution's product with itself
|
$Var(X^i)$ = $\mathbb{E}[(X^i - \mathbb{E}[X^i])^2]$ = $\mathbb{E}[X^{2i}] - (\mathbb{E}[X^i])^2$ by definition. This expresses the variance of $X^i$ in terms of moments of $X$.
The generalization is false, because $\mathbb{E}[(\lambda X)^{2i}]$ = $|\lambda|^{2i}\mathbb{E}[X^{2i}]$ implies that the scale parameter of $(\lambda X)^i$ will be smaller than the scale parameter of $\lambda X$ when $\lambda$ is sufficiently close to zero and $i \gt 1$.
|
Variance of a distribution's product with itself
|
$Var(X^i)$ = $\mathbb{E}[(X^i - \mathbb{E}[X^i])^2]$ = $\mathbb{E}[X^{2i}] - (\mathbb{E}[X^i])^2$ by definition. This expresses the variance of $X^i$ in terms of moments of $X$.
The generalization is
|
Variance of a distribution's product with itself
$Var(X^i)$ = $\mathbb{E}[(X^i - \mathbb{E}[X^i])^2]$ = $\mathbb{E}[X^{2i}] - (\mathbb{E}[X^i])^2$ by definition. This expresses the variance of $X^i$ in terms of moments of $X$.
The generalization is false, because $\mathbb{E}[(\lambda X)^{2i}]$ = $|\lambda|^{2i}\mathbb{E}[X^{2i}]$ implies that the scale parameter of $(\lambda X)^i$ will be smaller than the scale parameter of $\lambda X$ when $\lambda$ is sufficiently close to zero and $i \gt 1$.
|
Variance of a distribution's product with itself
$Var(X^i)$ = $\mathbb{E}[(X^i - \mathbb{E}[X^i])^2]$ = $\mathbb{E}[X^{2i}] - (\mathbb{E}[X^i])^2$ by definition. This expresses the variance of $X^i$ in terms of moments of $X$.
The generalization is
|
48,240
|
Variance of a distribution's product with itself
|
Quick note, you may find useful discussion of why the formula for estimating the standard deviation for a sample uses $n-1$ as opposed to $n$.
Paul Savory Why divide by (n-1) for sample standard deviation
Graphpad Why use n-1 when calculating a standard deviation?
Andrew Hardwick Why there is a Minus One in Standard Deviations
|
Variance of a distribution's product with itself
|
Quick note, you may find useful discussion of why the formula for estimating the standard deviation for a sample uses $n-1$ as opposed to $n$.
Paul Savory Why divide by (n-1) for sample standard devi
|
Variance of a distribution's product with itself
Quick note, you may find useful discussion of why the formula for estimating the standard deviation for a sample uses $n-1$ as opposed to $n$.
Paul Savory Why divide by (n-1) for sample standard deviation
Graphpad Why use n-1 when calculating a standard deviation?
Andrew Hardwick Why there is a Minus One in Standard Deviations
|
Variance of a distribution's product with itself
Quick note, you may find useful discussion of why the formula for estimating the standard deviation for a sample uses $n-1$ as opposed to $n$.
Paul Savory Why divide by (n-1) for sample standard devi
|
48,241
|
Overfit by removing misclassified objects?
|
The following is not restricted to NB + LogRes
Overfitting = Loss of generalization.
When you train a model on dataset you generally assume that the data you use for training has a similar structure than the data the model is applied to later (the general assumption of predicting the future from the past). So if you remove parts of the data (namely the misclassified instances) and train a model on this reduced dataset, you effectively change the structure of the data in comparison to the test dataset (and hence violate this assumption). In this case the following can happen (when testing this model on an unreduced test-dataset):
In the best case nothing happens, e.g. of the following reasons:
The missclassified instances represented only a tiny subspace of the dataspace (corresponds to a high accuracy achieved by the first model)
The model classifies one part of the dataspace better and another one worse so that they even out.
In the worst case the quality decreases rapidly, because of overfitting / loss of generalization power. The model focuses too hard on the part of the dataspace of in first step correctly classified instances and hence is not able anymore to make even an approximate statement for the rest of the dataspace.
I think what you are actually looking for is called Boosting, where one restricts the dataspace to the missclassified instances (i.e. doing the opposite of your strategy) to refine the model. The procedure tries to avoid overfitting by combining the different (subspace-)models afterwards, but nevertheless it is still an issue.
Here is an plain-text explanation of boosting with a illustrative graphic you might find helpful.
|
Overfit by removing misclassified objects?
|
The following is not restricted to NB + LogRes
Overfitting = Loss of generalization.
When you train a model on dataset you generally assume that the data you use for training has a similar structure t
|
Overfit by removing misclassified objects?
The following is not restricted to NB + LogRes
Overfitting = Loss of generalization.
When you train a model on dataset you generally assume that the data you use for training has a similar structure than the data the model is applied to later (the general assumption of predicting the future from the past). So if you remove parts of the data (namely the misclassified instances) and train a model on this reduced dataset, you effectively change the structure of the data in comparison to the test dataset (and hence violate this assumption). In this case the following can happen (when testing this model on an unreduced test-dataset):
In the best case nothing happens, e.g. of the following reasons:
The missclassified instances represented only a tiny subspace of the dataspace (corresponds to a high accuracy achieved by the first model)
The model classifies one part of the dataspace better and another one worse so that they even out.
In the worst case the quality decreases rapidly, because of overfitting / loss of generalization power. The model focuses too hard on the part of the dataspace of in first step correctly classified instances and hence is not able anymore to make even an approximate statement for the rest of the dataspace.
I think what you are actually looking for is called Boosting, where one restricts the dataspace to the missclassified instances (i.e. doing the opposite of your strategy) to refine the model. The procedure tries to avoid overfitting by combining the different (subspace-)models afterwards, but nevertheless it is still an issue.
Here is an plain-text explanation of boosting with a illustrative graphic you might find helpful.
|
Overfit by removing misclassified objects?
The following is not restricted to NB + LogRes
Overfitting = Loss of generalization.
When you train a model on dataset you generally assume that the data you use for training has a similar structure t
|
48,242
|
Overfit by removing misclassified objects?
|
Naive Bayes and Logistic Regression (Classification) are both linear classifiers. If you remove all misclassified instances, then you will allow an infinite number of separators to have 0 training error. In the case of the logistic regression, this translate to your information matrix being singular (The information matrix must be inverted at each iteration of GLM).
I don't know if that's what you mean by overfit.
|
Overfit by removing misclassified objects?
|
Naive Bayes and Logistic Regression (Classification) are both linear classifiers. If you remove all misclassified instances, then you will allow an infinite number of separators to have 0 training err
|
Overfit by removing misclassified objects?
Naive Bayes and Logistic Regression (Classification) are both linear classifiers. If you remove all misclassified instances, then you will allow an infinite number of separators to have 0 training error. In the case of the logistic regression, this translate to your information matrix being singular (The information matrix must be inverted at each iteration of GLM).
I don't know if that's what you mean by overfit.
|
Overfit by removing misclassified objects?
Naive Bayes and Logistic Regression (Classification) are both linear classifiers. If you remove all misclassified instances, then you will allow an infinite number of separators to have 0 training err
|
48,243
|
Efficient way to classify with SVM
|
I would do two things. First, to address your issue with accuracy due to imbalanced data, you need to set the cost of misclassifying positive and negative examples separately. A reasonable rule of thumb in your case would be to set the cost to 5 for the larger class and to 95 for the smaller class. This way misclassifying 10% of the smaller class will have the same cost as misclassifying 10% of the larger class even though the latter 10% is a much larger number of points. If you use the command line, the command is something like -w0 5 -w1 95. I feel this needs to be done anyway (even though you are using F score for now) because this is what SVM optimizes, so unless you do it, all your F scores will be poor.
Second, to address the issue of speed, I would try pre-computing the kernel. For 26k points this is borderline infeasible, but if you are willing to subsample, you can precompute the kernel once for each gamma and reuse it across all C's.
|
Efficient way to classify with SVM
|
I would do two things. First, to address your issue with accuracy due to imbalanced data, you need to set the cost of misclassifying positive and negative examples separately. A reasonable rule of thu
|
Efficient way to classify with SVM
I would do two things. First, to address your issue with accuracy due to imbalanced data, you need to set the cost of misclassifying positive and negative examples separately. A reasonable rule of thumb in your case would be to set the cost to 5 for the larger class and to 95 for the smaller class. This way misclassifying 10% of the smaller class will have the same cost as misclassifying 10% of the larger class even though the latter 10% is a much larger number of points. If you use the command line, the command is something like -w0 5 -w1 95. I feel this needs to be done anyway (even though you are using F score for now) because this is what SVM optimizes, so unless you do it, all your F scores will be poor.
Second, to address the issue of speed, I would try pre-computing the kernel. For 26k points this is borderline infeasible, but if you are willing to subsample, you can precompute the kernel once for each gamma and reuse it across all C's.
|
Efficient way to classify with SVM
I would do two things. First, to address your issue with accuracy due to imbalanced data, you need to set the cost of misclassifying positive and negative examples separately. A reasonable rule of thu
|
48,244
|
Efficient way to classify with SVM
|
By Default libSVM find the optimal hyper-parameters, for the SVM model using cross validation methods and by using Accuracy (for classification), or Mean Square Error (for regression) as a measure for evaluation.
Weka has several other evaluation metric to find the optimal parameters (using the gridSearch)
If the metric you are interested is not there, the simplest solution that comes to mind is to write a little program that would perform cross validation, and optimize the parameters of the model based on your measure of choice.
|
Efficient way to classify with SVM
|
By Default libSVM find the optimal hyper-parameters, for the SVM model using cross validation methods and by using Accuracy (for classification), or Mean Square Error (for regression) as a measure for
|
Efficient way to classify with SVM
By Default libSVM find the optimal hyper-parameters, for the SVM model using cross validation methods and by using Accuracy (for classification), or Mean Square Error (for regression) as a measure for evaluation.
Weka has several other evaluation metric to find the optimal parameters (using the gridSearch)
If the metric you are interested is not there, the simplest solution that comes to mind is to write a little program that would perform cross validation, and optimize the parameters of the model based on your measure of choice.
|
Efficient way to classify with SVM
By Default libSVM find the optimal hyper-parameters, for the SVM model using cross validation methods and by using Accuracy (for classification), or Mean Square Error (for regression) as a measure for
|
48,245
|
Analyzing a 2x3 repeated measures design using a logit mixed model
|
I would definitely use all your data and add direction of intended bias induction as a variable. Since you already have variables in the model describing the difference between the tasks, I don't believe that adding task as a random effect is necessary. The model would be:
my_model = lmer(
correct ~ (1|subject) + condition*distractor*direction
, family = 'binomial'
, data = my_data
)
Check out the ezMixed function from the ez package for an automated way of evaluating evidence for each effect in the model.
|
Analyzing a 2x3 repeated measures design using a logit mixed model
|
I would definitely use all your data and add direction of intended bias induction as a variable. Since you already have variables in the model describing the difference between the tasks, I don't beli
|
Analyzing a 2x3 repeated measures design using a logit mixed model
I would definitely use all your data and add direction of intended bias induction as a variable. Since you already have variables in the model describing the difference between the tasks, I don't believe that adding task as a random effect is necessary. The model would be:
my_model = lmer(
correct ~ (1|subject) + condition*distractor*direction
, family = 'binomial'
, data = my_data
)
Check out the ezMixed function from the ez package for an automated way of evaluating evidence for each effect in the model.
|
Analyzing a 2x3 repeated measures design using a logit mixed model
I would definitely use all your data and add direction of intended bias induction as a variable. Since you already have variables in the model describing the difference between the tasks, I don't beli
|
48,246
|
Analyzing a 2x3 repeated measures design using a logit mixed model
|
I disagree with the other responder, you shouldn't just fit varying intercept, fixed slope by default.
y~1+condition*distractor*direction+(1+condition*distractor*direction|subject) should at least be fit for model testing. Otherwise, you are just assuming the subject effect is only on the intercept and you are assuming there is no correlation of the slope and intercept random effects. Don't skip these crucial investigations.
See http://lme4.r-forge.r-project.org/book/Ch4.pdf and
http://www.stat.columbia.edu/~gelman/research/unpublished/multi.pdf
|
Analyzing a 2x3 repeated measures design using a logit mixed model
|
I disagree with the other responder, you shouldn't just fit varying intercept, fixed slope by default.
y~1+condition*distractor*direction+(1+condition*distractor*direction|subject) should at least be
|
Analyzing a 2x3 repeated measures design using a logit mixed model
I disagree with the other responder, you shouldn't just fit varying intercept, fixed slope by default.
y~1+condition*distractor*direction+(1+condition*distractor*direction|subject) should at least be fit for model testing. Otherwise, you are just assuming the subject effect is only on the intercept and you are assuming there is no correlation of the slope and intercept random effects. Don't skip these crucial investigations.
See http://lme4.r-forge.r-project.org/book/Ch4.pdf and
http://www.stat.columbia.edu/~gelman/research/unpublished/multi.pdf
|
Analyzing a 2x3 repeated measures design using a logit mixed model
I disagree with the other responder, you shouldn't just fit varying intercept, fixed slope by default.
y~1+condition*distractor*direction+(1+condition*distractor*direction|subject) should at least be
|
48,247
|
Alternative ways for interpretation of odds
|
The answer is near the bottom of p166. It's using a linear approximation (what social scientists would call a 'marginal effect'). A small change $\delta x$ in $x$ gives a change in probability of:
$$\delta\pi \approx \frac{\partial \pi(x)}{\partial x} \delta x.$$
With $\operatorname{logit}(\pi(x)) = \alpha + \beta x$, it's straightforward to show that
$ \partial \pi(x) / \partial x = \beta \pi(x)(1-\pi(x))$.
|
Alternative ways for interpretation of odds
|
The answer is near the bottom of p166. It's using a linear approximation (what social scientists would call a 'marginal effect'). A small change $\delta x$ in $x$ gives a change in probability of:
$$\
|
Alternative ways for interpretation of odds
The answer is near the bottom of p166. It's using a linear approximation (what social scientists would call a 'marginal effect'). A small change $\delta x$ in $x$ gives a change in probability of:
$$\delta\pi \approx \frac{\partial \pi(x)}{\partial x} \delta x.$$
With $\operatorname{logit}(\pi(x)) = \alpha + \beta x$, it's straightforward to show that
$ \partial \pi(x) / \partial x = \beta \pi(x)(1-\pi(x))$.
|
Alternative ways for interpretation of odds
The answer is near the bottom of p166. It's using a linear approximation (what social scientists would call a 'marginal effect'). A small change $\delta x$ in $x$ gives a change in probability of:
$$\
|
48,248
|
What is the conjugate of the noncentral hypergeometric distribution?
|
Perhaps a conjugate prior does not exist for the noncentral hypergeometric distribution.
If someone wants to confirm this, it is worth noting that the conjugate to a univariate hypergeometric distribution is the beta-binomial; the conjugate to a multivariate hypergeometric distribution is the Dirichlet-Multinomial (from Fink, 1997). For more details on the derivation, see Dyer and Pierce, 1993.
Dyer, Danny and Pierce, Rebecca L. "On the Choice of the Prior Distribution in Hypergeometric Sampling". Communications in Statistics-Theory and Methods, 1993, 22(8), 2125-214
Fink, D. 1997. A Compendium of Conjugate Priors.
|
What is the conjugate of the noncentral hypergeometric distribution?
|
Perhaps a conjugate prior does not exist for the noncentral hypergeometric distribution.
If someone wants to confirm this, it is worth noting that the conjugate to a univariate hypergeometric distribu
|
What is the conjugate of the noncentral hypergeometric distribution?
Perhaps a conjugate prior does not exist for the noncentral hypergeometric distribution.
If someone wants to confirm this, it is worth noting that the conjugate to a univariate hypergeometric distribution is the beta-binomial; the conjugate to a multivariate hypergeometric distribution is the Dirichlet-Multinomial (from Fink, 1997). For more details on the derivation, see Dyer and Pierce, 1993.
Dyer, Danny and Pierce, Rebecca L. "On the Choice of the Prior Distribution in Hypergeometric Sampling". Communications in Statistics-Theory and Methods, 1993, 22(8), 2125-214
Fink, D. 1997. A Compendium of Conjugate Priors.
|
What is the conjugate of the noncentral hypergeometric distribution?
Perhaps a conjugate prior does not exist for the noncentral hypergeometric distribution.
If someone wants to confirm this, it is worth noting that the conjugate to a univariate hypergeometric distribu
|
48,249
|
What is the conjugate of the noncentral hypergeometric distribution?
|
From the statement of the question, it seems as though you don't require conjugacy per se, rather you would like an analytical solution to your integration. From the form of the distribution, it would appear at first glance that the analytics of most solutions would be rather messy and difficult to interpret. The "analytic" solution would likely involve non-analytic functions (such as gamma function, beta function, confluent hypergeometric function), which may require numerical evaluation anyway.
May be quicker to use MCMC, rejection sampling or some other numerical technique to do the integration. But this means you need to choose a prior for you parameters (ideally, one which describes what you know about them).
One choice which comes to my mind, is the product of the beta binomial prior for the "central hypergeometric" part, and a beta distribution of the second kind for the odds ratio parameter. (beta distribution of the second kind is the distribution of the odds ratio of a beta distributed random variable, similar to a F distribution). But this is somewhat an arbitrary choice, only based on the conjugacy for the central hypergeometric distribution, and a "heavy-tailed" distribution (possibly robust? definitely more robust than gamma or inverse gamma) for the odds ratio parameter.
Also, which parameters are you integrating out? and which parameters are you taking the likelihood of?
|
What is the conjugate of the noncentral hypergeometric distribution?
|
From the statement of the question, it seems as though you don't require conjugacy per se, rather you would like an analytical solution to your integration. From the form of the distribution, it woul
|
What is the conjugate of the noncentral hypergeometric distribution?
From the statement of the question, it seems as though you don't require conjugacy per se, rather you would like an analytical solution to your integration. From the form of the distribution, it would appear at first glance that the analytics of most solutions would be rather messy and difficult to interpret. The "analytic" solution would likely involve non-analytic functions (such as gamma function, beta function, confluent hypergeometric function), which may require numerical evaluation anyway.
May be quicker to use MCMC, rejection sampling or some other numerical technique to do the integration. But this means you need to choose a prior for you parameters (ideally, one which describes what you know about them).
One choice which comes to my mind, is the product of the beta binomial prior for the "central hypergeometric" part, and a beta distribution of the second kind for the odds ratio parameter. (beta distribution of the second kind is the distribution of the odds ratio of a beta distributed random variable, similar to a F distribution). But this is somewhat an arbitrary choice, only based on the conjugacy for the central hypergeometric distribution, and a "heavy-tailed" distribution (possibly robust? definitely more robust than gamma or inverse gamma) for the odds ratio parameter.
Also, which parameters are you integrating out? and which parameters are you taking the likelihood of?
|
What is the conjugate of the noncentral hypergeometric distribution?
From the statement of the question, it seems as though you don't require conjugacy per se, rather you would like an analytical solution to your integration. From the form of the distribution, it woul
|
48,250
|
Find out pseudo R square value for a Logistic Regression analysis [closed]
|
Take a look at the lrm() function from the Design package. It features everything you need for fitting GLM. The Hosmer and Lemeshow test has limited power and depends on arbitrary discretization; it is discussed in Harrell, Regression Modeling Strategies (p. 231) and on the R-help mailing-list. There is also a comparison of GoF tests for logistic regression in A comparison of goodness-of-fit tests for the logistic regression model, Stat. Med. 1997 16(9):965.
Here is an example of use:
library(Design) # depends on Hmisc
x1 <- rnorm(500)
x2 <- rnorm(500)
L <- x1+abs(x2)
y <- ifelse(runif(500)<=plogis(L), 1, 0)
f <- lrm(y ~ x1+x2, x=TRUE, y=TRUE)
resid(f, 'gof')
which yields something like
Sum of squared errors Expected value|H0 SD
100.33517914 100.37281429 0.37641975
Z P
-0.09998187 0.92035872
but see help(residuals.lrm) for additional help.
The following thread contains critical discussions that might also be helpful: Logistic Regression: Which pseudo R-squared measure is the one to report (Cox & Snell or Nagelkerke)?
|
Find out pseudo R square value for a Logistic Regression analysis [closed]
|
Take a look at the lrm() function from the Design package. It features everything you need for fitting GLM. The Hosmer and Lemeshow test has limited power and depends on arbitrary discretization; it i
|
Find out pseudo R square value for a Logistic Regression analysis [closed]
Take a look at the lrm() function from the Design package. It features everything you need for fitting GLM. The Hosmer and Lemeshow test has limited power and depends on arbitrary discretization; it is discussed in Harrell, Regression Modeling Strategies (p. 231) and on the R-help mailing-list. There is also a comparison of GoF tests for logistic regression in A comparison of goodness-of-fit tests for the logistic regression model, Stat. Med. 1997 16(9):965.
Here is an example of use:
library(Design) # depends on Hmisc
x1 <- rnorm(500)
x2 <- rnorm(500)
L <- x1+abs(x2)
y <- ifelse(runif(500)<=plogis(L), 1, 0)
f <- lrm(y ~ x1+x2, x=TRUE, y=TRUE)
resid(f, 'gof')
which yields something like
Sum of squared errors Expected value|H0 SD
100.33517914 100.37281429 0.37641975
Z P
-0.09998187 0.92035872
but see help(residuals.lrm) for additional help.
The following thread contains critical discussions that might also be helpful: Logistic Regression: Which pseudo R-squared measure is the one to report (Cox & Snell or Nagelkerke)?
|
Find out pseudo R square value for a Logistic Regression analysis [closed]
Take a look at the lrm() function from the Design package. It features everything you need for fitting GLM. The Hosmer and Lemeshow test has limited power and depends on arbitrary discretization; it i
|
48,251
|
Find out pseudo R square value for a Logistic Regression analysis [closed]
|
Pseudo R Square is very easy to calculate manually. You just need to look up the -2LL value for the baseline based on the average probability of occurrence of the binomial event. And, you need the -2LL value for the actual Logistic regression.
Let's say the -2LL value for the baseline is 10 and for the Logistic regression model it is 5. Then, the calculation of the Pseudo R Square is: (10 - 5)/10 = 50%.
Another common Pseudo R Square measure is the McFadden R Square that generates the same result. Its calculation is: 1-(5/10) = 50%.
The Pseudo R Square measures do tell you how much your Logistic Regression model reduces the error vs simply guessing the average probability of occurrence for every observations.
|
Find out pseudo R square value for a Logistic Regression analysis [closed]
|
Pseudo R Square is very easy to calculate manually. You just need to look up the -2LL value for the baseline based on the average probability of occurrence of the binomial event. And, you need the -
|
Find out pseudo R square value for a Logistic Regression analysis [closed]
Pseudo R Square is very easy to calculate manually. You just need to look up the -2LL value for the baseline based on the average probability of occurrence of the binomial event. And, you need the -2LL value for the actual Logistic regression.
Let's say the -2LL value for the baseline is 10 and for the Logistic regression model it is 5. Then, the calculation of the Pseudo R Square is: (10 - 5)/10 = 50%.
Another common Pseudo R Square measure is the McFadden R Square that generates the same result. Its calculation is: 1-(5/10) = 50%.
The Pseudo R Square measures do tell you how much your Logistic Regression model reduces the error vs simply guessing the average probability of occurrence for every observations.
|
Find out pseudo R square value for a Logistic Regression analysis [closed]
Pseudo R Square is very easy to calculate manually. You just need to look up the -2LL value for the baseline based on the average probability of occurrence of the binomial event. And, you need the -
|
48,252
|
How can the IID assumption be checked in a given dataset?
|
You don't frame the two problems the right way.
Given a random dataset, ie a collection of observations $x_{ij}$ lying in general position you can always make the $n$ $x_{i}\in\mathbb{R}^p$ independent from one another by randomly shuffling the $n$ indexes. The real question is whether you will lose information doing this. In some context you will (times series, panel data, cluster analysis, functional analysis,...) in others you won't. That's for the first I in IID.
The 'ID' is also defined with respect to what you mean by distribution. Any mixture of distribution is also a distribution. Most often, 'ID' is a portmanteau term for 'unimodal'.
|
How can the IID assumption be checked in a given dataset?
|
You don't frame the two problems the right way.
Given a random dataset, ie a collection of observations $x_{ij}$ lying in general position you can always make the $n$ $x_{i}\in\mathbb{R}^p$ independe
|
How can the IID assumption be checked in a given dataset?
You don't frame the two problems the right way.
Given a random dataset, ie a collection of observations $x_{ij}$ lying in general position you can always make the $n$ $x_{i}\in\mathbb{R}^p$ independent from one another by randomly shuffling the $n$ indexes. The real question is whether you will lose information doing this. In some context you will (times series, panel data, cluster analysis, functional analysis,...) in others you won't. That's for the first I in IID.
The 'ID' is also defined with respect to what you mean by distribution. Any mixture of distribution is also a distribution. Most often, 'ID' is a portmanteau term for 'unimodal'.
|
How can the IID assumption be checked in a given dataset?
You don't frame the two problems the right way.
Given a random dataset, ie a collection of observations $x_{ij}$ lying in general position you can always make the $n$ $x_{i}\in\mathbb{R}^p$ independe
|
48,253
|
How can the IID assumption be checked in a given dataset?
|
Whether a set of observations are iid or not is a decision that is typically taken after a consideration of the underlying data generating process. In your case, the underlying data generating process seems to be the measurements of the speed of a river. I would not consider these observations to be independent. If a particular measurement is on the high end of the scale the next measurement is also likely to be on the high end of the scale. In other words, if I know one measurement I can infer something about the likely values for my next measurement. However, the values are likely to be identically distributed as the errors in your measurement probably come from the methodology used to measure velocity. I would imagine that you would use the same methodology to collect multiple measurements. You could of course use formal statistical tests to see if your observations are iid but for that you have to specify a data generating process, estimate the model under iid assumptions and examine for residuals for deviation from iid.
However, do note that I know nothing about engineering wavelets, wavelet space so I may be way-off in my above assumptions/answer.
|
How can the IID assumption be checked in a given dataset?
|
Whether a set of observations are iid or not is a decision that is typically taken after a consideration of the underlying data generating process. In your case, the underlying data generating process
|
How can the IID assumption be checked in a given dataset?
Whether a set of observations are iid or not is a decision that is typically taken after a consideration of the underlying data generating process. In your case, the underlying data generating process seems to be the measurements of the speed of a river. I would not consider these observations to be independent. If a particular measurement is on the high end of the scale the next measurement is also likely to be on the high end of the scale. In other words, if I know one measurement I can infer something about the likely values for my next measurement. However, the values are likely to be identically distributed as the errors in your measurement probably come from the methodology used to measure velocity. I would imagine that you would use the same methodology to collect multiple measurements. You could of course use formal statistical tests to see if your observations are iid but for that you have to specify a data generating process, estimate the model under iid assumptions and examine for residuals for deviation from iid.
However, do note that I know nothing about engineering wavelets, wavelet space so I may be way-off in my above assumptions/answer.
|
How can the IID assumption be checked in a given dataset?
Whether a set of observations are iid or not is a decision that is typically taken after a consideration of the underlying data generating process. In your case, the underlying data generating process
|
48,254
|
Checking assumptions for random effects in nested mixed-effects models in R / S-Plus
|
It seems you are using the nlme package. Maybe it would be worth trying R and the lme4 instead, although it is not fully comparable wrt. syntax or function call.
In your case, I would suggest to specify the level when you called ranef(), see ?ranef.lme:
level: an optional vector of positive integers giving the levels of
grouping to be used in extracting the random effects from an
object with multiple nested grouping levels. Defaults to all
levels of grouping.
This is also present in the official documentation for NLME 3.0 (e.g., p. 17).
Check out Douglas Bates's neat handouts on GLMM. He is also writing a textbook entitled lme4: Mixed-effects modeling with R. All are available on R-forge.
|
Checking assumptions for random effects in nested mixed-effects models in R / S-Plus
|
It seems you are using the nlme package. Maybe it would be worth trying R and the lme4 instead, although it is not fully comparable wrt. syntax or function call.
In your case, I would suggest to spec
|
Checking assumptions for random effects in nested mixed-effects models in R / S-Plus
It seems you are using the nlme package. Maybe it would be worth trying R and the lme4 instead, although it is not fully comparable wrt. syntax or function call.
In your case, I would suggest to specify the level when you called ranef(), see ?ranef.lme:
level: an optional vector of positive integers giving the levels of
grouping to be used in extracting the random effects from an
object with multiple nested grouping levels. Defaults to all
levels of grouping.
This is also present in the official documentation for NLME 3.0 (e.g., p. 17).
Check out Douglas Bates's neat handouts on GLMM. He is also writing a textbook entitled lme4: Mixed-effects modeling with R. All are available on R-forge.
|
Checking assumptions for random effects in nested mixed-effects models in R / S-Plus
It seems you are using the nlme package. Maybe it would be worth trying R and the lme4 instead, although it is not fully comparable wrt. syntax or function call.
In your case, I would suggest to spec
|
48,255
|
How to draw a probable outcome from a distribution?
|
I also think that it's not clear what you want. But if you want a set of deterministically chosen points, so that they preserve the moments of the initial distribution, you can use the sigma point selection method that applies to the unscented Kalman filter.
Say that you want to select $2L+1$ points that fulfill those requirements. Then proceed in the following way:
$\mathcal{X}_0=\overline{x} \qquad w_0=\frac{\kappa}{L+\kappa} \qquad i=0$
$\mathcal{X}_i=\overline{x}+\left(\sqrt{(\:L+\kappa\:)\:\mathbf{P}_x}\right)_i \qquad w_i=\frac{1}{2(L+\kappa)} \qquad i=1, \dots,L$
$\mathcal{X}_i=\overline{x}-\left(\sqrt{(\:L+\kappa\:)\:\mathbf{P}_x}\right)_i \qquad w_i=\frac{1}{2(L+\kappa)} \qquad i=L+1, \dots,2L$
where $w_i$ the weight of the i-th point,
$\kappa=3-L$ (in case of Normally distributed data),
and $\left(\sqrt{(\:L+\kappa\:)\mathbf{P}_x}\right)_i$ is the i-th row (or column)* of the matrix square root of the weighted covariance $(\:L+\kappa\:)\:\mathbf{P}_x$ matrix (usually given by the Cholesky decomposition)
* If the matrix square root $\mathbf{A}$ gives the original by giving $\mathbf{A}^T\mathbf{A}$, then use the rows of $\mathbf{A}$. If it gives the original by giving $\mathbf{A}\mathbf{A}^T$, then use the columns of $\mathbf{A}$. The result of the matlab function chol() falls into the first category.
Here is a simple example using R
x <- rnorm(1000,5,2.5)
y <- rnorm(1000,2,1)
P <- cov(cbind(x,y))
V0 <- c(mean(x),mean(y))
n <- 2;k <- 1
A <- chol((n+k)*P) # matrix square root
points <- as.data.frame(sapply(1:(2*n),function(i) if (i<=n) A[i,] + V0 else -A[i-n,] + V0))
attach(points)
#mean (equals V0)
1/(2*(n+k))*(V1+V2+V3+V4) + k/(n+k)*V0
#covariance (equals P)
1/(2*(n+k)) * ((V1-V0) %*% t(V1-V0) + (V2-V0) %*% t(V2-V0) + (V3-V0) %*% t(V3-V0) + (V4-V0) %*% t(V4-V0))
|
How to draw a probable outcome from a distribution?
|
I also think that it's not clear what you want. But if you want a set of deterministically chosen points, so that they preserve the moments of the initial distribution, you can use the sigma point sel
|
How to draw a probable outcome from a distribution?
I also think that it's not clear what you want. But if you want a set of deterministically chosen points, so that they preserve the moments of the initial distribution, you can use the sigma point selection method that applies to the unscented Kalman filter.
Say that you want to select $2L+1$ points that fulfill those requirements. Then proceed in the following way:
$\mathcal{X}_0=\overline{x} \qquad w_0=\frac{\kappa}{L+\kappa} \qquad i=0$
$\mathcal{X}_i=\overline{x}+\left(\sqrt{(\:L+\kappa\:)\:\mathbf{P}_x}\right)_i \qquad w_i=\frac{1}{2(L+\kappa)} \qquad i=1, \dots,L$
$\mathcal{X}_i=\overline{x}-\left(\sqrt{(\:L+\kappa\:)\:\mathbf{P}_x}\right)_i \qquad w_i=\frac{1}{2(L+\kappa)} \qquad i=L+1, \dots,2L$
where $w_i$ the weight of the i-th point,
$\kappa=3-L$ (in case of Normally distributed data),
and $\left(\sqrt{(\:L+\kappa\:)\mathbf{P}_x}\right)_i$ is the i-th row (or column)* of the matrix square root of the weighted covariance $(\:L+\kappa\:)\:\mathbf{P}_x$ matrix (usually given by the Cholesky decomposition)
* If the matrix square root $\mathbf{A}$ gives the original by giving $\mathbf{A}^T\mathbf{A}$, then use the rows of $\mathbf{A}$. If it gives the original by giving $\mathbf{A}\mathbf{A}^T$, then use the columns of $\mathbf{A}$. The result of the matlab function chol() falls into the first category.
Here is a simple example using R
x <- rnorm(1000,5,2.5)
y <- rnorm(1000,2,1)
P <- cov(cbind(x,y))
V0 <- c(mean(x),mean(y))
n <- 2;k <- 1
A <- chol((n+k)*P) # matrix square root
points <- as.data.frame(sapply(1:(2*n),function(i) if (i<=n) A[i,] + V0 else -A[i-n,] + V0))
attach(points)
#mean (equals V0)
1/(2*(n+k))*(V1+V2+V3+V4) + k/(n+k)*V0
#covariance (equals P)
1/(2*(n+k)) * ((V1-V0) %*% t(V1-V0) + (V2-V0) %*% t(V2-V0) + (V3-V0) %*% t(V3-V0) + (V4-V0) %*% t(V4-V0))
|
How to draw a probable outcome from a distribution?
I also think that it's not clear what you want. But if you want a set of deterministically chosen points, so that they preserve the moments of the initial distribution, you can use the sigma point sel
|
48,256
|
How to draw a probable outcome from a distribution?
|
To summarise (please correct me if I'm wrong):
You have a set of points for a number of parameters/states.
The points provide a joint distribution of the parameters states
You want to simulate from a model using some typical states.
The problem you have is that you can't write down a nice closed form density.
To tackle this problem you should use a particle filter. Suppose your model of a cell was this simple ODE:
\begin{equation}
\frac{dX(t)}{dt} = \lambda X(t)
\end{equation}
and your data consists of values of $\lambda$ and $X(0)$. Put this data in a matrix with two columns and $n$ rows, where $n$ is the number of points. Then
Choose a row at random, to get a particular values of $\lambda$ and $X(0)$
Optional step: perturb your parameters with noise.
Simulate from your model, in this case the ODE.
Repeat as necessary.
The key point is that step 1 is draw from the joint density of the $\lambda$ and $X(0)$.
This answer could be way off if I've misinterpreted what you mean about simulating from the model. Please correct me if I'm wrong.
|
How to draw a probable outcome from a distribution?
|
To summarise (please correct me if I'm wrong):
You have a set of points for a number of parameters/states.
The points provide a joint distribution of the parameters states
You want to simulate from a
|
How to draw a probable outcome from a distribution?
To summarise (please correct me if I'm wrong):
You have a set of points for a number of parameters/states.
The points provide a joint distribution of the parameters states
You want to simulate from a model using some typical states.
The problem you have is that you can't write down a nice closed form density.
To tackle this problem you should use a particle filter. Suppose your model of a cell was this simple ODE:
\begin{equation}
\frac{dX(t)}{dt} = \lambda X(t)
\end{equation}
and your data consists of values of $\lambda$ and $X(0)$. Put this data in a matrix with two columns and $n$ rows, where $n$ is the number of points. Then
Choose a row at random, to get a particular values of $\lambda$ and $X(0)$
Optional step: perturb your parameters with noise.
Simulate from your model, in this case the ODE.
Repeat as necessary.
The key point is that step 1 is draw from the joint density of the $\lambda$ and $X(0)$.
This answer could be way off if I've misinterpreted what you mean about simulating from the model. Please correct me if I'm wrong.
|
How to draw a probable outcome from a distribution?
To summarise (please correct me if I'm wrong):
You have a set of points for a number of parameters/states.
The points provide a joint distribution of the parameters states
You want to simulate from a
|
48,257
|
How to draw a probable outcome from a distribution?
|
One thing that you could do is to plot the position of all your experiments in the 2D plane, one point for each object, maybe colored by experiment (if you have a lot of experiments you may just plot a random subset of them).
If there is a pattern in the position of the objects it should emerge when doing this.
Also, depending on what you are measuring, maybe is not the absolute position that counts but the relative position of the objects. In that case you could rotate the positions around the origin so that for each experiment the first point always lies, for instance, on the x axis.
|
How to draw a probable outcome from a distribution?
|
One thing that you could do is to plot the position of all your experiments in the 2D plane, one point for each object, maybe colored by experiment (if you have a lot of experiments you may just plot
|
How to draw a probable outcome from a distribution?
One thing that you could do is to plot the position of all your experiments in the 2D plane, one point for each object, maybe colored by experiment (if you have a lot of experiments you may just plot a random subset of them).
If there is a pattern in the position of the objects it should emerge when doing this.
Also, depending on what you are measuring, maybe is not the absolute position that counts but the relative position of the objects. In that case you could rotate the positions around the origin so that for each experiment the first point always lies, for instance, on the x axis.
|
How to draw a probable outcome from a distribution?
One thing that you could do is to plot the position of all your experiments in the 2D plane, one point for each object, maybe colored by experiment (if you have a lot of experiments you may just plot
|
48,258
|
How to draw a probable outcome from a distribution?
|
Maybe you could use a smoothed scatterplot? It is an analogy to kernel density approximation, but in 2D.
|
How to draw a probable outcome from a distribution?
|
Maybe you could use a smoothed scatterplot? It is an analogy to kernel density approximation, but in 2D.
|
How to draw a probable outcome from a distribution?
Maybe you could use a smoothed scatterplot? It is an analogy to kernel density approximation, but in 2D.
|
How to draw a probable outcome from a distribution?
Maybe you could use a smoothed scatterplot? It is an analogy to kernel density approximation, but in 2D.
|
48,259
|
How can one speed up this correlation calculation in R without multicore?
|
While making a call to diag you throw out a lot of information, so you can save time by simply not calculating it. You code is equivalent to:
sapply(1:100,function(i) cor(x[i,],y[i,]))
Extended to reflect comments: This code will be slower for small matrices since it does not use the full "vectorization power" of cor. So, if you'd like to make fast calculations on small matrices, write it as a C chunk. If one would like to parallelize it (again, will be profitable only for large matrices), may use this code replacing sapply with mc.lapply or something like this.
|
How can one speed up this correlation calculation in R without multicore?
|
While making a call to diag you throw out a lot of information, so you can save time by simply not calculating it. You code is equivalent to:
sapply(1:100,function(i) cor(x[i,],y[i,]))
Extended to re
|
How can one speed up this correlation calculation in R without multicore?
While making a call to diag you throw out a lot of information, so you can save time by simply not calculating it. You code is equivalent to:
sapply(1:100,function(i) cor(x[i,],y[i,]))
Extended to reflect comments: This code will be slower for small matrices since it does not use the full "vectorization power" of cor. So, if you'd like to make fast calculations on small matrices, write it as a C chunk. If one would like to parallelize it (again, will be profitable only for large matrices), may use this code replacing sapply with mc.lapply or something like this.
|
How can one speed up this correlation calculation in R without multicore?
While making a call to diag you throw out a lot of information, so you can save time by simply not calculating it. You code is equivalent to:
sapply(1:100,function(i) cor(x[i,],y[i,]))
Extended to re
|
48,260
|
How can one speed up this correlation calculation in R without multicore?
|
This really depends on the relative numbers of "scores" and "subjects". The method you use calculates lots of cross-correlations which are not required. However, if there are relatively few "subjects" relative to "scores", then this probably doesn't matter too much, and the method you suggest is probably as good as anything, as it uses a small number of efficient blas operations. However, if there are a large number of "subjects" relative to scores, then it may well be quicker to loop over the rows computing the correlation for each pair separately, using the code suggested by "mbq".
|
How can one speed up this correlation calculation in R without multicore?
|
This really depends on the relative numbers of "scores" and "subjects". The method you use calculates lots of cross-correlations which are not required. However, if there are relatively few "subjects"
|
How can one speed up this correlation calculation in R without multicore?
This really depends on the relative numbers of "scores" and "subjects". The method you use calculates lots of cross-correlations which are not required. However, if there are relatively few "subjects" relative to "scores", then this probably doesn't matter too much, and the method you suggest is probably as good as anything, as it uses a small number of efficient blas operations. However, if there are a large number of "subjects" relative to scores, then it may well be quicker to loop over the rows computing the correlation for each pair separately, using the code suggested by "mbq".
|
How can one speed up this correlation calculation in R without multicore?
This really depends on the relative numbers of "scores" and "subjects". The method you use calculates lots of cross-correlations which are not required. However, if there are relatively few "subjects"
|
48,261
|
How can one speed up this correlation calculation in R without multicore?
|
It might be one of those cases where using a different BLAS engine would help. But I am not sure of it - it needs testing (and depends on your machine)
|
How can one speed up this correlation calculation in R without multicore?
|
It might be one of those cases where using a different BLAS engine would help. But I am not sure of it - it needs testing (and depends on your machine)
|
How can one speed up this correlation calculation in R without multicore?
It might be one of those cases where using a different BLAS engine would help. But I am not sure of it - it needs testing (and depends on your machine)
|
How can one speed up this correlation calculation in R without multicore?
It might be one of those cases where using a different BLAS engine would help. But I am not sure of it - it needs testing (and depends on your machine)
|
48,262
|
How could XGBoost beat perfect logistic regression?
|
I have upvoted Sycorax's answer as useful. Nevertheless, I think there is a serious issue with the question: sklearn.linear_model.LogisticRegression.score returns the mean accuracy, not AUC-ROC. If we used LR.predict_proba(df_1)[:,1] to get the predicted probabilistic estimates AUC-ROC values both in the training and testing sets would be higher for the "perfect" logistic regresssion model than XGBoost. For example, in the testing set, XGBoost's AUC-ROC is: 0.9071 and the AUC-ROC score from the logistic regression is: 0.9167.
|
How could XGBoost beat perfect logistic regression?
|
I have upvoted Sycorax's answer as useful. Nevertheless, I think there is a serious issue with the question: sklearn.linear_model.LogisticRegression.score returns the mean accuracy, not AUC-ROC. If w
|
How could XGBoost beat perfect logistic regression?
I have upvoted Sycorax's answer as useful. Nevertheless, I think there is a serious issue with the question: sklearn.linear_model.LogisticRegression.score returns the mean accuracy, not AUC-ROC. If we used LR.predict_proba(df_1)[:,1] to get the predicted probabilistic estimates AUC-ROC values both in the training and testing sets would be higher for the "perfect" logistic regresssion model than XGBoost. For example, in the testing set, XGBoost's AUC-ROC is: 0.9071 and the AUC-ROC score from the logistic regression is: 0.9167.
|
How could XGBoost beat perfect logistic regression?
I have upvoted Sycorax's answer as useful. Nevertheless, I think there is a serious issue with the question: sklearn.linear_model.LogisticRegression.score returns the mean accuracy, not AUC-ROC. If w
|
48,263
|
Average marginal means with marginaleffects
|
Yes, they are actually not called by marginal means in marginaleffects but rather adjusted predictions, and they can be estimated using the predictions() function. To compare adjusted predictions, you can uset he hypothesis argument of predicitions() or the comparisons() function, which is specifically designed for g-computation.
Here's how this would look:
# Adjusted predictions
predictions(mod,
newdata = datagridcf(species = c("Adelie", "Chinstrap", "Gentoo")),
by = "species") |>
summary()
#> species Predicted Std. Error z value Pr(>|z|) CI low CI high
#> 1 Adelie 0.5821 0.03659 15.908 < 2.22e-16 0.51039 0.65383
#> 2 Chinstrap 0.0602 0.01897 3.173 0.0015095 0.02301 0.09739
#> 3 Gentoo 0.9061 0.07522 12.045 < 2.22e-16 0.75867 1.05355
#>
#> Model type: glm
#> Prediction type: response
# Pairwise comparison between adjusted predictions
predictions(mod,
newdata = datagridcf(species = c("Adelie", "Chinstrap", "Gentoo")),
by = "species", hypothesis = "pairwise") |>
summary()
#> Term Predicted Std. Error z value Pr(>|z|) CI low CI high
#> 1 Adelie - Chinstrap 0.5219 0.04016 12.997 < 2.22e-16 0.4432 0.6006
#> 2 Adelie - Gentoo -0.3240 0.09578 -3.383 0.00071749 -0.5117 -0.1363
#> 3 Chinstrap - Gentoo -0.8459 0.07891 -10.719 < 2.22e-16 -1.0006 -0.6912
#>
#> Model type: glm
#> Prediction type: response
# The same but using comparisons()
comparisons(mod, variables = list(species = "pairwise")) |> summary()
#> Term Contrast Effect Std. Error z value Pr(>|z|) 2.5 %
#> 1 species Chinstrap - Adelie -0.5219 0.04016 -12.997 < 2.22e-16 -0.6006
#> 2 species Gentoo - Adelie 0.3240 0.09578 3.383 0.00071749 0.1363
#> 3 species Gentoo - Chinstrap 0.8459 0.07891 10.719 < 2.22e-16 0.6912
#> 97.5 %
#> 1 -0.4432
#> 2 0.5117
#> 3 1.0006
#>
#> Model type: glm
#> Prediction type: response
Created on 2022-10-25 with reprex v2.0.2
As you can see, we get the same answers as when using stdReg. marginaleffects has several other nice options, like being able to supply your own covariance matrix, choose the desired effect measure (e.g., risk ratio or odds ratio), or compute effects and predictions within subgroups. I demonstrate how to use it for g-computation in the context of moderation analysis after propensity score matching in this blog post.
|
Average marginal means with marginaleffects
|
Yes, they are actually not called by marginal means in marginaleffects but rather adjusted predictions, and they can be estimated using the predictions() function. To compare adjusted predictions, you
|
Average marginal means with marginaleffects
Yes, they are actually not called by marginal means in marginaleffects but rather adjusted predictions, and they can be estimated using the predictions() function. To compare adjusted predictions, you can uset he hypothesis argument of predicitions() or the comparisons() function, which is specifically designed for g-computation.
Here's how this would look:
# Adjusted predictions
predictions(mod,
newdata = datagridcf(species = c("Adelie", "Chinstrap", "Gentoo")),
by = "species") |>
summary()
#> species Predicted Std. Error z value Pr(>|z|) CI low CI high
#> 1 Adelie 0.5821 0.03659 15.908 < 2.22e-16 0.51039 0.65383
#> 2 Chinstrap 0.0602 0.01897 3.173 0.0015095 0.02301 0.09739
#> 3 Gentoo 0.9061 0.07522 12.045 < 2.22e-16 0.75867 1.05355
#>
#> Model type: glm
#> Prediction type: response
# Pairwise comparison between adjusted predictions
predictions(mod,
newdata = datagridcf(species = c("Adelie", "Chinstrap", "Gentoo")),
by = "species", hypothesis = "pairwise") |>
summary()
#> Term Predicted Std. Error z value Pr(>|z|) CI low CI high
#> 1 Adelie - Chinstrap 0.5219 0.04016 12.997 < 2.22e-16 0.4432 0.6006
#> 2 Adelie - Gentoo -0.3240 0.09578 -3.383 0.00071749 -0.5117 -0.1363
#> 3 Chinstrap - Gentoo -0.8459 0.07891 -10.719 < 2.22e-16 -1.0006 -0.6912
#>
#> Model type: glm
#> Prediction type: response
# The same but using comparisons()
comparisons(mod, variables = list(species = "pairwise")) |> summary()
#> Term Contrast Effect Std. Error z value Pr(>|z|) 2.5 %
#> 1 species Chinstrap - Adelie -0.5219 0.04016 -12.997 < 2.22e-16 -0.6006
#> 2 species Gentoo - Adelie 0.3240 0.09578 3.383 0.00071749 0.1363
#> 3 species Gentoo - Chinstrap 0.8459 0.07891 10.719 < 2.22e-16 0.6912
#> 97.5 %
#> 1 -0.4432
#> 2 0.5117
#> 3 1.0006
#>
#> Model type: glm
#> Prediction type: response
Created on 2022-10-25 with reprex v2.0.2
As you can see, we get the same answers as when using stdReg. marginaleffects has several other nice options, like being able to supply your own covariance matrix, choose the desired effect measure (e.g., risk ratio or odds ratio), or compute effects and predictions within subgroups. I demonstrate how to use it for g-computation in the context of moderation analysis after propensity score matching in this blog post.
|
Average marginal means with marginaleffects
Yes, they are actually not called by marginal means in marginaleffects but rather adjusted predictions, and they can be estimated using the predictions() function. To compare adjusted predictions, you
|
48,264
|
Average marginal means with marginaleffects
|
This truly is a different answer...
You won't believe this, but this can be done via a new counterfactuals argument that I added to ref_grid():
> emmeans(mod, "species", counterfact = "species")
species prob SE df asymp.LCL asymp.UCL
Adelie 0.5821 0.0367 Inf 0.510 0.6540
Chinstrap 0.0602 0.0190 Inf 0.023 0.0975
Gentoo 0.9061 0.0751 Inf 0.759 1.0534
Results are averaged over the levels of: .obs.no.
Confidence level used: 0.95
The estimates shown are the same as those shown in the OP using stdReg::stdGlm. All that I did was re-define the reference grid so that there is a new factor .obs.no. and we use that in place of any predictors not included in counterfactuals. Note that we do not use weights = "prop" here because we already give the same weight to each observation.
Alternative covariances
The SEs above are somewhat lower than those from stdGlm, because they are conditional on the covariate values. We get closer if we substitute a sandwich estimate of the covariance, e.g.,
> emmeans(mod, "species", counter = "species",
+ vcov. = sandwich::vcovHC(mod))
species prob SE df asymp.LCL asymp.UCL
Adelie 0.5821 0.0402 Inf 0.5032 0.6610
Chinstrap 0.0602 0.0202 Inf 0.0205 0.0999
Gentoo 0.9061 0.0852 Inf 0.7392 1.0731
Results are averaged over the levels of: .obs.no.
Confidence level used: 0.95
A humble approach
If you really like what you got from stdReg, maybe you should just use it by importing it into the emmeans machinery:
> std = stdGlm(fit = mod, data = dat_pen, X = "species")
> mod.emm = emmobj(bhat = std$est, V = std$vcov,
+ levels = list(species = levels(dat_pen$species)))
> mod.emm
species estimate SE df asymp.LCL asymp.UCL
Adelie 0.5821 0.0435 NA 0.4969 0.667
Chinstrap 0.0602 0.0204 NA 0.0202 0.100
Gentoo 0.9061 0.0826 NA 0.7441 1.068
Confidence level used: 0.95
> pairs(mod.emm)
contrast estimate SE df z.ratio p.value
Adelie - Chinstrap 0.522 0.0470 NA 11.106 <.0001
Adelie - Gentoo -0.324 0.1080 NA -2.999 0.0076
Chinstrap - Gentoo -0.846 0.0849 NA -9.963 <.0001
P value adjustment: tukey method for comparing a family of 3 estimates
|
Average marginal means with marginaleffects
|
This truly is a different answer...
You won't believe this, but this can be done via a new counterfactuals argument that I added to ref_grid():
> emmeans(mod, "species", counterfact = "species")
spec
|
Average marginal means with marginaleffects
This truly is a different answer...
You won't believe this, but this can be done via a new counterfactuals argument that I added to ref_grid():
> emmeans(mod, "species", counterfact = "species")
species prob SE df asymp.LCL asymp.UCL
Adelie 0.5821 0.0367 Inf 0.510 0.6540
Chinstrap 0.0602 0.0190 Inf 0.023 0.0975
Gentoo 0.9061 0.0751 Inf 0.759 1.0534
Results are averaged over the levels of: .obs.no.
Confidence level used: 0.95
The estimates shown are the same as those shown in the OP using stdReg::stdGlm. All that I did was re-define the reference grid so that there is a new factor .obs.no. and we use that in place of any predictors not included in counterfactuals. Note that we do not use weights = "prop" here because we already give the same weight to each observation.
Alternative covariances
The SEs above are somewhat lower than those from stdGlm, because they are conditional on the covariate values. We get closer if we substitute a sandwich estimate of the covariance, e.g.,
> emmeans(mod, "species", counter = "species",
+ vcov. = sandwich::vcovHC(mod))
species prob SE df asymp.LCL asymp.UCL
Adelie 0.5821 0.0402 Inf 0.5032 0.6610
Chinstrap 0.0602 0.0202 Inf 0.0205 0.0999
Gentoo 0.9061 0.0852 Inf 0.7392 1.0731
Results are averaged over the levels of: .obs.no.
Confidence level used: 0.95
A humble approach
If you really like what you got from stdReg, maybe you should just use it by importing it into the emmeans machinery:
> std = stdGlm(fit = mod, data = dat_pen, X = "species")
> mod.emm = emmobj(bhat = std$est, V = std$vcov,
+ levels = list(species = levels(dat_pen$species)))
> mod.emm
species estimate SE df asymp.LCL asymp.UCL
Adelie 0.5821 0.0435 NA 0.4969 0.667
Chinstrap 0.0602 0.0204 NA 0.0202 0.100
Gentoo 0.9061 0.0826 NA 0.7441 1.068
Confidence level used: 0.95
> pairs(mod.emm)
contrast estimate SE df z.ratio p.value
Adelie - Chinstrap 0.522 0.0470 NA 11.106 <.0001
Adelie - Gentoo -0.324 0.1080 NA -2.999 0.0076
Chinstrap - Gentoo -0.846 0.0849 NA -9.963 <.0001
P value adjustment: tukey method for comparing a family of 3 estimates
|
Average marginal means with marginaleffects
This truly is a different answer...
You won't believe this, but this can be done via a new counterfactuals argument that I added to ref_grid():
> emmeans(mod, "species", counterfact = "species")
spec
|
48,265
|
Gaussian fourth-moment formulas?
|
I have never seen an closed form expression for this. Probably because it is quite ugly. I have worked with a similar expression before, and I'd be happy to see if my expression is stands up to yours. So here is one way to compute the matrix expectation.
I will work with $\frac{X^TX}{m}$ rather than $X^TX$, since that is the empirical 2nd order moment matrix. It is a quantity that will converge.
Lemma
First some tricks that need index manipulations for me to see. If $y\sim \mathcal{N}(0,\Sigma)$, $\mu$ a vector and $A$ is a matrix,
$$E[y\mu{}^T A y \mu^T] = \Sigma{}A^T\mu\mu^T$$
$$E[\mu{}y^TA\mu{}y^T] = \mu\mu^T A^T \Sigma $$
Proof:
Follow the indices! I use Einstein summation convention to be able declutter notation.
$$E[y\mu{}^T A y \mu]_{ij} = E[y_i\mu_kA_{kl}y_l\mu_j] = E[y_iy_l]A^T_{lk} \mu_k \mu_j= \Sigma_{il}A^T_{lk}\mu_k\mu_j = [\Sigma{}A^T\mu\mu^T]_{ij}$$
The second equation is similarly proven.
QED
Next, we will look at the zero-mean case as a warm-up exercise.
Lemma
Assume $m$ independent gaussian random vectors $x^{(i)} \overset{iid}{\sim} \mathcal{N}(0,\Sigma)$. Row-stack them in the matrix $X$. Then
\begin{equation}
\begin{split}
E\left[\frac{X^TX}{m}A\frac{X^TX}{m}\right] &= \frac{m-1}{m} \Sigma{}A\Sigma{} \\
& + \frac{1}{m}\left( \Sigma{}(A+A^T)\Sigma{} + \operatorname{Tr}(\Sigma{}A)\Sigma{} \right)
\end{split}
\end{equation}
Proof:
$$
\frac{1}{m^2}E[X^TXAX^TX] = \sum_{i,j}E[x^{(i)}{x^{(i)}}^TAx^{(j)}{x^{(j)}}^T]
$$
There are $m(m-1)$ terms where $i\neq{}j$, and $m$ terms where they agree.
Since $x^{(i)}$ and $x^{(j)}$ are iid, we can let $x$ denote either of them, and state
$$
\frac{1}{m^2}E[X^TXAX^TX] = \frac{1}{m^2}( m(m-1) E[xx^T]AE[xx^T] + m E[xx^TAxx^T])
$$
The first term is just the variances. The second term needs isserlis theorem. It gives (again, einstein summation convention)
\begin{align}
E[xx^TAxx^T]_{ij} &= E[x_ix_kA_{kl}x_lx_j] \\&= A_{kl}(E[x_ix_k]E[x_lx_j]+E[x_ix_l]E[x_kx_j]+E[x_ix_j]E[x_lx_k] \\&= \left\{ \Sigma(A+A^T)\Sigma + \Sigma \operatorname{Tr}(A\Sigma)\right\}_{ij}
\end{align}
Armed with this, we can simply state
$$
\frac{1}{m^2}E[X^TXAX^TX] = \frac{m-1}{m^2} \Sigma{}A\Sigma{} + \frac{1}{m}(\Sigma(A+A^T)\Sigma + \Sigma \operatorname{Tr}(A\Sigma))
$$
QED
Now, we look at the general case.
Lemma:
Assume $m$ independent gaussian random vectors $x^{(i)} \overset{iid}{\sim} \mathcal{N}(\mu,\Sigma)$. Row-stack them in the matrix $X$. Let $H=\Sigma+\mu\mu^T$.
Then
\begin{equation}
E\left[\frac{X^TX}{m}A\frac{X^TX}{m}\right] = \frac{(m-1)}{m}HAH + \frac{1}{m}
\left( H(A+A^T)H - \mu\mu^T(A+A^T)\mu\mu^T + H\operatorname{Tr}(HA)) \right),
\end{equation}
Proof:
Let $x \sim \mathcal{N}(\mu,\Sigma)$. Define $y=x-\mu$.
As before,
\begin{equation}
\frac{1}{m^2}E[X^TXAX^TX] = \frac{1}{m^2}( m(m-1) E[xx^T]AE[xx^T] + m E[xx^TAxx^T]) \label{eq:one}
\end{equation}
The first term is simply
\begin{equation}
\label{eq:two}
E[xx^T]AE[xx^T] = (\Sigma+\mu\mu^T)A(\Sigma+\mu\mu^T).
\end{equation}
The second term needs more work. We expand it in $y+\mu$, and notice that all terms with 1 or 3 factors of $y$ must have expectation 0 due to either Isserlis theorem, or to the zero mean. There are in total 16 terms, but 8 gets zeroes out in that way.
\begin{equation}
\begin{split}
E[xx^TAxx^T] &= E[(y+\mu) (y+\mu)^TA(y+\mu)(y+\mu)^T] \\
& = E[yy^TAyy^T] + E[\mu\mu^TA\mu\mu^T]\\
& + E[yy^TA\mu\mu^T] + E[\mu\mu^TAyy^T]\\
& + E[y\mu^TAy\mu^T] + E[\mu{}y^TA\mu{}y^T]\\
& + E[y\mu^TA\mu{}y^T] + E[\mu{}y^TAy\mu{}^T]
\end{split}
\end{equation}
All these are simple expectations. The first one due to Isserlis' theorem. The second is the expectation of a constant. Term three and four are just covariances. Term five and six are computed by the initial Lemma that I needed some index manipulations for. Term seven is due to the inner three factors are scalar so the $y$'s can be combined. Term eight uses $y^TAy = \operatorname{Tr}(yy^TA)$ and that the trace is linear and thus commutes with expectations. So, we find
\begin{equation}
\begin{split}
E[xx^TAxx^T] &= (\Sigma(A+A^T)\Sigma + \Sigma \operatorname{Tr}(A\Sigma)) + \mu\mu^TA\mu\mu^T\\
& + \Sigma{}A\mu\mu^T + \mu\mu^TA\Sigma{}\\
& + \Sigma{}A^T\mu\mu^T + \mu\mu^TA^T\Sigma \\
& + \Sigma\mu^TA\mu + \mu\mu^T\operatorname{Tr}(\Sigma{}A)
\end{split}
\end{equation}
Some regrouping of terms yields
\begin{equation}
\begin{split}
E[xx^TAxx^T] &= (\Sigma+\mu\mu^T)(A+A^T)(\Sigma+\mu\mu^T) - \mu\mu^T(A+A^T)\mu\mu^T\\
& + (\Sigma+\mu\mu^T)\operatorname{Tr}((\Sigma+\mu\mu^T)A)
\end{split}
\end{equation}
Combining the found results, we get
\begin{equation}
E\left[\frac{X^TX}{m}A\frac{X^TX}{m}\right] = \frac{(m-1)}{m}HAH + \frac{1}{m}
\left( H(A+A^T)H - \mu\mu^T(A+A^T)\mu\mu^T + H\operatorname{Tr}(HA)) \right),
\end{equation}
where $H=\Sigma+\mu\mu^T$
QED
|
Gaussian fourth-moment formulas?
|
I have never seen an closed form expression for this. Probably because it is quite ugly. I have worked with a similar expression before, and I'd be happy to see if my expression is stands up to yours.
|
Gaussian fourth-moment formulas?
I have never seen an closed form expression for this. Probably because it is quite ugly. I have worked with a similar expression before, and I'd be happy to see if my expression is stands up to yours. So here is one way to compute the matrix expectation.
I will work with $\frac{X^TX}{m}$ rather than $X^TX$, since that is the empirical 2nd order moment matrix. It is a quantity that will converge.
Lemma
First some tricks that need index manipulations for me to see. If $y\sim \mathcal{N}(0,\Sigma)$, $\mu$ a vector and $A$ is a matrix,
$$E[y\mu{}^T A y \mu^T] = \Sigma{}A^T\mu\mu^T$$
$$E[\mu{}y^TA\mu{}y^T] = \mu\mu^T A^T \Sigma $$
Proof:
Follow the indices! I use Einstein summation convention to be able declutter notation.
$$E[y\mu{}^T A y \mu]_{ij} = E[y_i\mu_kA_{kl}y_l\mu_j] = E[y_iy_l]A^T_{lk} \mu_k \mu_j= \Sigma_{il}A^T_{lk}\mu_k\mu_j = [\Sigma{}A^T\mu\mu^T]_{ij}$$
The second equation is similarly proven.
QED
Next, we will look at the zero-mean case as a warm-up exercise.
Lemma
Assume $m$ independent gaussian random vectors $x^{(i)} \overset{iid}{\sim} \mathcal{N}(0,\Sigma)$. Row-stack them in the matrix $X$. Then
\begin{equation}
\begin{split}
E\left[\frac{X^TX}{m}A\frac{X^TX}{m}\right] &= \frac{m-1}{m} \Sigma{}A\Sigma{} \\
& + \frac{1}{m}\left( \Sigma{}(A+A^T)\Sigma{} + \operatorname{Tr}(\Sigma{}A)\Sigma{} \right)
\end{split}
\end{equation}
Proof:
$$
\frac{1}{m^2}E[X^TXAX^TX] = \sum_{i,j}E[x^{(i)}{x^{(i)}}^TAx^{(j)}{x^{(j)}}^T]
$$
There are $m(m-1)$ terms where $i\neq{}j$, and $m$ terms where they agree.
Since $x^{(i)}$ and $x^{(j)}$ are iid, we can let $x$ denote either of them, and state
$$
\frac{1}{m^2}E[X^TXAX^TX] = \frac{1}{m^2}( m(m-1) E[xx^T]AE[xx^T] + m E[xx^TAxx^T])
$$
The first term is just the variances. The second term needs isserlis theorem. It gives (again, einstein summation convention)
\begin{align}
E[xx^TAxx^T]_{ij} &= E[x_ix_kA_{kl}x_lx_j] \\&= A_{kl}(E[x_ix_k]E[x_lx_j]+E[x_ix_l]E[x_kx_j]+E[x_ix_j]E[x_lx_k] \\&= \left\{ \Sigma(A+A^T)\Sigma + \Sigma \operatorname{Tr}(A\Sigma)\right\}_{ij}
\end{align}
Armed with this, we can simply state
$$
\frac{1}{m^2}E[X^TXAX^TX] = \frac{m-1}{m^2} \Sigma{}A\Sigma{} + \frac{1}{m}(\Sigma(A+A^T)\Sigma + \Sigma \operatorname{Tr}(A\Sigma))
$$
QED
Now, we look at the general case.
Lemma:
Assume $m$ independent gaussian random vectors $x^{(i)} \overset{iid}{\sim} \mathcal{N}(\mu,\Sigma)$. Row-stack them in the matrix $X$. Let $H=\Sigma+\mu\mu^T$.
Then
\begin{equation}
E\left[\frac{X^TX}{m}A\frac{X^TX}{m}\right] = \frac{(m-1)}{m}HAH + \frac{1}{m}
\left( H(A+A^T)H - \mu\mu^T(A+A^T)\mu\mu^T + H\operatorname{Tr}(HA)) \right),
\end{equation}
Proof:
Let $x \sim \mathcal{N}(\mu,\Sigma)$. Define $y=x-\mu$.
As before,
\begin{equation}
\frac{1}{m^2}E[X^TXAX^TX] = \frac{1}{m^2}( m(m-1) E[xx^T]AE[xx^T] + m E[xx^TAxx^T]) \label{eq:one}
\end{equation}
The first term is simply
\begin{equation}
\label{eq:two}
E[xx^T]AE[xx^T] = (\Sigma+\mu\mu^T)A(\Sigma+\mu\mu^T).
\end{equation}
The second term needs more work. We expand it in $y+\mu$, and notice that all terms with 1 or 3 factors of $y$ must have expectation 0 due to either Isserlis theorem, or to the zero mean. There are in total 16 terms, but 8 gets zeroes out in that way.
\begin{equation}
\begin{split}
E[xx^TAxx^T] &= E[(y+\mu) (y+\mu)^TA(y+\mu)(y+\mu)^T] \\
& = E[yy^TAyy^T] + E[\mu\mu^TA\mu\mu^T]\\
& + E[yy^TA\mu\mu^T] + E[\mu\mu^TAyy^T]\\
& + E[y\mu^TAy\mu^T] + E[\mu{}y^TA\mu{}y^T]\\
& + E[y\mu^TA\mu{}y^T] + E[\mu{}y^TAy\mu{}^T]
\end{split}
\end{equation}
All these are simple expectations. The first one due to Isserlis' theorem. The second is the expectation of a constant. Term three and four are just covariances. Term five and six are computed by the initial Lemma that I needed some index manipulations for. Term seven is due to the inner three factors are scalar so the $y$'s can be combined. Term eight uses $y^TAy = \operatorname{Tr}(yy^TA)$ and that the trace is linear and thus commutes with expectations. So, we find
\begin{equation}
\begin{split}
E[xx^TAxx^T] &= (\Sigma(A+A^T)\Sigma + \Sigma \operatorname{Tr}(A\Sigma)) + \mu\mu^TA\mu\mu^T\\
& + \Sigma{}A\mu\mu^T + \mu\mu^TA\Sigma{}\\
& + \Sigma{}A^T\mu\mu^T + \mu\mu^TA^T\Sigma \\
& + \Sigma\mu^TA\mu + \mu\mu^T\operatorname{Tr}(\Sigma{}A)
\end{split}
\end{equation}
Some regrouping of terms yields
\begin{equation}
\begin{split}
E[xx^TAxx^T] &= (\Sigma+\mu\mu^T)(A+A^T)(\Sigma+\mu\mu^T) - \mu\mu^T(A+A^T)\mu\mu^T\\
& + (\Sigma+\mu\mu^T)\operatorname{Tr}((\Sigma+\mu\mu^T)A)
\end{split}
\end{equation}
Combining the found results, we get
\begin{equation}
E\left[\frac{X^TX}{m}A\frac{X^TX}{m}\right] = \frac{(m-1)}{m}HAH + \frac{1}{m}
\left( H(A+A^T)H - \mu\mu^T(A+A^T)\mu\mu^T + H\operatorname{Tr}(HA)) \right),
\end{equation}
where $H=\Sigma+\mu\mu^T$
QED
|
Gaussian fourth-moment formulas?
I have never seen an closed form expression for this. Probably because it is quite ugly. I have worked with a similar expression before, and I'd be happy to see if my expression is stands up to yours.
|
48,266
|
How to prove that $\frac{\int_{\{X\in B\}} P(A|X)(\omega)dP(\omega)}{P(X\in B)}=P(A\mid X\in B)$?
|
The answer is a one-liner, but that's disingenuous because (as you can see) it's going to take me some time to get to it!
Before setting out, let's establish a general yet accurate way to visualize what's going on.
Seeing things
This figure schematically draws $\Omega$ as the interior of a rectangle.
When $X:\Omega\to \mathbb R$ is any function, it has a "contour map" of level sets of the form $X^{-1}(b)$ for any contour level $b\in\mathbb R.$ Clearly, no distinct level sets may intersect and so they partition (a set-theoretic term), "dissect" (a statistical term), or "foliate" (a topological term) $\Omega.$ For our purposes the geometrical details of this dissection won't matter, so I have felt free to sketch each of the level curves as a vertical line segment, even though they needn't have the same shapes, sizes, or cardinalities.
Below, I will be discussing two kinds of events: measurable subsets of $\Omega.$ $\mathcal A$ is an arbitrary event in $\Omega.$ Because it could be anywhere, and we are free in this schematic to re-order the points within each of the vertical lines of the dissection any way we please (and separately from each other), I have drawn things so that the intersections of $\mathcal A$ with the level curves $X^{-1}(b)$ are segments originating at the bottom (dashed) axis. In this fashion we may conceive, with wide generality and accuracy, of any (single) event as being a region under some curve.
The event $\mathcal B$ bordered on the left and right by dashed lines is special because it is comprised of entire level curves. This means it is of the form $X^{-1}(B)$ where $B\subset \mathbb R$ is the set of "heights" of $X$ within $\mathcal B$ on the contour map. This helps us visualize the distinction between arbitrary events and events relative to the subalgebra generated by $X.$ The latter are all unions of level sets: collections of vertical strips.
It will do no harm to think of the probability measure $\mathbb P$ as being uniform: thus, areas in this figure represent probabilities, with the entire rectangle understood as having a unit area.
Finally, here is a sketch of the conditional expectation of the indicator function $\mathscr I_\mathcal A$ with respect to this dissection. (Recall that $\mathscr I_\mathcal A$ assigns the value $1$ to all points in $\mathcal A$ and the value $0$ to all other points.)
The horizontal line labeled with the conditional expectation $E[\mathscr I_\mathcal A\mid X\in B]$ is drawn at the average height of $A$ within $\mathcal B.$ As we are taught in Calculus (for real functions), that average is the integral of the height divided by the width of the strip representing $\mathcal B.$ That is, we have replaced the area of an arbitrary shape $\mathcal A \cap \mathcal B$ by a rectangle of the same area, spanning the same width as $\mathcal B$ in the horizontal direction.
This height equals the probability of $\mathcal A$ conditional on $\mathcal B.$
If you have managed to follow my descriptions, this is obvious in the picture, for if you were to throw darts randomly (and uniformly) at it, the (limiting) fraction of darts landing within $\mathcal B$ that are also in $\mathcal A$ is the same as the (limiting) fraction landing within $\mathcal B$ at heights between $0$ and $E[\mathscr I_\mathcal A\mid \mathscr B].$
Let's do this again in algebraic notation. As is common in such measure-theoretic situations, this result is a matter of notation and definitions, so let's begin with these simple preliminaries.
Conditioning on a sigma-algebra
When $\mathfrak G\subset \mathfrak F$ is a subalgebra of the probability space $(\Omega,\mathfrak F, \mathbb P),$ a conditional expectation $E$ for any integrable $\mathfrak F$-measurable random variable $Y$ is its "projection" $E[Y\mid\mathfrak G]$ onto some $\mathfrak G$-measurable random variable $E[Y\mid \mathfrak G]$ for which
$$\int_{\mathscr B} Y\mathrm d \mathbb P = \int_{\mathscr B} E[Y\mid\mathfrak G]\mathrm d \mathbb P\tag{1}$$
for any $\mathfrak G$-measurable event $\mathscr B.$
Applying $(1)$ to $Y = \mathscr I_\mathcal A,$ the indicator of some $\mathfrak F$-measurable event $\mathcal A,$ gives
$$\Pr(\mathcal A \cap \mathcal B) = \int_{\mathcal A \cap \mathcal B} \mathrm{d}\mathbb P = \int_{\mathcal B} \mathscr I_{\mathcal A}\mathrm\, d \mathbb P = \int_{\mathcal B}E[\mathscr I_{\mathcal A}\mid \mathfrak G]\mathrm d \mathbb P.\tag{2}$$
Conditioning on an event
When $\Pr(\mathcal B)\ne 0,$ according to the definition of conditioning on a single event $\mathcal B$,
$$\Pr(\mathcal A\mid \mathcal B) = \frac{\Pr(\mathcal A \cap \mathcal B)}{\Pr(\mathcal B)}.
\tag{3}$$
Substituting the conditional expectation expression $(2)$ for $\Pr(\mathcal A \cap \mathcal B)$ into $(3)$ yields
$$\Pr(\mathcal A \mid \mathcal B) = \frac{1}{\Pr(\mathcal B)} \int_{\mathcal B}E[\mathscr I_{\mathcal A}\mid \mathfrak G]\mathrm d \mathbb P.\tag{4}$$
Measure-theoretic definition of conditional probability
Apply the preceding remarks to the case where $X$ is a $\mathfrak F$-measurable random variable, $B$ is a real Borel set, $\mathcal B = X^{-1}(B),$ and $\mathfrak G$ is the sigma-algebra generated by $X.$ The conditional probability is defined in terms of expectations as
$$\Pr(\mathcal A \mid X \in B) = \int_{X^{-1}(B)} E[\mathscr I_{\mathcal A}\mid \mathfrak G]\mathrm d \mathbb P = \int_{X^{-1}(B)} \Pr(\mathcal A \mid X)\mathrm d \mathbb P.\tag{5}$$
Answer to the question
Since $\Pr(\mathcal B) = \Pr(X \in B),$ the statement in the question is a restatement of $(4)$ using $(5).$
|
How to prove that $\frac{\int_{\{X\in B\}} P(A|X)(\omega)dP(\omega)}{P(X\in B)}=P(A\mid X\in B)$?
|
The answer is a one-liner, but that's disingenuous because (as you can see) it's going to take me some time to get to it!
Before setting out, let's establish a general yet accurate way to visualize wh
|
How to prove that $\frac{\int_{\{X\in B\}} P(A|X)(\omega)dP(\omega)}{P(X\in B)}=P(A\mid X\in B)$?
The answer is a one-liner, but that's disingenuous because (as you can see) it's going to take me some time to get to it!
Before setting out, let's establish a general yet accurate way to visualize what's going on.
Seeing things
This figure schematically draws $\Omega$ as the interior of a rectangle.
When $X:\Omega\to \mathbb R$ is any function, it has a "contour map" of level sets of the form $X^{-1}(b)$ for any contour level $b\in\mathbb R.$ Clearly, no distinct level sets may intersect and so they partition (a set-theoretic term), "dissect" (a statistical term), or "foliate" (a topological term) $\Omega.$ For our purposes the geometrical details of this dissection won't matter, so I have felt free to sketch each of the level curves as a vertical line segment, even though they needn't have the same shapes, sizes, or cardinalities.
Below, I will be discussing two kinds of events: measurable subsets of $\Omega.$ $\mathcal A$ is an arbitrary event in $\Omega.$ Because it could be anywhere, and we are free in this schematic to re-order the points within each of the vertical lines of the dissection any way we please (and separately from each other), I have drawn things so that the intersections of $\mathcal A$ with the level curves $X^{-1}(b)$ are segments originating at the bottom (dashed) axis. In this fashion we may conceive, with wide generality and accuracy, of any (single) event as being a region under some curve.
The event $\mathcal B$ bordered on the left and right by dashed lines is special because it is comprised of entire level curves. This means it is of the form $X^{-1}(B)$ where $B\subset \mathbb R$ is the set of "heights" of $X$ within $\mathcal B$ on the contour map. This helps us visualize the distinction between arbitrary events and events relative to the subalgebra generated by $X.$ The latter are all unions of level sets: collections of vertical strips.
It will do no harm to think of the probability measure $\mathbb P$ as being uniform: thus, areas in this figure represent probabilities, with the entire rectangle understood as having a unit area.
Finally, here is a sketch of the conditional expectation of the indicator function $\mathscr I_\mathcal A$ with respect to this dissection. (Recall that $\mathscr I_\mathcal A$ assigns the value $1$ to all points in $\mathcal A$ and the value $0$ to all other points.)
The horizontal line labeled with the conditional expectation $E[\mathscr I_\mathcal A\mid X\in B]$ is drawn at the average height of $A$ within $\mathcal B.$ As we are taught in Calculus (for real functions), that average is the integral of the height divided by the width of the strip representing $\mathcal B.$ That is, we have replaced the area of an arbitrary shape $\mathcal A \cap \mathcal B$ by a rectangle of the same area, spanning the same width as $\mathcal B$ in the horizontal direction.
This height equals the probability of $\mathcal A$ conditional on $\mathcal B.$
If you have managed to follow my descriptions, this is obvious in the picture, for if you were to throw darts randomly (and uniformly) at it, the (limiting) fraction of darts landing within $\mathcal B$ that are also in $\mathcal A$ is the same as the (limiting) fraction landing within $\mathcal B$ at heights between $0$ and $E[\mathscr I_\mathcal A\mid \mathscr B].$
Let's do this again in algebraic notation. As is common in such measure-theoretic situations, this result is a matter of notation and definitions, so let's begin with these simple preliminaries.
Conditioning on a sigma-algebra
When $\mathfrak G\subset \mathfrak F$ is a subalgebra of the probability space $(\Omega,\mathfrak F, \mathbb P),$ a conditional expectation $E$ for any integrable $\mathfrak F$-measurable random variable $Y$ is its "projection" $E[Y\mid\mathfrak G]$ onto some $\mathfrak G$-measurable random variable $E[Y\mid \mathfrak G]$ for which
$$\int_{\mathscr B} Y\mathrm d \mathbb P = \int_{\mathscr B} E[Y\mid\mathfrak G]\mathrm d \mathbb P\tag{1}$$
for any $\mathfrak G$-measurable event $\mathscr B.$
Applying $(1)$ to $Y = \mathscr I_\mathcal A,$ the indicator of some $\mathfrak F$-measurable event $\mathcal A,$ gives
$$\Pr(\mathcal A \cap \mathcal B) = \int_{\mathcal A \cap \mathcal B} \mathrm{d}\mathbb P = \int_{\mathcal B} \mathscr I_{\mathcal A}\mathrm\, d \mathbb P = \int_{\mathcal B}E[\mathscr I_{\mathcal A}\mid \mathfrak G]\mathrm d \mathbb P.\tag{2}$$
Conditioning on an event
When $\Pr(\mathcal B)\ne 0,$ according to the definition of conditioning on a single event $\mathcal B$,
$$\Pr(\mathcal A\mid \mathcal B) = \frac{\Pr(\mathcal A \cap \mathcal B)}{\Pr(\mathcal B)}.
\tag{3}$$
Substituting the conditional expectation expression $(2)$ for $\Pr(\mathcal A \cap \mathcal B)$ into $(3)$ yields
$$\Pr(\mathcal A \mid \mathcal B) = \frac{1}{\Pr(\mathcal B)} \int_{\mathcal B}E[\mathscr I_{\mathcal A}\mid \mathfrak G]\mathrm d \mathbb P.\tag{4}$$
Measure-theoretic definition of conditional probability
Apply the preceding remarks to the case where $X$ is a $\mathfrak F$-measurable random variable, $B$ is a real Borel set, $\mathcal B = X^{-1}(B),$ and $\mathfrak G$ is the sigma-algebra generated by $X.$ The conditional probability is defined in terms of expectations as
$$\Pr(\mathcal A \mid X \in B) = \int_{X^{-1}(B)} E[\mathscr I_{\mathcal A}\mid \mathfrak G]\mathrm d \mathbb P = \int_{X^{-1}(B)} \Pr(\mathcal A \mid X)\mathrm d \mathbb P.\tag{5}$$
Answer to the question
Since $\Pr(\mathcal B) = \Pr(X \in B),$ the statement in the question is a restatement of $(4)$ using $(5).$
|
How to prove that $\frac{\int_{\{X\in B\}} P(A|X)(\omega)dP(\omega)}{P(X\in B)}=P(A\mid X\in B)$?
The answer is a one-liner, but that's disingenuous because (as you can see) it's going to take me some time to get to it!
Before setting out, let's establish a general yet accurate way to visualize wh
|
48,267
|
When are cluster robust standard errors a valid "alternative" to mixed models?
|
The answer from @Eoin gets to the heart of the matter. One models marginal, population-level values while the other models conditional, subject-level values.
Here are a few additional suggestions, drawing from the McNeish et al. paper recommended by @Noah in a comment, "On the unnecessary ubiquity of hierarchical linear modeling," Psychological Methods 22: 114–140 (2017), and Chapter 7 of Frank Harrell's course notes and book, on modeling longitudinal responses.
First, your concern about a highly influential point leading to bias is an issue in all regression. If some unmodeled characteristic leads to an individual with "particularly high values of the response variable (Y) for a given predictor" in standard linear regression with equal numbers of observations per individual, you have a similar problem.
The fundamental assumption is that the regression model is capturing the associations of predictors with outcome, plus an error term to be estimated from the model in least squares or set by the family in a generalized linear model. If that assumption isn't met, then an individual with an unmodeled extra association with outcome could lead to undue influence on the coefficient estimates. Whether that ends up being more or less of an issue with multiple measurements per subject has to do with the relative number of observations associated with the subject. Checking influence is important, regardless.
Second, a hierarchical model doesn't necessarily avoid that problem. Remember that a strength of multi-level modeling is its partial pooling of observations among cases to obtain its estimates--cases with more observations contribute more to the model. If the high response value Y of an individual is due to an individually high slope with respect to predictor X but you only model random intercepts, you have much the same problem.
Third, a working independence model followed by robust standard errors isn't the only way to deal with repeated measures outside of a mixed linear regression model. Generalized least squares, unlike a working independence model, can provide best linear unbiased estimates with correlated observations, provided that you specify the correct correlation structure. The coefficient estimates will in general differ from those under a working independence assumption. Harrell discusses this in his chapters on longitudinal modeling and includes a helpful summary table of strengths and weaknesses of different approaches.
Although generalized least squares doesn't work other than with linear regression, the McNeish et al paper nicely outlines the approach of generalized estimating equation (GEE) models, which can start with several choices of initial correlation structure and iteratively account for correlations in the broader context of generalized linear models.
So there are several valid approaches, beyond mixed models or working independence followed by robust standard errors, for dealing with multiple measurements per subject. They are appropriate choices when the primary focus is on marginal, population-average effects and there isn't a multi-level hierarchy.
|
When are cluster robust standard errors a valid "alternative" to mixed models?
|
The answer from @Eoin gets to the heart of the matter. One models marginal, population-level values while the other models conditional, subject-level values.
Here are a few additional suggestions, dra
|
When are cluster robust standard errors a valid "alternative" to mixed models?
The answer from @Eoin gets to the heart of the matter. One models marginal, population-level values while the other models conditional, subject-level values.
Here are a few additional suggestions, drawing from the McNeish et al. paper recommended by @Noah in a comment, "On the unnecessary ubiquity of hierarchical linear modeling," Psychological Methods 22: 114–140 (2017), and Chapter 7 of Frank Harrell's course notes and book, on modeling longitudinal responses.
First, your concern about a highly influential point leading to bias is an issue in all regression. If some unmodeled characteristic leads to an individual with "particularly high values of the response variable (Y) for a given predictor" in standard linear regression with equal numbers of observations per individual, you have a similar problem.
The fundamental assumption is that the regression model is capturing the associations of predictors with outcome, plus an error term to be estimated from the model in least squares or set by the family in a generalized linear model. If that assumption isn't met, then an individual with an unmodeled extra association with outcome could lead to undue influence on the coefficient estimates. Whether that ends up being more or less of an issue with multiple measurements per subject has to do with the relative number of observations associated with the subject. Checking influence is important, regardless.
Second, a hierarchical model doesn't necessarily avoid that problem. Remember that a strength of multi-level modeling is its partial pooling of observations among cases to obtain its estimates--cases with more observations contribute more to the model. If the high response value Y of an individual is due to an individually high slope with respect to predictor X but you only model random intercepts, you have much the same problem.
Third, a working independence model followed by robust standard errors isn't the only way to deal with repeated measures outside of a mixed linear regression model. Generalized least squares, unlike a working independence model, can provide best linear unbiased estimates with correlated observations, provided that you specify the correct correlation structure. The coefficient estimates will in general differ from those under a working independence assumption. Harrell discusses this in his chapters on longitudinal modeling and includes a helpful summary table of strengths and weaknesses of different approaches.
Although generalized least squares doesn't work other than with linear regression, the McNeish et al paper nicely outlines the approach of generalized estimating equation (GEE) models, which can start with several choices of initial correlation structure and iteratively account for correlations in the broader context of generalized linear models.
So there are several valid approaches, beyond mixed models or working independence followed by robust standard errors, for dealing with multiple measurements per subject. They are appropriate choices when the primary focus is on marginal, population-average effects and there isn't a multi-level hierarchy.
|
When are cluster robust standard errors a valid "alternative" to mixed models?
The answer from @Eoin gets to the heart of the matter. One models marginal, population-level values while the other models conditional, subject-level values.
Here are a few additional suggestions, dra
|
48,268
|
When are cluster robust standard errors a valid "alternative" to mixed models?
|
Good question!
I think the short answer is that the working independence linear model and the random effects model by design estimate different quantities, and in your example these quantities are not the same. In the simplest example...
m = lm(y ~ 1, data = data)
mixed_m = lmer(y ~ 1 + (1|id), data = data)
$$
\begin{align}
\text{m: }&y \sim Normal(\mu_y, \sigma_y); \\
\text{mixed_m: }&y_s \sim Normal(\mu_s, \sigma) \\
&\mu_s \sim Normal(\mu_p, \sigma_p);
\end{align}
$$
(s for subject, p for population)
...the simple linear model m estimates the average across all observations ($\mu_y$), while the mixed model mixed_m estimates the average of each of the subject-level averages ($\mu_p$). As you say, these aren't necessarily the same thing, but that's doesn't mean one model is "biased", it's just being used to answer the wrong question.
|
When are cluster robust standard errors a valid "alternative" to mixed models?
|
Good question!
I think the short answer is that the working independence linear model and the random effects model by design estimate different quantities, and in your example these quantities are not
|
When are cluster robust standard errors a valid "alternative" to mixed models?
Good question!
I think the short answer is that the working independence linear model and the random effects model by design estimate different quantities, and in your example these quantities are not the same. In the simplest example...
m = lm(y ~ 1, data = data)
mixed_m = lmer(y ~ 1 + (1|id), data = data)
$$
\begin{align}
\text{m: }&y \sim Normal(\mu_y, \sigma_y); \\
\text{mixed_m: }&y_s \sim Normal(\mu_s, \sigma) \\
&\mu_s \sim Normal(\mu_p, \sigma_p);
\end{align}
$$
(s for subject, p for population)
...the simple linear model m estimates the average across all observations ($\mu_y$), while the mixed model mixed_m estimates the average of each of the subject-level averages ($\mu_p$). As you say, these aren't necessarily the same thing, but that's doesn't mean one model is "biased", it's just being used to answer the wrong question.
|
When are cluster robust standard errors a valid "alternative" to mixed models?
Good question!
I think the short answer is that the working independence linear model and the random effects model by design estimate different quantities, and in your example these quantities are not
|
48,269
|
Expected Fisher information isn't positive definite for truncated normal with heteroskedasticity
|
The expected Fisher information is positive-definite by definition, so there must be some mistake in your code.
Here is exactly the same calculation using MATLAB's symbolic math toolbox, which produces a positive-definite matrix with the same inputs:
(it's enough to check the case $k=1$, since a sum of positive definite matrices is also positive definite)
syms mu tau sigma_i Y
z = 1.96 ;
c_i = (z*sigma_i - mu)/sqrt(sigma_i^2 + tau^2) ;
r = normpdf(c_i) / normcdf(c_i) ;
%the likelihood
logl = -log(sigma_i^2 + tau^2)/2 - (Y - mu)^2/(sigma_i^2 + tau^2)/2 - log( normcdf( c_i ) );
%Fisher matrix from second derivatives
I = -[diff(logl,'mu',2) , diff(logl,'mu','tau') ;
diff(logl,'mu','tau') , diff(logl,'tau',2)] ;
%subsitute Y and (Y-mu)^2 with their expectations
I(2,2) = subs( I(2,2), (Y-mu)^2 , (tau^2 + sigma_i^2)*(1 - c_i*r) ) ; %I(2,2) has only quadratic term
I(1,2) = subs( I(1,2) , Y , mu - r*sqrt(tau^2 +sigma_i^2) ) ; %I(1,2) has only linear term
I(2,1) = I(1,2) ;
%evaluate at some values
>> eval( subs(I , {'mu','tau','sigma_i'} , [0.5,0.3,0.3] ))
ans =
2.2836 -3.1146
-3.1146 5.0987
>> eig(ans)
ans =
0.2733
7.1091
|
Expected Fisher information isn't positive definite for truncated normal with heteroskedasticity
|
The expected Fisher information is positive-definite by definition, so there must be some mistake in your code.
Here is exactly the same calculation using MATLAB's symbolic math toolbox, which produce
|
Expected Fisher information isn't positive definite for truncated normal with heteroskedasticity
The expected Fisher information is positive-definite by definition, so there must be some mistake in your code.
Here is exactly the same calculation using MATLAB's symbolic math toolbox, which produces a positive-definite matrix with the same inputs:
(it's enough to check the case $k=1$, since a sum of positive definite matrices is also positive definite)
syms mu tau sigma_i Y
z = 1.96 ;
c_i = (z*sigma_i - mu)/sqrt(sigma_i^2 + tau^2) ;
r = normpdf(c_i) / normcdf(c_i) ;
%the likelihood
logl = -log(sigma_i^2 + tau^2)/2 - (Y - mu)^2/(sigma_i^2 + tau^2)/2 - log( normcdf( c_i ) );
%Fisher matrix from second derivatives
I = -[diff(logl,'mu',2) , diff(logl,'mu','tau') ;
diff(logl,'mu','tau') , diff(logl,'tau',2)] ;
%subsitute Y and (Y-mu)^2 with their expectations
I(2,2) = subs( I(2,2), (Y-mu)^2 , (tau^2 + sigma_i^2)*(1 - c_i*r) ) ; %I(2,2) has only quadratic term
I(1,2) = subs( I(1,2) , Y , mu - r*sqrt(tau^2 +sigma_i^2) ) ; %I(1,2) has only linear term
I(2,1) = I(1,2) ;
%evaluate at some values
>> eval( subs(I , {'mu','tau','sigma_i'} , [0.5,0.3,0.3] ))
ans =
2.2836 -3.1146
-3.1146 5.0987
>> eig(ans)
ans =
0.2733
7.1091
|
Expected Fisher information isn't positive definite for truncated normal with heteroskedasticity
The expected Fisher information is positive-definite by definition, so there must be some mistake in your code.
Here is exactly the same calculation using MATLAB's symbolic math toolbox, which produce
|
48,270
|
3-D random walk: average distance after N steps
|
Let's solve this in all dimensions $d=1,2,3,\ldots.$
The (vector) increments of the walk are $\mathbf{X}_i = (x_{1i}, x_{2i}, \ldots, x_{di}).$ After $n$ such independent steps the walk has reached the point $\mathbf{S}_n = \mathbf{X}_1 + \mathbf{X}_2 + \cdots + \mathbf{X}_n$ with corresponding components $s_{1n}, \ldots, s_{dn}.$ The question asks for the expectation of $|\mathbf{S}_n| = \sqrt{s_{1n}^2 + \cdots + s_{dn}^2}$ for large $n.$
Because the $\mathbf{X}_i$ are uniformly distributed on the unit sphere,
Their components are identically distributed. (Thus, in particular, they have identical means, variances, and covariances. Details are given at https://stats.stackexchange.com/a/85977/919, but this additional information is not necessary for the following analysis.)
Their means are all zero (since the spherical symmetry implies the means equal their own negatives and the boundedness of the vectors implies the means exist and are finite.)
The variances of each $x_{ki}$ are all $1/d,$ because for any fixed $i,$ the sum of the variances of the $x_{ki}$ is the expectation of the sum of their squares, which is constantly $x_{1i}^2 + \cdots + x_{di}^2 = 1.$
Their covariances are all zero. This is a bit of a surprise, because the sum-to-square restriction implies the components of any $\mathbf{X}_i$ are not independent. Nevertheless, the spherical symmetry of the distribution of $\mathbf{X}_i$ implies the distribution of $y_i=(x_{1i} + x_{2i} + \cdots + x_{di})/\sqrt{d}$ is identical to that of any of the components, whence
$$\frac{1}{d} = \operatorname{Var}\left(y_i\right) = \frac{1}{d}\sum_{j,k=1}^d E\left[x_{ji}x_{ki}\right] = \frac{1}{d}\left(d\operatorname{Var}(x_{1i}) + d(d-1)\operatorname{Cov}(x_{1i}, x_{2i})\right).$$
Upon plugging in $1/d$ for the variance term on the right, we see the last term $d(d-1)\operatorname{Cov}(x_{1i},x_{2i})$ must be zero. Since either there is no covariance (for $d=1$) or else $d\gt 1,$ the covariance is zero, QED.
Because the increments are independent, the multivariate Central Limit Theorem (CLT) tells us the distribution of $\mathbf{S}_n$ is approximately multivariate Normal. The approximating Normal distribution's parameters are determined by the means and variances of the $\mathbf{X}_i:$ it will have zero mean, variances of $n/d,$ and zero covariances. Ergo,
the variables $(d/n)s_{kn}^2$ must be distributed approximately like squares of standard Normal variates and (therefore) their sum $(d/n)|\mathbf{S}_n|^2$ must be distributed approximately like the sum of squares of $d$ uncorrelated (whence independent) standard Normal variates.
By definition, a sum of independent standard Normal variables has a chi-squared distribution with $d$ degrees of freedom. Also by definition, its square root has a chi distribution with $d$ d.f. Its expectation is
$$ E\left[|\mathbf{S}_n|\right] = \sqrt{\frac{n}{d}}E\left[\sqrt{(d/n)s_{1n}^2 + (d/n)s_{2n}^2 + \cdots + (d/n)s_{dn}^2}\right] = \frac{\sqrt{2n}\,\Gamma((d+1)/2)}{\sqrt{d}\,\Gamma(d/2)}.$$
As a special case, when $d=2$ the right hand side is
$$\frac{\sqrt{2n}\,\Gamma((2+1)/2)}{\sqrt{2}\,\Gamma(2/2)} = \frac{\sqrt{n\pi}}{2},$$
exactly as noted in a comment to the question. When $d=3$ (the case of the question), the right hand side is
$$\frac{\sqrt{2n}\,\Gamma((3+1)/2)}{\sqrt{3}\,\Gamma(3/2)} = \frac{2\sqrt{2n}}{\sqrt{3\pi}}.$$
To illustrate the general formula, here is a plot of $\sqrt{2n}\,\Gamma((d+1)/2) / (\sqrt{d}\,\Gamma(d/2))$ for $d=3$ (in red) along with the means of 1,000,000 simulated random walks at times $1$ through $n=30.$ They look to be in good agreement, especially for $n\gt 1.$ The differences between the means and this formula approach zero at a rate of $O(n^{-1/2})$ (plotted in blue) or better, as predicted by the CLT.
|
3-D random walk: average distance after N steps
|
Let's solve this in all dimensions $d=1,2,3,\ldots.$
The (vector) increments of the walk are $\mathbf{X}_i = (x_{1i}, x_{2i}, \ldots, x_{di}).$ After $n$ such independent steps the walk has reached t
|
3-D random walk: average distance after N steps
Let's solve this in all dimensions $d=1,2,3,\ldots.$
The (vector) increments of the walk are $\mathbf{X}_i = (x_{1i}, x_{2i}, \ldots, x_{di}).$ After $n$ such independent steps the walk has reached the point $\mathbf{S}_n = \mathbf{X}_1 + \mathbf{X}_2 + \cdots + \mathbf{X}_n$ with corresponding components $s_{1n}, \ldots, s_{dn}.$ The question asks for the expectation of $|\mathbf{S}_n| = \sqrt{s_{1n}^2 + \cdots + s_{dn}^2}$ for large $n.$
Because the $\mathbf{X}_i$ are uniformly distributed on the unit sphere,
Their components are identically distributed. (Thus, in particular, they have identical means, variances, and covariances. Details are given at https://stats.stackexchange.com/a/85977/919, but this additional information is not necessary for the following analysis.)
Their means are all zero (since the spherical symmetry implies the means equal their own negatives and the boundedness of the vectors implies the means exist and are finite.)
The variances of each $x_{ki}$ are all $1/d,$ because for any fixed $i,$ the sum of the variances of the $x_{ki}$ is the expectation of the sum of their squares, which is constantly $x_{1i}^2 + \cdots + x_{di}^2 = 1.$
Their covariances are all zero. This is a bit of a surprise, because the sum-to-square restriction implies the components of any $\mathbf{X}_i$ are not independent. Nevertheless, the spherical symmetry of the distribution of $\mathbf{X}_i$ implies the distribution of $y_i=(x_{1i} + x_{2i} + \cdots + x_{di})/\sqrt{d}$ is identical to that of any of the components, whence
$$\frac{1}{d} = \operatorname{Var}\left(y_i\right) = \frac{1}{d}\sum_{j,k=1}^d E\left[x_{ji}x_{ki}\right] = \frac{1}{d}\left(d\operatorname{Var}(x_{1i}) + d(d-1)\operatorname{Cov}(x_{1i}, x_{2i})\right).$$
Upon plugging in $1/d$ for the variance term on the right, we see the last term $d(d-1)\operatorname{Cov}(x_{1i},x_{2i})$ must be zero. Since either there is no covariance (for $d=1$) or else $d\gt 1,$ the covariance is zero, QED.
Because the increments are independent, the multivariate Central Limit Theorem (CLT) tells us the distribution of $\mathbf{S}_n$ is approximately multivariate Normal. The approximating Normal distribution's parameters are determined by the means and variances of the $\mathbf{X}_i:$ it will have zero mean, variances of $n/d,$ and zero covariances. Ergo,
the variables $(d/n)s_{kn}^2$ must be distributed approximately like squares of standard Normal variates and (therefore) their sum $(d/n)|\mathbf{S}_n|^2$ must be distributed approximately like the sum of squares of $d$ uncorrelated (whence independent) standard Normal variates.
By definition, a sum of independent standard Normal variables has a chi-squared distribution with $d$ degrees of freedom. Also by definition, its square root has a chi distribution with $d$ d.f. Its expectation is
$$ E\left[|\mathbf{S}_n|\right] = \sqrt{\frac{n}{d}}E\left[\sqrt{(d/n)s_{1n}^2 + (d/n)s_{2n}^2 + \cdots + (d/n)s_{dn}^2}\right] = \frac{\sqrt{2n}\,\Gamma((d+1)/2)}{\sqrt{d}\,\Gamma(d/2)}.$$
As a special case, when $d=2$ the right hand side is
$$\frac{\sqrt{2n}\,\Gamma((2+1)/2)}{\sqrt{2}\,\Gamma(2/2)} = \frac{\sqrt{n\pi}}{2},$$
exactly as noted in a comment to the question. When $d=3$ (the case of the question), the right hand side is
$$\frac{\sqrt{2n}\,\Gamma((3+1)/2)}{\sqrt{3}\,\Gamma(3/2)} = \frac{2\sqrt{2n}}{\sqrt{3\pi}}.$$
To illustrate the general formula, here is a plot of $\sqrt{2n}\,\Gamma((d+1)/2) / (\sqrt{d}\,\Gamma(d/2))$ for $d=3$ (in red) along with the means of 1,000,000 simulated random walks at times $1$ through $n=30.$ They look to be in good agreement, especially for $n\gt 1.$ The differences between the means and this formula approach zero at a rate of $O(n^{-1/2})$ (plotted in blue) or better, as predicted by the CLT.
|
3-D random walk: average distance after N steps
Let's solve this in all dimensions $d=1,2,3,\ldots.$
The (vector) increments of the walk are $\mathbf{X}_i = (x_{1i}, x_{2i}, \ldots, x_{di}).$ After $n$ such independent steps the walk has reached t
|
48,271
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
|
This problem is more challenging than it might look, for many reasons--some of which will become apparent in discussing one set of solutions. I was moved to post this discussion because of the emergence of several surprising results, illustrated at the end.
In the interests of space, I will focus on presenting one solution and describing its important statistical properties. I offer it partly as an object lesson in the pitfalls lurking for the unwary (who might otherwise be tempted to apply some "standard" statistical procedure to this problem). The approach it describes does look promising as a way of addressing the problem if you are suitably careful.
Readers in a hurry might want to skip to the illustrated example that makes up the second half of this post.
The question essentially asks for a way to (1) match the observations to a "salience" distribution and (2) assess how well those observations fit the distribution. The matching must account for the possibility that the origin of the observations (its "tonic," or basic tone) is unknown. The example in the question also makes it clear the observations are not discrete: singing a given tone of a scale can be expected to result in various frequencies. (This can result from poor singing; but even with excellent singing it is to be anticipated because the frequency chosen to render a given note can, and ought, to vary with the musical meaning--context--of the note. For instance, "B" is nominally the leading tone of the scale and often will be sung rather sharp when preceding the tonic note, but flatter otherwise.)
One approach is to consider how much the notes, as recorded, would need to be transposed to place them into a standard scale. To this end let the frequencies of the notes be $x_i,$ each sustained for duration $y_i.$ Because frequencies modulo an octave are considered the same tone of the scale, we must begin by
Expressing the frequencies on a binary logarithmic scale and
Focusing on their fractional values: that is, reducing them modulo $1.$
When $(2)$ is performed, the durations of all frequencies with the same fractional log values must be summed to yield the total duration of that fraction.
A "scale" of length $s$ can be represented as a sequence of breaks $(b_0=0, b_1, b_2, \ldots, b_s, b_{s+1}=1)$ that partition the interval $[0,1)$ of all fractional logarithms. Any frequency whose fractional log lies in the interval $[b_i, b_{i+1})$ is assigned to note $i$ of the scale, $i=1,2,\ldots, s.$ The "well-tempered" scale (invented in the late 17th century) places $s=12$ breaks at exactly even intervals $b_i=i/12.$ I use this in the examples below.
The task of transposition, then, consists of adding some quantity $h$ to all the $\log_2(x_i)$ and assigning the result to a note of the scale. For an well-tempered scale, for instance, transposition of a frequency by $h$ can be represented by the mathematical formula
$$\operatorname{Note}(x\mid h) = \lfloor 12(\log_2(x) + h \mod 1) \rfloor + 1.$$
(Amounts like $h$ are traditionally measured in cents where one cent equals $1/1200.$ That is, there are $100$ cents in each of $12$ "semitones" comprising the chromatic well-tempered octave. Absent any harmonic background for reference, untrained humans usually do not detect errors smaller than about $10$ cents.)
Once we have transposed the data by some amount $h,$ $0\le h\lt 1,$ thereby (provisionally) assigning each recorded frequency a note of the scale, we (of course) sum the frequencies to obtain the proportions of time each note was sung. This is what we can hope to match to the reference "salience" distribution.
Although a chi-squared test is not appropriate for this purpose, a chi-squared-like statistic is a natural way to compare two note distributions. Specifically, let the reference scale assign a proportion of time $p_i$ to each note and suppose the data give corresponding proportions $q_i.$ The chi-squared statistic for the data (as transposed by $h$) is
$$\chi^2(h) = \sum_{i=1}^s \frac{(q_i-p_i)^2}{p_i}.$$
The numerator measures difference in proportions while the denominator weights that difference according to its expected variance. There are three strong reasons to expect $\chi^2(h)$ will not have a chi-squared distribution:
We are going to pick $h$ to achieve the best match to the reference distribution. By construction, this tends to decrease the value of $\chi^2(h),$ especially for small datasets or "noisy" data.
The data are not counts and the $p_i$ are not necessarily their variances. One (at least) of these is an essential precondition for any classical chi-squared test.
The data are not an independent sample from a distribution of notes. (Songs are not chaotic: they follow conventions for what differences of notes--"intervals"--are likely and pleasing.) This, too, is essential for any of the classical distribution tests (including all those mentioned in the question).
Nevertheless, the statistic itself is one of the better ways to compare two discrete distributions.
I propose transposing the data by an amount $h$ that creates the best possible match with the reference distribution.
After all, what else can one do?
Finally, we need to know the null distribution of this chi-squared statistic: what value is it likely to have for a given dataset if that dataset is generated according to the reference distribution? A full, correct answer to this question requires the ability to generate random plausible-sounding songs. We don't have the information to do that. What we can do is draw independent samples of a given size from the reference distribution, go through the process of transposition and note assignment for each such sample, and track the chi-squared statistic it generates. Doing this a few hundred times will give us a good sense of what such randomly-generated data look like. We can use this to assess the chi-squared statistic for the actual data. If this is unusually large, we may conclude the data were not generated in the way we supposed. In particular, that would constitute evidence against the supposition that the salience distribution was involved.
Let's look at some examples.
Here is a summary of $80$ frequencies (each of unit duration, for simplicity) generated using the reference distribution in the key of A (where the tonic is at 440 Hz).
These notes were sung to an accuracy of $\pm 15$ cents each. You can make out all $12$ notes as clusters in the histogram. When optimally transposed, these frequencies match the reference distribution (as I have transcribed it from the bar plot in the question, at least) pretty well:
C C# D D# E F F# G G# A A# B
Reference 12.4 4.1 6.9 4.2 8.3 7.9 4.5 10.2 4.3 7.1 4.2 5.7
Fit 9.0 4.0 7.0 4.0 10.0 13.0 4.0 11.0 6.0 5.0 4.0 3.0
For instance, we would expect about $12.4$ notes in the tonic (C) and heard $9$ in of them, and so on. The chi-squared statistic for this comparison is $7.3.$ But is that close or not?
To find out, I repeated this process a thousand more times. Here is a summary of all thousand random results.
The originally observed value of $7.3$ falls smack in the center, indicating it is perfectly consistent with this "null distribution."
In contrast to this, I generated $80$ notes uniformly between $120$ and $180$ Hz (spanning B to F#, roughly). This time the chi-squared statistic was $53:$ literally off the chart and obviously inconsistent with the reference. No surprise: this dataset had no chance of including the upper half of the scale (G# through B).
Now for some of the surprises. Many people might expect such reference distributions to behave like a chi-squared distribution. On the preceding histogram I have superimposed graphs of five chi-squared distributions having $11=12-1$ degrees of freedom (dark blue) down to $7$ DF.
None of the colored graphs are great descriptions of the null distribution. The ones that come closest have only $7$ (red) and $8$ (yellow) DF. Few people would expect these values for the DF when comparing distributions with $12$ categories--no theory suggests they should have these specific values.
(For comparison, the same five graphs appear on all the later histograms.)
The next surprise is that the null distribution depends heavily on even small errors in tonal generation. Here are the results of exactly the same simulation, but this time with no errors.
This time the chi-squared distribution with $11$ DF is a beautiful fit. Thus, the presence of just $\pm 15$ cents error in intonation substantially changed the null distribution.
The third surprise (maybe it's not so much of a surprise) is that short, totally-random "songs" are difficult to distinguish from the reference. This is a repeat of the first simulation, but this time frequencies were generated uniformly between $120$ and $240$ Hz. (The "salience" distribution, when plotted, would have 12 bars of equal heights.)
The original distribution has been shifted right (towards higher chi-squared values), as one might hope, but it exhibits substantial overlap with the null distribution. Why is there not much shifting? The reason is that uniformly random data are usually not exactly uniform: they have some higher and lower frequencies. It is all to easy to take such a dataset and find a way to transpose it so that it still closely matches the reference distribution. If we want a chance of distinguishing the uniform "songs" from the reference songs, we need more data.
Here is what the null and alternative distributions look like with $n=320$ frequencies in the dataset (again, sung with up to 15 cents error).
First, notice that the null distribution itself has shifted a little relative to the null for $n=80.$ Yet the shift isn't huge: it is approximated by a chi-squared distribution with $8$ DF instead of $7.$ But the alternative distribution is now far to the right, clearly beyond the tails of any of these chi-squared plots. This means that with a song of total duration $320,$ we can almost surely distinguish between the reference distribution and a uniform alternative distribution.
These surprises give abundant reasons for caution. Do your best to generate a realistic null distribution, preferably according to how you think the song might have been sung, and consider using this transpose/note assignment/chi-squared approach to assess how close your data come to that null.
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
|
This problem is more challenging than it might look, for many reasons--some of which will become apparent in discussing one set of solutions. I was moved to post this discussion because of the emerge
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
This problem is more challenging than it might look, for many reasons--some of which will become apparent in discussing one set of solutions. I was moved to post this discussion because of the emergence of several surprising results, illustrated at the end.
In the interests of space, I will focus on presenting one solution and describing its important statistical properties. I offer it partly as an object lesson in the pitfalls lurking for the unwary (who might otherwise be tempted to apply some "standard" statistical procedure to this problem). The approach it describes does look promising as a way of addressing the problem if you are suitably careful.
Readers in a hurry might want to skip to the illustrated example that makes up the second half of this post.
The question essentially asks for a way to (1) match the observations to a "salience" distribution and (2) assess how well those observations fit the distribution. The matching must account for the possibility that the origin of the observations (its "tonic," or basic tone) is unknown. The example in the question also makes it clear the observations are not discrete: singing a given tone of a scale can be expected to result in various frequencies. (This can result from poor singing; but even with excellent singing it is to be anticipated because the frequency chosen to render a given note can, and ought, to vary with the musical meaning--context--of the note. For instance, "B" is nominally the leading tone of the scale and often will be sung rather sharp when preceding the tonic note, but flatter otherwise.)
One approach is to consider how much the notes, as recorded, would need to be transposed to place them into a standard scale. To this end let the frequencies of the notes be $x_i,$ each sustained for duration $y_i.$ Because frequencies modulo an octave are considered the same tone of the scale, we must begin by
Expressing the frequencies on a binary logarithmic scale and
Focusing on their fractional values: that is, reducing them modulo $1.$
When $(2)$ is performed, the durations of all frequencies with the same fractional log values must be summed to yield the total duration of that fraction.
A "scale" of length $s$ can be represented as a sequence of breaks $(b_0=0, b_1, b_2, \ldots, b_s, b_{s+1}=1)$ that partition the interval $[0,1)$ of all fractional logarithms. Any frequency whose fractional log lies in the interval $[b_i, b_{i+1})$ is assigned to note $i$ of the scale, $i=1,2,\ldots, s.$ The "well-tempered" scale (invented in the late 17th century) places $s=12$ breaks at exactly even intervals $b_i=i/12.$ I use this in the examples below.
The task of transposition, then, consists of adding some quantity $h$ to all the $\log_2(x_i)$ and assigning the result to a note of the scale. For an well-tempered scale, for instance, transposition of a frequency by $h$ can be represented by the mathematical formula
$$\operatorname{Note}(x\mid h) = \lfloor 12(\log_2(x) + h \mod 1) \rfloor + 1.$$
(Amounts like $h$ are traditionally measured in cents where one cent equals $1/1200.$ That is, there are $100$ cents in each of $12$ "semitones" comprising the chromatic well-tempered octave. Absent any harmonic background for reference, untrained humans usually do not detect errors smaller than about $10$ cents.)
Once we have transposed the data by some amount $h,$ $0\le h\lt 1,$ thereby (provisionally) assigning each recorded frequency a note of the scale, we (of course) sum the frequencies to obtain the proportions of time each note was sung. This is what we can hope to match to the reference "salience" distribution.
Although a chi-squared test is not appropriate for this purpose, a chi-squared-like statistic is a natural way to compare two note distributions. Specifically, let the reference scale assign a proportion of time $p_i$ to each note and suppose the data give corresponding proportions $q_i.$ The chi-squared statistic for the data (as transposed by $h$) is
$$\chi^2(h) = \sum_{i=1}^s \frac{(q_i-p_i)^2}{p_i}.$$
The numerator measures difference in proportions while the denominator weights that difference according to its expected variance. There are three strong reasons to expect $\chi^2(h)$ will not have a chi-squared distribution:
We are going to pick $h$ to achieve the best match to the reference distribution. By construction, this tends to decrease the value of $\chi^2(h),$ especially for small datasets or "noisy" data.
The data are not counts and the $p_i$ are not necessarily their variances. One (at least) of these is an essential precondition for any classical chi-squared test.
The data are not an independent sample from a distribution of notes. (Songs are not chaotic: they follow conventions for what differences of notes--"intervals"--are likely and pleasing.) This, too, is essential for any of the classical distribution tests (including all those mentioned in the question).
Nevertheless, the statistic itself is one of the better ways to compare two discrete distributions.
I propose transposing the data by an amount $h$ that creates the best possible match with the reference distribution.
After all, what else can one do?
Finally, we need to know the null distribution of this chi-squared statistic: what value is it likely to have for a given dataset if that dataset is generated according to the reference distribution? A full, correct answer to this question requires the ability to generate random plausible-sounding songs. We don't have the information to do that. What we can do is draw independent samples of a given size from the reference distribution, go through the process of transposition and note assignment for each such sample, and track the chi-squared statistic it generates. Doing this a few hundred times will give us a good sense of what such randomly-generated data look like. We can use this to assess the chi-squared statistic for the actual data. If this is unusually large, we may conclude the data were not generated in the way we supposed. In particular, that would constitute evidence against the supposition that the salience distribution was involved.
Let's look at some examples.
Here is a summary of $80$ frequencies (each of unit duration, for simplicity) generated using the reference distribution in the key of A (where the tonic is at 440 Hz).
These notes were sung to an accuracy of $\pm 15$ cents each. You can make out all $12$ notes as clusters in the histogram. When optimally transposed, these frequencies match the reference distribution (as I have transcribed it from the bar plot in the question, at least) pretty well:
C C# D D# E F F# G G# A A# B
Reference 12.4 4.1 6.9 4.2 8.3 7.9 4.5 10.2 4.3 7.1 4.2 5.7
Fit 9.0 4.0 7.0 4.0 10.0 13.0 4.0 11.0 6.0 5.0 4.0 3.0
For instance, we would expect about $12.4$ notes in the tonic (C) and heard $9$ in of them, and so on. The chi-squared statistic for this comparison is $7.3.$ But is that close or not?
To find out, I repeated this process a thousand more times. Here is a summary of all thousand random results.
The originally observed value of $7.3$ falls smack in the center, indicating it is perfectly consistent with this "null distribution."
In contrast to this, I generated $80$ notes uniformly between $120$ and $180$ Hz (spanning B to F#, roughly). This time the chi-squared statistic was $53:$ literally off the chart and obviously inconsistent with the reference. No surprise: this dataset had no chance of including the upper half of the scale (G# through B).
Now for some of the surprises. Many people might expect such reference distributions to behave like a chi-squared distribution. On the preceding histogram I have superimposed graphs of five chi-squared distributions having $11=12-1$ degrees of freedom (dark blue) down to $7$ DF.
None of the colored graphs are great descriptions of the null distribution. The ones that come closest have only $7$ (red) and $8$ (yellow) DF. Few people would expect these values for the DF when comparing distributions with $12$ categories--no theory suggests they should have these specific values.
(For comparison, the same five graphs appear on all the later histograms.)
The next surprise is that the null distribution depends heavily on even small errors in tonal generation. Here are the results of exactly the same simulation, but this time with no errors.
This time the chi-squared distribution with $11$ DF is a beautiful fit. Thus, the presence of just $\pm 15$ cents error in intonation substantially changed the null distribution.
The third surprise (maybe it's not so much of a surprise) is that short, totally-random "songs" are difficult to distinguish from the reference. This is a repeat of the first simulation, but this time frequencies were generated uniformly between $120$ and $240$ Hz. (The "salience" distribution, when plotted, would have 12 bars of equal heights.)
The original distribution has been shifted right (towards higher chi-squared values), as one might hope, but it exhibits substantial overlap with the null distribution. Why is there not much shifting? The reason is that uniformly random data are usually not exactly uniform: they have some higher and lower frequencies. It is all to easy to take such a dataset and find a way to transpose it so that it still closely matches the reference distribution. If we want a chance of distinguishing the uniform "songs" from the reference songs, we need more data.
Here is what the null and alternative distributions look like with $n=320$ frequencies in the dataset (again, sung with up to 15 cents error).
First, notice that the null distribution itself has shifted a little relative to the null for $n=80.$ Yet the shift isn't huge: it is approximated by a chi-squared distribution with $8$ DF instead of $7.$ But the alternative distribution is now far to the right, clearly beyond the tails of any of these chi-squared plots. This means that with a song of total duration $320,$ we can almost surely distinguish between the reference distribution and a uniform alternative distribution.
These surprises give abundant reasons for caution. Do your best to generate a realistic null distribution, preferably according to how you think the song might have been sung, and consider using this transpose/note assignment/chi-squared approach to assess how close your data come to that null.
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
This problem is more challenging than it might look, for many reasons--some of which will become apparent in discussing one set of solutions. I was moved to post this discussion because of the emerge
|
48,272
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
|
Since there are still no other answers to this question and several comments by @whuber highlighted flaws in using Pearson's Chi-Square test, here is a second answer that uses the Mann-Whitney U test. Before answering, I'll point out that the question itself includes 3 possible solutions that the author seemed interested in, but abandoned only for coding problems. It may be more reasonable to try to fix the coding problem instead of seeking different methods (which again may not result in data formats that work with whatever implementations you have available).
1. Convert your theoretical distribution from tones to frequencies.
2. Auto-tune your subject's singing to make sure the pitch is correct, then change the frequencies to fit into a single octave (so that it is comparable to your single octave theoretical distribution). I'm assuming here that imperfect pitch is not a part of this study, otherwise this breaks down.
3. You can subdivide into notes as I recommended in #2 of my previous answer. Alternatively, determine the number of milliseconds for each frequency in the subject's singing, then determine the total number of milliseconds.
4. Now, make a new vector to contain sung frequencies. For each frequency sung, repeatedly add that frequency to the vector however many milliseconds it was sung. For example, if 440 hz was sung for 4000 milliseconds, add 440 to the vector 4000 times.
5. Now make the same type of vector using the theoretical distribution. If the subject sang for a total of 10000 milliseconds and the theoretical distribution says that 440 hz should be 40% of the frequencies, then add 440 to the vector $10000\times 0.4=4000$ times.
6. These two vectors now contain the distributions that you'll compare. Run the Mann-Whitney U test to compare them.
7. The data is in a format that allows you to readily visualize where the differences are, if there are any.
Comments: this may not address your circular problem without using a work-around, but I can't think of anything that does address it automatically. Your question explicitly says that you're using a major-key as your theoretical distribution and one of your comments explicitly says that you're comparing the subject's singing to a diatonic scale. If you're specifically interested in comparing to a diatonic major scale, you should be able to pick out the tonal centre of the subject's singing in order to determine which theoretical distribution you need to pick for comparison (i.e. you can hear which key they're singing in).
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
|
Since there are still no other answers to this question and several comments by @whuber highlighted flaws in using Pearson's Chi-Square test, here is a second answer that uses the Mann-Whitney U test.
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
Since there are still no other answers to this question and several comments by @whuber highlighted flaws in using Pearson's Chi-Square test, here is a second answer that uses the Mann-Whitney U test. Before answering, I'll point out that the question itself includes 3 possible solutions that the author seemed interested in, but abandoned only for coding problems. It may be more reasonable to try to fix the coding problem instead of seeking different methods (which again may not result in data formats that work with whatever implementations you have available).
1. Convert your theoretical distribution from tones to frequencies.
2. Auto-tune your subject's singing to make sure the pitch is correct, then change the frequencies to fit into a single octave (so that it is comparable to your single octave theoretical distribution). I'm assuming here that imperfect pitch is not a part of this study, otherwise this breaks down.
3. You can subdivide into notes as I recommended in #2 of my previous answer. Alternatively, determine the number of milliseconds for each frequency in the subject's singing, then determine the total number of milliseconds.
4. Now, make a new vector to contain sung frequencies. For each frequency sung, repeatedly add that frequency to the vector however many milliseconds it was sung. For example, if 440 hz was sung for 4000 milliseconds, add 440 to the vector 4000 times.
5. Now make the same type of vector using the theoretical distribution. If the subject sang for a total of 10000 milliseconds and the theoretical distribution says that 440 hz should be 40% of the frequencies, then add 440 to the vector $10000\times 0.4=4000$ times.
6. These two vectors now contain the distributions that you'll compare. Run the Mann-Whitney U test to compare them.
7. The data is in a format that allows you to readily visualize where the differences are, if there are any.
Comments: this may not address your circular problem without using a work-around, but I can't think of anything that does address it automatically. Your question explicitly says that you're using a major-key as your theoretical distribution and one of your comments explicitly says that you're comparing the subject's singing to a diatonic scale. If you're specifically interested in comparing to a diatonic major scale, you should be able to pick out the tonal centre of the subject's singing in order to determine which theoretical distribution you need to pick for comparison (i.e. you can hear which key they're singing in).
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
Since there are still no other answers to this question and several comments by @whuber highlighted flaws in using Pearson's Chi-Square test, here is a second answer that uses the Mann-Whitney U test.
|
48,273
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
|
Here is what I would do in your situation. Whether it works for you depends on the format and quantity of your data, but I do think that it will yield the answer you're looking for if the data allows this method. The method is a regular Pearson's chi-squared test. The reason this choice makes sense is that music is arranged in time (it can be subdivided into countable notes rather than chaotic, arbitrary intervals of time) and you are using a 12 tone scale.
1. You have sung frequencies and the time in seconds for each frequency. You've already said that you can convert frequencies to tones. Do so. I assume you ignore octave since the picture of your theoretic distribution only contains one octave.
2. Convert your sung data from continuous time to a count of standardized notes. You say the experimental subject was singing. Even if the subject was not using a metronome, you can probably impose a loose metre and use your subject-matter expertise to transcribe the melody. Put another way, if you took a subject's melody, you could probably write it in musical notation. If you did that, you would see not continuous times, but notes of finite duration. Find the smallest meaningful subdivision (probably a 16th? Maybe a 32nd?) in your subjects' melodies and then subdivide all of their other notes into that unit and count them. From now on, I'll refer to this standardized subdivision simply as the "units." You'll count how many units for each tone was sung, and also sum the total units sung by the subject. The data format for the subject should now be 13 variables. The first 12 contain values that are the number of units of each tone sung by the subject, and the 13th variable is the total number of units they sang. The crucial point here is that you're standardizing the melodies into a unit, the chosen subdivision, then counting how many of those units were sung in each tone.
*You could keep the data in time and subdivide the seconds into counts, but notes are better. The reason is that music is inherently structured into note durations, and note durations don't need to be rounded up or down. Moreover, if you're publishing or presenting this, notes are probably more easily understood by your audience since most of them will be musically inclined. There is natural structure here. Use it if you can.
3. Now, you have a theoretical distribution of a major scale. You didn't say what the units were, but you need to convert it into a probability mass function. In other words, what proportion of notes do you expect to be the tonic? the 2nd? The major 3rd? You should be able to make this conversion relatively easily if you've already got literature on the subject and an example distribution.
4. You now have a recipe for getting your answer. You already have the observed counts in each tone and their total count from what your subject sang. To get their expected counts, take your theoretical distribution of the major scale and multiply each note probability by the total number of notes sung by the subject. E.g. if the subject sung a total of 100 notes and your theoretical distribution says that 40% of their sung notes should be a C and only 5% should be a C#, then their expected count of C should be $100\times0.4=40$ C notes and the expected count of C# should be $100\times0.05=5$.
5. Treat your data as a one-way table with 12 categories (the tones), and perform Pearson's Chi-Squared test. There are multiple other tests you could try, but this is the most well-known.
The benefits I see of using the above methods are (1) you're using the natural structure of music and musical scales, (2) visualizations (histograms or others) of expected versus observed counts will be far clearer than trying to compare a plot of times and frequencies, (3) those visualizations of expected versus observed counts make the extent and type of differences between your theoretical distribution and subject's distribution very clear in a way that other methods do not allow (you can clearly see how much they differ and by which tones they differ), and (4) you're using a well-known and simple statistical method to check the significance of the difference.
The pitfalls of using this methods are (1) your data format may make it difficult, (2) transcribing the melody may be difficult depending on the technology or skill that you possess for this purpose and how long the recording is, (3) Pearson's chi-squared test assumes independence of events, which almost certainly is not strictly fulfilled here (keep in mind the same subject is singing multiple notes--the units are not independent. Whether this matters depends on exactly what you're trying to explain here), and (4) if the singing is short, you may not have enough units to achieve reliable results.
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
|
Here is what I would do in your situation. Whether it works for you depends on the format and quantity of your data, but I do think that it will yield the answer you're looking for if the data allows
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
Here is what I would do in your situation. Whether it works for you depends on the format and quantity of your data, but I do think that it will yield the answer you're looking for if the data allows this method. The method is a regular Pearson's chi-squared test. The reason this choice makes sense is that music is arranged in time (it can be subdivided into countable notes rather than chaotic, arbitrary intervals of time) and you are using a 12 tone scale.
1. You have sung frequencies and the time in seconds for each frequency. You've already said that you can convert frequencies to tones. Do so. I assume you ignore octave since the picture of your theoretic distribution only contains one octave.
2. Convert your sung data from continuous time to a count of standardized notes. You say the experimental subject was singing. Even if the subject was not using a metronome, you can probably impose a loose metre and use your subject-matter expertise to transcribe the melody. Put another way, if you took a subject's melody, you could probably write it in musical notation. If you did that, you would see not continuous times, but notes of finite duration. Find the smallest meaningful subdivision (probably a 16th? Maybe a 32nd?) in your subjects' melodies and then subdivide all of their other notes into that unit and count them. From now on, I'll refer to this standardized subdivision simply as the "units." You'll count how many units for each tone was sung, and also sum the total units sung by the subject. The data format for the subject should now be 13 variables. The first 12 contain values that are the number of units of each tone sung by the subject, and the 13th variable is the total number of units they sang. The crucial point here is that you're standardizing the melodies into a unit, the chosen subdivision, then counting how many of those units were sung in each tone.
*You could keep the data in time and subdivide the seconds into counts, but notes are better. The reason is that music is inherently structured into note durations, and note durations don't need to be rounded up or down. Moreover, if you're publishing or presenting this, notes are probably more easily understood by your audience since most of them will be musically inclined. There is natural structure here. Use it if you can.
3. Now, you have a theoretical distribution of a major scale. You didn't say what the units were, but you need to convert it into a probability mass function. In other words, what proportion of notes do you expect to be the tonic? the 2nd? The major 3rd? You should be able to make this conversion relatively easily if you've already got literature on the subject and an example distribution.
4. You now have a recipe for getting your answer. You already have the observed counts in each tone and their total count from what your subject sang. To get their expected counts, take your theoretical distribution of the major scale and multiply each note probability by the total number of notes sung by the subject. E.g. if the subject sung a total of 100 notes and your theoretical distribution says that 40% of their sung notes should be a C and only 5% should be a C#, then their expected count of C should be $100\times0.4=40$ C notes and the expected count of C# should be $100\times0.05=5$.
5. Treat your data as a one-way table with 12 categories (the tones), and perform Pearson's Chi-Squared test. There are multiple other tests you could try, but this is the most well-known.
The benefits I see of using the above methods are (1) you're using the natural structure of music and musical scales, (2) visualizations (histograms or others) of expected versus observed counts will be far clearer than trying to compare a plot of times and frequencies, (3) those visualizations of expected versus observed counts make the extent and type of differences between your theoretical distribution and subject's distribution very clear in a way that other methods do not allow (you can clearly see how much they differ and by which tones they differ), and (4) you're using a well-known and simple statistical method to check the significance of the difference.
The pitfalls of using this methods are (1) your data format may make it difficult, (2) transcribing the melody may be difficult depending on the technology or skill that you possess for this purpose and how long the recording is, (3) Pearson's chi-squared test assumes independence of events, which almost certainly is not strictly fulfilled here (keep in mind the same subject is singing multiple notes--the units are not independent. Whether this matters depends on exactly what you're trying to explain here), and (4) if the singing is short, you may not have enough units to achieve reliable results.
|
Measure of similarity between two distributions - with variable starting point (wrap-around)
Here is what I would do in your situation. Whether it works for you depends on the format and quantity of your data, but I do think that it will yield the answer you're looking for if the data allows
|
48,274
|
How do Bayesians interpret unobservable model parameters?
|
You can find a good primer on the Bayesian interpretation of these types of models in Bernardo and Smith (1994). In that work they take an "operational" approach where model parameters are interpreted as limiting quantities that are functions of the observable sequence. You can also find a more detailed discussion of these particular interpretive issues in O'Neill (2009), which extends the operational interpretation to ensure that the parameter exists and corresponds to a limiting quantity under all possible sequence values.
Before getting to the interpretational side, it is important to note where the IID model comes from in Bayesian analysis. Given an infinite sequence $\mathbf{x}$ we can define the limiting empirical distribution $F_\mathbf{x}: \mathbb{R} \rightarrow [0,1]$ as the Banach limit that extends the following Cesàro limit:
$$F_\mathbf{x}(x) \equiv \lim_{n \rightarrow \infty} \frac{1}{n} \sum_{i=1}^n \mathbb{I}(x_i \leqslant x)
\quad \quad \quad \quad \quad \text{for all } x \in \mathbb{R}.$$
Now, an important result connecting the probability of the observable values to the underlying model parameters is the celebrated "representation theorem" from de Finetti (later extended by Hewitt and Savage). The version I show here is an adapted version shown in O'Neill (2009) (p. 242, Theorem 1). For this version, we show the decomposition of the marginal distribution of the sample vector $\mathbf{x}_n = (x_1,...,x_n)$. As with all versions of the theorem, the exchangeability of the underlying sequence leads to the IID model and the parameter-observation connection.
Representation theorem: If the sequence $\mathbf{x}$ is exchangeable then it follows that the elements of $\mathbf{x}|F_\mathbf{x}$ are independent with sampling distribution $F_\mathbf{x}$ (i.e., the sampling distribution is the empirical distribution of $\mathbf{x}$) so that for all $n \in \mathbb{N}$ we have:
$$F(\mathbf{x}_n) = \int \prod_{i=1}^n F_\mathbf{x}(x_i) \ dP (F_\mathbf{x}).$$
This theorem essentially says that if the observable sequence $\mathbf{x}$ is exchangeable, then we have the following IID model:
$$\begin{align}
x_1,...,x_n | F_\mathbf{x} &\sim \text{IID } F_\mathbf{x}, \\[6pt]
F_\mathbf{x} &\sim \pi. \\[6pt]
\end{align}$$
Now, in many applications, we will make the additional assumption that the observations obey some other invariance constraints that lead us to a particular parametric family of distributions. In this case, it may be possible to index the empirical distribution $F_\mathbf{x}$ by a parameter vector $\theta \in \Theta$ (i.e., we have a mapping $F_\mathbf{x} \mapsto \theta$ that defines the index and the model is restricted to empirical distributions corresponding to a value of $\theta$). In this case, we would write the IID model as:$^\dagger$
$$\begin{align}
x_1,...,x_n | \theta &\sim \text{IID } f_\theta, \\[6pt]
\theta &\sim \pi. \\[6pt]
\end{align}$$
So, as you can see, the setup for the Bayesian IID model occurs when we have an exchangeable sequence of observable values, and we then see that the model "parameter" is an index to the empirical distribution for the observable sequence (which can be defined through the Banach limit extending the above Cesàro limit). This "index" is a function of the empirical distribution, which is in turn a function of the observable sequence, so there exist mappings $\mathbf{x} \mapsto F_\mathbf{x} \mapsto \theta$.
Interpretation of the parameters: In the above setup, there exists a mapping $\mathbf{x} \mapsto \theta$, and so it is natural to take this as the "definition" of the parameter $\theta$. Under this approach, the parameter $\theta$ has an "operational" meaning as a quantity that is fully determined by the observable sequence (i.e., it is a limiting quantity on the observed sample as $n \rightarrow \infty$). Note that this interpretation relates closely to the strong law of large numbers.
$^\dagger$ I am using a slight abuse of notation here by taking $\pi$ as a generic reference to a prior distribution for whatever parameter is under use. Note that the prior for $\theta$ would be a simple mapping of the prior for $F_\mathbf{x}$.
|
How do Bayesians interpret unobservable model parameters?
|
You can find a good primer on the Bayesian interpretation of these types of models in Bernardo and Smith (1994). In that work they take an "operational" approach where model parameters are interprete
|
How do Bayesians interpret unobservable model parameters?
You can find a good primer on the Bayesian interpretation of these types of models in Bernardo and Smith (1994). In that work they take an "operational" approach where model parameters are interpreted as limiting quantities that are functions of the observable sequence. You can also find a more detailed discussion of these particular interpretive issues in O'Neill (2009), which extends the operational interpretation to ensure that the parameter exists and corresponds to a limiting quantity under all possible sequence values.
Before getting to the interpretational side, it is important to note where the IID model comes from in Bayesian analysis. Given an infinite sequence $\mathbf{x}$ we can define the limiting empirical distribution $F_\mathbf{x}: \mathbb{R} \rightarrow [0,1]$ as the Banach limit that extends the following Cesàro limit:
$$F_\mathbf{x}(x) \equiv \lim_{n \rightarrow \infty} \frac{1}{n} \sum_{i=1}^n \mathbb{I}(x_i \leqslant x)
\quad \quad \quad \quad \quad \text{for all } x \in \mathbb{R}.$$
Now, an important result connecting the probability of the observable values to the underlying model parameters is the celebrated "representation theorem" from de Finetti (later extended by Hewitt and Savage). The version I show here is an adapted version shown in O'Neill (2009) (p. 242, Theorem 1). For this version, we show the decomposition of the marginal distribution of the sample vector $\mathbf{x}_n = (x_1,...,x_n)$. As with all versions of the theorem, the exchangeability of the underlying sequence leads to the IID model and the parameter-observation connection.
Representation theorem: If the sequence $\mathbf{x}$ is exchangeable then it follows that the elements of $\mathbf{x}|F_\mathbf{x}$ are independent with sampling distribution $F_\mathbf{x}$ (i.e., the sampling distribution is the empirical distribution of $\mathbf{x}$) so that for all $n \in \mathbb{N}$ we have:
$$F(\mathbf{x}_n) = \int \prod_{i=1}^n F_\mathbf{x}(x_i) \ dP (F_\mathbf{x}).$$
This theorem essentially says that if the observable sequence $\mathbf{x}$ is exchangeable, then we have the following IID model:
$$\begin{align}
x_1,...,x_n | F_\mathbf{x} &\sim \text{IID } F_\mathbf{x}, \\[6pt]
F_\mathbf{x} &\sim \pi. \\[6pt]
\end{align}$$
Now, in many applications, we will make the additional assumption that the observations obey some other invariance constraints that lead us to a particular parametric family of distributions. In this case, it may be possible to index the empirical distribution $F_\mathbf{x}$ by a parameter vector $\theta \in \Theta$ (i.e., we have a mapping $F_\mathbf{x} \mapsto \theta$ that defines the index and the model is restricted to empirical distributions corresponding to a value of $\theta$). In this case, we would write the IID model as:$^\dagger$
$$\begin{align}
x_1,...,x_n | \theta &\sim \text{IID } f_\theta, \\[6pt]
\theta &\sim \pi. \\[6pt]
\end{align}$$
So, as you can see, the setup for the Bayesian IID model occurs when we have an exchangeable sequence of observable values, and we then see that the model "parameter" is an index to the empirical distribution for the observable sequence (which can be defined through the Banach limit extending the above Cesàro limit). This "index" is a function of the empirical distribution, which is in turn a function of the observable sequence, so there exist mappings $\mathbf{x} \mapsto F_\mathbf{x} \mapsto \theta$.
Interpretation of the parameters: In the above setup, there exists a mapping $\mathbf{x} \mapsto \theta$, and so it is natural to take this as the "definition" of the parameter $\theta$. Under this approach, the parameter $\theta$ has an "operational" meaning as a quantity that is fully determined by the observable sequence (i.e., it is a limiting quantity on the observed sample as $n \rightarrow \infty$). Note that this interpretation relates closely to the strong law of large numbers.
$^\dagger$ I am using a slight abuse of notation here by taking $\pi$ as a generic reference to a prior distribution for whatever parameter is under use. Note that the prior for $\theta$ would be a simple mapping of the prior for $F_\mathbf{x}$.
|
How do Bayesians interpret unobservable model parameters?
You can find a good primer on the Bayesian interpretation of these types of models in Bernardo and Smith (1994). In that work they take an "operational" approach where model parameters are interprete
|
48,275
|
Why is the size of the feature bagging sample typically the square root of the total predictor set size?
|
It's just a recommended default value. Leo Breiman observed that this value tends to work well on the classification problems that he worked on, but I'm not aware of any rigorous demonstration that this value must work best on all problems; indeed, the discovery that a different value works better on a specific problem seems to show that such a proof would be impossible. For RF regression, he suggests a different value. In short: you should tune $m$.
|
Why is the size of the feature bagging sample typically the square root of the total predictor set s
|
It's just a recommended default value. Leo Breiman observed that this value tends to work well on the classification problems that he worked on, but I'm not aware of any rigorous demonstration that th
|
Why is the size of the feature bagging sample typically the square root of the total predictor set size?
It's just a recommended default value. Leo Breiman observed that this value tends to work well on the classification problems that he worked on, but I'm not aware of any rigorous demonstration that this value must work best on all problems; indeed, the discovery that a different value works better on a specific problem seems to show that such a proof would be impossible. For RF regression, he suggests a different value. In short: you should tune $m$.
|
Why is the size of the feature bagging sample typically the square root of the total predictor set s
It's just a recommended default value. Leo Breiman observed that this value tends to work well on the classification problems that he worked on, but I'm not aware of any rigorous demonstration that th
|
48,276
|
Independent copula vs Student-$t$ copula with zero correlation matrix?
|
The uncorrelated $t$ copula is not the same as the independence copula. It is based on the multivariate $t$-distribution, which is an elliptical family, and the only elliptical distribution for which zero correlation implies independence is the normal. The difference can be quite large.
Below we will illustrate this using the R package copula. A contour plot of a $t$-copula is
The density of the independence copula is a constant 1. Note how the $t$-copula concentrates probability in the center and close the the four corners. The code used is
library(copula)
indCop <- ellipCopula(family="normal", param=0, dim=2, dispst="ex")
tCop <- ellipCopula(family="t", dim=2, dispst="ex", param=0, df=2)
getSigma(indCop)
[,1] [,2]
[1,] 1 0
[2,] 0 1
getSigma(tCop)
[,1] [,2]
[1,] 1 0
[2,] 0 1
# See they are different:
dCopula(c(0.5, 0.5), indCop)
[1] 1
dCopula(c(0.5, 0.5), tCop)
[1] 1.27324
contour(tCop, dCopula, n.grid=101, levels=c(0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3), main="t copula, uncorrelated, df=2")
|
Independent copula vs Student-$t$ copula with zero correlation matrix?
|
The uncorrelated $t$ copula is not the same as the independence copula. It is based on the multivariate $t$-distribution, which is an elliptical family, and the only elliptical distribution for which
|
Independent copula vs Student-$t$ copula with zero correlation matrix?
The uncorrelated $t$ copula is not the same as the independence copula. It is based on the multivariate $t$-distribution, which is an elliptical family, and the only elliptical distribution for which zero correlation implies independence is the normal. The difference can be quite large.
Below we will illustrate this using the R package copula. A contour plot of a $t$-copula is
The density of the independence copula is a constant 1. Note how the $t$-copula concentrates probability in the center and close the the four corners. The code used is
library(copula)
indCop <- ellipCopula(family="normal", param=0, dim=2, dispst="ex")
tCop <- ellipCopula(family="t", dim=2, dispst="ex", param=0, df=2)
getSigma(indCop)
[,1] [,2]
[1,] 1 0
[2,] 0 1
getSigma(tCop)
[,1] [,2]
[1,] 1 0
[2,] 0 1
# See they are different:
dCopula(c(0.5, 0.5), indCop)
[1] 1
dCopula(c(0.5, 0.5), tCop)
[1] 1.27324
contour(tCop, dCopula, n.grid=101, levels=c(0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3), main="t copula, uncorrelated, df=2")
|
Independent copula vs Student-$t$ copula with zero correlation matrix?
The uncorrelated $t$ copula is not the same as the independence copula. It is based on the multivariate $t$-distribution, which is an elliptical family, and the only elliptical distribution for which
|
48,277
|
Is there any reason that mean squared log error uses the natural log?
|
By the change of base property of logarithms,
$$\log_a b = \frac{\log_c b}{\log_c a} = \frac{\ln b}{\ln a}, $$
so changing from any fixed base $a$ to any other base $c$ (or $e$) simply means dividing by a fixed value $\log_c a$, so a change of base is just a scaling. All logarithms are equivalent.
The natural logarithm to base $e$ is very common and indeed natural in many other statistical and mathematical settings, so it's often the first thing that comes to mind to statisticians (computer scientists might indeed rather think first of base $2$, or engineers to base $10$).
|
Is there any reason that mean squared log error uses the natural log?
|
By the change of base property of logarithms,
$$\log_a b = \frac{\log_c b}{\log_c a} = \frac{\ln b}{\ln a}, $$
so changing from any fixed base $a$ to any other base $c$ (or $e$) simply means dividing
|
Is there any reason that mean squared log error uses the natural log?
By the change of base property of logarithms,
$$\log_a b = \frac{\log_c b}{\log_c a} = \frac{\ln b}{\ln a}, $$
so changing from any fixed base $a$ to any other base $c$ (or $e$) simply means dividing by a fixed value $\log_c a$, so a change of base is just a scaling. All logarithms are equivalent.
The natural logarithm to base $e$ is very common and indeed natural in many other statistical and mathematical settings, so it's often the first thing that comes to mind to statisticians (computer scientists might indeed rather think first of base $2$, or engineers to base $10$).
|
Is there any reason that mean squared log error uses the natural log?
By the change of base property of logarithms,
$$\log_a b = \frac{\log_c b}{\log_c a} = \frac{\ln b}{\ln a}, $$
so changing from any fixed base $a$ to any other base $c$ (or $e$) simply means dividing
|
48,278
|
How to show that $\left|\left|E\left[\frac{x-X}{||x-X||}\right]\right|\right|\xrightarrow{||x||\to\infty}1$ for a multivariate distribution?
|
Approach:
First, we approach through a sequence $\{x_n\}_{n\in\mathbb{N}}$ such that $||x_n||\to\infty$ as $n \to \infty.$ We fix an $x_n$ first.
We take an $L_\epsilon$ such that $P(||X||>L_\epsilon) <\epsilon$, i.e., we first take the n-ball where 'most of the $X$' lies.
Then, we will show that for all such 'good' values of $X$'s, $\frac{x_n-X}{||x_n-X||}$ is close to 'something' whose norm is 1.
Next, the rest of the $X$'s have a minuscule probability of contributing, and corresponding values of the random variable are bounded.
Image:
First, it would be easier to look at this scratch image:
$O$ is the origin and $U$ is the unit hypersphere(circle in 2D). Denote the large circle by $C_\epsilon$ where 'most of the X lies'. Choose one $X_1$ from there. $Y$ is the vector corresponding to the $\frac{x_n-X}{||x_n-X||}.$ Denote $P_n$ as the $\frac{x_n}{||x_n||},$ i.e., the value corresponding to the $X=0.$
Carefully note that any point $X$ from inside the $C_\epsilon$ would have corresponding $\frac{x_n-X}{||x_n-X||}$ value inside the arc $B_1 P_n B_2.$ Let the angle $B_1OP_n$ is denoted by $\theta$ (which depends on both $\epsilon$ and $n$). We will show that this length ($YP_n$) is smaller than $B_1P_n$, which can be 'very small'.
The images are in 2D, but I think they are valid for any fixed finite-dimension, $p\in\mathbb{N}$ also.
Proof:
Fix $\epsilon>0$ and get $L_\epsilon$ such that $P(||X||>L_\epsilon) <\epsilon$ assuming $X$ is $\mathbb{R}^p$ valued for a fixed $p\in\mathbb{N}.$
If $||X||\le L_\epsilon,$ then writing $\sin\theta_{n,\epsilon}=L_\epsilon/||x_n||$ and $P_n=\frac{x_n}{||x_n||}$
$$||\frac{x_n-X}{||x_n-X||} - P_n||\le 2\sin(\theta_{n,\epsilon}/2) = \sqrt{2}\sqrt{1-\cos\theta_{n,\epsilon}} = \sqrt{2}\sqrt{1-\sqrt{1-L_\epsilon^2/||x_n||^2}}$$
Then
\begin{align}
&E\left(||\frac{x_n-X}{||x_n-X||} - P_n||\right) \\
&=E\left(||\frac{x_n-X}{||x_n-X||} - P_n||\cdot I_{(||X||\le L_\epsilon)}\right) + E\left(||\frac{x_n-X}{||x_n-X||} - P_n||\cdot I_{(||X||> L_\epsilon)}\right) \\
&\le 2\sin(\theta_{n,\epsilon}/2) \cdot P(||X||\le L_\epsilon) + 2 \cdot P(||X||> L_\epsilon) \\
&\le 2\sin(\theta_{n,\epsilon}/2) + 2 \epsilon
\end{align}
We want to show that, $E\left(||\frac{x_n-X}{||x_n-X||} - P_n||\right) \to 0$ as $n\to \infty$ so that $||E \frac{x_n-X}{||x_n-X||} - E P_n||\to 0$ and hence $||E \frac{x_n-X}{||x_n-X||} || \to 1$ as $n\to\infty$
($0\le |\ ||EW|| -||EV||\ | \le ||E(W-V)|| \le E||W-V||$)
Now, for any fixed $\epsilon>0,$ $\sin(\theta_{n, \epsilon})\to 0$ as $n\to \infty.$ This concludes $\lim_{n\to \infty} E\left(||\frac{x_n-X}{||x_n-X||} - P_n||\right) \le \epsilon$ from which you can conclude your result.
The (almost) proof I gave looks a little complex - however, there are possibly easier proofs. There should be some more arguments to handle the
$X=x$ case indefiniteness as $P(X=x)\to 0$ as $||x||\to\infty$ assuming $X\in\mathbb{R}^p.$ There might be some argument problem; please mention if you find any.
|
How to show that $\left|\left|E\left[\frac{x-X}{||x-X||}\right]\right|\right|\xrightarrow{||x||\to\i
|
Approach:
First, we approach through a sequence $\{x_n\}_{n\in\mathbb{N}}$ such that $||x_n||\to\infty$ as $n \to \infty.$ We fix an $x_n$ first.
We take an $L_\epsilon$ such that $P(||X||>L_\epsilon
|
How to show that $\left|\left|E\left[\frac{x-X}{||x-X||}\right]\right|\right|\xrightarrow{||x||\to\infty}1$ for a multivariate distribution?
Approach:
First, we approach through a sequence $\{x_n\}_{n\in\mathbb{N}}$ such that $||x_n||\to\infty$ as $n \to \infty.$ We fix an $x_n$ first.
We take an $L_\epsilon$ such that $P(||X||>L_\epsilon) <\epsilon$, i.e., we first take the n-ball where 'most of the $X$' lies.
Then, we will show that for all such 'good' values of $X$'s, $\frac{x_n-X}{||x_n-X||}$ is close to 'something' whose norm is 1.
Next, the rest of the $X$'s have a minuscule probability of contributing, and corresponding values of the random variable are bounded.
Image:
First, it would be easier to look at this scratch image:
$O$ is the origin and $U$ is the unit hypersphere(circle in 2D). Denote the large circle by $C_\epsilon$ where 'most of the X lies'. Choose one $X_1$ from there. $Y$ is the vector corresponding to the $\frac{x_n-X}{||x_n-X||}.$ Denote $P_n$ as the $\frac{x_n}{||x_n||},$ i.e., the value corresponding to the $X=0.$
Carefully note that any point $X$ from inside the $C_\epsilon$ would have corresponding $\frac{x_n-X}{||x_n-X||}$ value inside the arc $B_1 P_n B_2.$ Let the angle $B_1OP_n$ is denoted by $\theta$ (which depends on both $\epsilon$ and $n$). We will show that this length ($YP_n$) is smaller than $B_1P_n$, which can be 'very small'.
The images are in 2D, but I think they are valid for any fixed finite-dimension, $p\in\mathbb{N}$ also.
Proof:
Fix $\epsilon>0$ and get $L_\epsilon$ such that $P(||X||>L_\epsilon) <\epsilon$ assuming $X$ is $\mathbb{R}^p$ valued for a fixed $p\in\mathbb{N}.$
If $||X||\le L_\epsilon,$ then writing $\sin\theta_{n,\epsilon}=L_\epsilon/||x_n||$ and $P_n=\frac{x_n}{||x_n||}$
$$||\frac{x_n-X}{||x_n-X||} - P_n||\le 2\sin(\theta_{n,\epsilon}/2) = \sqrt{2}\sqrt{1-\cos\theta_{n,\epsilon}} = \sqrt{2}\sqrt{1-\sqrt{1-L_\epsilon^2/||x_n||^2}}$$
Then
\begin{align}
&E\left(||\frac{x_n-X}{||x_n-X||} - P_n||\right) \\
&=E\left(||\frac{x_n-X}{||x_n-X||} - P_n||\cdot I_{(||X||\le L_\epsilon)}\right) + E\left(||\frac{x_n-X}{||x_n-X||} - P_n||\cdot I_{(||X||> L_\epsilon)}\right) \\
&\le 2\sin(\theta_{n,\epsilon}/2) \cdot P(||X||\le L_\epsilon) + 2 \cdot P(||X||> L_\epsilon) \\
&\le 2\sin(\theta_{n,\epsilon}/2) + 2 \epsilon
\end{align}
We want to show that, $E\left(||\frac{x_n-X}{||x_n-X||} - P_n||\right) \to 0$ as $n\to \infty$ so that $||E \frac{x_n-X}{||x_n-X||} - E P_n||\to 0$ and hence $||E \frac{x_n-X}{||x_n-X||} || \to 1$ as $n\to\infty$
($0\le |\ ||EW|| -||EV||\ | \le ||E(W-V)|| \le E||W-V||$)
Now, for any fixed $\epsilon>0,$ $\sin(\theta_{n, \epsilon})\to 0$ as $n\to \infty.$ This concludes $\lim_{n\to \infty} E\left(||\frac{x_n-X}{||x_n-X||} - P_n||\right) \le \epsilon$ from which you can conclude your result.
The (almost) proof I gave looks a little complex - however, there are possibly easier proofs. There should be some more arguments to handle the
$X=x$ case indefiniteness as $P(X=x)\to 0$ as $||x||\to\infty$ assuming $X\in\mathbb{R}^p.$ There might be some argument problem; please mention if you find any.
|
How to show that $\left|\left|E\left[\frac{x-X}{||x-X||}\right]\right|\right|\xrightarrow{||x||\to\i
Approach:
First, we approach through a sequence $\{x_n\}_{n\in\mathbb{N}}$ such that $||x_n||\to\infty$ as $n \to \infty.$ We fix an $x_n$ first.
We take an $L_\epsilon$ such that $P(||X||>L_\epsilon
|
48,279
|
How to show that $\left|\left|E\left[\frac{x-X}{||x-X||}\right]\right|\right|\xrightarrow{||x||\to\infty}1$ for a multivariate distribution?
|
$X$ is the random variable. The quantity you are taking the expectation of can be viewed in two ways: as written, it looks like the unit vector pointing from $X$ to $x.$ One route to a simple solution is to negate this, so that it is the unit vector pointing from $x$ to $X.$ This negation changes nothing, because it factors out of the expectation and disappears when the norm is taken. Thus, $(x-X)/|x-X|$ projects $X$ onto the unit sphere centered at $x.$
(In physical terms: I am inviting you to conceive of this setting not in terms of some fixed frame from which to examine $X,$ but in terms of a moving frame attached to $x.$)
Think, then, of $X$ as a probability "cloud" of points, like a galactic nebula, and $x$ as a starship receding from the cloud (and perhaps orbiting it at the same time). The starship will always be looking backwards at the point whence it came. (Physically, this determines a special set of moving reference frames useful for the analysis.) From the starship's perspective, the cloud is shrinking to the image of the ship's starting point in the viewfinder (the unit sphere). This implies the projection of the cloud onto a unit sphere around the ship's telescope is converging towards the unit vector pointing back at the ship's point of origin, whence the length of its (vector average) will approach $1.$
One technical problem is that the cloud could extend throughout all of space. How to handle that? The key is that most of the cloud will still lie near the center of the ship's viewfinder, once the ship has traveled far enough outward. The rest of the cloud, which could lie at arbitrarily great distances, projects down to a distribution of vectors that could be scattered all over the unit sphere, but they all are unit length $1$ (by construction). Their mean will be a vector $z$ of length even less than $1$ and, since this eventually contributes an arbitrarily small amount to the expectation, it can be neglected.
The method of proof should now be clear. When $\delta \gt 0$ is an arbitrarily small angular distance (from the starship's perspective) and $\epsilon\gt 0$ is that proportion of the $X$ cloud, as seen from $x,$ which might lie beyond an angular distance $\delta$ of some fixed reference point $O$ (which we might as well take to be the origin), then almost all the values of $(X-x)/|X-x|$ are very nearly parallel to the vector from $x$ to $O$ (namely, $-x$) and their contribution to the expectation will be close to the unit vector in that direction. Since $\epsilon$ is tiny, the projection of the rest of $X$ doesn't change that expectation much. Thus, the norm of the expectation approaches the norm of the unit vector from $x$ to $O,$ which is always $1,$ QED.
This proof can be carried out formally in many ways. The following proceeds according to the foregoing plan. Thus, let $\epsilon \gt 0$ and $\delta\gt 0$ be arbitrary small numbers; let $r$ be the smallest radius for which $\Pr(|X| \le r) \ge 1-\epsilon,$ and choose $x$ such that $|x| \ge r\csc(\delta).$ This guarantees that when $|X|\le r,$
$$\left|y\right| \le \sin(\delta)\lt \delta\tag{*}$$
where
$$y= \frac{x-X}{|x-X|} - \frac{x}{|x|}.$$
($y$ is the vector displacement between $X$ and the origin in the ship's viewfinder.)
If necessary, adjust $\epsilon$ downwards to $\epsilon^\prime$ so that $1-\epsilon^\prime= \Pr(|X|\le r).$ This is needed to deal with non-continuous distributions of $X.$
Writing the expectation in terms of expectations conditioned on the events $|X|\le r$ and $|X|\gt r,$ we have
$$E\left[\frac{x-X}{|x-X|}\right] = (1-\epsilon^\prime)\left(\frac{x}{|x|} + y\right) + (\epsilon^\prime)z$$
where $z$ is the conditional expectation of $(x-X)/|x-X|$ for $|X|\gt r$ and therefore $|z|\le 1.$ Taking norms of both sides (note that $|\,x/|x|\,|=1$) and applying the triangle inequality along with the inequality $(*)$ yields
$$(1-\epsilon^\prime)(1-\delta) - (\epsilon^\prime)(1) \le \Bigg| E\left[\frac{x-X}{|x-X|}\right]\Bigg| \le (1-\epsilon^\prime)(1+\delta) + (\epsilon^\prime)(1).$$
Since both $\epsilon^\prime \le \epsilon$ and $\delta$ can be made arbitrarily small, both bounds shrink to $1,$ proving $$1 = \lim_{|x|\to\infty} \Bigg|E\left[\frac{x-X}{|x-X|}\right]\Bigg|,$$ QED.
|
How to show that $\left|\left|E\left[\frac{x-X}{||x-X||}\right]\right|\right|\xrightarrow{||x||\to\i
|
$X$ is the random variable. The quantity you are taking the expectation of can be viewed in two ways: as written, it looks like the unit vector pointing from $X$ to $x.$ One route to a simple solutio
|
How to show that $\left|\left|E\left[\frac{x-X}{||x-X||}\right]\right|\right|\xrightarrow{||x||\to\infty}1$ for a multivariate distribution?
$X$ is the random variable. The quantity you are taking the expectation of can be viewed in two ways: as written, it looks like the unit vector pointing from $X$ to $x.$ One route to a simple solution is to negate this, so that it is the unit vector pointing from $x$ to $X.$ This negation changes nothing, because it factors out of the expectation and disappears when the norm is taken. Thus, $(x-X)/|x-X|$ projects $X$ onto the unit sphere centered at $x.$
(In physical terms: I am inviting you to conceive of this setting not in terms of some fixed frame from which to examine $X,$ but in terms of a moving frame attached to $x.$)
Think, then, of $X$ as a probability "cloud" of points, like a galactic nebula, and $x$ as a starship receding from the cloud (and perhaps orbiting it at the same time). The starship will always be looking backwards at the point whence it came. (Physically, this determines a special set of moving reference frames useful for the analysis.) From the starship's perspective, the cloud is shrinking to the image of the ship's starting point in the viewfinder (the unit sphere). This implies the projection of the cloud onto a unit sphere around the ship's telescope is converging towards the unit vector pointing back at the ship's point of origin, whence the length of its (vector average) will approach $1.$
One technical problem is that the cloud could extend throughout all of space. How to handle that? The key is that most of the cloud will still lie near the center of the ship's viewfinder, once the ship has traveled far enough outward. The rest of the cloud, which could lie at arbitrarily great distances, projects down to a distribution of vectors that could be scattered all over the unit sphere, but they all are unit length $1$ (by construction). Their mean will be a vector $z$ of length even less than $1$ and, since this eventually contributes an arbitrarily small amount to the expectation, it can be neglected.
The method of proof should now be clear. When $\delta \gt 0$ is an arbitrarily small angular distance (from the starship's perspective) and $\epsilon\gt 0$ is that proportion of the $X$ cloud, as seen from $x,$ which might lie beyond an angular distance $\delta$ of some fixed reference point $O$ (which we might as well take to be the origin), then almost all the values of $(X-x)/|X-x|$ are very nearly parallel to the vector from $x$ to $O$ (namely, $-x$) and their contribution to the expectation will be close to the unit vector in that direction. Since $\epsilon$ is tiny, the projection of the rest of $X$ doesn't change that expectation much. Thus, the norm of the expectation approaches the norm of the unit vector from $x$ to $O,$ which is always $1,$ QED.
This proof can be carried out formally in many ways. The following proceeds according to the foregoing plan. Thus, let $\epsilon \gt 0$ and $\delta\gt 0$ be arbitrary small numbers; let $r$ be the smallest radius for which $\Pr(|X| \le r) \ge 1-\epsilon,$ and choose $x$ such that $|x| \ge r\csc(\delta).$ This guarantees that when $|X|\le r,$
$$\left|y\right| \le \sin(\delta)\lt \delta\tag{*}$$
where
$$y= \frac{x-X}{|x-X|} - \frac{x}{|x|}.$$
($y$ is the vector displacement between $X$ and the origin in the ship's viewfinder.)
If necessary, adjust $\epsilon$ downwards to $\epsilon^\prime$ so that $1-\epsilon^\prime= \Pr(|X|\le r).$ This is needed to deal with non-continuous distributions of $X.$
Writing the expectation in terms of expectations conditioned on the events $|X|\le r$ and $|X|\gt r,$ we have
$$E\left[\frac{x-X}{|x-X|}\right] = (1-\epsilon^\prime)\left(\frac{x}{|x|} + y\right) + (\epsilon^\prime)z$$
where $z$ is the conditional expectation of $(x-X)/|x-X|$ for $|X|\gt r$ and therefore $|z|\le 1.$ Taking norms of both sides (note that $|\,x/|x|\,|=1$) and applying the triangle inequality along with the inequality $(*)$ yields
$$(1-\epsilon^\prime)(1-\delta) - (\epsilon^\prime)(1) \le \Bigg| E\left[\frac{x-X}{|x-X|}\right]\Bigg| \le (1-\epsilon^\prime)(1+\delta) + (\epsilon^\prime)(1).$$
Since both $\epsilon^\prime \le \epsilon$ and $\delta$ can be made arbitrarily small, both bounds shrink to $1,$ proving $$1 = \lim_{|x|\to\infty} \Bigg|E\left[\frac{x-X}{|x-X|}\right]\Bigg|,$$ QED.
|
How to show that $\left|\left|E\left[\frac{x-X}{||x-X||}\right]\right|\right|\xrightarrow{||x||\to\i
$X$ is the random variable. The quantity you are taking the expectation of can be viewed in two ways: as written, it looks like the unit vector pointing from $X$ to $x.$ One route to a simple solutio
|
48,280
|
Why is the ROC curve two-dimensional instead of three-dimensional?
|
The ROC curve is two-dimensional because it is defined as the plot of TPR and FPR. Yes, you might be interested in the threshold used to generate the TPR and FPR, and you might want to plot that on a third axis, but then it is not a ROC curve but something else (arguably more informative, arguably harder to draw, arguably so hard to draw that the additional information is not worth the trouble).
|
Why is the ROC curve two-dimensional instead of three-dimensional?
|
The ROC curve is two-dimensional because it is defined as the plot of TPR and FPR. Yes, you might be interested in the threshold used to generate the TPR and FPR, and you might want to plot that on a
|
Why is the ROC curve two-dimensional instead of three-dimensional?
The ROC curve is two-dimensional because it is defined as the plot of TPR and FPR. Yes, you might be interested in the threshold used to generate the TPR and FPR, and you might want to plot that on a third axis, but then it is not a ROC curve but something else (arguably more informative, arguably harder to draw, arguably so hard to draw that the additional information is not worth the trouble).
|
Why is the ROC curve two-dimensional instead of three-dimensional?
The ROC curve is two-dimensional because it is defined as the plot of TPR and FPR. Yes, you might be interested in the threshold used to generate the TPR and FPR, and you might want to plot that on a
|
48,281
|
Basic properties of the kernel density estimator
|
You did everything correctly, you are just missing the last step. First of all, you can write $o((uh)^m) = u^m o(h^m)$, which will lead to
$$ \int_\mathbb{R} k(u) o((uh)^m)du = o(h^m)\int_\mathbb{R} k(u) u^mdu = o(h^m)$$
by the properties of the kernel function given in the assignment. Hence,
$$\mathbb{E}[f_n(t)] = f(t) + \frac{f^{(m)}(t)(-h)^m}{m!} \int_{\mathbb{R}}k(u)u^m du + o(h^m).$$
In the simplest case, when the underlying density is twice continuously differentiable, we have
$$Bias(f_n(t)) = \mathbb{E}[f_n(t)] - f(t) = h^2 \frac{\nu_2(k)}{2}{}f^{\prime\prime}(t) + o(h^2),$$
where $\nu_2(k) = \int_{\mathbb{R}}k(u)u^2$. This is the most common expression for the bias and for many usual kernel functions.
Edit:
Note that the Bias depends on $t$. Hence, in your notation it should be $A(t)$, not just $A$. It exists and is finite, because $f^{(m)}$ is $m$-times continuously differentiable, and $f^{(m)}(t)$ is just a number.
3.
\begin{align*}
\mathrm{Var}[f_n(t)]&=\frac{1}{nh}\left(h\int_{\mathbb{R}}k^2(u)f(t-hu)\mathrm{d}u-\left(h\int_{\mathbb{R}}k(u)f(t-hu)\mathrm{d}u\right)^2\right)\\
&=\frac{1}{nh^2}\left(h\int_{\mathbb{R}}k^2(u)\left(f(t)-(hu)f^{(1)}(t)+o(hu)\right)\mathrm{d}u +O(h^2) \right)\\
&=\frac{1}{nh^2}\left(h\cdot f(t)\int_{\mathbb{R}}k^2(u)du - h^2 f^{(1)}(t)\int_{\mathbb{R}}k^2(u)udu + o(h^2) +O(h^2) \right)\\
&=\frac{1}{nh^2}\left(h\cdot f(t)\int_{\mathbb{R}}k^2(u)du +O(h^2) \right)\\
&=\frac{f(t)}{nh}\int_{\mathbb{R}}k^2(u)du +o\left(\frac{1}{nh}\right).
\end{align*}
Here, we used the following facts:
a. $o(h^2) + O(h^2) = O(h^2)$
b. $\int |k^2(u)u|du \le \int k^2(u)du< \infty$ because $k(u)$ has support on $[-1, 1]$. In the kernel density estimation, it is usually assumed that $\int k^2(u)du$ is finite and sometimes is denoted by $R(k)$ (roughness of the kernel, though the term is rarely used). It is possible that this condition can vbe derived from the assumptions that are given in the exercise but I have not tried it.
c. $O(h^2) \cdot \frac{1}{nh^2} = O(h) \cdot\frac{1}{nh} = o(1)\cdot \frac{1}{nh} = o\left(\frac{1}{nh}\right)$.
Everything is correct, just do not forget that $A$ depends on $t$.
You will have different order for the variance. If I understand the question correctly, you can "forget" about the remainder terms and find $h$ such that the main part of MSE is the smallest. The sum of these two terms are often called asymptotic mean squared error.
And here you will need also to substitute the optimal bandwidth from 5. into the formula for MSE from 4.
|
Basic properties of the kernel density estimator
|
You did everything correctly, you are just missing the last step. First of all, you can write $o((uh)^m) = u^m o(h^m)$, which will lead to
$$ \int_\mathbb{R} k(u) o((uh)^m)du = o(h^m)\int_\mathbb{R} k
|
Basic properties of the kernel density estimator
You did everything correctly, you are just missing the last step. First of all, you can write $o((uh)^m) = u^m o(h^m)$, which will lead to
$$ \int_\mathbb{R} k(u) o((uh)^m)du = o(h^m)\int_\mathbb{R} k(u) u^mdu = o(h^m)$$
by the properties of the kernel function given in the assignment. Hence,
$$\mathbb{E}[f_n(t)] = f(t) + \frac{f^{(m)}(t)(-h)^m}{m!} \int_{\mathbb{R}}k(u)u^m du + o(h^m).$$
In the simplest case, when the underlying density is twice continuously differentiable, we have
$$Bias(f_n(t)) = \mathbb{E}[f_n(t)] - f(t) = h^2 \frac{\nu_2(k)}{2}{}f^{\prime\prime}(t) + o(h^2),$$
where $\nu_2(k) = \int_{\mathbb{R}}k(u)u^2$. This is the most common expression for the bias and for many usual kernel functions.
Edit:
Note that the Bias depends on $t$. Hence, in your notation it should be $A(t)$, not just $A$. It exists and is finite, because $f^{(m)}$ is $m$-times continuously differentiable, and $f^{(m)}(t)$ is just a number.
3.
\begin{align*}
\mathrm{Var}[f_n(t)]&=\frac{1}{nh}\left(h\int_{\mathbb{R}}k^2(u)f(t-hu)\mathrm{d}u-\left(h\int_{\mathbb{R}}k(u)f(t-hu)\mathrm{d}u\right)^2\right)\\
&=\frac{1}{nh^2}\left(h\int_{\mathbb{R}}k^2(u)\left(f(t)-(hu)f^{(1)}(t)+o(hu)\right)\mathrm{d}u +O(h^2) \right)\\
&=\frac{1}{nh^2}\left(h\cdot f(t)\int_{\mathbb{R}}k^2(u)du - h^2 f^{(1)}(t)\int_{\mathbb{R}}k^2(u)udu + o(h^2) +O(h^2) \right)\\
&=\frac{1}{nh^2}\left(h\cdot f(t)\int_{\mathbb{R}}k^2(u)du +O(h^2) \right)\\
&=\frac{f(t)}{nh}\int_{\mathbb{R}}k^2(u)du +o\left(\frac{1}{nh}\right).
\end{align*}
Here, we used the following facts:
a. $o(h^2) + O(h^2) = O(h^2)$
b. $\int |k^2(u)u|du \le \int k^2(u)du< \infty$ because $k(u)$ has support on $[-1, 1]$. In the kernel density estimation, it is usually assumed that $\int k^2(u)du$ is finite and sometimes is denoted by $R(k)$ (roughness of the kernel, though the term is rarely used). It is possible that this condition can vbe derived from the assumptions that are given in the exercise but I have not tried it.
c. $O(h^2) \cdot \frac{1}{nh^2} = O(h) \cdot\frac{1}{nh} = o(1)\cdot \frac{1}{nh} = o\left(\frac{1}{nh}\right)$.
Everything is correct, just do not forget that $A$ depends on $t$.
You will have different order for the variance. If I understand the question correctly, you can "forget" about the remainder terms and find $h$ such that the main part of MSE is the smallest. The sum of these two terms are often called asymptotic mean squared error.
And here you will need also to substitute the optimal bandwidth from 5. into the formula for MSE from 4.
|
Basic properties of the kernel density estimator
You did everything correctly, you are just missing the last step. First of all, you can write $o((uh)^m) = u^m o(h^m)$, which will lead to
$$ \int_\mathbb{R} k(u) o((uh)^m)du = o(h^m)\int_\mathbb{R} k
|
48,282
|
AdaBoost - why decision stumps instead of trees?
|
The reason for using 'stumps' in boosting but full-height trees in random forests is to do with how the aggregation and fitting is done.
In random forests, the trees in the ensemble are fitted independently to independent bootstrap samples, so any error caused by growing the trees too far is independent for each tree and tends to cancel out in the ensemble average.
In boosting, the trees are fitted sequentially, with each one trained on (in some sense) the residuals from the previous classifier. Once a boosted ensemble starts overfitting, it will keep overfitting; the errors won't just cancel out.
For this reason, it's worth having individual trees be short when boosting and tall when bagging. It's not clear that 'stumps' are optimal for boosting -- there are recommendations for trees with, say, 6 leaves to include interactions better -- but that's an explanation for the basic idea.
|
AdaBoost - why decision stumps instead of trees?
|
The reason for using 'stumps' in boosting but full-height trees in random forests is to do with how the aggregation and fitting is done.
In random forests, the trees in the ensemble are fitted indepen
|
AdaBoost - why decision stumps instead of trees?
The reason for using 'stumps' in boosting but full-height trees in random forests is to do with how the aggregation and fitting is done.
In random forests, the trees in the ensemble are fitted independently to independent bootstrap samples, so any error caused by growing the trees too far is independent for each tree and tends to cancel out in the ensemble average.
In boosting, the trees are fitted sequentially, with each one trained on (in some sense) the residuals from the previous classifier. Once a boosted ensemble starts overfitting, it will keep overfitting; the errors won't just cancel out.
For this reason, it's worth having individual trees be short when boosting and tall when bagging. It's not clear that 'stumps' are optimal for boosting -- there are recommendations for trees with, say, 6 leaves to include interactions better -- but that's an explanation for the basic idea.
|
AdaBoost - why decision stumps instead of trees?
The reason for using 'stumps' in boosting but full-height trees in random forests is to do with how the aggregation and fitting is done.
In random forests, the trees in the ensemble are fitted indepen
|
48,283
|
AdaBoost - why decision stumps instead of trees?
|
If you think about the gradient-boosted CART (aka an atom of gbm), the model is "boxes"(1).
This (data):
Is represented by a (CART fit) as this:
Each leaf-tip is a mean. Each split is perpendicular to an axis. It is trying to adjust the box bounds and the mean height to minimize error in representation.
From the above, you see the motivation for oblique forests.
If you have a deeper tree, then there are many splits and means per level of boosting. We know there is weakness in an individual tree, it is literally a "weak learner". If you have a stump, then every line is boosted as it is made. The "boostings" to "split-and-mean" ratio is at its upper extreme value. If you have a deep tree, or even one whose depth is limited by leaf-count or other control metrics, then that ratio is arguably at its opposite extreme.
$$ \text {root to leaf ratio} = \frac {\text {number of tree roots}}{\text{mean splits per tree}}$$
So why the stump? A wonderful young woman over at Microsoft described the gbm like a tiger-mom, where the student is force to study over and over. For a student that is poor or content that is very difficult, the learning rate is lower and the iterations are higher. This makes a model that is larger, takes more to train, and takes more to execute. If the student is good then they can move faster through the content, and they can take bigger steps; similarly if the content is easier then progress is easier to make. In that case a deeper tree, with a larger learning rate, and with a smaller ensemble-count is possible. It makes a smaller file, with fewer parameters, that trains quickly and runs quickly.
All of these are elements of the "art" where the practitioner must make decisions using some limited design of experiments. Exhaustive grid searching can be expensive (in terms of time and money) here.
I like the "philosophy" section:
RF is an example of a tool that is useful in doing analyses of
scientific data.
But the cleverest algorithms are no substitute for human intelligence
and knowledge of the data in the problem.
Take the output of random forests not as absolute truth, but as smart
computer generated guesses that may be helpful in leading to a deeper
understanding of the problem.
|
AdaBoost - why decision stumps instead of trees?
|
If you think about the gradient-boosted CART (aka an atom of gbm), the model is "boxes"(1).
This (data):
Is represented by a (CART fit) as this:
Each leaf-tip is a mean. Each split is perpendicular
|
AdaBoost - why decision stumps instead of trees?
If you think about the gradient-boosted CART (aka an atom of gbm), the model is "boxes"(1).
This (data):
Is represented by a (CART fit) as this:
Each leaf-tip is a mean. Each split is perpendicular to an axis. It is trying to adjust the box bounds and the mean height to minimize error in representation.
From the above, you see the motivation for oblique forests.
If you have a deeper tree, then there are many splits and means per level of boosting. We know there is weakness in an individual tree, it is literally a "weak learner". If you have a stump, then every line is boosted as it is made. The "boostings" to "split-and-mean" ratio is at its upper extreme value. If you have a deep tree, or even one whose depth is limited by leaf-count or other control metrics, then that ratio is arguably at its opposite extreme.
$$ \text {root to leaf ratio} = \frac {\text {number of tree roots}}{\text{mean splits per tree}}$$
So why the stump? A wonderful young woman over at Microsoft described the gbm like a tiger-mom, where the student is force to study over and over. For a student that is poor or content that is very difficult, the learning rate is lower and the iterations are higher. This makes a model that is larger, takes more to train, and takes more to execute. If the student is good then they can move faster through the content, and they can take bigger steps; similarly if the content is easier then progress is easier to make. In that case a deeper tree, with a larger learning rate, and with a smaller ensemble-count is possible. It makes a smaller file, with fewer parameters, that trains quickly and runs quickly.
All of these are elements of the "art" where the practitioner must make decisions using some limited design of experiments. Exhaustive grid searching can be expensive (in terms of time and money) here.
I like the "philosophy" section:
RF is an example of a tool that is useful in doing analyses of
scientific data.
But the cleverest algorithms are no substitute for human intelligence
and knowledge of the data in the problem.
Take the output of random forests not as absolute truth, but as smart
computer generated guesses that may be helpful in leading to a deeper
understanding of the problem.
|
AdaBoost - why decision stumps instead of trees?
If you think about the gradient-boosted CART (aka an atom of gbm), the model is "boxes"(1).
This (data):
Is represented by a (CART fit) as this:
Each leaf-tip is a mean. Each split is perpendicular
|
48,284
|
Does a Binomial converge to Poisson or Normal?
|
The difficulty disappears when you are careful in formulating the limits. In the first case, $p$ is not constant, so it would be more precise to write it as $p_n$, as $p$ varies with $n$. We can write $n \cdot p_n \to \lambda>0$ another way as $p_n \sim \lambda/n$, where $\sim$ means that the quotient between the two sides converges to unity with $n \to\infty$.
For the second case, $p$ is constant, and however small, when $n$ is large enough, $np$ is no longer small. The CLT is still valid when $p>0$ is small and constant.
To understand this better, you could try to use the CLT for IID variables in the first case. Write the binomial out as a sum of $n$ IID Bernoulli variables, as $X_n= B_1 + \dotsm + B_n$. Now check the assumptions of the CLT. You will find that the $B_1, B_2, \dotso, B_n$ all must have the same distribution, and that distribution should not depend on $n$. Is that the case?
|
Does a Binomial converge to Poisson or Normal?
|
The difficulty disappears when you are careful in formulating the limits. In the first case, $p$ is not constant, so it would be more precise to write it as $p_n$, as $p$ varies with $n$. We can write
|
Does a Binomial converge to Poisson or Normal?
The difficulty disappears when you are careful in formulating the limits. In the first case, $p$ is not constant, so it would be more precise to write it as $p_n$, as $p$ varies with $n$. We can write $n \cdot p_n \to \lambda>0$ another way as $p_n \sim \lambda/n$, where $\sim$ means that the quotient between the two sides converges to unity with $n \to\infty$.
For the second case, $p$ is constant, and however small, when $n$ is large enough, $np$ is no longer small. The CLT is still valid when $p>0$ is small and constant.
To understand this better, you could try to use the CLT for IID variables in the first case. Write the binomial out as a sum of $n$ IID Bernoulli variables, as $X_n= B_1 + \dotsm + B_n$. Now check the assumptions of the CLT. You will find that the $B_1, B_2, \dotso, B_n$ all must have the same distribution, and that distribution should not depend on $n$. Is that the case?
|
Does a Binomial converge to Poisson or Normal?
The difficulty disappears when you are careful in formulating the limits. In the first case, $p$ is not constant, so it would be more precise to write it as $p_n$, as $p$ varies with $n$. We can write
|
48,285
|
Does a Binomial converge to Poisson or Normal?
|
One can write the CLT as:
$$
\frac{\sum_{i=1}^{n}X_i - n\mu}{\sigma\sqrt{n}} \stackrel{d}{\to} N(0,1)
$$
If we consider each $X_i$ here as a Bernoulli random variable that are independent and identically distributed, recalling that the mean and variance of a Bernoulli random variable are $p$ and $p(1-p)$ respectively, we can rewrite this as
$$
\frac{\sum_{i=1}^{n}X_i - np}{\sqrt{np(1-p)}} \stackrel{d}{\to} N(0,1)
$$
And then note that a binomial is simply a sum of n Bernoulli random variable. That is that for $X = X_1 + \dots + X_n$ where each $X_i \sim Bernoulli(p)$ we have $X \sim Binomial(n,p)$. So we can finally get the form of the CLT given in your question.
$$
\frac{X - np}{\sqrt{np(1-p)}} \stackrel{d}{\to} N(0,1)
$$
This is true even when p is very small, so long as the bernoulli random variables are identically distributed. In the first case where the binomial converges to a poisson distribution, p is growing smaller as n goes to infinity, and so the requirement that the random variables be identically distributed is not satisfied.
|
Does a Binomial converge to Poisson or Normal?
|
One can write the CLT as:
$$
\frac{\sum_{i=1}^{n}X_i - n\mu}{\sigma\sqrt{n}} \stackrel{d}{\to} N(0,1)
$$
If we consider each $X_i$ here as a Bernoulli random variable that are independent and identica
|
Does a Binomial converge to Poisson or Normal?
One can write the CLT as:
$$
\frac{\sum_{i=1}^{n}X_i - n\mu}{\sigma\sqrt{n}} \stackrel{d}{\to} N(0,1)
$$
If we consider each $X_i$ here as a Bernoulli random variable that are independent and identically distributed, recalling that the mean and variance of a Bernoulli random variable are $p$ and $p(1-p)$ respectively, we can rewrite this as
$$
\frac{\sum_{i=1}^{n}X_i - np}{\sqrt{np(1-p)}} \stackrel{d}{\to} N(0,1)
$$
And then note that a binomial is simply a sum of n Bernoulli random variable. That is that for $X = X_1 + \dots + X_n$ where each $X_i \sim Bernoulli(p)$ we have $X \sim Binomial(n,p)$. So we can finally get the form of the CLT given in your question.
$$
\frac{X - np}{\sqrt{np(1-p)}} \stackrel{d}{\to} N(0,1)
$$
This is true even when p is very small, so long as the bernoulli random variables are identically distributed. In the first case where the binomial converges to a poisson distribution, p is growing smaller as n goes to infinity, and so the requirement that the random variables be identically distributed is not satisfied.
|
Does a Binomial converge to Poisson or Normal?
One can write the CLT as:
$$
\frac{\sum_{i=1}^{n}X_i - n\mu}{\sigma\sqrt{n}} \stackrel{d}{\to} N(0,1)
$$
If we consider each $X_i$ here as a Bernoulli random variable that are independent and identica
|
48,286
|
What is MBConv that EfficientNetv2 is using?
|
The bottleneck_block used as the basic building block of MobileNetv2 is the MBConv (building block of EfficientNets).
Please refer bottle_neck method in https://towardsdatascience.com/mobilenetv2-inverted-residuals-and-linear-bottlenecks-8a4362f4ffd5
MBConvs seek inverted Res nature, which is the exact contrary to the working of ResNets.. It should all be clear in the above link
It can be seen in many papers involving EfficientNets, that MBConvs are basically the structure of MobileNetv2
|
What is MBConv that EfficientNetv2 is using?
|
The bottleneck_block used as the basic building block of MobileNetv2 is the MBConv (building block of EfficientNets).
Please refer bottle_neck method in https://towardsdatascience.com/mobilenetv2-inve
|
What is MBConv that EfficientNetv2 is using?
The bottleneck_block used as the basic building block of MobileNetv2 is the MBConv (building block of EfficientNets).
Please refer bottle_neck method in https://towardsdatascience.com/mobilenetv2-inverted-residuals-and-linear-bottlenecks-8a4362f4ffd5
MBConvs seek inverted Res nature, which is the exact contrary to the working of ResNets.. It should all be clear in the above link
It can be seen in many papers involving EfficientNets, that MBConvs are basically the structure of MobileNetv2
|
What is MBConv that EfficientNetv2 is using?
The bottleneck_block used as the basic building block of MobileNetv2 is the MBConv (building block of EfficientNets).
Please refer bottle_neck method in https://towardsdatascience.com/mobilenetv2-inve
|
48,287
|
Variance involving two independent variables
|
The inequality should follow from the Law of Total Variance. Also, I'm assuming $\alpha \in [0,1]$, as otherwise the construction doesn't make sense.
We need a slightly more formal definition of your compound variable. Let $Z$ be an independent, binary variable with $P(Z=1)=\alpha$, $P(Z=0)=1-\alpha$, and thus we can define $R_2 := Z P + (1-Z)Q$ (I assume this is what you mean).
We consider the variance of $R_2$ using the Law of Total Variance, conditioned on $Z$. I'll use subscripts on $E$ and $Var$ to denote the conditional expectation/variance.
$Var(R_2) = E_Z[Var_Z(R_2)] + Var_Z(E_Z[R_2])$
We want a sufficiently large lower bound on this variance, and we can discard the second term as $\geq 0 $. Then, we can write out the first expectation for the two possible values $Z=1$ and $Z=0$. Recall, if we condition on $Z=1$, then $R_2 = P$.
$ Var(R_2) \geq E_Z[Var_Z(R_2)] = \alpha Var(P) + (1-\alpha)Var(Q)$
Thus, our lower bound is a mixture of $Var(P)$ and $Var(Q)$. Compare this to your variance of $R_1$, and we note that for $\alpha \in [0,1]$, $\alpha \geq \alpha^2$, and $(1-\alpha) \geq (1-\alpha)^2$, which implies
$Var(R_2) \geq Var(R_1).$
While crude, this should be an easy way to understand the intuition behind the bound.
|
Variance involving two independent variables
|
The inequality should follow from the Law of Total Variance. Also, I'm assuming $\alpha \in [0,1]$, as otherwise the construction doesn't make sense.
We need a slightly more formal definition of your
|
Variance involving two independent variables
The inequality should follow from the Law of Total Variance. Also, I'm assuming $\alpha \in [0,1]$, as otherwise the construction doesn't make sense.
We need a slightly more formal definition of your compound variable. Let $Z$ be an independent, binary variable with $P(Z=1)=\alpha$, $P(Z=0)=1-\alpha$, and thus we can define $R_2 := Z P + (1-Z)Q$ (I assume this is what you mean).
We consider the variance of $R_2$ using the Law of Total Variance, conditioned on $Z$. I'll use subscripts on $E$ and $Var$ to denote the conditional expectation/variance.
$Var(R_2) = E_Z[Var_Z(R_2)] + Var_Z(E_Z[R_2])$
We want a sufficiently large lower bound on this variance, and we can discard the second term as $\geq 0 $. Then, we can write out the first expectation for the two possible values $Z=1$ and $Z=0$. Recall, if we condition on $Z=1$, then $R_2 = P$.
$ Var(R_2) \geq E_Z[Var_Z(R_2)] = \alpha Var(P) + (1-\alpha)Var(Q)$
Thus, our lower bound is a mixture of $Var(P)$ and $Var(Q)$. Compare this to your variance of $R_1$, and we note that for $\alpha \in [0,1]$, $\alpha \geq \alpha^2$, and $(1-\alpha) \geq (1-\alpha)^2$, which implies
$Var(R_2) \geq Var(R_1).$
While crude, this should be an easy way to understand the intuition behind the bound.
|
Variance involving two independent variables
The inequality should follow from the Law of Total Variance. Also, I'm assuming $\alpha \in [0,1]$, as otherwise the construction doesn't make sense.
We need a slightly more formal definition of your
|
48,288
|
Why is the explanatory variable non-stochastic or fixed in repeated samples?
|
The main reason is simply for teaching purposes: Assuming fixed explanatory variables ensures that the error term is independent of the (deterministic) variables, $E(u|X) = 0$ holds by definition, see also here. Sometimes you started with fixed / deterministic explanatory variables in a first undergraduate course to explain the basic ideas and algebra. Then proceed with stochastic variables to make clear that in the real world correlation and causality are not always the same.
Wooldridge describes this in his (advanced) textbook Econometric Analysis of Cross Section and Panel Data as follows:
In a first course in econometrics, the method of ordinary least squares (OLS) and
its extensions are usually learned under the fixed regressor assumption. This is appropriate for understanding the mechanics of least squares and for gaining experience
with statistical derivations. Unfortunately, reliance on fixed regressors or, more generally, fixed ‘‘exogenous’’ variables, can have unintended consequences, especially in
more advanced settings. [...] This is not just a technical point: estimation methods that are consistent under the fixed regressor assumption, such as generalized least squares, are no longer consistent when the fixed
regressor assumption is relaxed in interesting ways.
|
Why is the explanatory variable non-stochastic or fixed in repeated samples?
|
The main reason is simply for teaching purposes: Assuming fixed explanatory variables ensures that the error term is independent of the (deterministic) variables, $E(u|X) = 0$ holds by definition, see
|
Why is the explanatory variable non-stochastic or fixed in repeated samples?
The main reason is simply for teaching purposes: Assuming fixed explanatory variables ensures that the error term is independent of the (deterministic) variables, $E(u|X) = 0$ holds by definition, see also here. Sometimes you started with fixed / deterministic explanatory variables in a first undergraduate course to explain the basic ideas and algebra. Then proceed with stochastic variables to make clear that in the real world correlation and causality are not always the same.
Wooldridge describes this in his (advanced) textbook Econometric Analysis of Cross Section and Panel Data as follows:
In a first course in econometrics, the method of ordinary least squares (OLS) and
its extensions are usually learned under the fixed regressor assumption. This is appropriate for understanding the mechanics of least squares and for gaining experience
with statistical derivations. Unfortunately, reliance on fixed regressors or, more generally, fixed ‘‘exogenous’’ variables, can have unintended consequences, especially in
more advanced settings. [...] This is not just a technical point: estimation methods that are consistent under the fixed regressor assumption, such as generalized least squares, are no longer consistent when the fixed
regressor assumption is relaxed in interesting ways.
|
Why is the explanatory variable non-stochastic or fixed in repeated samples?
The main reason is simply for teaching purposes: Assuming fixed explanatory variables ensures that the error term is independent of the (deterministic) variables, $E(u|X) = 0$ holds by definition, see
|
48,289
|
Why is the explanatory variable non-stochastic or fixed in repeated samples?
|
I assume this is a regression model. The main reason is inferential, the explanatory variable(s) are treated as fixed for purposes of inference. The regression model $Y= X\beta + \epsilon$ is a model for the conditional expectation of $Y$ given $X$: $\DeclareMathOperator{\E}{\mathbb{E}} \E\left\{ Y | X=x\right\} = x^T \beta$ which is assumed to hold whichever value of $x$, so variation in $x$ has no role in describing that relation.
For more details see What is the difference between conditioning on regressors vs. treating them as fixed?
|
Why is the explanatory variable non-stochastic or fixed in repeated samples?
|
I assume this is a regression model. The main reason is inferential, the explanatory variable(s) are treated as fixed for purposes of inference. The regression model $Y= X\beta + \epsilon$ is a model
|
Why is the explanatory variable non-stochastic or fixed in repeated samples?
I assume this is a regression model. The main reason is inferential, the explanatory variable(s) are treated as fixed for purposes of inference. The regression model $Y= X\beta + \epsilon$ is a model for the conditional expectation of $Y$ given $X$: $\DeclareMathOperator{\E}{\mathbb{E}} \E\left\{ Y | X=x\right\} = x^T \beta$ which is assumed to hold whichever value of $x$, so variation in $x$ has no role in describing that relation.
For more details see What is the difference between conditioning on regressors vs. treating them as fixed?
|
Why is the explanatory variable non-stochastic or fixed in repeated samples?
I assume this is a regression model. The main reason is inferential, the explanatory variable(s) are treated as fixed for purposes of inference. The regression model $Y= X\beta + \epsilon$ is a model
|
48,290
|
Why do we need Gumbel distribution?
|
Given a sample of iid $\{ X_1, ..., X_n \}$, we can compute its maximum $Y = \max \{ X_1, ..., X_n \}$. The question is, if the values of the sample follow a distribution $P(X)$, what is the distribution for the maximum value of the sample, $P(Y)$?
It can be shown that depending on the form of $P(X)$ in the limit $X\to\inf$, the form of $P(Y)$ changes. If $P(X)$ decays as a power-law for $X\to\inf$, then $P(Y)$ is a Frechet distribution. If there's a finite end-point $x_0$ which is approached as $(x_0-x)^\alpha$, then it follows a Weibull distribution, whose parameters can be easily written as a function of the sample size $n$. If $P(X)$ decays faster than a power-law, then $P(Y)$ is a Gumbel distribution (I'm not sure one can write its parameters as a function of $n$ as in the case of the Weibull). This is important because it shows universal behavior, i.e. details don't matter so it's the same for $e^{-x}$, $e^{-x^2}$ or any other form. Only matters that it decays faster than a power-law. You can see it in this book, page 24. Also, note that the discussion here for maximums also applies to minimums if we talk about the properties of the left tail of $P(X)$ instead of its right tail.
However, these results are only valid in the limit of an infinite sample size. If you want to have the exact result for finite $n$, you will need to compute by yourself the form of $P(Y)$ for the specific distribution $P(X)$, as shown e.g. here.
|
Why do we need Gumbel distribution?
|
Given a sample of iid $\{ X_1, ..., X_n \}$, we can compute its maximum $Y = \max \{ X_1, ..., X_n \}$. The question is, if the values of the sample follow a distribution $P(X)$, what is the distribut
|
Why do we need Gumbel distribution?
Given a sample of iid $\{ X_1, ..., X_n \}$, we can compute its maximum $Y = \max \{ X_1, ..., X_n \}$. The question is, if the values of the sample follow a distribution $P(X)$, what is the distribution for the maximum value of the sample, $P(Y)$?
It can be shown that depending on the form of $P(X)$ in the limit $X\to\inf$, the form of $P(Y)$ changes. If $P(X)$ decays as a power-law for $X\to\inf$, then $P(Y)$ is a Frechet distribution. If there's a finite end-point $x_0$ which is approached as $(x_0-x)^\alpha$, then it follows a Weibull distribution, whose parameters can be easily written as a function of the sample size $n$. If $P(X)$ decays faster than a power-law, then $P(Y)$ is a Gumbel distribution (I'm not sure one can write its parameters as a function of $n$ as in the case of the Weibull). This is important because it shows universal behavior, i.e. details don't matter so it's the same for $e^{-x}$, $e^{-x^2}$ or any other form. Only matters that it decays faster than a power-law. You can see it in this book, page 24. Also, note that the discussion here for maximums also applies to minimums if we talk about the properties of the left tail of $P(X)$ instead of its right tail.
However, these results are only valid in the limit of an infinite sample size. If you want to have the exact result for finite $n$, you will need to compute by yourself the form of $P(Y)$ for the specific distribution $P(X)$, as shown e.g. here.
|
Why do we need Gumbel distribution?
Given a sample of iid $\{ X_1, ..., X_n \}$, we can compute its maximum $Y = \max \{ X_1, ..., X_n \}$. The question is, if the values of the sample follow a distribution $P(X)$, what is the distribut
|
48,291
|
Multivariate Normal Distribution: Divide each random variable by its standard deviation
|
So, let's say $X=[X_1,...,X_n]$, and your new vector is $Y=[X_1/\sigma_1, ...,X_n/\sigma_n]$. For each pair $i,j$, the new covariance entries will be
$$(\Sigma_Y)_{ij}=\operatorname{cov}(X_i/\sigma_i, X_j/\sigma_j)=\frac{\operatorname{cov}(X_i,X_j)}{\sigma_i\sigma_j}=\frac{(\Sigma_X)_{ij}}{\sigma_i\sigma_j}$$
Note that, the diagonal entries will all be $1$ (assuming no degenerate entries exist).
|
Multivariate Normal Distribution: Divide each random variable by its standard deviation
|
So, let's say $X=[X_1,...,X_n]$, and your new vector is $Y=[X_1/\sigma_1, ...,X_n/\sigma_n]$. For each pair $i,j$, the new covariance entries will be
$$(\Sigma_Y)_{ij}=\operatorname{cov}(X_i/\sigma_i,
|
Multivariate Normal Distribution: Divide each random variable by its standard deviation
So, let's say $X=[X_1,...,X_n]$, and your new vector is $Y=[X_1/\sigma_1, ...,X_n/\sigma_n]$. For each pair $i,j$, the new covariance entries will be
$$(\Sigma_Y)_{ij}=\operatorname{cov}(X_i/\sigma_i, X_j/\sigma_j)=\frac{\operatorname{cov}(X_i,X_j)}{\sigma_i\sigma_j}=\frac{(\Sigma_X)_{ij}}{\sigma_i\sigma_j}$$
Note that, the diagonal entries will all be $1$ (assuming no degenerate entries exist).
|
Multivariate Normal Distribution: Divide each random variable by its standard deviation
So, let's say $X=[X_1,...,X_n]$, and your new vector is $Y=[X_1/\sigma_1, ...,X_n/\sigma_n]$. For each pair $i,j$, the new covariance entries will be
$$(\Sigma_Y)_{ij}=\operatorname{cov}(X_i/\sigma_i,
|
48,292
|
Help finding MGF of mixture distribution
|
You want the moment generating function $M_X(t)=\mathbb{E}[e^{tX}]$.
Read this to understand why $\mathbb{E}[e^{tX}]=\mathbb{E}[\mathbb{E}[e^{tX}\mid N]]$.
The information given in the problem statement gives you
$$\mathbb{E}[e^{tX}\mid N]=(1-p+e^tp)^N. \qquad\qquad \text{(why?)}$$
Defining $e^u:=1-p+e^tp$, and using the expression of the moment generating function of a random variable with Poisson distribution given in the problem statement, you're done; just express the result as a function of $t$.
|
Help finding MGF of mixture distribution
|
You want the moment generating function $M_X(t)=\mathbb{E}[e^{tX}]$.
Read this to understand why $\mathbb{E}[e^{tX}]=\mathbb{E}[\mathbb{E}[e^{tX}\mid N]]$.
The information given in the problem stateme
|
Help finding MGF of mixture distribution
You want the moment generating function $M_X(t)=\mathbb{E}[e^{tX}]$.
Read this to understand why $\mathbb{E}[e^{tX}]=\mathbb{E}[\mathbb{E}[e^{tX}\mid N]]$.
The information given in the problem statement gives you
$$\mathbb{E}[e^{tX}\mid N]=(1-p+e^tp)^N. \qquad\qquad \text{(why?)}$$
Defining $e^u:=1-p+e^tp$, and using the expression of the moment generating function of a random variable with Poisson distribution given in the problem statement, you're done; just express the result as a function of $t$.
|
Help finding MGF of mixture distribution
You want the moment generating function $M_X(t)=\mathbb{E}[e^{tX}]$.
Read this to understand why $\mathbb{E}[e^{tX}]=\mathbb{E}[\mathbb{E}[e^{tX}\mid N]]$.
The information given in the problem stateme
|
48,293
|
Non-mathematical explanation of how to interpret and evaluate scoring rules in R
|
Scoring rules are cost functions that evaluate how far probabilistic predictions deviate from observations. Proper scoring rules have minimum cost when true probabilities are reported; strictly proper scoring rules have minimum cost only when true probabilities are reported.
The choice of scoring rule is closely connected to "how to translate these results into real-world decision making." If misclassification costs are scaled so that the cost of a false positive is $c$ and that of a false negative is $(1-c)$, then the minimum-cost cutoff for classification is at a probability of $c$.*
The Wikipedia section on Interpretation of proper scoring rules is worth quoting in detail, as it shows how this idea extends over the entire probability range to construct proper scoring rules:
All proper scoring rules are equal to weighted sums ... of the losses in a set of simple two-alternative decision problems that use the probabilistic prediction, each such decision problem having a particular combination of associated cost parameters for false positive and false negative decisions. A strictly proper scoring rule corresponds to having a nonzero weighting for all possible decision thresholds. Any given proper scoring rule is equal to the expected losses with respect to a particular probability distribution over the decision thresholds; thus the choice of a scoring rule corresponds to an assumption about the probability distribution of decision problems for which the predicted probabilities will ultimately be employed...
So the choice of scoring rule comes down to how much weight you want to place on different portions of the probability scale or, equivalently, at different relative false-positive and false-negative costs. For example, the log-loss used in logistic regression puts a lot of weight on correct probabilities at the extremes. That might not always be the best choice.
I've found "Loss Functions for Binary Class Probability Estimation and Classification: Structure and Applications," by Andreas Buja, Werner Stuetzle, and Yi Shen (2005) to be very helpful in thinking through these issues. Some of it is perhaps a bit more heavily mathematical than this question asks for, but there is enough non-mathematical content to make the fundamental issues pretty clear.
Those authors show how to fit linear models with proper scoring rules via iteratively reweighted least squares. They also describe a family of scoring rules related to beta functions that can differentially weight regions of the probability scale, and how several scoring rules--boosting loss, log loss, squared error (Brier score)--and even misclassification error (as a limiting case) can be expressed within that family.
That family is implemented in the scoring package to which you link, although perhaps not very clearly explained there (it's a fam option in the calcscore() function). There is a less mathematical, more application-oriented presentation by E. C. Merkle (package author) and M. Steyvers, "Choosing a Strictly Proper Scoring Rule," Decision Analysis
Vol. 10, No. 4, December 2013, pp. 292–304. That paper explains other families of scoring rules implemented in the package, and should be a good starting point for study.
*That answer also shows how to incorporate gains from correct classifications into this schema, following O'Brien et al, "Cost-sensitive Multi-class Classification from Probability Estimates," Proceedings of the 25th International Conference on Machine Learning, Helsinki, Finland, 2008.
|
Non-mathematical explanation of how to interpret and evaluate scoring rules in R
|
Scoring rules are cost functions that evaluate how far probabilistic predictions deviate from observations. Proper scoring rules have minimum cost when true probabilities are reported; strictly proper
|
Non-mathematical explanation of how to interpret and evaluate scoring rules in R
Scoring rules are cost functions that evaluate how far probabilistic predictions deviate from observations. Proper scoring rules have minimum cost when true probabilities are reported; strictly proper scoring rules have minimum cost only when true probabilities are reported.
The choice of scoring rule is closely connected to "how to translate these results into real-world decision making." If misclassification costs are scaled so that the cost of a false positive is $c$ and that of a false negative is $(1-c)$, then the minimum-cost cutoff for classification is at a probability of $c$.*
The Wikipedia section on Interpretation of proper scoring rules is worth quoting in detail, as it shows how this idea extends over the entire probability range to construct proper scoring rules:
All proper scoring rules are equal to weighted sums ... of the losses in a set of simple two-alternative decision problems that use the probabilistic prediction, each such decision problem having a particular combination of associated cost parameters for false positive and false negative decisions. A strictly proper scoring rule corresponds to having a nonzero weighting for all possible decision thresholds. Any given proper scoring rule is equal to the expected losses with respect to a particular probability distribution over the decision thresholds; thus the choice of a scoring rule corresponds to an assumption about the probability distribution of decision problems for which the predicted probabilities will ultimately be employed...
So the choice of scoring rule comes down to how much weight you want to place on different portions of the probability scale or, equivalently, at different relative false-positive and false-negative costs. For example, the log-loss used in logistic regression puts a lot of weight on correct probabilities at the extremes. That might not always be the best choice.
I've found "Loss Functions for Binary Class Probability Estimation and Classification: Structure and Applications," by Andreas Buja, Werner Stuetzle, and Yi Shen (2005) to be very helpful in thinking through these issues. Some of it is perhaps a bit more heavily mathematical than this question asks for, but there is enough non-mathematical content to make the fundamental issues pretty clear.
Those authors show how to fit linear models with proper scoring rules via iteratively reweighted least squares. They also describe a family of scoring rules related to beta functions that can differentially weight regions of the probability scale, and how several scoring rules--boosting loss, log loss, squared error (Brier score)--and even misclassification error (as a limiting case) can be expressed within that family.
That family is implemented in the scoring package to which you link, although perhaps not very clearly explained there (it's a fam option in the calcscore() function). There is a less mathematical, more application-oriented presentation by E. C. Merkle (package author) and M. Steyvers, "Choosing a Strictly Proper Scoring Rule," Decision Analysis
Vol. 10, No. 4, December 2013, pp. 292–304. That paper explains other families of scoring rules implemented in the package, and should be a good starting point for study.
*That answer also shows how to incorporate gains from correct classifications into this schema, following O'Brien et al, "Cost-sensitive Multi-class Classification from Probability Estimates," Proceedings of the 25th International Conference on Machine Learning, Helsinki, Finland, 2008.
|
Non-mathematical explanation of how to interpret and evaluate scoring rules in R
Scoring rules are cost functions that evaluate how far probabilistic predictions deviate from observations. Proper scoring rules have minimum cost when true probabilities are reported; strictly proper
|
48,294
|
Asymptotic equivalence of Likelihood Ratio Statistic and Wald Statistic?
|
Either the number of binomial trials or the number of observations will do; usually we think of this result as applying more generally than binomial data and so think of the number of observations as the $n\to\infty$.
It's also important to note that the asymptotic equivalence is local. Suppose 0 is the null value of $\theta$. If you set $\theta=\theta_A=\neq 0$ and take $n$ observations with that value of $\theta$, $n\to\infty$, there is no guarantee that the the test statistics will approach each other. The standard result is that if you take have a sequence values $\theta_n=h/\sqrt{n}$ and take $n$ observations with $\theta=\theta_n$, then as $n\to\infty$ the score, Wald, and likelihood ratio tests will converge in probability to the same random variable.
Here's the picture: on a graph with the score (derivative of loglikelihood) on the $y$-axis and $\theta$ on the $x$-axis, the Wald chi-squared statistic is twice the area of the blue triangle. The score chi-squared statistic is twice the area of the red triangle, and the likelihood ratio chi-squared statistic is twice the grey area under the curve.
With $n\to\infty$ and $\theta_n=h/\sqrt{n}$, we're zooming in to this picture. The curve locally asymptotically approaches a straight line and the three coloured areas become the same
But if you fix $\theta\neq 0$ and just increase $n$, the picture doesn't change. It still just looks like
and there's no asymptotic equivalence.
|
Asymptotic equivalence of Likelihood Ratio Statistic and Wald Statistic?
|
Either the number of binomial trials or the number of observations will do; usually we think of this result as applying more generally than binomial data and so think of the number of observations as
|
Asymptotic equivalence of Likelihood Ratio Statistic and Wald Statistic?
Either the number of binomial trials or the number of observations will do; usually we think of this result as applying more generally than binomial data and so think of the number of observations as the $n\to\infty$.
It's also important to note that the asymptotic equivalence is local. Suppose 0 is the null value of $\theta$. If you set $\theta=\theta_A=\neq 0$ and take $n$ observations with that value of $\theta$, $n\to\infty$, there is no guarantee that the the test statistics will approach each other. The standard result is that if you take have a sequence values $\theta_n=h/\sqrt{n}$ and take $n$ observations with $\theta=\theta_n$, then as $n\to\infty$ the score, Wald, and likelihood ratio tests will converge in probability to the same random variable.
Here's the picture: on a graph with the score (derivative of loglikelihood) on the $y$-axis and $\theta$ on the $x$-axis, the Wald chi-squared statistic is twice the area of the blue triangle. The score chi-squared statistic is twice the area of the red triangle, and the likelihood ratio chi-squared statistic is twice the grey area under the curve.
With $n\to\infty$ and $\theta_n=h/\sqrt{n}$, we're zooming in to this picture. The curve locally asymptotically approaches a straight line and the three coloured areas become the same
But if you fix $\theta\neq 0$ and just increase $n$, the picture doesn't change. It still just looks like
and there's no asymptotic equivalence.
|
Asymptotic equivalence of Likelihood Ratio Statistic and Wald Statistic?
Either the number of binomial trials or the number of observations will do; usually we think of this result as applying more generally than binomial data and so think of the number of observations as
|
48,295
|
Whether the minimal sufficient statistic is complete for a translated exponential distribution
|
Lemma The minimal sufficient statistic $\left(X_{(1)},\sum_{i=2}^n \{X_{(i)}-X_{(1)}\}\right)$ is not complete.
Proof. The joint distribution of $$\left(X_{(1)},\sum_{i=2}^n \{X_{(i)}-X_{(1)}\}\right)$$
is the product of an Exponential $\mathcal E(n/\theta^2)$ translated by $\theta$ and of a $\mathcal Ga(n-1,1/\theta^2)$ [the proof follows from Sukhatme's Theorem, 1937, recalled in Devroye's simulation bible (1986, p.211)]. This means that $X_{(1)}$ can be represented as
$$X_{(1)}=\frac{\theta^2}{n}\varepsilon+\theta\qquad\varepsilon\sim\mathcal E(1)$$
that $Y$ is scaled by $\theta^2$ since
$$Y=\sum_{i=2}^n \{X_{(i)}-X_{(1)}\}=\theta^2 \eta\qquad\eta\sim\mathcal Ga(n-1,1)$$
and that
$$\mathbb E_\theta\left[ Y^\frac{1}{2}\right]=\theta \frac{\Gamma(n-1/2)}{\Gamma(n-1)}$$
Therefore,
$$\mathbb E_\theta\left[X_{(1)}-\frac{\Gamma(n-1)}{\Gamma(n-1/2)}Y^\frac{1}{2}\right]=\frac{\theta^2}{n}$$
eliminates the location part in $X_{(1)}$ and suggests dividing by $Y$ to remove the scale part: since
$$\mathbb E_\theta\left[ Y^\frac{-1}{2}\right]=\theta^{-1} \frac{\Gamma(n-3/2)}{\Gamma(n-1)}\qquad \mathbb E_\theta\left[ Y^{-1}\right]=\theta^{-2} \frac{\Gamma(n-2)}{\Gamma(n-1)}$$
we have (for an arbitrary $\gamma)$ that
$$\mathbb E_\theta\left[\frac{X_{(1)}-\gamma Y^\frac{1}{2}}{Y}\right]=\frac{\Gamma(n-2)}{n\Gamma(n-1)}+\frac{\theta^{-1}\Gamma(n-2)}{\Gamma(n-1)}- \frac{\gamma \theta^{-1}\Gamma(n-3/2)}{\Gamma(n-1)}
$$
Setting
$$\gamma=\frac{\Gamma(n-2)}{\Gamma(n-3/2)}$$
leads to
$$\mathbb E_\theta\left[\frac{X_{(1)}-\gamma Y^\frac{1}{2}}{Y}\right]=\frac{\Gamma(n-2)}{n\Gamma(n-1)}$$
which is constant in $\theta$. Therefore this concludes the proof.
As pointed out by Sextus Empiricus, this is not the only transform of the sufficient statistic with constant expectation. His proposal
$$\mathbb E_\theta\left[ X - \frac{1}{n(n-1)}Y- \frac{\Gamma(n-1)}{\Gamma(n-1/2)}Y^{1/2}\right] = 0$$is an alternative.
|
Whether the minimal sufficient statistic is complete for a translated exponential distribution
|
Lemma The minimal sufficient statistic $\left(X_{(1)},\sum_{i=2}^n \{X_{(i)}-X_{(1)}\}\right)$ is not complete.
Proof. The joint distribution of $$\left(X_{(1)},\sum_{i=2}^n \{X_{(i)}-X_{(1)}\}\righ
|
Whether the minimal sufficient statistic is complete for a translated exponential distribution
Lemma The minimal sufficient statistic $\left(X_{(1)},\sum_{i=2}^n \{X_{(i)}-X_{(1)}\}\right)$ is not complete.
Proof. The joint distribution of $$\left(X_{(1)},\sum_{i=2}^n \{X_{(i)}-X_{(1)}\}\right)$$
is the product of an Exponential $\mathcal E(n/\theta^2)$ translated by $\theta$ and of a $\mathcal Ga(n-1,1/\theta^2)$ [the proof follows from Sukhatme's Theorem, 1937, recalled in Devroye's simulation bible (1986, p.211)]. This means that $X_{(1)}$ can be represented as
$$X_{(1)}=\frac{\theta^2}{n}\varepsilon+\theta\qquad\varepsilon\sim\mathcal E(1)$$
that $Y$ is scaled by $\theta^2$ since
$$Y=\sum_{i=2}^n \{X_{(i)}-X_{(1)}\}=\theta^2 \eta\qquad\eta\sim\mathcal Ga(n-1,1)$$
and that
$$\mathbb E_\theta\left[ Y^\frac{1}{2}\right]=\theta \frac{\Gamma(n-1/2)}{\Gamma(n-1)}$$
Therefore,
$$\mathbb E_\theta\left[X_{(1)}-\frac{\Gamma(n-1)}{\Gamma(n-1/2)}Y^\frac{1}{2}\right]=\frac{\theta^2}{n}$$
eliminates the location part in $X_{(1)}$ and suggests dividing by $Y$ to remove the scale part: since
$$\mathbb E_\theta\left[ Y^\frac{-1}{2}\right]=\theta^{-1} \frac{\Gamma(n-3/2)}{\Gamma(n-1)}\qquad \mathbb E_\theta\left[ Y^{-1}\right]=\theta^{-2} \frac{\Gamma(n-2)}{\Gamma(n-1)}$$
we have (for an arbitrary $\gamma)$ that
$$\mathbb E_\theta\left[\frac{X_{(1)}-\gamma Y^\frac{1}{2}}{Y}\right]=\frac{\Gamma(n-2)}{n\Gamma(n-1)}+\frac{\theta^{-1}\Gamma(n-2)}{\Gamma(n-1)}- \frac{\gamma \theta^{-1}\Gamma(n-3/2)}{\Gamma(n-1)}
$$
Setting
$$\gamma=\frac{\Gamma(n-2)}{\Gamma(n-3/2)}$$
leads to
$$\mathbb E_\theta\left[\frac{X_{(1)}-\gamma Y^\frac{1}{2}}{Y}\right]=\frac{\Gamma(n-2)}{n\Gamma(n-1)}$$
which is constant in $\theta$. Therefore this concludes the proof.
As pointed out by Sextus Empiricus, this is not the only transform of the sufficient statistic with constant expectation. His proposal
$$\mathbb E_\theta\left[ X - \frac{1}{n(n-1)}Y- \frac{\Gamma(n-1)}{\Gamma(n-1/2)}Y^{1/2}\right] = 0$$is an alternative.
|
Whether the minimal sufficient statistic is complete for a translated exponential distribution
Lemma The minimal sufficient statistic $\left(X_{(1)},\sum_{i=2}^n \{X_{(i)}-X_{(1)}\}\right)$ is not complete.
Proof. The joint distribution of $$\left(X_{(1)},\sum_{i=2}^n \{X_{(i)}-X_{(1)}\}\righ
|
48,296
|
Can we ALWAYS assume normal distribution if n >30?
|
My strategy is to look at the distribution of the data before statistical tests between two groups via histograms, q-q plots, and Shapiro Wilk test. If the data is approximately normal I use an appropriate test (t-test, ANOVA, Linear Regression etc). If not I use an appropriate non-parametric method (Mann-Whitney Test, Kruskal-Wallis, Bootstrap regression model).
What is 'approximately normal'? Do you need to pass a hypothesis test to be sufficiently approximate normal?
A problem is that those tests for normality are becoming more powerful (more likely to reject normality) when the sample size is increasing, and can even reject in the case of very small deviations. And ironically for larger sample sizes deviations from normality are less important.
My coworker doesn't look at the distribution if the sample is >30 or >50 he automatically assumes it is normal and cites the central limit theorem for using the t-test or ANOVA.
Can we ALWAYS assume normal distribution if n >30?
It is a bit strong to say 'always'. Also it is not correct to say that normality can be assumed (instead we can say that the impact of the deviation from normality can be negligible).
The problem that the article from Morten W Fagerland addresses is not whether the t-test works if n>30 (it does not work so well for n=30 which can also be seen in the graph, and it requires large numbers like their table which used sample size 1000). The problem is that a non-parametric test like Wilcoxon-Mann-Whitney (WMW) is not the right solution, and this is because WMW is answering a different question. The WMW test is not a test for equality of means or medians.
In the article it is not said to 'never' use WMW. Or to always use a t-test.
Is the WMW test a bad test? No, but it is not always an appropriate alternative to the t-test. The WMW test is most useful for the analysis of ordinal data and may also be used in smaller studies, under certain conditions, to compare means or medians.
Depending on the situation, a person might always use a t-test without analysing the normality, because of experience with distributions that might occur. Sure, one can think of examples/situations where t-tests in samples of 30 or 50 are a lot less powerful (too high p-values), but if you never deal with these examples then you can always use a t-test.
Something else.
If you have a sample size of 1000 then you might consider that not only the mean is important and you could look at more than just differences in means. In that case a WMW test is actually not a bad idea.
|
Can we ALWAYS assume normal distribution if n >30?
|
My strategy is to look at the distribution of the data before statistical tests between two groups via histograms, q-q plots, and Shapiro Wilk test. If the data is approximately normal I use an approp
|
Can we ALWAYS assume normal distribution if n >30?
My strategy is to look at the distribution of the data before statistical tests between two groups via histograms, q-q plots, and Shapiro Wilk test. If the data is approximately normal I use an appropriate test (t-test, ANOVA, Linear Regression etc). If not I use an appropriate non-parametric method (Mann-Whitney Test, Kruskal-Wallis, Bootstrap regression model).
What is 'approximately normal'? Do you need to pass a hypothesis test to be sufficiently approximate normal?
A problem is that those tests for normality are becoming more powerful (more likely to reject normality) when the sample size is increasing, and can even reject in the case of very small deviations. And ironically for larger sample sizes deviations from normality are less important.
My coworker doesn't look at the distribution if the sample is >30 or >50 he automatically assumes it is normal and cites the central limit theorem for using the t-test or ANOVA.
Can we ALWAYS assume normal distribution if n >30?
It is a bit strong to say 'always'. Also it is not correct to say that normality can be assumed (instead we can say that the impact of the deviation from normality can be negligible).
The problem that the article from Morten W Fagerland addresses is not whether the t-test works if n>30 (it does not work so well for n=30 which can also be seen in the graph, and it requires large numbers like their table which used sample size 1000). The problem is that a non-parametric test like Wilcoxon-Mann-Whitney (WMW) is not the right solution, and this is because WMW is answering a different question. The WMW test is not a test for equality of means or medians.
In the article it is not said to 'never' use WMW. Or to always use a t-test.
Is the WMW test a bad test? No, but it is not always an appropriate alternative to the t-test. The WMW test is most useful for the analysis of ordinal data and may also be used in smaller studies, under certain conditions, to compare means or medians.
Depending on the situation, a person might always use a t-test without analysing the normality, because of experience with distributions that might occur. Sure, one can think of examples/situations where t-tests in samples of 30 or 50 are a lot less powerful (too high p-values), but if you never deal with these examples then you can always use a t-test.
Something else.
If you have a sample size of 1000 then you might consider that not only the mean is important and you could look at more than just differences in means. In that case a WMW test is actually not a bad idea.
|
Can we ALWAYS assume normal distribution if n >30?
My strategy is to look at the distribution of the data before statistical tests between two groups via histograms, q-q plots, and Shapiro Wilk test. If the data is approximately normal I use an approp
|
48,297
|
Can we ALWAYS assume normal distribution if n >30?
|
The data does NOT get closer to being normally distributed as the sample size grows.
Rather, the thing that gets closer to being normally distributed is the sample mean or the sample sum.
And if the population distribution is very skewed, then you may need far more than $30,$ and it it isn't then maybe $10$ would be enough.
|
Can we ALWAYS assume normal distribution if n >30?
|
The data does NOT get closer to being normally distributed as the sample size grows.
Rather, the thing that gets closer to being normally distributed is the sample mean or the sample sum.
And if the p
|
Can we ALWAYS assume normal distribution if n >30?
The data does NOT get closer to being normally distributed as the sample size grows.
Rather, the thing that gets closer to being normally distributed is the sample mean or the sample sum.
And if the population distribution is very skewed, then you may need far more than $30,$ and it it isn't then maybe $10$ would be enough.
|
Can we ALWAYS assume normal distribution if n >30?
The data does NOT get closer to being normally distributed as the sample size grows.
Rather, the thing that gets closer to being normally distributed is the sample mean or the sample sum.
And if the p
|
48,298
|
Forward algorithm vs Forward–backward algorithm
|
What you are referring to is called fixed-lag smoothing (see the Wikipedia article on the topic). The idea of fixed-lag smoothing is to use $k$ observations to infer the hidden state at time $k-N$. In other words, you wait for a time $N$ (which is called the lag) to gather more information about the state at time $k-N$. Having gathered your $k$ observations, you then perform smoothing (i.e. a forward-backward procedure to compute $p(x_{k-N}|o_1 \dots o_k)$) instead of filtering (i.e. a forward procedure to compute $p(x_{k-N}|o_1 \dots o_{k-N})$).
The estimation improvement is going to depend on your system. Generally, smoothing is more precise than filtering, but also more complex: you will have to find a trade-off between estimation accuracy and computational complexity. Running simulations might be of help. An interesting reference on the subject:
Moore, J. B. (1973). Discrete-time fixed-lag smoothing algorithms. Automatica, 9(2), 163-173.
Just a side comment : by "live estimate for the state", I guess that your are referring to filtering. Most filtering methods are not online (i.e. they cannot be used on the fly as observations are being recorded), since their algorithmic complexity increases with the number of acquired observations. Some approximations need to be done to make the complexity time-independent.
|
Forward algorithm vs Forward–backward algorithm
|
What you are referring to is called fixed-lag smoothing (see the Wikipedia article on the topic). The idea of fixed-lag smoothing is to use $k$ observations to infer the hidden state at time $k-N$. In
|
Forward algorithm vs Forward–backward algorithm
What you are referring to is called fixed-lag smoothing (see the Wikipedia article on the topic). The idea of fixed-lag smoothing is to use $k$ observations to infer the hidden state at time $k-N$. In other words, you wait for a time $N$ (which is called the lag) to gather more information about the state at time $k-N$. Having gathered your $k$ observations, you then perform smoothing (i.e. a forward-backward procedure to compute $p(x_{k-N}|o_1 \dots o_k)$) instead of filtering (i.e. a forward procedure to compute $p(x_{k-N}|o_1 \dots o_{k-N})$).
The estimation improvement is going to depend on your system. Generally, smoothing is more precise than filtering, but also more complex: you will have to find a trade-off between estimation accuracy and computational complexity. Running simulations might be of help. An interesting reference on the subject:
Moore, J. B. (1973). Discrete-time fixed-lag smoothing algorithms. Automatica, 9(2), 163-173.
Just a side comment : by "live estimate for the state", I guess that your are referring to filtering. Most filtering methods are not online (i.e. they cannot be used on the fly as observations are being recorded), since their algorithmic complexity increases with the number of acquired observations. Some approximations need to be done to make the complexity time-independent.
|
Forward algorithm vs Forward–backward algorithm
What you are referring to is called fixed-lag smoothing (see the Wikipedia article on the topic). The idea of fixed-lag smoothing is to use $k$ observations to infer the hidden state at time $k-N$. In
|
48,299
|
What is the role of non-anchor items when equating scales across studies using IRT?
|
It is entirely possible to equate the test forms if the items common across all three forms contain no response bias (i.e., DIF). All that would be required is to estimate a multiple-group IRT model with equality constraints for the respective anchor items across all test versions (there may be larger blocks of missing data for datasets that did not respond to the respective items, but that's not a statistical issue), as well as freely estimating the scaling parameters for the latent traits in the focal groups. As well, if there is a sufficient number of common items across the forms it may be possible to test for DIF in more suspect items, but more information is needed on how many items are common across the forms.
Yes, non-anchor items add information to the equating process, thereby improving the quality of the equating. You can think of the non-anchor items as adding measurement precision to the respective latent trait estimates for each individual, which in turn helps the accuracy of the equating process by way of borrowing strength from other aspects of the model.
|
What is the role of non-anchor items when equating scales across studies using IRT?
|
It is entirely possible to equate the test forms if the items common across all three forms contain no response bias (i.e., DIF). All that would be required is to estimate a multiple-group IRT model w
|
What is the role of non-anchor items when equating scales across studies using IRT?
It is entirely possible to equate the test forms if the items common across all three forms contain no response bias (i.e., DIF). All that would be required is to estimate a multiple-group IRT model with equality constraints for the respective anchor items across all test versions (there may be larger blocks of missing data for datasets that did not respond to the respective items, but that's not a statistical issue), as well as freely estimating the scaling parameters for the latent traits in the focal groups. As well, if there is a sufficient number of common items across the forms it may be possible to test for DIF in more suspect items, but more information is needed on how many items are common across the forms.
Yes, non-anchor items add information to the equating process, thereby improving the quality of the equating. You can think of the non-anchor items as adding measurement precision to the respective latent trait estimates for each individual, which in turn helps the accuracy of the equating process by way of borrowing strength from other aspects of the model.
|
What is the role of non-anchor items when equating scales across studies using IRT?
It is entirely possible to equate the test forms if the items common across all three forms contain no response bias (i.e., DIF). All that would be required is to estimate a multiple-group IRT model w
|
48,300
|
Inverse Gaussian chi square connection
|
The proof is not exactly standard, although it relates to the "law of the unconscious statistician" [an expression I cannot fathom and do not find amusing] :
First, define $Y=\min\{X,\mu^2/X\}$ which belongs to $(0,\mu)$. The density of $Y$ can be derived from $(y<\mu)$
$$\mathbb P(Y\le y) = \mathbb P(X\le y)+\mathbb P(\mu^2/X \le y\,,\,X>\mu)$$
as
$$f_Y(y;\mu,\lambda)=\left\{f_X(y)+\frac{\mu^2}{y^2}f_X(\mu^2/y)\right\}\mathbb I_{(0,\mu)}(y)$$
And if we notice that
$$\dfrac{(\mu-\mu^2/y)^2}{\mu^2\,\mu^2/y}=\dfrac{(\mu-\mu^2/y)^2}{\mu^2\,\mu^2/y}=\dfrac{(\mu-y)^2}{\mu^2\,y}$$
which is also why $Z=\frac{(X-\mu)^2}{\mu^2X}$, then
\begin{align}f_Y(y;\mu,\lambda)&=\sqrt{\frac{\lambda}{2\pi}}\,e^{-\frac{\lambda(\mu-y)^2}{2\mu^2\,y}}\left\{y^{-3/2}+\mu^{-1}\,y^{-1/2} \right\}\\
&=\sqrt{\frac{\lambda}{2\pi}}\,e^{-\frac{\lambda(\mu-y)^2}{2\mu^2\,y}}\,y^{-3/2}\mu^{-1}\,(\mu+y)\end{align}
If we consider the transform$$H(y) = \dfrac{\lambda(\mu-y)^2}{\mu^2\,y}$$
then
\begin{align}\left\vert\dfrac{\text{d}H(y)}{\text{d}y}\right\vert
&=\frac{\lambda}{\mu^2}
\frac{(\mu-y)}{y}\left\{\frac{\mu-y}{y}+2 \right\}\\
&=\frac{\lambda}{\mu^2}\frac{(\mu-y)(\mu+y)}{y^2}\\
&=\frac{\sqrt{\lambda}}{\mu}H(y)^{1/2}\frac{(\mu+y)}{y^{3/2}}
\end{align}
Which leads to
$$\require{enclose}
f_Y(y;\mu,\lambda)\text{d}y=\frac{1}{\sqrt{2\pi}}\,e^{-z/2}\,z^{-1/2}\frac{\text{d}z}{\enclose{horizontalstrike}{\text{d}y}}\,\enclose{horizontalstrike}{\text{d}y}=f_Z(z;\mu,\lambda)\text{d}z$$
i.e., a chi-square $\chi^2(1)$ density.
Note that a proof of the above using the moment generating function of $Z$ is straightforward (communication of Éric Marchand from Sherbrooke) and that Seshadri's 1994 book The Inverse Gaussian Distribution is the ultimate reference in the matter (communication of Gérard Letac).
|
Inverse Gaussian chi square connection
|
The proof is not exactly standard, although it relates to the "law of the unconscious statistician" [an expression I cannot fathom and do not find amusing] :
First, define $Y=\min\{X,\mu^2/X\}$ which
|
Inverse Gaussian chi square connection
The proof is not exactly standard, although it relates to the "law of the unconscious statistician" [an expression I cannot fathom and do not find amusing] :
First, define $Y=\min\{X,\mu^2/X\}$ which belongs to $(0,\mu)$. The density of $Y$ can be derived from $(y<\mu)$
$$\mathbb P(Y\le y) = \mathbb P(X\le y)+\mathbb P(\mu^2/X \le y\,,\,X>\mu)$$
as
$$f_Y(y;\mu,\lambda)=\left\{f_X(y)+\frac{\mu^2}{y^2}f_X(\mu^2/y)\right\}\mathbb I_{(0,\mu)}(y)$$
And if we notice that
$$\dfrac{(\mu-\mu^2/y)^2}{\mu^2\,\mu^2/y}=\dfrac{(\mu-\mu^2/y)^2}{\mu^2\,\mu^2/y}=\dfrac{(\mu-y)^2}{\mu^2\,y}$$
which is also why $Z=\frac{(X-\mu)^2}{\mu^2X}$, then
\begin{align}f_Y(y;\mu,\lambda)&=\sqrt{\frac{\lambda}{2\pi}}\,e^{-\frac{\lambda(\mu-y)^2}{2\mu^2\,y}}\left\{y^{-3/2}+\mu^{-1}\,y^{-1/2} \right\}\\
&=\sqrt{\frac{\lambda}{2\pi}}\,e^{-\frac{\lambda(\mu-y)^2}{2\mu^2\,y}}\,y^{-3/2}\mu^{-1}\,(\mu+y)\end{align}
If we consider the transform$$H(y) = \dfrac{\lambda(\mu-y)^2}{\mu^2\,y}$$
then
\begin{align}\left\vert\dfrac{\text{d}H(y)}{\text{d}y}\right\vert
&=\frac{\lambda}{\mu^2}
\frac{(\mu-y)}{y}\left\{\frac{\mu-y}{y}+2 \right\}\\
&=\frac{\lambda}{\mu^2}\frac{(\mu-y)(\mu+y)}{y^2}\\
&=\frac{\sqrt{\lambda}}{\mu}H(y)^{1/2}\frac{(\mu+y)}{y^{3/2}}
\end{align}
Which leads to
$$\require{enclose}
f_Y(y;\mu,\lambda)\text{d}y=\frac{1}{\sqrt{2\pi}}\,e^{-z/2}\,z^{-1/2}\frac{\text{d}z}{\enclose{horizontalstrike}{\text{d}y}}\,\enclose{horizontalstrike}{\text{d}y}=f_Z(z;\mu,\lambda)\text{d}z$$
i.e., a chi-square $\chi^2(1)$ density.
Note that a proof of the above using the moment generating function of $Z$ is straightforward (communication of Éric Marchand from Sherbrooke) and that Seshadri's 1994 book The Inverse Gaussian Distribution is the ultimate reference in the matter (communication of Gérard Letac).
|
Inverse Gaussian chi square connection
The proof is not exactly standard, although it relates to the "law of the unconscious statistician" [an expression I cannot fathom and do not find amusing] :
First, define $Y=\min\{X,\mu^2/X\}$ which
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.