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 |
|---|---|---|---|---|---|---|
29,601 | Accounting for discrete or binary parameters in Bayesian information criterion | It is partly because of this imprecision in the "number of parameters" in BIC that DIC (the deviance information criterion) introduced an effective number of parameters as
$$
p_D(x) = \mathbb{E}[D(\theta)|x] - D(\mathbb{E}[\theta|x])
$$
where
$$
D(\theta)=-2\log f(x|\theta)
$$
and
$$
\text{DIC}(x) = p_D(x) + \mathbb{E}[D(\theta)|x]
$$
Note that $p_D(x)$ is then data-dependent. (As discussed there, DIC also has problems of its own!) | Accounting for discrete or binary parameters in Bayesian information criterion | It is partly because of this imprecision in the "number of parameters" in BIC that DIC (the deviance information criterion) introduced an effective number of parameters as
$$
p_D(x) = \mathbb{E}[D(\ | Accounting for discrete or binary parameters in Bayesian information criterion
It is partly because of this imprecision in the "number of parameters" in BIC that DIC (the deviance information criterion) introduced an effective number of parameters as
$$
p_D(x) = \mathbb{E}[D(\theta)|x] - D(\mathbb{E}[\theta|x])
$$
where
$$
D(\theta)=-2\log f(x|\theta)
$$
and
$$
\text{DIC}(x) = p_D(x) + \mathbb{E}[D(\theta)|x]
$$
Note that $p_D(x)$ is then data-dependent. (As discussed there, DIC also has problems of its own!) | Accounting for discrete or binary parameters in Bayesian information criterion
It is partly because of this imprecision in the "number of parameters" in BIC that DIC (the deviance information criterion) introduced an effective number of parameters as
$$
p_D(x) = \mathbb{E}[D(\ |
29,602 | How can I estimate the phase difference between two periodic time-series? | This is the very problem cross-spectral analysis is good for. Next you have an example of code using consumer prices (in differences) and price of oil, and estimating the coherency (roughly, a squared correlation coefficient broken by frequency band) and phase (lag in radians, again by frequency band).
Crudo <- dget(file="Crudo.dge")
IPC <- dget(file="ipc2001.dge")[,1]
dIPC <- diff(IPC)
datos <- ts.union(dIPC,
Crudo)
datos <- window(datos,
start=c(1979,1),
end=c(2002,1))
sp <- spectrum(datos,
main="Petróleo e IPC",
spans=rep(3,5))
par(mfrow=c(2,1))
plot(sp,plot.type="coh")
plot(sp,plot.type="phase")
These are the graphs produced by the last instructions. You can probably adapt this to your setup. | How can I estimate the phase difference between two periodic time-series? | This is the very problem cross-spectral analysis is good for. Next you have an example of code using consumer prices (in differences) and price of oil, and estimating the coherency (roughly, a squared | How can I estimate the phase difference between two periodic time-series?
This is the very problem cross-spectral analysis is good for. Next you have an example of code using consumer prices (in differences) and price of oil, and estimating the coherency (roughly, a squared correlation coefficient broken by frequency band) and phase (lag in radians, again by frequency band).
Crudo <- dget(file="Crudo.dge")
IPC <- dget(file="ipc2001.dge")[,1]
dIPC <- diff(IPC)
datos <- ts.union(dIPC,
Crudo)
datos <- window(datos,
start=c(1979,1),
end=c(2002,1))
sp <- spectrum(datos,
main="Petróleo e IPC",
spans=rep(3,5))
par(mfrow=c(2,1))
plot(sp,plot.type="coh")
plot(sp,plot.type="phase")
These are the graphs produced by the last instructions. You can probably adapt this to your setup. | How can I estimate the phase difference between two periodic time-series?
This is the very problem cross-spectral analysis is good for. Next you have an example of code using consumer prices (in differences) and price of oil, and estimating the coherency (roughly, a squared |
29,603 | Assessing peaks in time series of cell signal data | So it sounds like from your October 25th comment that you are interested in algorithmically finding and characterizing two main features: the initial response decay followed by a cycle of increased response and subsequent decay. I assume that the data are observed at discrete time intervals.
Here is what I would try:
Use a routine like numpy.ma.polyfit to fit, say, a 4th degree polynomial through your data. This should account for the initial drop followed by the rise/drop, but smooth out the numerous but minor fluctuations. Hopefully this degree of polynomial would be flexible enough to fit other, similar series well. The main goal I think would be to get a function that accounts for the major pattern you are looking for.
Use Python routines for computing the derivative of the polynomial function fit to the data. Example routines are scipy.misc.derivative and numpy.diff. You are looking for the time values where the 1st derivative is zero, indicating a possible local min or max of the function. A second derivative test could be used to confirm which point corresponds to a min or max. Presumably you will have three such points if the graph you showed is representative. Note that the sage project could be very valuable here.
At this point you'll have the time values associated with
a. the start of the initial decay
b. the start of the upswing
c. the start of the second decay
You can then do what you want analytically to assess the changes.
It may be best to let the data speak for itself: across multiple series, when you apply this method, what is the typical size change at the upswing, when does it typically occur into the decay period, and how long does it last? And what does the distribution of this upswing look like in terms of where, how big, and how long? Knowing these statistics, you can better characterize a particular upswing as being within tolerance, with respect to where in time it occurs as well as it size and duration. The key from my understanding would be to easily identify where these changes are occurring. The rest of what I have described is straight-forward to calculate. | Assessing peaks in time series of cell signal data | So it sounds like from your October 25th comment that you are interested in algorithmically finding and characterizing two main features: the initial response decay followed by a cycle of increased re | Assessing peaks in time series of cell signal data
So it sounds like from your October 25th comment that you are interested in algorithmically finding and characterizing two main features: the initial response decay followed by a cycle of increased response and subsequent decay. I assume that the data are observed at discrete time intervals.
Here is what I would try:
Use a routine like numpy.ma.polyfit to fit, say, a 4th degree polynomial through your data. This should account for the initial drop followed by the rise/drop, but smooth out the numerous but minor fluctuations. Hopefully this degree of polynomial would be flexible enough to fit other, similar series well. The main goal I think would be to get a function that accounts for the major pattern you are looking for.
Use Python routines for computing the derivative of the polynomial function fit to the data. Example routines are scipy.misc.derivative and numpy.diff. You are looking for the time values where the 1st derivative is zero, indicating a possible local min or max of the function. A second derivative test could be used to confirm which point corresponds to a min or max. Presumably you will have three such points if the graph you showed is representative. Note that the sage project could be very valuable here.
At this point you'll have the time values associated with
a. the start of the initial decay
b. the start of the upswing
c. the start of the second decay
You can then do what you want analytically to assess the changes.
It may be best to let the data speak for itself: across multiple series, when you apply this method, what is the typical size change at the upswing, when does it typically occur into the decay period, and how long does it last? And what does the distribution of this upswing look like in terms of where, how big, and how long? Knowing these statistics, you can better characterize a particular upswing as being within tolerance, with respect to where in time it occurs as well as it size and duration. The key from my understanding would be to easily identify where these changes are occurring. The rest of what I have described is straight-forward to calculate. | Assessing peaks in time series of cell signal data
So it sounds like from your October 25th comment that you are interested in algorithmically finding and characterizing two main features: the initial response decay followed by a cycle of increased re |
29,604 | Assessing peaks in time series of cell signal data | Here are some ideas but I off the top my head that just may work...
Derivatives:
If you take your array and subtract the elements from each other to get an array of one less points, but that's the first derivative. If you now smooth that and look for the sign change, that may detect your bump.
Moving averages:
Perhaps using 2 lagged (exponential or windowed) moving averages might reveal the large bump while ignoring the small one. Basically, the width of the smaller window moving average must be greater than the width of of the bumps you want to ignore. The wider EMA must be wider but not too wide to detect the bump.
You look for when they cross and subtract the lag (window/2) and that's an estimate where your bump is.
http://www.stockopedia.com/content/trading-the-golden-cross-does-it-really-work-69694/
Linear models:
Do a series of linear models of sufficient width that are several little bumps wide, let's say 100 points. Now loop thru the data set generating linear regressions on the X variable. Just look at the coefficient of X and see where the big sign change happened. That is a big bump.
The above is just conjecture is on my part and there are probably better ways of doing it. | Assessing peaks in time series of cell signal data | Here are some ideas but I off the top my head that just may work...
Derivatives:
If you take your array and subtract the elements from each other to get an array of one less points, but that's the fir | Assessing peaks in time series of cell signal data
Here are some ideas but I off the top my head that just may work...
Derivatives:
If you take your array and subtract the elements from each other to get an array of one less points, but that's the first derivative. If you now smooth that and look for the sign change, that may detect your bump.
Moving averages:
Perhaps using 2 lagged (exponential or windowed) moving averages might reveal the large bump while ignoring the small one. Basically, the width of the smaller window moving average must be greater than the width of of the bumps you want to ignore. The wider EMA must be wider but not too wide to detect the bump.
You look for when they cross and subtract the lag (window/2) and that's an estimate where your bump is.
http://www.stockopedia.com/content/trading-the-golden-cross-does-it-really-work-69694/
Linear models:
Do a series of linear models of sufficient width that are several little bumps wide, let's say 100 points. Now loop thru the data set generating linear regressions on the X variable. Just look at the coefficient of X and see where the big sign change happened. That is a big bump.
The above is just conjecture is on my part and there are probably better ways of doing it. | Assessing peaks in time series of cell signal data
Here are some ideas but I off the top my head that just may work...
Derivatives:
If you take your array and subtract the elements from each other to get an array of one less points, but that's the fir |
29,605 | Proving a sequence decreases (supported by plotting a large number of pts) | This has been answered on MO by Pietro Majer here. | Proving a sequence decreases (supported by plotting a large number of pts) | This has been answered on MO by Pietro Majer here. | Proving a sequence decreases (supported by plotting a large number of pts)
This has been answered on MO by Pietro Majer here. | Proving a sequence decreases (supported by plotting a large number of pts)
This has been answered on MO by Pietro Majer here. |
29,606 | How to interpret results of dimensionality reduction/multidimensional scaling? | If the singular values are precisely equal, then the singular vectors can be just about any set of orthonormal vectors, therefore they carry no information.
Generally, if two singular values are equal, the corresponding singular vectors can be rotated in the plane defined by them, and nothing changes. It will not be possible to distinguish between direction in that plane based on the data.
To show a 2D example similar to yours, ${(1, 1), (1, -1)}$ are just two orthogonal vectors, but your numerical method could just as easily have given you ${(1,0), (0,1)}$. | How to interpret results of dimensionality reduction/multidimensional scaling? | If the singular values are precisely equal, then the singular vectors can be just about any set of orthonormal vectors, therefore they carry no information.
Generally, if two singular values are equ | How to interpret results of dimensionality reduction/multidimensional scaling?
If the singular values are precisely equal, then the singular vectors can be just about any set of orthonormal vectors, therefore they carry no information.
Generally, if two singular values are equal, the corresponding singular vectors can be rotated in the plane defined by them, and nothing changes. It will not be possible to distinguish between direction in that plane based on the data.
To show a 2D example similar to yours, ${(1, 1), (1, -1)}$ are just two orthogonal vectors, but your numerical method could just as easily have given you ${(1,0), (0,1)}$. | How to interpret results of dimensionality reduction/multidimensional scaling?
If the singular values are precisely equal, then the singular vectors can be just about any set of orthonormal vectors, therefore they carry no information.
Generally, if two singular values are equ |
29,607 | Best methods of feature selection for nonparametric regression | Unless identification of the most relevant variables is a key aim of the analysis, it is often better not to do any feature selection at all and use regularisation to prevent over-fitting. Feature selection is a tricky procedure and it is all too easy to over-fit the feature selection criterion as there are many degrees of freedom. LASSO and elastic net are a good compromise, the achieve sparsity via regularisation rather than via direct feature selection, so they are less prone to that particular form of over-fitting. | Best methods of feature selection for nonparametric regression | Unless identification of the most relevant variables is a key aim of the analysis, it is often better not to do any feature selection at all and use regularisation to prevent over-fitting. Feature se | Best methods of feature selection for nonparametric regression
Unless identification of the most relevant variables is a key aim of the analysis, it is often better not to do any feature selection at all and use regularisation to prevent over-fitting. Feature selection is a tricky procedure and it is all too easy to over-fit the feature selection criterion as there are many degrees of freedom. LASSO and elastic net are a good compromise, the achieve sparsity via regularisation rather than via direct feature selection, so they are less prone to that particular form of over-fitting. | Best methods of feature selection for nonparametric regression
Unless identification of the most relevant variables is a key aim of the analysis, it is often better not to do any feature selection at all and use regularisation to prevent over-fitting. Feature se |
29,608 | Best methods of feature selection for nonparametric regression | Lasso is indeed a good one. Simple things like starting with none, and adding them one by one sorted on 'usefullness' (via cross-validation) do also work quite well in practice.
This is sometimes called stagewise feedforward selection.
Note that the subset selection problem is fairly independent on the type of classification / regression. It's just that nonparametric methods can be slow and therefore require more intelligent methods of selection.
The book 'The elements of statistical learning' from T. Hastie gives a nice overview. | Best methods of feature selection for nonparametric regression | Lasso is indeed a good one. Simple things like starting with none, and adding them one by one sorted on 'usefullness' (via cross-validation) do also work quite well in practice.
This is sometimes cal | Best methods of feature selection for nonparametric regression
Lasso is indeed a good one. Simple things like starting with none, and adding them one by one sorted on 'usefullness' (via cross-validation) do also work quite well in practice.
This is sometimes called stagewise feedforward selection.
Note that the subset selection problem is fairly independent on the type of classification / regression. It's just that nonparametric methods can be slow and therefore require more intelligent methods of selection.
The book 'The elements of statistical learning' from T. Hastie gives a nice overview. | Best methods of feature selection for nonparametric regression
Lasso is indeed a good one. Simple things like starting with none, and adding them one by one sorted on 'usefullness' (via cross-validation) do also work quite well in practice.
This is sometimes cal |
29,609 | Example of a stochastic process that is 1st and 2nd order stationary, but not strictly stationary (Round 2) | Here is such an example. I will describe the process in terms of its sample paths.
It's a simple process, it only has four sample paths: $\omega_1$, $\omega_2$, $\omega_3$, $\omega_4$. This means that the only possible outcomes are:
$$ ...,\ X(-1) = \omega_i(-1),\ X(0) = \omega_i(0),\ X(1) = \omega_i(1),\ ... $$
One outcome for every $i \in \{1,2,3,4\}$.
The sample paths are defined as follows, for $t\in \mathbb{Z}$:
$$\omega_1(t):= \begin{cases}
1 & \text{if $t$ is a multiple of $4$,}\\
0 & \text{else.}\\
\end{cases} $$
$$\omega_2(t):= \begin{cases}
0 & \text{if $t$ is a multiple of $4$,}\\
1 & \text{else.}\\
\end{cases} $$
$$\omega_3(t):= \omega_1(t-2) $$
$$\omega_4(t):= \omega_2(t-2) $$
So they are:
$$ ...,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,... $$
$$ ...,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,... $$
$$ ...,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,... $$
$$ ...,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,... $$
Here is a plot of the four possible sample paths:
Each sample path is defined to have probability $1/4$. This concludes the definition of the process.
I will now show that it satisfies the conditions required by the OP.
For $t\in\{1,2,3,4\}$ one can see that there are exactly $2$ sample paths such that $X(t)=1$, and exactly $2$ sample paths such that $X(t)=0$. Hence for $t\in\{1,2,3,4\}$:
$$ P[X(t)=1] = P[X(t)=0] = 1/2 .$$
Since the process is periodic this is true for every $t\in \mathbb{Z}$. This means that the distribution of $X(t)$ does not depend on $t$ and therefore the process is 1st order stationary.
Likewise, looking at consecutive pairs, for $t\in\{1,2,3,4\}$ there is exactly $1$ sample path with $X(t)=1$ and $X(t+1)=0$, exactly $1$ sample path with $X(t)=0$ and $X(t+1)=1$, exactly $1$ sample path with $X(t)=0$ and $X(t+1)=0$, and exactly $1$ sample path with $X(t)=1$ and $X(t+1)=1$. So for $t\in\{1,2,3,4\}$:
$$ P[X(t)=1,X(t+1)=0] = P[X(t)=0,X(t+1)=1] =P[X(t)=0,X(t+1)=0] =P[X(t)=1,X(t+1)=1] = 1/4 .$$
Again by periodicity, this is true for every $t\in \mathbb{Z}$ and the process is 2nd order stationary.
However, for instance: $$P[X(0)=0,X(1)=0,X(2)=0] = 0,$$ while $$P[X(1)=0,X(2)=0,X(3)=0] = 1/4.$$
Therefore the process is not 3rd order stationary | Example of a stochastic process that is 1st and 2nd order stationary, but not strictly stationary (R | Here is such an example. I will describe the process in terms of its sample paths.
It's a simple process, it only has four sample paths: $\omega_1$, $\omega_2$, $\omega_3$, $\omega_4$. This means that | Example of a stochastic process that is 1st and 2nd order stationary, but not strictly stationary (Round 2)
Here is such an example. I will describe the process in terms of its sample paths.
It's a simple process, it only has four sample paths: $\omega_1$, $\omega_2$, $\omega_3$, $\omega_4$. This means that the only possible outcomes are:
$$ ...,\ X(-1) = \omega_i(-1),\ X(0) = \omega_i(0),\ X(1) = \omega_i(1),\ ... $$
One outcome for every $i \in \{1,2,3,4\}$.
The sample paths are defined as follows, for $t\in \mathbb{Z}$:
$$\omega_1(t):= \begin{cases}
1 & \text{if $t$ is a multiple of $4$,}\\
0 & \text{else.}\\
\end{cases} $$
$$\omega_2(t):= \begin{cases}
0 & \text{if $t$ is a multiple of $4$,}\\
1 & \text{else.}\\
\end{cases} $$
$$\omega_3(t):= \omega_1(t-2) $$
$$\omega_4(t):= \omega_2(t-2) $$
So they are:
$$ ...,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,... $$
$$ ...,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,... $$
$$ ...,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,... $$
$$ ...,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,... $$
Here is a plot of the four possible sample paths:
Each sample path is defined to have probability $1/4$. This concludes the definition of the process.
I will now show that it satisfies the conditions required by the OP.
For $t\in\{1,2,3,4\}$ one can see that there are exactly $2$ sample paths such that $X(t)=1$, and exactly $2$ sample paths such that $X(t)=0$. Hence for $t\in\{1,2,3,4\}$:
$$ P[X(t)=1] = P[X(t)=0] = 1/2 .$$
Since the process is periodic this is true for every $t\in \mathbb{Z}$. This means that the distribution of $X(t)$ does not depend on $t$ and therefore the process is 1st order stationary.
Likewise, looking at consecutive pairs, for $t\in\{1,2,3,4\}$ there is exactly $1$ sample path with $X(t)=1$ and $X(t+1)=0$, exactly $1$ sample path with $X(t)=0$ and $X(t+1)=1$, exactly $1$ sample path with $X(t)=0$ and $X(t+1)=0$, and exactly $1$ sample path with $X(t)=1$ and $X(t+1)=1$. So for $t\in\{1,2,3,4\}$:
$$ P[X(t)=1,X(t+1)=0] = P[X(t)=0,X(t+1)=1] =P[X(t)=0,X(t+1)=0] =P[X(t)=1,X(t+1)=1] = 1/4 .$$
Again by periodicity, this is true for every $t\in \mathbb{Z}$ and the process is 2nd order stationary.
However, for instance: $$P[X(0)=0,X(1)=0,X(2)=0] = 0,$$ while $$P[X(1)=0,X(2)=0,X(3)=0] = 1/4.$$
Therefore the process is not 3rd order stationary | Example of a stochastic process that is 1st and 2nd order stationary, but not strictly stationary (R
Here is such an example. I will describe the process in terms of its sample paths.
It's a simple process, it only has four sample paths: $\omega_1$, $\omega_2$, $\omega_3$, $\omega_4$. This means that |
29,610 | Estimating variability over time | From your description I can't see any reason to distinguish the "baseline test" from the immediately drawn "second sample". They are simply 2 baseline measurements and the variance (at baseline) can be calculated on that basis. It would be better plotting the mean of the two baseline measurements versus the third "six month" sample.
The problem is with the 6 month sample. As only one sample is taken at this point there is no way of estimating the "variability" at this point, or rather separating sampling variation from longitudinal (real) change in TB reading.
If we consider this a longitudinal data analysis problem we would probably choose the a random intercept (baseline TB) and a random slope (to fit the 6 month TB). The sampling variability would be estimated from the two baseline measurements and the slope from the third 6 month measure. We can't estimate the variability at 6 months without strong distributional assumptions on the chnage over those six months, such as assuming no change. | Estimating variability over time | From your description I can't see any reason to distinguish the "baseline test" from the immediately drawn "second sample". They are simply 2 baseline measurements and the variance (at baseline) can b | Estimating variability over time
From your description I can't see any reason to distinguish the "baseline test" from the immediately drawn "second sample". They are simply 2 baseline measurements and the variance (at baseline) can be calculated on that basis. It would be better plotting the mean of the two baseline measurements versus the third "six month" sample.
The problem is with the 6 month sample. As only one sample is taken at this point there is no way of estimating the "variability" at this point, or rather separating sampling variation from longitudinal (real) change in TB reading.
If we consider this a longitudinal data analysis problem we would probably choose the a random intercept (baseline TB) and a random slope (to fit the 6 month TB). The sampling variability would be estimated from the two baseline measurements and the slope from the third 6 month measure. We can't estimate the variability at 6 months without strong distributional assumptions on the chnage over those six months, such as assuming no change. | Estimating variability over time
From your description I can't see any reason to distinguish the "baseline test" from the immediately drawn "second sample". They are simply 2 baseline measurements and the variance (at baseline) can b |
29,611 | What's an intuitive way to understand how KL divergence differs from other similarity metrics? | A very short answer; there are too many similarity metrics (or divergences) proposed to even try looking at more than a few. I will try to say a little about why use specific ones.
Kullback-Leibler divergence: See Intuition on the Kullback-Leibler (KL) Divergence, I will not rewrite here. Short summary, KL divergence is natural when interest is in hypothesis testing, as it is the expected value under the alternative hypothesis of the log likelihood ratio. Some other divergences look at other functions of the likelihood ratio, but log is natural given its role in statistical inference.
Earth Mover distance, see Difference between Hausdorff and earth mover (EMD) distance and Wikipedia. The ideas here are very different from KL divergence, and I cannot see obvious connection to inference. The wikipedia article gives the following example:
An early application of the EMD in computer science was to compare two
grayscale images that may differ due to dithering, blurring, or local
deformations.[10] In this case, the region is the image's domain, and
the total amount of light (or ink) is the "dirt" to be rearranged.
This seems similar to dynamic time warping used in time series.
Bhattacharyaa distance, see Intuition of the Bhattacharya Coefficient and the Bhattacharya distance?. This is also related to inference, it is the expectation under the null hypothesis of the square root of the likelihood ratio. To me it is unclear why it is interesting, but it can be seen as a generalization of the Mahalanobis distance to nonnormal distributions. Note that starting from $\int \left(\sqrt{f(x)} - \sqrt{g(x)}\right)^2 \; dx \geq 0$ a little manipulation gives $\int \sqrt{f(x) g(x) }\; dx \le 1$ for densities $f, g$. That might give some intuition.
Chisquare distance can be found here have a lot of tradition and seems natural with discrete data. An example of use is correspondence analysis.
Probably many divergences are mostly used technically in proofs, and intuition must then come from their use. An interesting paper. | What's an intuitive way to understand how KL divergence differs from other similarity metrics? | A very short answer; there are too many similarity metrics (or divergences) proposed to even try looking at more than a few. I will try to say a little about why use specific ones.
Kullback-Leibler d | What's an intuitive way to understand how KL divergence differs from other similarity metrics?
A very short answer; there are too many similarity metrics (or divergences) proposed to even try looking at more than a few. I will try to say a little about why use specific ones.
Kullback-Leibler divergence: See Intuition on the Kullback-Leibler (KL) Divergence, I will not rewrite here. Short summary, KL divergence is natural when interest is in hypothesis testing, as it is the expected value under the alternative hypothesis of the log likelihood ratio. Some other divergences look at other functions of the likelihood ratio, but log is natural given its role in statistical inference.
Earth Mover distance, see Difference between Hausdorff and earth mover (EMD) distance and Wikipedia. The ideas here are very different from KL divergence, and I cannot see obvious connection to inference. The wikipedia article gives the following example:
An early application of the EMD in computer science was to compare two
grayscale images that may differ due to dithering, blurring, or local
deformations.[10] In this case, the region is the image's domain, and
the total amount of light (or ink) is the "dirt" to be rearranged.
This seems similar to dynamic time warping used in time series.
Bhattacharyaa distance, see Intuition of the Bhattacharya Coefficient and the Bhattacharya distance?. This is also related to inference, it is the expectation under the null hypothesis of the square root of the likelihood ratio. To me it is unclear why it is interesting, but it can be seen as a generalization of the Mahalanobis distance to nonnormal distributions. Note that starting from $\int \left(\sqrt{f(x)} - \sqrt{g(x)}\right)^2 \; dx \geq 0$ a little manipulation gives $\int \sqrt{f(x) g(x) }\; dx \le 1$ for densities $f, g$. That might give some intuition.
Chisquare distance can be found here have a lot of tradition and seems natural with discrete data. An example of use is correspondence analysis.
Probably many divergences are mostly used technically in proofs, and intuition must then come from their use. An interesting paper. | What's an intuitive way to understand how KL divergence differs from other similarity metrics?
A very short answer; there are too many similarity metrics (or divergences) proposed to even try looking at more than a few. I will try to say a little about why use specific ones.
Kullback-Leibler d |
29,612 | Maximum number of balls thrown into $k$ urns with equal probability | I have an attempt at an estimate here. But I can't make the computations work well because it involves a deconvolution step which is not very stable
When I decrease the number of urns then the deconvolution with fft starts to become problematical.
When I increase the number of urns then the solution is not as good as I would have expected. Especially for the Gaussian distribution I would expect a nearly perfect fit. I may have made some little mistakes due to the bins and rounding off, and possibly a little shift, but I guess that maybe there is some bigger problem.
The principle behind the estimate is
The adaptation of a naïve approach that assumes all the urns to be independent. In that case the distribution of the maximum is the power of the CDF of a single case. $$P(\max(X_i)\leq x) = P(\text{all $X_i \leq x$}) = F(x)^{n_{urns}}$$
The case with the urns is the maximum of a multinomial distribution which has variance $npq$ and covariance $np^2$. We can relate this to a multivariate normal distribution.
In the case of a multivariate distribution with negative correlation we can get a multivariate distribution with zero correlation by adding a normal distributed variable. So $\max(x) \sim \max(y) + z$ where $x$ is our target variable, $\max(y)$ we can compute with our naive method, the addition of $z$ is effectively a convolution with a normal distributed variable.
The idea is then to find the distribution of $\max(x)$ by deconvolving $\max(y)$.
Note: this mimics the situation of the question where the correlation is positive and the solution asks for a convolution instead of a deconvolution CDF of maximum of $n$ correlated normal random variables
We apply the same deconvolution as with the multivariate normal distribution, but now to the multinomial distribution.
set.seed(1)
n_balls <- 50
n_urns <- 10
n_sims <- 1e4
layout(matrix(1:2),2)
Maximum = replicate(n_sims,max(table(sample(x=1:n_urns,size=n_balls,replace=TRUE))))
h1=hist(Maximum,breaks=seq(min(Maximum)-1.5,max(Maximum)+1.5),freq=FALSE, main = "maximum of multinomial")
### mean and covariance matrix of multinomial
mu = rep(n_balls/n_urns,n_urns)
p = 1/n_urns
q = 1-p
xVAR = n_balls*p*q
xCOV = -1*n_balls*p*p
sigma = matrix(rep(xCOV, n_urns^2),n_urns)
diag(sigma) = xVAR
### variance of convolved component
varconvolve = n_balls*p/n_urns
### computation of naive estimate
d = 1
k1 = seq(0,mu[1]*4,d)
Fk1 = pbinom(k1,n_balls,1/n_urns)^(n_urns)
fk1 = diff(c(0,Fk1))/d
### function to deconvolve with Gaussian
deconvolve = function(dt,y,var,SN=10^3) {
L = length(y)
t = seq(0,L-1)*dt
x = dnorm(t,0,var^0.5)/dt*2
y = c(y,rep(0,L)) # padding of zeros
x = c(x,0,rev(x[-1]))
x = x/sum(x)
fftx = fft(x)
g = Conj(fftx)/(Mod(fftx)^2+1/SN)
z = (Re(fft(fft(y)*g,inverse=T))/(2*L))[1:L]
return(z[1:L])
}
y = deconvolve(d,fk1,varconvolve,SN=10^18)
lines(k1,fk1, lty = 2)
lines(k1,deconvolve(d,fk1,varconvolve*0.9,SN=10^18))
###
### case of Gaussian
###
Maximum = apply(MASS::mvrnorm(n_sims,mu,sigma),1,max)
h2=hist(Maximum,breaks=seq(min(Maximum)-1.5,max(Maximum)+1.5,0.25),freq=FALSE,main = "maximum of multivariate Gaussian with negative correlation")
### computation of naive estimate
d = 0.25
k2 = seq(-mu[1]*4,mu[1]*4,d)
Fk2 = pnorm(k2,mu[1],xVAR^0.5)^(n_urns)
fk2 = diff(c(0,Fk2))/d
z = deconvolve(d,fk2,varconvolve,SN=10^9)
lines(k2,fk2, lty = 2)
lines(k2,z)
legend(10,0.4,c("naive estimate","deconvolved estimate"), lty = c(2,1)) | Maximum number of balls thrown into $k$ urns with equal probability | I have an attempt at an estimate here. But I can't make the computations work well because it involves a deconvolution step which is not very stable
When I decrease the number of urns then the deconv | Maximum number of balls thrown into $k$ urns with equal probability
I have an attempt at an estimate here. But I can't make the computations work well because it involves a deconvolution step which is not very stable
When I decrease the number of urns then the deconvolution with fft starts to become problematical.
When I increase the number of urns then the solution is not as good as I would have expected. Especially for the Gaussian distribution I would expect a nearly perfect fit. I may have made some little mistakes due to the bins and rounding off, and possibly a little shift, but I guess that maybe there is some bigger problem.
The principle behind the estimate is
The adaptation of a naïve approach that assumes all the urns to be independent. In that case the distribution of the maximum is the power of the CDF of a single case. $$P(\max(X_i)\leq x) = P(\text{all $X_i \leq x$}) = F(x)^{n_{urns}}$$
The case with the urns is the maximum of a multinomial distribution which has variance $npq$ and covariance $np^2$. We can relate this to a multivariate normal distribution.
In the case of a multivariate distribution with negative correlation we can get a multivariate distribution with zero correlation by adding a normal distributed variable. So $\max(x) \sim \max(y) + z$ where $x$ is our target variable, $\max(y)$ we can compute with our naive method, the addition of $z$ is effectively a convolution with a normal distributed variable.
The idea is then to find the distribution of $\max(x)$ by deconvolving $\max(y)$.
Note: this mimics the situation of the question where the correlation is positive and the solution asks for a convolution instead of a deconvolution CDF of maximum of $n$ correlated normal random variables
We apply the same deconvolution as with the multivariate normal distribution, but now to the multinomial distribution.
set.seed(1)
n_balls <- 50
n_urns <- 10
n_sims <- 1e4
layout(matrix(1:2),2)
Maximum = replicate(n_sims,max(table(sample(x=1:n_urns,size=n_balls,replace=TRUE))))
h1=hist(Maximum,breaks=seq(min(Maximum)-1.5,max(Maximum)+1.5),freq=FALSE, main = "maximum of multinomial")
### mean and covariance matrix of multinomial
mu = rep(n_balls/n_urns,n_urns)
p = 1/n_urns
q = 1-p
xVAR = n_balls*p*q
xCOV = -1*n_balls*p*p
sigma = matrix(rep(xCOV, n_urns^2),n_urns)
diag(sigma) = xVAR
### variance of convolved component
varconvolve = n_balls*p/n_urns
### computation of naive estimate
d = 1
k1 = seq(0,mu[1]*4,d)
Fk1 = pbinom(k1,n_balls,1/n_urns)^(n_urns)
fk1 = diff(c(0,Fk1))/d
### function to deconvolve with Gaussian
deconvolve = function(dt,y,var,SN=10^3) {
L = length(y)
t = seq(0,L-1)*dt
x = dnorm(t,0,var^0.5)/dt*2
y = c(y,rep(0,L)) # padding of zeros
x = c(x,0,rev(x[-1]))
x = x/sum(x)
fftx = fft(x)
g = Conj(fftx)/(Mod(fftx)^2+1/SN)
z = (Re(fft(fft(y)*g,inverse=T))/(2*L))[1:L]
return(z[1:L])
}
y = deconvolve(d,fk1,varconvolve,SN=10^18)
lines(k1,fk1, lty = 2)
lines(k1,deconvolve(d,fk1,varconvolve*0.9,SN=10^18))
###
### case of Gaussian
###
Maximum = apply(MASS::mvrnorm(n_sims,mu,sigma),1,max)
h2=hist(Maximum,breaks=seq(min(Maximum)-1.5,max(Maximum)+1.5,0.25),freq=FALSE,main = "maximum of multivariate Gaussian with negative correlation")
### computation of naive estimate
d = 0.25
k2 = seq(-mu[1]*4,mu[1]*4,d)
Fk2 = pnorm(k2,mu[1],xVAR^0.5)^(n_urns)
fk2 = diff(c(0,Fk2))/d
z = deconvolve(d,fk2,varconvolve,SN=10^9)
lines(k2,fk2, lty = 2)
lines(k2,z)
legend(10,0.4,c("naive estimate","deconvolved estimate"), lty = c(2,1)) | Maximum number of balls thrown into $k$ urns with equal probability
I have an attempt at an estimate here. But I can't make the computations work well because it involves a deconvolution step which is not very stable
When I decrease the number of urns then the deconv |
29,613 | Understanding AR1 through the glmmTMB package | So I realized this was asked years ago, but as there still isn't an answer, I'll try and explain the structure and the logic of AR-1 at bit of a higher level, and explain why the effect of time (defined here tt) is inherently a random effect. I'm not very familiar with the calculations of glmmTMB
The AR-1 accounts for auto-correlation which means, for a variable that is repeatedly measured over time, the values of the individual time points are correlated with the other values of that same variable, and observations closer in time are more correlated than observations farther in time. Further, the variance $\sigma^2$ is assumed to be homogenous within a time-series, and that the time measurements are evenly spaced. An example could be a measure of blood cell counts taken from a patient at the same time every morning for a span of days.
Lets assume we have 4 time points, or $t = 4$. The AR-1 correlation is a square matrix and is written:
$$
\mathbb{R} = \begin{bmatrix} 1 & \rho & \rho^2 & \rho^3 \\
\rho & 1 & \rho & \rho^2\\
\rho^2 & \rho & 1 & \rho \\
\rho^3 & \rho^2 & \rho & 1
\end{bmatrix}
$$
where $\rho$ is the correlation between time points. The correlation between time points exponentially declines as the distance between two time points $i-j$ increases. $\rho$ is also limited to $-1 < \rho < 1$.
Because we have the assumption that $\sigma^2$ is homogenous within a time series, the covariance is then:
$$
\sigma^2 \begin{bmatrix} 1 & \rho & \rho^2 & \rho^3 \\
\rho & 1 & \rho & \rho^2\\
\rho^2 & \rho & 1 & \rho \\
\rho^3 & \rho^2 & \rho & 1
\end{bmatrix} = \begin{bmatrix} \sigma^2 & \sigma^2\rho & \sigma^2\rho^2 & \sigma^2\rho^3 \\
\sigma^2\rho & \sigma^2 & \sigma^2\rho & \sigma^2\rho^2\\
\sigma^2\rho^2 & \sigma^2\rho & \sigma^2 & \sigma^2\rho \\
\sigma^2\rho^3 & \sigma^2\rho^2 & \sigma^2\rho & \sigma^2
\end{bmatrix}
$$
So, in the example of the blood cell counts, within an individual person the change in variance over time is an inherently random process. | Understanding AR1 through the glmmTMB package | So I realized this was asked years ago, but as there still isn't an answer, I'll try and explain the structure and the logic of AR-1 at bit of a higher level, and explain why the effect of time (defin | Understanding AR1 through the glmmTMB package
So I realized this was asked years ago, but as there still isn't an answer, I'll try and explain the structure and the logic of AR-1 at bit of a higher level, and explain why the effect of time (defined here tt) is inherently a random effect. I'm not very familiar with the calculations of glmmTMB
The AR-1 accounts for auto-correlation which means, for a variable that is repeatedly measured over time, the values of the individual time points are correlated with the other values of that same variable, and observations closer in time are more correlated than observations farther in time. Further, the variance $\sigma^2$ is assumed to be homogenous within a time-series, and that the time measurements are evenly spaced. An example could be a measure of blood cell counts taken from a patient at the same time every morning for a span of days.
Lets assume we have 4 time points, or $t = 4$. The AR-1 correlation is a square matrix and is written:
$$
\mathbb{R} = \begin{bmatrix} 1 & \rho & \rho^2 & \rho^3 \\
\rho & 1 & \rho & \rho^2\\
\rho^2 & \rho & 1 & \rho \\
\rho^3 & \rho^2 & \rho & 1
\end{bmatrix}
$$
where $\rho$ is the correlation between time points. The correlation between time points exponentially declines as the distance between two time points $i-j$ increases. $\rho$ is also limited to $-1 < \rho < 1$.
Because we have the assumption that $\sigma^2$ is homogenous within a time series, the covariance is then:
$$
\sigma^2 \begin{bmatrix} 1 & \rho & \rho^2 & \rho^3 \\
\rho & 1 & \rho & \rho^2\\
\rho^2 & \rho & 1 & \rho \\
\rho^3 & \rho^2 & \rho & 1
\end{bmatrix} = \begin{bmatrix} \sigma^2 & \sigma^2\rho & \sigma^2\rho^2 & \sigma^2\rho^3 \\
\sigma^2\rho & \sigma^2 & \sigma^2\rho & \sigma^2\rho^2\\
\sigma^2\rho^2 & \sigma^2\rho & \sigma^2 & \sigma^2\rho \\
\sigma^2\rho^3 & \sigma^2\rho^2 & \sigma^2\rho & \sigma^2
\end{bmatrix}
$$
So, in the example of the blood cell counts, within an individual person the change in variance over time is an inherently random process. | Understanding AR1 through the glmmTMB package
So I realized this was asked years ago, but as there still isn't an answer, I'll try and explain the structure and the logic of AR-1 at bit of a higher level, and explain why the effect of time (defin |
29,614 | Use f1 score in GridSearchCV [closed] | Ok, I found it out:
If you use scoring='f1_micro' according to https://scikit-learn.org/stable/modules/model_evaluation.html, you get exactly what I want. | Use f1 score in GridSearchCV [closed] | Ok, I found it out:
If you use scoring='f1_micro' according to https://scikit-learn.org/stable/modules/model_evaluation.html, you get exactly what I want. | Use f1 score in GridSearchCV [closed]
Ok, I found it out:
If you use scoring='f1_micro' according to https://scikit-learn.org/stable/modules/model_evaluation.html, you get exactly what I want. | Use f1 score in GridSearchCV [closed]
Ok, I found it out:
If you use scoring='f1_micro' according to https://scikit-learn.org/stable/modules/model_evaluation.html, you get exactly what I want. |
29,615 | Use f1 score in GridSearchCV [closed] | You can follow the example that is provided here, simply pass average='micro' to make_scorer. https://scikit-learn.org/stable/modules/generated/sklearn.metrics.make_scorer.html | Use f1 score in GridSearchCV [closed] | You can follow the example that is provided here, simply pass average='micro' to make_scorer. https://scikit-learn.org/stable/modules/generated/sklearn.metrics.make_scorer.html | Use f1 score in GridSearchCV [closed]
You can follow the example that is provided here, simply pass average='micro' to make_scorer. https://scikit-learn.org/stable/modules/generated/sklearn.metrics.make_scorer.html | Use f1 score in GridSearchCV [closed]
You can follow the example that is provided here, simply pass average='micro' to make_scorer. https://scikit-learn.org/stable/modules/generated/sklearn.metrics.make_scorer.html |
29,616 | Use f1 score in GridSearchCV [closed] | gridsearch = GridSearchCV(estimator=pipeline_steps,
param_grid=grid,
n_jobs=-1,
cv=5,
scoring='f1_micro')
You can check following link and use all scoring in classification columns.
link : https://scikit-learn.org/stable/modules/model_evaluation.html | Use f1 score in GridSearchCV [closed] | gridsearch = GridSearchCV(estimator=pipeline_steps,
param_grid=grid,
n_jobs=-1,
cv=5,
scoring='f1_micro')
You can check following link and use all scoring in classification columns.
link : https://sci | Use f1 score in GridSearchCV [closed]
gridsearch = GridSearchCV(estimator=pipeline_steps,
param_grid=grid,
n_jobs=-1,
cv=5,
scoring='f1_micro')
You can check following link and use all scoring in classification columns.
link : https://scikit-learn.org/stable/modules/model_evaluation.html | Use f1 score in GridSearchCV [closed]
gridsearch = GridSearchCV(estimator=pipeline_steps,
param_grid=grid,
n_jobs=-1,
cv=5,
scoring='f1_micro')
You can check following link and use all scoring in classification columns.
link : https://sci |
29,617 | Model fitting vs minimizing expected risk | One of the problems with "Expected Risk Mimimization" is that the distribution, $p(y׳|x_i;\phi)$, is unknown, and thus it is not clear how to minimize it.
You could theoretically argue, that we can try to find this distribution, during the minimization process, but as you said, in this case it will not approximate the true distribution, because the model incentive is minimize the loss and not finding the probability distribution. For example, It can end up with putting the mass probability on the a single point that minimizes the loss, instead of finding the full distribution.
If all we care about is minimizing the loss (as opposed to approximating the true distribution), we could minimize the loss directly e.g. minimize the MSE. i.e.
$\min_{\theta} \sum_i MSE(y_i, y^{'}_i)$
Moreover, this is just theoretically. Practically, true distribution is intractable and cannot be computed. This is also true for the maximum likelihood optimization.
Usually in machine learning, in order to solve the intractability problem, we add assumptions regarding the output distribution. We tend to pick "easy to work with" distribution and not complex one. For example distributions that are easily described by finite numbers like $\mu, \sigma$. A popular choice for such distribution is the normal distribution. i.e. we assume that the the output is normally distributed with the label as mean plus some variance around it.
It can be proved that, assuming normal distribution, maximizing the log likelihood is equivalent to minimizing the MSE. So in the practical setup, in which you assume normal distribution, both tasks are the same. i.e. in one shot, we are minimizing the loss and maximizing the likelihood. See more details here | Model fitting vs minimizing expected risk | One of the problems with "Expected Risk Mimimization" is that the distribution, $p(y׳|x_i;\phi)$, is unknown, and thus it is not clear how to minimize it.
You could theoretically argue, that we can tr | Model fitting vs minimizing expected risk
One of the problems with "Expected Risk Mimimization" is that the distribution, $p(y׳|x_i;\phi)$, is unknown, and thus it is not clear how to minimize it.
You could theoretically argue, that we can try to find this distribution, during the minimization process, but as you said, in this case it will not approximate the true distribution, because the model incentive is minimize the loss and not finding the probability distribution. For example, It can end up with putting the mass probability on the a single point that minimizes the loss, instead of finding the full distribution.
If all we care about is minimizing the loss (as opposed to approximating the true distribution), we could minimize the loss directly e.g. minimize the MSE. i.e.
$\min_{\theta} \sum_i MSE(y_i, y^{'}_i)$
Moreover, this is just theoretically. Practically, true distribution is intractable and cannot be computed. This is also true for the maximum likelihood optimization.
Usually in machine learning, in order to solve the intractability problem, we add assumptions regarding the output distribution. We tend to pick "easy to work with" distribution and not complex one. For example distributions that are easily described by finite numbers like $\mu, \sigma$. A popular choice for such distribution is the normal distribution. i.e. we assume that the the output is normally distributed with the label as mean plus some variance around it.
It can be proved that, assuming normal distribution, maximizing the log likelihood is equivalent to minimizing the MSE. So in the practical setup, in which you assume normal distribution, both tasks are the same. i.e. in one shot, we are minimizing the loss and maximizing the likelihood. See more details here | Model fitting vs minimizing expected risk
One of the problems with "Expected Risk Mimimization" is that the distribution, $p(y׳|x_i;\phi)$, is unknown, and thus it is not clear how to minimize it.
You could theoretically argue, that we can tr |
29,618 | Proposal distribution for a generalised normal distribution | You do not need to use the Markov Chain Monte Carlo (MCMC) method.
If you are using uniform prior distributions then you are doing something very similar as maximum likelihood estimation on a restricted space for the parameters $a$ and $b$.
$$P(a,b;d) = P(d;a,b) \frac{P(a,b)}{P(d)} = \mathcal{L}(a,b;d) \times const $$
where $\frac{P(a,b)}{P(d)}$ is a constant (independent from $a$ and $b$) and it can be found by scaling the likelihood function such that it integrates to 1.
The log likelihood function, for $n$ iid variables $d_i \sim GN(0,a,b)$ is:
$$\log \mathcal{L}(a,b;d) = -n \log(2a) - n \log\left(\frac{\Gamma(1/b)}{b} \right) - \frac{1}{a^b} \sum_{i=1}^n \left( d_i \right)^b $$
For this function it should not be too difficult to plot it and find a maximum. | Proposal distribution for a generalised normal distribution | You do not need to use the Markov Chain Monte Carlo (MCMC) method.
If you are using uniform prior distributions then you are doing something very similar as maximum likelihood estimation on a restrict | Proposal distribution for a generalised normal distribution
You do not need to use the Markov Chain Monte Carlo (MCMC) method.
If you are using uniform prior distributions then you are doing something very similar as maximum likelihood estimation on a restricted space for the parameters $a$ and $b$.
$$P(a,b;d) = P(d;a,b) \frac{P(a,b)}{P(d)} = \mathcal{L}(a,b;d) \times const $$
where $\frac{P(a,b)}{P(d)}$ is a constant (independent from $a$ and $b$) and it can be found by scaling the likelihood function such that it integrates to 1.
The log likelihood function, for $n$ iid variables $d_i \sim GN(0,a,b)$ is:
$$\log \mathcal{L}(a,b;d) = -n \log(2a) - n \log\left(\frac{\Gamma(1/b)}{b} \right) - \frac{1}{a^b} \sum_{i=1}^n \left( d_i \right)^b $$
For this function it should not be too difficult to plot it and find a maximum. | Proposal distribution for a generalised normal distribution
You do not need to use the Markov Chain Monte Carlo (MCMC) method.
If you are using uniform prior distributions then you are doing something very similar as maximum likelihood estimation on a restrict |
29,619 | Proposal distribution for a generalised normal distribution | I don't quite understand how you are setting up the model: in particular, it seems to me that for a given seed, the possible pollen dispersal distances are a finite set, and thus your "dispersal probability" might be better termed a "dispersal rate" (as it would need to be normalized by summing over putative fathers to be a probability). Thus the parameters may not quite have the meaning (as in, plausible values) that you expect.
I have worked on a couple of similar problems in the past and so I'll try to fill in the gaps in my understanding, as a way of suggesting a possible approach/critical look. Apologies if I completely miss the point your original question. The treatment below basically follows Hadfield et al (2006), one of the better papers about of this kind of model.
Let $X_{l,k}$ denote the genotype at locus $l$ for some individual $k$. For offspring $i$ with known mother $m_i$ and putative father $f$, let the probability of the observed offspring genotypes be $$G_{i,f} = \prod_l \mathrm{Pr}(X_{l,i}|X_{l,m_i}, X_{l,f}, \theta)$$ -- in the simplest case this is simply a product of Mendelian inheritance probabilities, but in more complicated cases may include some model of genotyping error or missing parental genotypes, so I include nuisance parameter(s) $\theta$.
Let $\delta_i$ be the pollen dispersal distance for offspring $i$, and let $d_{m_i,f}$ be the distance between known mother $m_i$ and putative father $f$, and let $D_{i,f} = q(d_{m_i,f}|a,b,c)$ be the dispersal rate (e.g a weighted combination of generalized normal and uniform pdfs as in your question). To express the dispersal rate as a probability, normalize w.r.t to the finite state space: the (finite) set of possible dispersal distances induced by the (finite) number of putative fathers in your study area, so that
$$\tilde{D}_{i,f} = \mathrm{Pr}(\delta_i = d_{m_i,f}|a,b,c) = \frac{D_{i,f}}{\sum_k D_{i,k}}$$
Let $P_i$ be the paternal assignment of seed $i$, that is $P_i = f$ if plant $f$ is the father of offspring $i$. Assuming a uniform prior on paternity assignments,
$$\mathrm{Pr}(P_i = f|a,b,c,\theta,X) = \frac{G_{i,f}\tilde{D}_{i,f}}{\sum_k G_{i,k}\tilde{D}_{i,k}} = \frac{G_{i,f}D_{i,f}}{\sum_k G_{i,k}D_{i,k}}$$ In other words, conditional on other parameters and genotypes, paternal assignment is a discrete r.v. with finite support, that is normalized by integrating across said support (possible fathers).
So a reasonable way to write a simple sampler for this problem is Metropolis-within-Gibbs:
Conditional on $\{a,b,c,\theta\}$, update paternity assignments $P_i$ for all $i$. This is a discrete r.v. with finite support so you can easily draw an exact sample
Conditional on $\{P_i,\theta\}$, update $a,b,c$ with a Metropolis-Hastings update. To form the target, only the $D$ values in the equations above need to be updated, so this isn't costly
Conditional on $\{P_i,a,b,c\}$, update $\theta$ with a MH update. To form the target, the $G$ values need to be updated, which is costly, but the $D$ do not.
To decrease the cost of drawing samples of $\{a,b,c\}$, you could perform steps 1-2 multiple times before 3. To tune the proposal distributions in steps 2-3, you could use samples from a preliminary run to estimate the covariance of the joint posterior distribution for $\{a,b,c,\theta\}$. Then use this covariance estimate within a multivariate Gaussian proposal. I'm sure this isn't the most efficient approach, but it is easy to implement.
Now, this scheme may be close to what you are already doing (I can't tell how you are modelling paternity from your question). But beyond computational concerns, my larger point is that the parameters $a,b,c$ may not have the meaning you think they do, with regards to mean dispersal distance. This is because, in the context of the paternity model $\mathrm{Pr}(P_i|\cdot)$ I described above, $a,b,c$ enter into both numerator and denominator (normalizing constant): thus, the spatial arrangement of plants will have a potentially strong effect on which values of $a,b,c$ have a high likelihood or posterior probability. This is especially true when the spatial distribution of the plants is uneven.
Finally, I suggest you take a look at that Hadfield paper linked to above and the accompanying R package ("MasterBayes"), if you haven't already. At the least it may provide ideas. | Proposal distribution for a generalised normal distribution | I don't quite understand how you are setting up the model: in particular, it seems to me that for a given seed, the possible pollen dispersal distances are a finite set, and thus your "dispersal proba | Proposal distribution for a generalised normal distribution
I don't quite understand how you are setting up the model: in particular, it seems to me that for a given seed, the possible pollen dispersal distances are a finite set, and thus your "dispersal probability" might be better termed a "dispersal rate" (as it would need to be normalized by summing over putative fathers to be a probability). Thus the parameters may not quite have the meaning (as in, plausible values) that you expect.
I have worked on a couple of similar problems in the past and so I'll try to fill in the gaps in my understanding, as a way of suggesting a possible approach/critical look. Apologies if I completely miss the point your original question. The treatment below basically follows Hadfield et al (2006), one of the better papers about of this kind of model.
Let $X_{l,k}$ denote the genotype at locus $l$ for some individual $k$. For offspring $i$ with known mother $m_i$ and putative father $f$, let the probability of the observed offspring genotypes be $$G_{i,f} = \prod_l \mathrm{Pr}(X_{l,i}|X_{l,m_i}, X_{l,f}, \theta)$$ -- in the simplest case this is simply a product of Mendelian inheritance probabilities, but in more complicated cases may include some model of genotyping error or missing parental genotypes, so I include nuisance parameter(s) $\theta$.
Let $\delta_i$ be the pollen dispersal distance for offspring $i$, and let $d_{m_i,f}$ be the distance between known mother $m_i$ and putative father $f$, and let $D_{i,f} = q(d_{m_i,f}|a,b,c)$ be the dispersal rate (e.g a weighted combination of generalized normal and uniform pdfs as in your question). To express the dispersal rate as a probability, normalize w.r.t to the finite state space: the (finite) set of possible dispersal distances induced by the (finite) number of putative fathers in your study area, so that
$$\tilde{D}_{i,f} = \mathrm{Pr}(\delta_i = d_{m_i,f}|a,b,c) = \frac{D_{i,f}}{\sum_k D_{i,k}}$$
Let $P_i$ be the paternal assignment of seed $i$, that is $P_i = f$ if plant $f$ is the father of offspring $i$. Assuming a uniform prior on paternity assignments,
$$\mathrm{Pr}(P_i = f|a,b,c,\theta,X) = \frac{G_{i,f}\tilde{D}_{i,f}}{\sum_k G_{i,k}\tilde{D}_{i,k}} = \frac{G_{i,f}D_{i,f}}{\sum_k G_{i,k}D_{i,k}}$$ In other words, conditional on other parameters and genotypes, paternal assignment is a discrete r.v. with finite support, that is normalized by integrating across said support (possible fathers).
So a reasonable way to write a simple sampler for this problem is Metropolis-within-Gibbs:
Conditional on $\{a,b,c,\theta\}$, update paternity assignments $P_i$ for all $i$. This is a discrete r.v. with finite support so you can easily draw an exact sample
Conditional on $\{P_i,\theta\}$, update $a,b,c$ with a Metropolis-Hastings update. To form the target, only the $D$ values in the equations above need to be updated, so this isn't costly
Conditional on $\{P_i,a,b,c\}$, update $\theta$ with a MH update. To form the target, the $G$ values need to be updated, which is costly, but the $D$ do not.
To decrease the cost of drawing samples of $\{a,b,c\}$, you could perform steps 1-2 multiple times before 3. To tune the proposal distributions in steps 2-3, you could use samples from a preliminary run to estimate the covariance of the joint posterior distribution for $\{a,b,c,\theta\}$. Then use this covariance estimate within a multivariate Gaussian proposal. I'm sure this isn't the most efficient approach, but it is easy to implement.
Now, this scheme may be close to what you are already doing (I can't tell how you are modelling paternity from your question). But beyond computational concerns, my larger point is that the parameters $a,b,c$ may not have the meaning you think they do, with regards to mean dispersal distance. This is because, in the context of the paternity model $\mathrm{Pr}(P_i|\cdot)$ I described above, $a,b,c$ enter into both numerator and denominator (normalizing constant): thus, the spatial arrangement of plants will have a potentially strong effect on which values of $a,b,c$ have a high likelihood or posterior probability. This is especially true when the spatial distribution of the plants is uneven.
Finally, I suggest you take a look at that Hadfield paper linked to above and the accompanying R package ("MasterBayes"), if you haven't already. At the least it may provide ideas. | Proposal distribution for a generalised normal distribution
I don't quite understand how you are setting up the model: in particular, it seems to me that for a given seed, the possible pollen dispersal distances are a finite set, and thus your "dispersal proba |
29,620 | What is the difference between VAE and Stochastic Backpropagation for Deep Generative Models? | Stochastic Backpropagation and Approximate Inference in Deep Generative Models seems to just consider a slightly more general implementation of the same ideas. Compared to the VAE paper, they:
propose multiple sets of latent variables, as opposed to VAE which has just one
consider non-diagonal gaussian posteriors, which make it more difficult to optimize | What is the difference between VAE and Stochastic Backpropagation for Deep Generative Models? | Stochastic Backpropagation and Approximate Inference in Deep Generative Models seems to just consider a slightly more general implementation of the same ideas. Compared to the VAE paper, they:
propos | What is the difference between VAE and Stochastic Backpropagation for Deep Generative Models?
Stochastic Backpropagation and Approximate Inference in Deep Generative Models seems to just consider a slightly more general implementation of the same ideas. Compared to the VAE paper, they:
propose multiple sets of latent variables, as opposed to VAE which has just one
consider non-diagonal gaussian posteriors, which make it more difficult to optimize | What is the difference between VAE and Stochastic Backpropagation for Deep Generative Models?
Stochastic Backpropagation and Approximate Inference in Deep Generative Models seems to just consider a slightly more general implementation of the same ideas. Compared to the VAE paper, they:
propos |
29,621 | Is Deep-Q Learning inherently unstable | Given that tricks such as replay memory, gradient clipping, reward clipping, carefully selected rollout strategies, and the use of a target network are often necessary for achieving reasonable performance, and even then training can be unstable, yes, it seems to be true in practice.
That doesn't mean it doesn't work in practice -- DeepMind's Atari paper showed it is indeed possible, with the help of aforementioned tricks. However, it is fairly challenging and requires tens of millions of steps to train properly. | Is Deep-Q Learning inherently unstable | Given that tricks such as replay memory, gradient clipping, reward clipping, carefully selected rollout strategies, and the use of a target network are often necessary for achieving reasonable perform | Is Deep-Q Learning inherently unstable
Given that tricks such as replay memory, gradient clipping, reward clipping, carefully selected rollout strategies, and the use of a target network are often necessary for achieving reasonable performance, and even then training can be unstable, yes, it seems to be true in practice.
That doesn't mean it doesn't work in practice -- DeepMind's Atari paper showed it is indeed possible, with the help of aforementioned tricks. However, it is fairly challenging and requires tens of millions of steps to train properly. | Is Deep-Q Learning inherently unstable
Given that tricks such as replay memory, gradient clipping, reward clipping, carefully selected rollout strategies, and the use of a target network are often necessary for achieving reasonable perform |
29,622 | Higher overfitting using data augmentation with noise? | You fit a model to error free input features. Then you added some error (noise) to your same data and fit the model again. You observed worse prediction on noisy inputs (inputs with error) than on noise free inputs (inputs without error). You expected the model to be just as good as previous model on noise free inputs and better on noisy inputs.
You did not add more training data you simply duplicated the same data with noise. Intuitively, a model trained on ALL noise free inputs is going to have more accurate predictions when inputs are also noise free than a model trained on ALL noisy data. Similarly, my intuition is that a model trained with all noisy data will be more accurate when predicting from noisy inputs than a model trained with all noise free data. If you have some mix of noise free and noisy data, then my intuition is you will have better predictions on noisy data than a model trained with only noise free data and better predictions on noise free data than a model trained on only noisy data. This seems consistent with what you observed.
EDIT:
Basically, overfitting occurs when we mistake noise in the data for signal. I use the term noise in th conceptual sense of useless information or information specific only to training data. If this occurs the model fits the training data well, but does not generalize well. Imagine we have points and the model interpolates all the points. If the points are noisy then this behavior is undesirable. My rudimentary knowledge of data augmentation is that it reduces overfitting because when we add noise to training data the model we fit will tend to balance the error between these nearby points in order to minmize the overall error. This model is better in an average sense in that it has less error when predicting both noisy and noise free data. It will generalize better to data that may be slightly different than training data. However, the model does not distinguish between noisy and noise free data so it has worse performance on noise free data because it mistakes some signal for noise. | Higher overfitting using data augmentation with noise? | You fit a model to error free input features. Then you added some error (noise) to your same data and fit the model again. You observed worse prediction on noisy inputs (inputs with error) than on noi | Higher overfitting using data augmentation with noise?
You fit a model to error free input features. Then you added some error (noise) to your same data and fit the model again. You observed worse prediction on noisy inputs (inputs with error) than on noise free inputs (inputs without error). You expected the model to be just as good as previous model on noise free inputs and better on noisy inputs.
You did not add more training data you simply duplicated the same data with noise. Intuitively, a model trained on ALL noise free inputs is going to have more accurate predictions when inputs are also noise free than a model trained on ALL noisy data. Similarly, my intuition is that a model trained with all noisy data will be more accurate when predicting from noisy inputs than a model trained with all noise free data. If you have some mix of noise free and noisy data, then my intuition is you will have better predictions on noisy data than a model trained with only noise free data and better predictions on noise free data than a model trained on only noisy data. This seems consistent with what you observed.
EDIT:
Basically, overfitting occurs when we mistake noise in the data for signal. I use the term noise in th conceptual sense of useless information or information specific only to training data. If this occurs the model fits the training data well, but does not generalize well. Imagine we have points and the model interpolates all the points. If the points are noisy then this behavior is undesirable. My rudimentary knowledge of data augmentation is that it reduces overfitting because when we add noise to training data the model we fit will tend to balance the error between these nearby points in order to minmize the overall error. This model is better in an average sense in that it has less error when predicting both noisy and noise free data. It will generalize better to data that may be slightly different than training data. However, the model does not distinguish between noisy and noise free data so it has worse performance on noise free data because it mistakes some signal for noise. | Higher overfitting using data augmentation with noise?
You fit a model to error free input features. Then you added some error (noise) to your same data and fit the model again. You observed worse prediction on noisy inputs (inputs with error) than on noi |
29,623 | How will one determine a classifier to be of high bias or high variance? | I presume you are interested in the intrinsic quality of an algorithm. This is a non trivial question and the topic of active research.
Bounds on the bias and variance of an algorithm can be proven via the notion of algorithmic stability - see:
Variance of $K$-fold cross-validation estimates as $f(K)$: what is the role of "stability"?
http://math.arizona.edu/~hzhang/math574m/Read/LOOtheory.pdf
The arizona paper shows the proof for K-NN and 1-NN algorithms which is nearly perfectly unbiased (page 4). You will have to read into the other papers for other kinds of algorithms. Note that not all algorithms have proofs yet and that there are many different forms of stability with their corresponding bounds.
A different (but related) approach is to look into VC theory https://en.wikipedia.org/wiki/Vapnik%E2%80%93Chervonenkis_theory | How will one determine a classifier to be of high bias or high variance? | I presume you are interested in the intrinsic quality of an algorithm. This is a non trivial question and the topic of active research.
Bounds on the bias and variance of an algorithm can be proven v | How will one determine a classifier to be of high bias or high variance?
I presume you are interested in the intrinsic quality of an algorithm. This is a non trivial question and the topic of active research.
Bounds on the bias and variance of an algorithm can be proven via the notion of algorithmic stability - see:
Variance of $K$-fold cross-validation estimates as $f(K)$: what is the role of "stability"?
http://math.arizona.edu/~hzhang/math574m/Read/LOOtheory.pdf
The arizona paper shows the proof for K-NN and 1-NN algorithms which is nearly perfectly unbiased (page 4). You will have to read into the other papers for other kinds of algorithms. Note that not all algorithms have proofs yet and that there are many different forms of stability with their corresponding bounds.
A different (but related) approach is to look into VC theory https://en.wikipedia.org/wiki/Vapnik%E2%80%93Chervonenkis_theory | How will one determine a classifier to be of high bias or high variance?
I presume you are interested in the intrinsic quality of an algorithm. This is a non trivial question and the topic of active research.
Bounds on the bias and variance of an algorithm can be proven v |
29,624 | Why are Gaussian distributions the only "forbidden" source distribution for ICA? | First question: No. There exist non-Gaussian rotationally-invariant distributions (for example, a multivariate student-t distribution).
Second question: Yes, the only rotationally symmetric distributions with independnt components are spherical Gaussians. This is sometimes called Maxwell's theorem, and I agree it is a crazy fact. | Why are Gaussian distributions the only "forbidden" source distribution for ICA? | First question: No. There exist non-Gaussian rotationally-invariant distributions (for example, a multivariate student-t distribution).
Second question: Yes, the only rotationally symmetric distributi | Why are Gaussian distributions the only "forbidden" source distribution for ICA?
First question: No. There exist non-Gaussian rotationally-invariant distributions (for example, a multivariate student-t distribution).
Second question: Yes, the only rotationally symmetric distributions with independnt components are spherical Gaussians. This is sometimes called Maxwell's theorem, and I agree it is a crazy fact. | Why are Gaussian distributions the only "forbidden" source distribution for ICA?
First question: No. There exist non-Gaussian rotationally-invariant distributions (for example, a multivariate student-t distribution).
Second question: Yes, the only rotationally symmetric distributi |
29,625 | What are 'blocks' of an LSTM? [duplicate] | I usually visualize a block as the box (the cup) and the cells as the content.
One block can have one or many cells, but a cell belongs to only one box.
A block controls, protects and manages (through the 3 gates) the information that is held/taken care of by the cells.
I also define one LSTM unit as (one Block + its cells) to avoid getting confused by all the different notations. | What are 'blocks' of an LSTM? [duplicate] | I usually visualize a block as the box (the cup) and the cells as the content.
One block can have one or many cells, but a cell belongs to only one box.
A block controls, protects and manages (through | What are 'blocks' of an LSTM? [duplicate]
I usually visualize a block as the box (the cup) and the cells as the content.
One block can have one or many cells, but a cell belongs to only one box.
A block controls, protects and manages (through the 3 gates) the information that is held/taken care of by the cells.
I also define one LSTM unit as (one Block + its cells) to avoid getting confused by all the different notations. | What are 'blocks' of an LSTM? [duplicate]
I usually visualize a block as the box (the cup) and the cells as the content.
One block can have one or many cells, but a cell belongs to only one box.
A block controls, protects and manages (through |
29,626 | What is the cause of the multiple comparisons problem? | You seem to assume that a researcher can tell when a discovery is made. It's not the case. Even if you "find a discovery", you can never be sure that you have done so (unless you are some kind of omniscient being), because, as abashing as it sounds, what discriminates a false alarm from a discovery in science is usually some degree of human "confidence" in the analysis. | What is the cause of the multiple comparisons problem? | You seem to assume that a researcher can tell when a discovery is made. It's not the case. Even if you "find a discovery", you can never be sure that you have done so (unless you are some kind of omni | What is the cause of the multiple comparisons problem?
You seem to assume that a researcher can tell when a discovery is made. It's not the case. Even if you "find a discovery", you can never be sure that you have done so (unless you are some kind of omniscient being), because, as abashing as it sounds, what discriminates a false alarm from a discovery in science is usually some degree of human "confidence" in the analysis. | What is the cause of the multiple comparisons problem?
You seem to assume that a researcher can tell when a discovery is made. It's not the case. Even if you "find a discovery", you can never be sure that you have done so (unless you are some kind of omni |
29,627 | What is the cause of the multiple comparisons problem? | Your intuition is roughly correct, but it may help to consider how multiple comparison undermines the assumptions of the hypothesis test itself. When you conduct a classical hypothesis test you are generating a p-value, which is a measure of the evidence against the null hypothesis. The p-value is constructed in such a way that lower values constitute greater evidence against the null, and it is distributed uniformly under the null hypothesis. This is what allows you to regard the null hypothesis as being implausible for low p-values (relative to the significance level).
Suppose you decide to test $N > 1$ hypotheses without making any adjustment to your testing method to account for multiple comparisons. Each p-value for these tests is a random variable that is uniform under the null hypothesis for that test. So if none of the alternative hypotheses of these tests are true (i.e., all the null hypotheses are true) you have $p_1, ..., p_N \sim \text{U}(0, 1)$ (these values are generally not independent). Suppose you choose a significance level $0 < \alpha < 1$ and you test all these hypotheses against that level. To do this, you look at the ordered p-values and observe that you have $p_{(1)} < ... < p_{(k)} < \alpha < p_{(k+1)} ... < p_{(N)}$ for some $0 \leqslant k \leqslant N$. This tells you that for the first $k$ tests (corresponding to the ordered p-values) you should reject the null hypothesis for each of those tests.
What is the problem here? Well, the problem is that although the p-values of each of the tests are uniform under their respective null hypotheses, the ordered p-values are not uniform. By picking out the lowest $k$ p-values that are below the significance level, you are no longer looking at random variables that are uniform under their respective null hypotheses. In fact, for large $N$, the lowest p-values are likely to have a distribution that is heavily concentrated near zero, and so these are highly likely to be below your significance level, even though (by assumption) all the null hypotheses for your tests are true.
This phenomenon occurs regardless of whether the p-values are independent or not, and therefore occurs regardless of whether you use the same data or different data to test these hypotheses. The problem of multiple comparisons is that the lower p-values of the $N$ tests will have marginal null distributions that are not uniform. Adjustments such as the Bonferroni correction attempt to deal with this by either adjusting the p-values or significance levels to create a comparison that accounts for this phenomenon. | What is the cause of the multiple comparisons problem? | Your intuition is roughly correct, but it may help to consider how multiple comparison undermines the assumptions of the hypothesis test itself. When you conduct a classical hypothesis test you are g | What is the cause of the multiple comparisons problem?
Your intuition is roughly correct, but it may help to consider how multiple comparison undermines the assumptions of the hypothesis test itself. When you conduct a classical hypothesis test you are generating a p-value, which is a measure of the evidence against the null hypothesis. The p-value is constructed in such a way that lower values constitute greater evidence against the null, and it is distributed uniformly under the null hypothesis. This is what allows you to regard the null hypothesis as being implausible for low p-values (relative to the significance level).
Suppose you decide to test $N > 1$ hypotheses without making any adjustment to your testing method to account for multiple comparisons. Each p-value for these tests is a random variable that is uniform under the null hypothesis for that test. So if none of the alternative hypotheses of these tests are true (i.e., all the null hypotheses are true) you have $p_1, ..., p_N \sim \text{U}(0, 1)$ (these values are generally not independent). Suppose you choose a significance level $0 < \alpha < 1$ and you test all these hypotheses against that level. To do this, you look at the ordered p-values and observe that you have $p_{(1)} < ... < p_{(k)} < \alpha < p_{(k+1)} ... < p_{(N)}$ for some $0 \leqslant k \leqslant N$. This tells you that for the first $k$ tests (corresponding to the ordered p-values) you should reject the null hypothesis for each of those tests.
What is the problem here? Well, the problem is that although the p-values of each of the tests are uniform under their respective null hypotheses, the ordered p-values are not uniform. By picking out the lowest $k$ p-values that are below the significance level, you are no longer looking at random variables that are uniform under their respective null hypotheses. In fact, for large $N$, the lowest p-values are likely to have a distribution that is heavily concentrated near zero, and so these are highly likely to be below your significance level, even though (by assumption) all the null hypotheses for your tests are true.
This phenomenon occurs regardless of whether the p-values are independent or not, and therefore occurs regardless of whether you use the same data or different data to test these hypotheses. The problem of multiple comparisons is that the lower p-values of the $N$ tests will have marginal null distributions that are not uniform. Adjustments such as the Bonferroni correction attempt to deal with this by either adjusting the p-values or significance levels to create a comparison that accounts for this phenomenon. | What is the cause of the multiple comparisons problem?
Your intuition is roughly correct, but it may help to consider how multiple comparison undermines the assumptions of the hypothesis test itself. When you conduct a classical hypothesis test you are g |
29,628 | What is the difference using a Fisher's Exact Test vs. a Logistic Regression for $2 \times 2$ tables? | I am not sure what the person you've taked to meant with "Logistic Regression give us the magnitude of association" since as you state the fisher's exact test does something quite similar. But still, there are some differences I can think of.
1. The odds ratios (OR) can differ
The OR being reported don't have to be the same. At least this is true for R functions fisher.test() and exact2x2() versus logistic regression via the glm() function. Here an example:
# generating data
set.seed(1)
n <- 200
x <- rbinom(n, 1, .5)
y <- rbinom(n, 1, .4)
df <- data.frame(x, y)
# OR from logistic regression
exp(coef(glm(y ~ x,family=binomial(link='logit'),data= df)))[2]
1.423077
# OR from fisher's exact test
tab <- table(x, y)
fisher.test(tab)$estimate
1.420543 # the methods "minlike", "central" and "blaker" in the exact2x2 function result in the same OR
# calculating OR by hand
(tab[1,1]/ tab[2,1])/ (tab[1,2]/ tab[2,2])
1.423077
The OR of fisher's exact test differs from those calculated by hand or reported in logistic regression because they are calculated by the conditional Maximum Likelihood Estimate and not by the unconditional MLE (sample OR). There may be situations where the OR values differ more than in my example. And again, the OR differ for the functions mentioned but there may be other variants of the tests were they are the same.
2. p values differ
Of course the p values differ since in case of logistic regression they are determined with the Wald statistic and a z value while there are different types of exact fisher's test that even differ in p values among themselves (last link opens pdf). See here for the data used before:
# p value from logistic regression
summary(glm(y ~ x,family=binomial(link='logit'),data= df))$coefficients["x", "Pr(>|z|)"]
0.2457947
# p value from fisher's exact test
library(exact2x2) # package covers different exact fisher's tests, see here https://cran.r-project.org/web/packages/exact2x2/index.html
exact2x2(tab,tsmethod="central")$p.value
0.3116818
exact2x2(tab,tsmethod="minlike")$p.value
0.290994 # which is same as fisher.test(tab)$p.value and exact2x2(tab,tsmethod="blaker")$p.value
Here in all cases one would conclude that there is no significant effect. But still, as you can see the differences are not trivial (.246 for logistic regression versus .291 or even .312 for exact fisher's test). Thus depending on whether you are using logistic regression or fisher's exact test you may come to an other conclusion wether there is a significant effect or not.
3. Making a prediction
To make an analogy: Pearson correlation and linear regression are quite similar in bivariate cases and the standardised regression coefficient is even the same as Pearson's correlation r. But you can't make predictions with a correlation since it is missing an intercept. Similarly, even if odds ratios of logistic regression and fisher's exact test were the same (what is not the case as discussed in point 1) you couldn't make predictions with the results of the fisher's exact test. On the other hand, logistic regression provides you the intercept and the coefficient(s) that are needed to make predictions.
4. Performance
The differences mentioned before can lead to the assumption that there should be differences in the performance of both tests in terms of power and type I error. There are some sources stating that fisher's exact test is too conservarive. On the other hand, one should keep in mind that the standard logistic regression analyses is asymptotic, so with few observations you will probably prefer fisher's exact test.
To sum up, although both tests can be used for same data, there are some differences that can lead to different results and thus to different conclusions. So it depends on the situation which of the two tests you want to use - in case of prediction it would be the logistic regression, in case of small sample sizes the fisher's exact test, and so on. Probably there are even more differences which I left out but maybe someone can edit and add them. | What is the difference using a Fisher's Exact Test vs. a Logistic Regression for $2 \times 2$ tables | I am not sure what the person you've taked to meant with "Logistic Regression give us the magnitude of association" since as you state the fisher's exact test does something quite similar. But still, | What is the difference using a Fisher's Exact Test vs. a Logistic Regression for $2 \times 2$ tables?
I am not sure what the person you've taked to meant with "Logistic Regression give us the magnitude of association" since as you state the fisher's exact test does something quite similar. But still, there are some differences I can think of.
1. The odds ratios (OR) can differ
The OR being reported don't have to be the same. At least this is true for R functions fisher.test() and exact2x2() versus logistic regression via the glm() function. Here an example:
# generating data
set.seed(1)
n <- 200
x <- rbinom(n, 1, .5)
y <- rbinom(n, 1, .4)
df <- data.frame(x, y)
# OR from logistic regression
exp(coef(glm(y ~ x,family=binomial(link='logit'),data= df)))[2]
1.423077
# OR from fisher's exact test
tab <- table(x, y)
fisher.test(tab)$estimate
1.420543 # the methods "minlike", "central" and "blaker" in the exact2x2 function result in the same OR
# calculating OR by hand
(tab[1,1]/ tab[2,1])/ (tab[1,2]/ tab[2,2])
1.423077
The OR of fisher's exact test differs from those calculated by hand or reported in logistic regression because they are calculated by the conditional Maximum Likelihood Estimate and not by the unconditional MLE (sample OR). There may be situations where the OR values differ more than in my example. And again, the OR differ for the functions mentioned but there may be other variants of the tests were they are the same.
2. p values differ
Of course the p values differ since in case of logistic regression they are determined with the Wald statistic and a z value while there are different types of exact fisher's test that even differ in p values among themselves (last link opens pdf). See here for the data used before:
# p value from logistic regression
summary(glm(y ~ x,family=binomial(link='logit'),data= df))$coefficients["x", "Pr(>|z|)"]
0.2457947
# p value from fisher's exact test
library(exact2x2) # package covers different exact fisher's tests, see here https://cran.r-project.org/web/packages/exact2x2/index.html
exact2x2(tab,tsmethod="central")$p.value
0.3116818
exact2x2(tab,tsmethod="minlike")$p.value
0.290994 # which is same as fisher.test(tab)$p.value and exact2x2(tab,tsmethod="blaker")$p.value
Here in all cases one would conclude that there is no significant effect. But still, as you can see the differences are not trivial (.246 for logistic regression versus .291 or even .312 for exact fisher's test). Thus depending on whether you are using logistic regression or fisher's exact test you may come to an other conclusion wether there is a significant effect or not.
3. Making a prediction
To make an analogy: Pearson correlation and linear regression are quite similar in bivariate cases and the standardised regression coefficient is even the same as Pearson's correlation r. But you can't make predictions with a correlation since it is missing an intercept. Similarly, even if odds ratios of logistic regression and fisher's exact test were the same (what is not the case as discussed in point 1) you couldn't make predictions with the results of the fisher's exact test. On the other hand, logistic regression provides you the intercept and the coefficient(s) that are needed to make predictions.
4. Performance
The differences mentioned before can lead to the assumption that there should be differences in the performance of both tests in terms of power and type I error. There are some sources stating that fisher's exact test is too conservarive. On the other hand, one should keep in mind that the standard logistic regression analyses is asymptotic, so with few observations you will probably prefer fisher's exact test.
To sum up, although both tests can be used for same data, there are some differences that can lead to different results and thus to different conclusions. So it depends on the situation which of the two tests you want to use - in case of prediction it would be the logistic regression, in case of small sample sizes the fisher's exact test, and so on. Probably there are even more differences which I left out but maybe someone can edit and add them. | What is the difference using a Fisher's Exact Test vs. a Logistic Regression for $2 \times 2$ tables
I am not sure what the person you've taked to meant with "Logistic Regression give us the magnitude of association" since as you state the fisher's exact test does something quite similar. But still, |
29,629 | Why are the value and policy iteration dynamic programming algorithms? | Have you seen Silver's lecture? Did you know Bellman coined the dynamic programming term, his first book was called "Dynamic programming" in 1957, see Wikipedia?
DP is an algorithm technique to problems that have an optimal substructure and overlapping subproblems. In contrast, if problems have the non-overlapping subproblems property, you only need to solve it once.
In the top-down DP approach (see below) we find a solution based on previously stored results. In policy iteration (policy
evaluation + iteration) and value iteration we update the value
of each state, from older estimates of the optimal policy and state
values.
I think there is also a difference between "classical" DP, because in policy and value iteration we apply update steps iteratively until convergence. In DP updates can be done in one pass. | Why are the value and policy iteration dynamic programming algorithms? | Have you seen Silver's lecture? Did you know Bellman coined the dynamic programming term, his first book was called "Dynamic programming" in 1957, see Wikipedia?
DP is an algorithm technique to probl | Why are the value and policy iteration dynamic programming algorithms?
Have you seen Silver's lecture? Did you know Bellman coined the dynamic programming term, his first book was called "Dynamic programming" in 1957, see Wikipedia?
DP is an algorithm technique to problems that have an optimal substructure and overlapping subproblems. In contrast, if problems have the non-overlapping subproblems property, you only need to solve it once.
In the top-down DP approach (see below) we find a solution based on previously stored results. In policy iteration (policy
evaluation + iteration) and value iteration we update the value
of each state, from older estimates of the optimal policy and state
values.
I think there is also a difference between "classical" DP, because in policy and value iteration we apply update steps iteratively until convergence. In DP updates can be done in one pass. | Why are the value and policy iteration dynamic programming algorithms?
Have you seen Silver's lecture? Did you know Bellman coined the dynamic programming term, his first book was called "Dynamic programming" in 1957, see Wikipedia?
DP is an algorithm technique to probl |
29,630 | Assessing predictive accuracy on longitudinal data | To me, it seems that when the model is making a prediction for subject $s$ at time $t$, it should be allowed to use as training data the observations from all subjects other than $s$ and from all of $s$'s observations that occurred earlier than $t$.
This approach may (may!) make you overestimate your accuracy, depending on your actual use case. And that in two related ways. Why?
For the first reason, consider the following situation. Assume you have multiple weather stations and different weather parameters $W_{s,t}$ measured at each station $s$ and time $t$, like temperature, cloud cover, wind speed & direction. The goal is to predict the weather at all stations.
When predicting the weather at station $s$ for time $t$, would you consider it valid to use all weather data from other stations than $s$ and the weather data up to time $t$ for station $s$?
I hope not. Because the weather $W_{s',t}$ at time $t$ (and later) at stations $s'\neq s$ may be highly correlated with the weather $W_{s,t}$ at station $s$ and time $t$ you want to predict. So using $(W_{s',t})_{s'\neq s}$ may lead to data leakage. After all, you will likely also want to predict $W_{s',t}$ for some $s'\neq s$ using your model - would it be licit to use $W_{s,t}$ here?
What you should be using is the weather data up to but not including $t$ for all stations, i.e., $(W_{s',t'})_{s';t'<t}$.
Of course, the same holds in your application. The behavior for subject $s$ at time $t$ may be highly correlated with the behavior of other subjects $s'\neq s$ at the same time $t$, for all kinds of social reasons.
At some time $t'$, you are predicting for subject $s$ at time $t$. If $t>t'$, then you don't know the information for the other subjects at time $t$ yet! (In the example above, we would be forecasting tomorrow's weather at New York City - but then we wouldn't know tomorrow's weather in Boston, either!) Thus, it doesn't make sense to use the information from other subjects at a time $t$ (or even later!) that we have not observed yet.
Actually, both points may be irrelevant if we are interpolating in the time domain. For instance, we may be sitting in Boston and wonder what the weather right now is in New York City. Then it of course makes sense to look outside and see what the weather is right now outside the window, together with what we know of past weather in New York City. In this situation, you would be explicitly using the fact of a high correlation between the weather at these two cities, and the fact that you know the weather at Boston at the exact time when you want to "predict" it in NYC.
Thus, the takeaway is that you should tailor your model to the question you are actually trying to answer, and to the information set you have at the time you run your predictions in a "production" environment (assuming this notion makes sense).
This is a common setup in time series forecasting, and there called "time series cross validation". (I personally find this term a bit unfortunate and prefer "holdout set" and similar.) In my own applications, for instance, we often want to include the impact of weather on retail sales, and here the second point above comes in: if we want to predict tomorrow's sales, then we don't know tomorrow's weather yet and need to predict this in turn, which adds noise. | Assessing predictive accuracy on longitudinal data | To me, it seems that when the model is making a prediction for subject $s$ at time $t$, it should be allowed to use as training data the observations from all subjects other than $s$ and from all of $ | Assessing predictive accuracy on longitudinal data
To me, it seems that when the model is making a prediction for subject $s$ at time $t$, it should be allowed to use as training data the observations from all subjects other than $s$ and from all of $s$'s observations that occurred earlier than $t$.
This approach may (may!) make you overestimate your accuracy, depending on your actual use case. And that in two related ways. Why?
For the first reason, consider the following situation. Assume you have multiple weather stations and different weather parameters $W_{s,t}$ measured at each station $s$ and time $t$, like temperature, cloud cover, wind speed & direction. The goal is to predict the weather at all stations.
When predicting the weather at station $s$ for time $t$, would you consider it valid to use all weather data from other stations than $s$ and the weather data up to time $t$ for station $s$?
I hope not. Because the weather $W_{s',t}$ at time $t$ (and later) at stations $s'\neq s$ may be highly correlated with the weather $W_{s,t}$ at station $s$ and time $t$ you want to predict. So using $(W_{s',t})_{s'\neq s}$ may lead to data leakage. After all, you will likely also want to predict $W_{s',t}$ for some $s'\neq s$ using your model - would it be licit to use $W_{s,t}$ here?
What you should be using is the weather data up to but not including $t$ for all stations, i.e., $(W_{s',t'})_{s';t'<t}$.
Of course, the same holds in your application. The behavior for subject $s$ at time $t$ may be highly correlated with the behavior of other subjects $s'\neq s$ at the same time $t$, for all kinds of social reasons.
At some time $t'$, you are predicting for subject $s$ at time $t$. If $t>t'$, then you don't know the information for the other subjects at time $t$ yet! (In the example above, we would be forecasting tomorrow's weather at New York City - but then we wouldn't know tomorrow's weather in Boston, either!) Thus, it doesn't make sense to use the information from other subjects at a time $t$ (or even later!) that we have not observed yet.
Actually, both points may be irrelevant if we are interpolating in the time domain. For instance, we may be sitting in Boston and wonder what the weather right now is in New York City. Then it of course makes sense to look outside and see what the weather is right now outside the window, together with what we know of past weather in New York City. In this situation, you would be explicitly using the fact of a high correlation between the weather at these two cities, and the fact that you know the weather at Boston at the exact time when you want to "predict" it in NYC.
Thus, the takeaway is that you should tailor your model to the question you are actually trying to answer, and to the information set you have at the time you run your predictions in a "production" environment (assuming this notion makes sense).
This is a common setup in time series forecasting, and there called "time series cross validation". (I personally find this term a bit unfortunate and prefer "holdout set" and similar.) In my own applications, for instance, we often want to include the impact of weather on retail sales, and here the second point above comes in: if we want to predict tomorrow's sales, then we don't know tomorrow's weather yet and need to predict this in turn, which adds noise. | Assessing predictive accuracy on longitudinal data
To me, it seems that when the model is making a prediction for subject $s$ at time $t$, it should be allowed to use as training data the observations from all subjects other than $s$ and from all of $ |
29,631 | How does an estimator that minimizes a weighted sum of squared bias and variance fit into decision theory? | This is a fairly interesting and novel question! At a formal level, using the frequentist risk function
$$(\mathbb{E}_\theta[\hat\theta(X)]-\theta)^2+k\mathbb{E}_\theta[(\hat\theta(X)-\mathbb{E}[\hat\theta(X)])^2],$$
means using (for instance) the loss function defined as
$$L(\theta,\hat{\theta})=(\mathbb{E}_\theta[\hat\theta(X)]-\theta)^2+k(\hat\theta-\mathbb{E}_\theta[\hat\theta(X)])^2$$
since there is no reason to prohibit expectations like $\mathbb{E}_\theta[\hat\theta(X)]$ to appear in a loss function. That they depend on the whole distribution of $\hat{\theta}(X)$ is a feature that may seem odd, but the whole distribution is set as a function of $\theta$ and the resulting loss is thus a function of $\theta$, $\hat{\theta}$ and the distribution of $\hat{\theta}(X)$.
I can perfectly forecast an objection coming that a loss function $L(\theta,\delta)$ is on principle a function of a state of nature, $\theta$, and of an action, $\delta$, taking place for instance in the parameter space $\Theta$, hence involving no distributional assumption whatsoever. Which is correct from a game theory perspective. But given that this is statistical decision theory, where a decision $\delta$ will depend on the observation $x$ of a random variable $X$, I see no reason why the generalisation where the loss function depends on the distribution of $X$, indexed by $\theta$, could not be considered. That it may violate the likelihood principle is not of direct concern for decision theory and does not prevent the formal derivation of a Bayes estimator. | How does an estimator that minimizes a weighted sum of squared bias and variance fit into decision t | This is a fairly interesting and novel question! At a formal level, using the frequentist risk function
$$(\mathbb{E}_\theta[\hat\theta(X)]-\theta)^2+k\mathbb{E}_\theta[(\hat\theta(X)-\mathbb{E}[\hat\ | How does an estimator that minimizes a weighted sum of squared bias and variance fit into decision theory?
This is a fairly interesting and novel question! At a formal level, using the frequentist risk function
$$(\mathbb{E}_\theta[\hat\theta(X)]-\theta)^2+k\mathbb{E}_\theta[(\hat\theta(X)-\mathbb{E}[\hat\theta(X)])^2],$$
means using (for instance) the loss function defined as
$$L(\theta,\hat{\theta})=(\mathbb{E}_\theta[\hat\theta(X)]-\theta)^2+k(\hat\theta-\mathbb{E}_\theta[\hat\theta(X)])^2$$
since there is no reason to prohibit expectations like $\mathbb{E}_\theta[\hat\theta(X)]$ to appear in a loss function. That they depend on the whole distribution of $\hat{\theta}(X)$ is a feature that may seem odd, but the whole distribution is set as a function of $\theta$ and the resulting loss is thus a function of $\theta$, $\hat{\theta}$ and the distribution of $\hat{\theta}(X)$.
I can perfectly forecast an objection coming that a loss function $L(\theta,\delta)$ is on principle a function of a state of nature, $\theta$, and of an action, $\delta$, taking place for instance in the parameter space $\Theta$, hence involving no distributional assumption whatsoever. Which is correct from a game theory perspective. But given that this is statistical decision theory, where a decision $\delta$ will depend on the observation $x$ of a random variable $X$, I see no reason why the generalisation where the loss function depends on the distribution of $X$, indexed by $\theta$, could not be considered. That it may violate the likelihood principle is not of direct concern for decision theory and does not prevent the formal derivation of a Bayes estimator. | How does an estimator that minimizes a weighted sum of squared bias and variance fit into decision t
This is a fairly interesting and novel question! At a formal level, using the frequentist risk function
$$(\mathbb{E}_\theta[\hat\theta(X)]-\theta)^2+k\mathbb{E}_\theta[(\hat\theta(X)-\mathbb{E}[\hat\ |
29,632 | Is there another interpretation for a Gamma distribution with non-integer shape parameter? | If $X\sim{\cal G}(\alpha,1)$ and $Y\sim{\cal G}(\beta,1)$ are independent then$$X+Y\sim{\cal G}(\alpha+\beta,1)$$ In particular, if $X\sim{\cal G}(\alpha,1)$, it is distributed with the same distribution as
$$X_1+\cdots+X_n\sim{\cal G}(\alpha,1)\qquad X_i\stackrel{\text{iid}}{\sim}{\cal G}(\alpha/n,1)$$for any $n\in\mathbb N$. (This property is called infinite divisibility.) This means that, if $X\sim{\cal G}(\alpha,1)$ when $\alpha$ is not an integer, $X$ has the same distribution as $Y+Z$ with $Z$ independent from $Y$ and
$$Y\sim{\cal G}(\lfloor\alpha\rfloor,1)\qquad Z\sim{\cal G}(\alpha-\lfloor\alpha\rfloor,1)$$It also implies that integer valued shapes $\alpha$ have no particular meaning for Gammas.
Conversely, if $X\sim{\cal G}(\alpha,1)$ with $\alpha<1$, it has the same distribution as $YU^{1/\alpha}$ when $Y$ is independent from $U\sim{\cal U}(0,1)$ and $$Y\sim{\cal G}(\alpha+1,1)$$And hence the distribution ${\cal G}(\alpha,1)$ is invariant in $$X \sim (X'+\xi)U^{1/\alpha}\qquad X,X'\sim{\cal G}(\alpha,1)\quad U\sim{\cal U}(0,1)\quad \xi\sim{\cal E}(1)$$ | Is there another interpretation for a Gamma distribution with non-integer shape parameter? | If $X\sim{\cal G}(\alpha,1)$ and $Y\sim{\cal G}(\beta,1)$ are independent then$$X+Y\sim{\cal G}(\alpha+\beta,1)$$ In particular, if $X\sim{\cal G}(\alpha,1)$, it is distributed with the same distribut | Is there another interpretation for a Gamma distribution with non-integer shape parameter?
If $X\sim{\cal G}(\alpha,1)$ and $Y\sim{\cal G}(\beta,1)$ are independent then$$X+Y\sim{\cal G}(\alpha+\beta,1)$$ In particular, if $X\sim{\cal G}(\alpha,1)$, it is distributed with the same distribution as
$$X_1+\cdots+X_n\sim{\cal G}(\alpha,1)\qquad X_i\stackrel{\text{iid}}{\sim}{\cal G}(\alpha/n,1)$$for any $n\in\mathbb N$. (This property is called infinite divisibility.) This means that, if $X\sim{\cal G}(\alpha,1)$ when $\alpha$ is not an integer, $X$ has the same distribution as $Y+Z$ with $Z$ independent from $Y$ and
$$Y\sim{\cal G}(\lfloor\alpha\rfloor,1)\qquad Z\sim{\cal G}(\alpha-\lfloor\alpha\rfloor,1)$$It also implies that integer valued shapes $\alpha$ have no particular meaning for Gammas.
Conversely, if $X\sim{\cal G}(\alpha,1)$ with $\alpha<1$, it has the same distribution as $YU^{1/\alpha}$ when $Y$ is independent from $U\sim{\cal U}(0,1)$ and $$Y\sim{\cal G}(\alpha+1,1)$$And hence the distribution ${\cal G}(\alpha,1)$ is invariant in $$X \sim (X'+\xi)U^{1/\alpha}\qquad X,X'\sim{\cal G}(\alpha,1)\quad U\sim{\cal U}(0,1)\quad \xi\sim{\cal E}(1)$$ | Is there another interpretation for a Gamma distribution with non-integer shape parameter?
If $X\sim{\cal G}(\alpha,1)$ and $Y\sim{\cal G}(\beta,1)$ are independent then$$X+Y\sim{\cal G}(\alpha+\beta,1)$$ In particular, if $X\sim{\cal G}(\alpha,1)$, it is distributed with the same distribut |
29,633 | Difference between linear model and linear regression | The simplest way to solve your immediate problem, with most of your data fitting simple linear regression well except for data from one depth, is to separate out the issue of the model itself from that of the display of the model results. For the one depth that required a transformation of variables, back-transform the regression fit into the original scale before plotting. For that one depth you will have a curve rather than the straight lines that characterized the other depths, but you should still have a useful x-intercept and the slope of the curve near that intercept will be a start for comparisons of slopes among depths.
You should, however, consider why this particular depth seems to have such different properties from the other depths. Is it an extreme of depth values, perhaps beyond some type of boundary (with respect to temperature, mixing, etc) versus the other depths? Or might it just be that the measurements at that particular depth had some systematic errors, in which case you shouldn't be considering them at all? Such scientific and technical issues are much more important than the details of the statistical approaches.
For the broader issues raised in your question, the assumptions underlying linear models are discussed extensively on this site, for example here. Linearity of outcome with respect to the predictor variables is important, but other assumptions like normal distributions of errors mainly affect the ability to interpret p-values. If there is linearity with respect to predictor variables, the regression will still give a useful estimate of the underlying relation. Generalized linear models provide a way to deal with errors that are a function of the predicted value, as you seem to have for that one troubling depth.
Note that your experimental design, if it is an observational study based on concentrations of chemicals measured at different depths, already violates one of the assumptions of standard linear regression, as there presumably are errors in the values of the predictor variables. What you really have in that case is an error-in-variables model. In practice that distinction is often overlooked, but your regression models (and those of most scientists engaged in observational rather than controlled studies) already violate strict linear regression assumptions.
Finally, although I appreciate that you have already done much data analysis, consider whether you really should use concentration ratios as predictor variables. Ratios are notoriously troublesome, particularly if a denominator can be close to 0. Almost anything that can be accomplished with ratios as predictors can be done with log transformations of the numerator and denominator variables. As I understand your situation, you have a single outcome variable (rate of production of some chemical) and multiple measured concentrations of other chemicals; you then examined various ratios of those other chemicals as predictors for the outcome variable. If you instead formed a combined regression model that used the log concentrations of all the other chemicals as the predictors of the outcome, you might end up with a more useful model, which may show unexpected interactions among the chemicals and still can be interpreted in terms of ratios if you wish. | Difference between linear model and linear regression | The simplest way to solve your immediate problem, with most of your data fitting simple linear regression well except for data from one depth, is to separate out the issue of the model itself from tha | Difference between linear model and linear regression
The simplest way to solve your immediate problem, with most of your data fitting simple linear regression well except for data from one depth, is to separate out the issue of the model itself from that of the display of the model results. For the one depth that required a transformation of variables, back-transform the regression fit into the original scale before plotting. For that one depth you will have a curve rather than the straight lines that characterized the other depths, but you should still have a useful x-intercept and the slope of the curve near that intercept will be a start for comparisons of slopes among depths.
You should, however, consider why this particular depth seems to have such different properties from the other depths. Is it an extreme of depth values, perhaps beyond some type of boundary (with respect to temperature, mixing, etc) versus the other depths? Or might it just be that the measurements at that particular depth had some systematic errors, in which case you shouldn't be considering them at all? Such scientific and technical issues are much more important than the details of the statistical approaches.
For the broader issues raised in your question, the assumptions underlying linear models are discussed extensively on this site, for example here. Linearity of outcome with respect to the predictor variables is important, but other assumptions like normal distributions of errors mainly affect the ability to interpret p-values. If there is linearity with respect to predictor variables, the regression will still give a useful estimate of the underlying relation. Generalized linear models provide a way to deal with errors that are a function of the predicted value, as you seem to have for that one troubling depth.
Note that your experimental design, if it is an observational study based on concentrations of chemicals measured at different depths, already violates one of the assumptions of standard linear regression, as there presumably are errors in the values of the predictor variables. What you really have in that case is an error-in-variables model. In practice that distinction is often overlooked, but your regression models (and those of most scientists engaged in observational rather than controlled studies) already violate strict linear regression assumptions.
Finally, although I appreciate that you have already done much data analysis, consider whether you really should use concentration ratios as predictor variables. Ratios are notoriously troublesome, particularly if a denominator can be close to 0. Almost anything that can be accomplished with ratios as predictors can be done with log transformations of the numerator and denominator variables. As I understand your situation, you have a single outcome variable (rate of production of some chemical) and multiple measured concentrations of other chemicals; you then examined various ratios of those other chemicals as predictors for the outcome variable. If you instead formed a combined regression model that used the log concentrations of all the other chemicals as the predictors of the outcome, you might end up with a more useful model, which may show unexpected interactions among the chemicals and still can be interpreted in terms of ratios if you wish. | Difference between linear model and linear regression
The simplest way to solve your immediate problem, with most of your data fitting simple linear regression well except for data from one depth, is to separate out the issue of the model itself from tha |
29,634 | How to combine regression models? | It's not clear whether you want estimates of height for each individual man and woman (more of a classification problem) or to characterize the distribution of heights of each sex. I will assume the latter. You also do not specify what additional information you are using in your model, so I will confine myself to addressing the case where you only have height data (and sex data, in the case of non-US citizens).
I recommend simply fitting a mixture of distributions to the height data from the US only, because the distributions of height in men and women are reasonably different. This would estimate the parameters of two distributions that when summed together best describe the variation in the data. The parameters of these distributions (mean and variance, since a Gaussian distribution should work fine) give you the information you are after. The R packages mixtools and mixdist let you do this; I'm sure there are many more as well.
This solution may seem odd, because it leaves out all the information you have from outside the US, where you have know the sex and height of each individual. But I think it is justified because:
1) We have a very strong prior expectation that men are on average taller than women. Wikipedia's List of average human height worldwide shows not even one country or region where women are taller than men. So the identity of the distribution with the greater mean height is not really in doubt.
2) Integrating more specific information from the non-US data will likely involve making the assumption that the covariance between sex and height is the same outside the US as inside. But this is not entirely true - the same Wikipedia list indicates that the ratio of male to female heights varies between approximately 1.04 and 1.13.
3) Your international data may be much more complicated to analyse because people in different countries have wide variation in height distributions as well. You may therefore need to consider modelling mixtures of mixtures of distributions. This may also be true in the US, but it is likely to be less of a problem than a dataset that includes the Dutch (mean height: 184 cms) and Indonesians (mean height: 158 cms). And those are country-level averages; subpopulations differ to an even degree. | How to combine regression models? | It's not clear whether you want estimates of height for each individual man and woman (more of a classification problem) or to characterize the distribution of heights of each sex. I will assume the l | How to combine regression models?
It's not clear whether you want estimates of height for each individual man and woman (more of a classification problem) or to characterize the distribution of heights of each sex. I will assume the latter. You also do not specify what additional information you are using in your model, so I will confine myself to addressing the case where you only have height data (and sex data, in the case of non-US citizens).
I recommend simply fitting a mixture of distributions to the height data from the US only, because the distributions of height in men and women are reasonably different. This would estimate the parameters of two distributions that when summed together best describe the variation in the data. The parameters of these distributions (mean and variance, since a Gaussian distribution should work fine) give you the information you are after. The R packages mixtools and mixdist let you do this; I'm sure there are many more as well.
This solution may seem odd, because it leaves out all the information you have from outside the US, where you have know the sex and height of each individual. But I think it is justified because:
1) We have a very strong prior expectation that men are on average taller than women. Wikipedia's List of average human height worldwide shows not even one country or region where women are taller than men. So the identity of the distribution with the greater mean height is not really in doubt.
2) Integrating more specific information from the non-US data will likely involve making the assumption that the covariance between sex and height is the same outside the US as inside. But this is not entirely true - the same Wikipedia list indicates that the ratio of male to female heights varies between approximately 1.04 and 1.13.
3) Your international data may be much more complicated to analyse because people in different countries have wide variation in height distributions as well. You may therefore need to consider modelling mixtures of mixtures of distributions. This may also be true in the US, but it is likely to be less of a problem than a dataset that includes the Dutch (mean height: 184 cms) and Indonesians (mean height: 158 cms). And those are country-level averages; subpopulations differ to an even degree. | How to combine regression models?
It's not clear whether you want estimates of height for each individual man and woman (more of a classification problem) or to characterize the distribution of heights of each sex. I will assume the l |
29,635 | Sampling Effects on Time Series Models | ARIMA's may not be well suited to your purpose, but state space models are: you might sample as often as you wish (and in principle, the more the better) and perform a temporal update at fixed intervals, as the dynamics of your assumed process may demand. One of the beauties of state-space models is that the observation process is separate from the model process, and separate time intervals may be used for each. | Sampling Effects on Time Series Models | ARIMA's may not be well suited to your purpose, but state space models are: you might sample as often as you wish (and in principle, the more the better) and perform a temporal update at fixed interva | Sampling Effects on Time Series Models
ARIMA's may not be well suited to your purpose, but state space models are: you might sample as often as you wish (and in principle, the more the better) and perform a temporal update at fixed intervals, as the dynamics of your assumed process may demand. One of the beauties of state-space models is that the observation process is separate from the model process, and separate time intervals may be used for each. | Sampling Effects on Time Series Models
ARIMA's may not be well suited to your purpose, but state space models are: you might sample as often as you wish (and in principle, the more the better) and perform a temporal update at fixed interva |
29,636 | Sampling Effects on Time Series Models | I'd like to point you to the article
Ghysels, E, P. Santa-Clara and R. Valkanov (2006): "Predicting volatility:
Getting the most of return data sampled at different frequencies",
Journal of Econometrics, vol. 131, pp. 59-95.
The authors employ a technique called MIDAS (mixed data sampling) by themselves in order to compare estimates of volatility based on data sampled at different frequencies. Admittedly this is not exactly what you were looking for but the authors claim that their technique is suitable for comparing the results in a meaningful way. Maybe this gives you at least a second way of analyzing your data. It seems that in particular in the field of macroeconomics this approach has gained some interest. | Sampling Effects on Time Series Models | I'd like to point you to the article
Ghysels, E, P. Santa-Clara and R. Valkanov (2006): "Predicting volatility:
Getting the most of return data sampled at different frequencies",
Journal of Econometr | Sampling Effects on Time Series Models
I'd like to point you to the article
Ghysels, E, P. Santa-Clara and R. Valkanov (2006): "Predicting volatility:
Getting the most of return data sampled at different frequencies",
Journal of Econometrics, vol. 131, pp. 59-95.
The authors employ a technique called MIDAS (mixed data sampling) by themselves in order to compare estimates of volatility based on data sampled at different frequencies. Admittedly this is not exactly what you were looking for but the authors claim that their technique is suitable for comparing the results in a meaningful way. Maybe this gives you at least a second way of analyzing your data. It seems that in particular in the field of macroeconomics this approach has gained some interest. | Sampling Effects on Time Series Models
I'd like to point you to the article
Ghysels, E, P. Santa-Clara and R. Valkanov (2006): "Predicting volatility:
Getting the most of return data sampled at different frequencies",
Journal of Econometr |
29,637 | Sampling Effects on Time Series Models | sample more frequently when there is variation, and less frequently when there is not
That could work in sample but would be difficult to use for out-of-sample predictions, unless you figure out how to predict the variability itself (and that need not be impossible). Also, if you encounter regimes with low variation (or no variation at all) followed by regimes of high variation, you would naturally need separate models for the two; having one model for the whole process and sampling at uneven intervals/frequencies would intuitively seem suboptimal. You mentioned regime switching models (when answering my comment), and that is a good illustration what you might need here.
I should be sampling as frequently as possible so that I will have a much bigger number of samples, hence my model parameters will have less variation.
This is not entirely true. In a time series setting, it is often the time span rather than the number of observations that matters. For example, 120 monthly observations (spanning 10 years) is a more informative sample than 209 weekly observation (spanning 4 years) when testing for presence of a unit root; see this Dave Giles' blog post and the last reference in it. Or consider a limiting case where you sample so frequently that you essentially measure the same thing multiple times. That would increase your sample size but would not bring in new information, leading to a spurious impression of estimate precision. So perhaps you should not spend too much time on increasing the sampling frequency and building some corresponding models? | Sampling Effects on Time Series Models | sample more frequently when there is variation, and less frequently when there is not
That could work in sample but would be difficult to use for out-of-sample predictions, unless you figure out how | Sampling Effects on Time Series Models
sample more frequently when there is variation, and less frequently when there is not
That could work in sample but would be difficult to use for out-of-sample predictions, unless you figure out how to predict the variability itself (and that need not be impossible). Also, if you encounter regimes with low variation (or no variation at all) followed by regimes of high variation, you would naturally need separate models for the two; having one model for the whole process and sampling at uneven intervals/frequencies would intuitively seem suboptimal. You mentioned regime switching models (when answering my comment), and that is a good illustration what you might need here.
I should be sampling as frequently as possible so that I will have a much bigger number of samples, hence my model parameters will have less variation.
This is not entirely true. In a time series setting, it is often the time span rather than the number of observations that matters. For example, 120 monthly observations (spanning 10 years) is a more informative sample than 209 weekly observation (spanning 4 years) when testing for presence of a unit root; see this Dave Giles' blog post and the last reference in it. Or consider a limiting case where you sample so frequently that you essentially measure the same thing multiple times. That would increase your sample size but would not bring in new information, leading to a spurious impression of estimate precision. So perhaps you should not spend too much time on increasing the sampling frequency and building some corresponding models? | Sampling Effects on Time Series Models
sample more frequently when there is variation, and less frequently when there is not
That could work in sample but would be difficult to use for out-of-sample predictions, unless you figure out how |
29,638 | Comparing two ECDFs using Kolmogorov-Smirnov test (alternative hypothesis) | First, please note that your understanding of what the p-values mean is not correct. E.g.:
Hypothesis #1: two-sided (equal)
The probability that both distributions are the same is 2.03% (p-value
= 0.02030601).
This is not the case. The p-value is not the probability of the null hypothesis being true. The correct definition is: if the null hypothesis is true (which you don't know), then the p-value is the (maximal) probability that you obtained the particular test statistic* value you calculated from your sample(s) purely by chance.
If the p-value is considered "very low" (how much, it's up to you to decide by stipulating a p-value threshold, say 0.05 by tradition), then you may say that it seems to be very unlikely that the test statistic value came from the null distribution by chance (although it could!), therefore it's reasonable to reject the null hypothesis.
Second, would it not have been easier to compare just the means of the system response times between November/December using a t-test (if the raw data are approx. normally distributed), or to compare the sample locations with a Wilcoxon-Mann-Whitney U-test? Please note that I am not familiar with the task at hand so this might be a completely useless suggestion.
*In general the test statistic is a number that you calculate from your sample(s). Its distribution is the null distribution if the null hypothesis is true. For the K-S test the test statistic is the maximal difference between the two (empirical) CDFs. | Comparing two ECDFs using Kolmogorov-Smirnov test (alternative hypothesis) | First, please note that your understanding of what the p-values mean is not correct. E.g.:
Hypothesis #1: two-sided (equal)
The probability that both distributions are the same is 2.03% (p-value
= | Comparing two ECDFs using Kolmogorov-Smirnov test (alternative hypothesis)
First, please note that your understanding of what the p-values mean is not correct. E.g.:
Hypothesis #1: two-sided (equal)
The probability that both distributions are the same is 2.03% (p-value
= 0.02030601).
This is not the case. The p-value is not the probability of the null hypothesis being true. The correct definition is: if the null hypothesis is true (which you don't know), then the p-value is the (maximal) probability that you obtained the particular test statistic* value you calculated from your sample(s) purely by chance.
If the p-value is considered "very low" (how much, it's up to you to decide by stipulating a p-value threshold, say 0.05 by tradition), then you may say that it seems to be very unlikely that the test statistic value came from the null distribution by chance (although it could!), therefore it's reasonable to reject the null hypothesis.
Second, would it not have been easier to compare just the means of the system response times between November/December using a t-test (if the raw data are approx. normally distributed), or to compare the sample locations with a Wilcoxon-Mann-Whitney U-test? Please note that I am not familiar with the task at hand so this might be a completely useless suggestion.
*In general the test statistic is a number that you calculate from your sample(s). Its distribution is the null distribution if the null hypothesis is true. For the K-S test the test statistic is the maximal difference between the two (empirical) CDFs. | Comparing two ECDFs using Kolmogorov-Smirnov test (alternative hypothesis)
First, please note that your understanding of what the p-values mean is not correct. E.g.:
Hypothesis #1: two-sided (equal)
The probability that both distributions are the same is 2.03% (p-value
= |
29,639 | Comparing two ECDFs using Kolmogorov-Smirnov test (alternative hypothesis) | Sorry, I think that you misunderstood this metrics purpose. KS gives a criterion about the similarity of the distribution of two dataset. In this cases p-value indicates the probability that both dataset have the same distribution. | Comparing two ECDFs using Kolmogorov-Smirnov test (alternative hypothesis) | Sorry, I think that you misunderstood this metrics purpose. KS gives a criterion about the similarity of the distribution of two dataset. In this cases p-value indicates the probability that both data | Comparing two ECDFs using Kolmogorov-Smirnov test (alternative hypothesis)
Sorry, I think that you misunderstood this metrics purpose. KS gives a criterion about the similarity of the distribution of two dataset. In this cases p-value indicates the probability that both dataset have the same distribution. | Comparing two ECDFs using Kolmogorov-Smirnov test (alternative hypothesis)
Sorry, I think that you misunderstood this metrics purpose. KS gives a criterion about the similarity of the distribution of two dataset. In this cases p-value indicates the probability that both data |
29,640 | What is the variance of this estimator | Q1: No, it's not quite right. You omit the subscripts in line 3 of your final derivation of the covariance. That obscures the fact that the two RVs labeled "X" are in fact independent of one another: one had an $\ell$ subscript and the other a $k$. In that whole block of equalities, the only nonzero terms should be when $k=\ell$, because functions of independent inputs are independent. (I assume you are okay with saying $X_{12}, Y_1$ is independent of $X_{22}, Y_2$ even though this does not follow, strictly speaking, from pairwise claims of independence among all the $X$'s and $Y$'s.)
Q2: From above, that term is nonzero only when $k=\ell$, and in that case, it reduces to $Cov(f(X_{jk}, Y_k), f(X_{jk}, Y_k)) = Var(f(X_{jk}, Y_k))$. The result after the sum is $Cov(\mu_k, \mu_k) = \frac{1}{n_k} Var(f(X_{jk}, Y_k))$.
Q3: Yes: after these modifications, you will have only a linear number of terms in the very last sum, so the denominator's quadratic term will win. | What is the variance of this estimator | Q1: No, it's not quite right. You omit the subscripts in line 3 of your final derivation of the covariance. That obscures the fact that the two RVs labeled "X" are in fact independent of one another: | What is the variance of this estimator
Q1: No, it's not quite right. You omit the subscripts in line 3 of your final derivation of the covariance. That obscures the fact that the two RVs labeled "X" are in fact independent of one another: one had an $\ell$ subscript and the other a $k$. In that whole block of equalities, the only nonzero terms should be when $k=\ell$, because functions of independent inputs are independent. (I assume you are okay with saying $X_{12}, Y_1$ is independent of $X_{22}, Y_2$ even though this does not follow, strictly speaking, from pairwise claims of independence among all the $X$'s and $Y$'s.)
Q2: From above, that term is nonzero only when $k=\ell$, and in that case, it reduces to $Cov(f(X_{jk}, Y_k), f(X_{jk}, Y_k)) = Var(f(X_{jk}, Y_k))$. The result after the sum is $Cov(\mu_k, \mu_k) = \frac{1}{n_k} Var(f(X_{jk}, Y_k))$.
Q3: Yes: after these modifications, you will have only a linear number of terms in the very last sum, so the denominator's quadratic term will win. | What is the variance of this estimator
Q1: No, it's not quite right. You omit the subscripts in line 3 of your final derivation of the covariance. That obscures the fact that the two RVs labeled "X" are in fact independent of one another: |
29,641 | How do gradients propagate in an unrolled recurrent neural network? | I think you need target values. So for the sequence $(x_1, x_2, x_3)$, you'd need corresponding targets $(t_1, t_2, t_3)$. Since you seem to want to predict the next term of the original input sequence, you'd need:
$$t_1 = x_2,\ t_2 = x_3,\ t_3 = x_4$$
You'd need to define $x_4$, so if you had a input sequence of length $N$ to train the RNN with, you'd only be able to use the first $N-1$ terms as input values and the last $N-1$ terms as target values.
If we use a sum of square error term for the objective function, then how is it defined?
As far as I'm aware, you're right - the error is the sum across the whole sequence. This is because the weights $u$, $v$ and $w$ are the same across the unfolded RNN.
So,
$$E = \sum\limits_t E^t = \sum\limits_t (t^t - p^t)^2$$
Are weights updated only once the entire sequence was looked at (in this case, the 3-point sequence)?
Yes, if using back propagation through time then I believe so.
As for the differentials, you won't want to expand the whole expression out for $E$ and differentiate it when it comes to larger RNNs. So, some notation can make it neater:
Let $z^t$ denote the input to the hidden neuron at time $t$ (i.e. $z^1 = ws + vx^1$)
Let $y^t$ denote the output for the hidden neuron at time $t$ (i.e.
$y^1 = \sigma(ws + vx^1))$
Let $y^0 = s$
Let $\delta^t = \frac{\partial E}{\partial z^t}$
Then, the derivatives are:
$$\begin{align}\frac{\partial E}{\partial u} &= y^t \\\\
\frac{\partial E}{\partial v} &= \sum\limits_t\delta^tx^t \\\\
\frac{\partial E}{\partial w} &= \sum\limits_t\delta^ty^{t-1}
\end{align}$$
Where $t \in [1,\ T]$ for a sequence of length $T$, and:
$$\begin{equation}
\delta^t = \sigma'(z^t)(u + \delta^{t+1}w)
\end{equation}$$
This recurrent relation comes from realising that the $t^{th}$ hidden activity not only effects the error at the $t^{th}$ output, $E^t$, but it also effects the rest of the error further down the RNN, $E - E^t$:
$$\begin{align}
\frac{\partial E}{\partial z^t} &= \frac{\partial E^t}{\partial y^t}\frac{\partial y^t}{\partial z^t} + \frac{\partial (E - E^t)}{\partial z^{t+1}}\frac{\partial z^{t+1}}{\partial y^t}\frac{\partial y^t}{\partial z^t} \\\\
\frac{\partial E}{\partial z^t} &= \frac{\partial y^t}{\partial z^t}\left(\frac{\partial E^t}{\partial y^t} + \frac{\partial (E - E^t)}{\partial z^{t+1}}\frac{\partial z^{t+1}}{\partial y^t}\right) \\\\
\frac{\partial E}{\partial z^t} &= \sigma'(z^t)\left(u + \frac{\partial (E - E^t)}{\partial z^{t+1}}w\right) \\\\
\delta^t = \frac{\partial E}{\partial z^t} &= \sigma'(z^t)(u + \delta^{t+1}w) \\\\
\end{align}$$
Besides doing it that way, this doesn't look like vanilla back-propagation to me, because the same parameters appear in different layers of the network. How do we adjust for that?
This method is called back propagation through time (BPTT), and is similar to back propagation in the sense that it uses repeated application of the chain rule.
A more detailed but complicated worked example for an RNN can be found in Chapter 3.2 of 'Supervised Sequence Labelling with Recurrent Neural Networks' by Alex Graves - really interesting read! | How do gradients propagate in an unrolled recurrent neural network? | I think you need target values. So for the sequence $(x_1, x_2, x_3)$, you'd need corresponding targets $(t_1, t_2, t_3)$. Since you seem to want to predict the next term of the original input sequenc | How do gradients propagate in an unrolled recurrent neural network?
I think you need target values. So for the sequence $(x_1, x_2, x_3)$, you'd need corresponding targets $(t_1, t_2, t_3)$. Since you seem to want to predict the next term of the original input sequence, you'd need:
$$t_1 = x_2,\ t_2 = x_3,\ t_3 = x_4$$
You'd need to define $x_4$, so if you had a input sequence of length $N$ to train the RNN with, you'd only be able to use the first $N-1$ terms as input values and the last $N-1$ terms as target values.
If we use a sum of square error term for the objective function, then how is it defined?
As far as I'm aware, you're right - the error is the sum across the whole sequence. This is because the weights $u$, $v$ and $w$ are the same across the unfolded RNN.
So,
$$E = \sum\limits_t E^t = \sum\limits_t (t^t - p^t)^2$$
Are weights updated only once the entire sequence was looked at (in this case, the 3-point sequence)?
Yes, if using back propagation through time then I believe so.
As for the differentials, you won't want to expand the whole expression out for $E$ and differentiate it when it comes to larger RNNs. So, some notation can make it neater:
Let $z^t$ denote the input to the hidden neuron at time $t$ (i.e. $z^1 = ws + vx^1$)
Let $y^t$ denote the output for the hidden neuron at time $t$ (i.e.
$y^1 = \sigma(ws + vx^1))$
Let $y^0 = s$
Let $\delta^t = \frac{\partial E}{\partial z^t}$
Then, the derivatives are:
$$\begin{align}\frac{\partial E}{\partial u} &= y^t \\\\
\frac{\partial E}{\partial v} &= \sum\limits_t\delta^tx^t \\\\
\frac{\partial E}{\partial w} &= \sum\limits_t\delta^ty^{t-1}
\end{align}$$
Where $t \in [1,\ T]$ for a sequence of length $T$, and:
$$\begin{equation}
\delta^t = \sigma'(z^t)(u + \delta^{t+1}w)
\end{equation}$$
This recurrent relation comes from realising that the $t^{th}$ hidden activity not only effects the error at the $t^{th}$ output, $E^t$, but it also effects the rest of the error further down the RNN, $E - E^t$:
$$\begin{align}
\frac{\partial E}{\partial z^t} &= \frac{\partial E^t}{\partial y^t}\frac{\partial y^t}{\partial z^t} + \frac{\partial (E - E^t)}{\partial z^{t+1}}\frac{\partial z^{t+1}}{\partial y^t}\frac{\partial y^t}{\partial z^t} \\\\
\frac{\partial E}{\partial z^t} &= \frac{\partial y^t}{\partial z^t}\left(\frac{\partial E^t}{\partial y^t} + \frac{\partial (E - E^t)}{\partial z^{t+1}}\frac{\partial z^{t+1}}{\partial y^t}\right) \\\\
\frac{\partial E}{\partial z^t} &= \sigma'(z^t)\left(u + \frac{\partial (E - E^t)}{\partial z^{t+1}}w\right) \\\\
\delta^t = \frac{\partial E}{\partial z^t} &= \sigma'(z^t)(u + \delta^{t+1}w) \\\\
\end{align}$$
Besides doing it that way, this doesn't look like vanilla back-propagation to me, because the same parameters appear in different layers of the network. How do we adjust for that?
This method is called back propagation through time (BPTT), and is similar to back propagation in the sense that it uses repeated application of the chain rule.
A more detailed but complicated worked example for an RNN can be found in Chapter 3.2 of 'Supervised Sequence Labelling with Recurrent Neural Networks' by Alex Graves - really interesting read! | How do gradients propagate in an unrolled recurrent neural network?
I think you need target values. So for the sequence $(x_1, x_2, x_3)$, you'd need corresponding targets $(t_1, t_2, t_3)$. Since you seem to want to predict the next term of the original input sequenc |
29,642 | How do gradients propagate in an unrolled recurrent neural network? | Error that you describe above (after modification which I wrote in comment below the question) you can use only like a total prediction error, but you can't use it in learning process. On every iteration you put one input value in network and get one output. When you get output, you must check your network result and propagate the error to all weights. After update you will put next value in sequence and make prediction for this value, than you also propagate the error and so on. | How do gradients propagate in an unrolled recurrent neural network? | Error that you describe above (after modification which I wrote in comment below the question) you can use only like a total prediction error, but you can't use it in learning process. On every iterat | How do gradients propagate in an unrolled recurrent neural network?
Error that you describe above (after modification which I wrote in comment below the question) you can use only like a total prediction error, but you can't use it in learning process. On every iteration you put one input value in network and get one output. When you get output, you must check your network result and propagate the error to all weights. After update you will put next value in sequence and make prediction for this value, than you also propagate the error and so on. | How do gradients propagate in an unrolled recurrent neural network?
Error that you describe above (after modification which I wrote in comment below the question) you can use only like a total prediction error, but you can't use it in learning process. On every iterat |
29,643 | Order statistic for beta distribution | Let the parent random variable $X \sim Beta(a,b)$ with pdf $f(x)$:
(source: tri.org.au)
Then, given a sample of size $n$, the pdf of the $1^{st}$ order statistic (sample minimum) is:
(source: tri.org.au)
... and the pdf of the $n^{th}$ order statistic (sample maximum) is:
(source: tri.org.au)
where:
I am using the OrderStat function from the mathStatica package for Mathematica to automate the nitty-gritties
Beta[x,a,b] denotes the incomplete Beta function $B_x(a,b) = \int _0^x t^{a-1} (1-t)^{b-1} d t$
and the domain of support is (0,1). | Order statistic for beta distribution | Let the parent random variable $X \sim Beta(a,b)$ with pdf $f(x)$:
(source: tri.org.au)
Then, given a sample of size $n$, the pdf of the $1^{st}$ order statistic (sample minimum) is:
(source: tri.or | Order statistic for beta distribution
Let the parent random variable $X \sim Beta(a,b)$ with pdf $f(x)$:
(source: tri.org.au)
Then, given a sample of size $n$, the pdf of the $1^{st}$ order statistic (sample minimum) is:
(source: tri.org.au)
... and the pdf of the $n^{th}$ order statistic (sample maximum) is:
(source: tri.org.au)
where:
I am using the OrderStat function from the mathStatica package for Mathematica to automate the nitty-gritties
Beta[x,a,b] denotes the incomplete Beta function $B_x(a,b) = \int _0^x t^{a-1} (1-t)^{b-1} d t$
and the domain of support is (0,1). | Order statistic for beta distribution
Let the parent random variable $X \sim Beta(a,b)$ with pdf $f(x)$:
(source: tri.org.au)
Then, given a sample of size $n$, the pdf of the $1^{st}$ order statistic (sample minimum) is:
(source: tri.or |
29,644 | References: Tail of the inverse cdf | To handle the "little work" suggested by Yves in the comments, geometry suggests a rigorous and fully general proof.
If you like, you may replace all references to areas by integrals and references to "arbitrary" by the usual epsilon-delta arguments. The translation is easy.
To set up the picture, let $G$ be the survival function
$$G(x) = 1-F(x) = \Pr(X \gt x).$$
The figure plots a part of $G$. (Notice the jump in the graph: this particular distribution is not continuous.) A large threshold $T$ is shown and a tiny probability $\epsilon \le G(T)$ has been selected (so that $G^{-1}(\epsilon)\ge T$).
We're ready to go: the value we're interested in, $\epsilon F^{-1}(1-\epsilon) = \epsilon G^{-1}(\epsilon)$ (the one we want to show converges to zero), is the area of the white rectangle with height $\epsilon$ and base from $x=0$ to $x= G^{-1}(\epsilon)$. Let's relate this area to the expectation of $F$, because the only assumption available to us is that this expectation exists and is finite.
The positive part $E_{+}$ of the expectation $\mathbb{E}_F(X)$ is the area under the survival curve (from $0$ to $\infty$):
$$\mathbb{E}_F(X) = E_{+}-E_{-} = \int_0^\infty G(x) dx - \int_{-\infty}^0 F(x) dx.$$
Because $E_{+}$ must be finite (for otherwise the expectation itself would not exist and be finite), we may pick $T$ so large that the area under $G$ between $0$ and $T$ accounts for all, or nearly all, of $E_{+}$.
All the pieces are now in place: the graph of $G$, the threshold $T$, the small height $\epsilon$, and the right-hand endpoint $G^{-1}(\epsilon)$ suggest a dissection of $E_{+}$ into areas we can analyze:
As $\epsilon$ goes to zero from above, the area of the white rectangle with base $0\le x \lt T$ shrinks to zero, because $T$ remains constant. (This is why $T$ was introduced; it's the key idea to this demonstration.)
The blue area can be made as close to $E_{+}$ as you might like, by starting with a suitably large $T$ and then choosing small $\epsilon$.
Consequently, the area left over--which clearly is no greater than the white rectangle with base from $x=T$ to $x=G^{-1}(\epsilon)$--can be made arbitrarily small. (In other words, just ignore the red and gold areas.)
We have thereby broken $\epsilon G^{-1}(\epsilon)$ into two pieces whose areas both converge to zero. Thus, $\epsilon G^{-1}(\epsilon)\to 0$, QED. | References: Tail of the inverse cdf | To handle the "little work" suggested by Yves in the comments, geometry suggests a rigorous and fully general proof.
If you like, you may replace all references to areas by integrals and references to | References: Tail of the inverse cdf
To handle the "little work" suggested by Yves in the comments, geometry suggests a rigorous and fully general proof.
If you like, you may replace all references to areas by integrals and references to "arbitrary" by the usual epsilon-delta arguments. The translation is easy.
To set up the picture, let $G$ be the survival function
$$G(x) = 1-F(x) = \Pr(X \gt x).$$
The figure plots a part of $G$. (Notice the jump in the graph: this particular distribution is not continuous.) A large threshold $T$ is shown and a tiny probability $\epsilon \le G(T)$ has been selected (so that $G^{-1}(\epsilon)\ge T$).
We're ready to go: the value we're interested in, $\epsilon F^{-1}(1-\epsilon) = \epsilon G^{-1}(\epsilon)$ (the one we want to show converges to zero), is the area of the white rectangle with height $\epsilon$ and base from $x=0$ to $x= G^{-1}(\epsilon)$. Let's relate this area to the expectation of $F$, because the only assumption available to us is that this expectation exists and is finite.
The positive part $E_{+}$ of the expectation $\mathbb{E}_F(X)$ is the area under the survival curve (from $0$ to $\infty$):
$$\mathbb{E}_F(X) = E_{+}-E_{-} = \int_0^\infty G(x) dx - \int_{-\infty}^0 F(x) dx.$$
Because $E_{+}$ must be finite (for otherwise the expectation itself would not exist and be finite), we may pick $T$ so large that the area under $G$ between $0$ and $T$ accounts for all, or nearly all, of $E_{+}$.
All the pieces are now in place: the graph of $G$, the threshold $T$, the small height $\epsilon$, and the right-hand endpoint $G^{-1}(\epsilon)$ suggest a dissection of $E_{+}$ into areas we can analyze:
As $\epsilon$ goes to zero from above, the area of the white rectangle with base $0\le x \lt T$ shrinks to zero, because $T$ remains constant. (This is why $T$ was introduced; it's the key idea to this demonstration.)
The blue area can be made as close to $E_{+}$ as you might like, by starting with a suitably large $T$ and then choosing small $\epsilon$.
Consequently, the area left over--which clearly is no greater than the white rectangle with base from $x=T$ to $x=G^{-1}(\epsilon)$--can be made arbitrarily small. (In other words, just ignore the red and gold areas.)
We have thereby broken $\epsilon G^{-1}(\epsilon)$ into two pieces whose areas both converge to zero. Thus, $\epsilon G^{-1}(\epsilon)\to 0$, QED. | References: Tail of the inverse cdf
To handle the "little work" suggested by Yves in the comments, geometry suggests a rigorous and fully general proof.
If you like, you may replace all references to areas by integrals and references to |
29,645 | How to make sure that a machine learning algorithm's implementation is correct? [duplicate] | There are various metrics for algorithm's performance (precision, recall, f1, etc.). I'd start by searching for a paper by the algorithm's authors where they mention what kind of data they have tested their algorithm on, what are the results (what metric do they mention) of their algorithm on that data. Then I'd search for the same or similar data, run my implementation on it and compare the results with theirs | How to make sure that a machine learning algorithm's implementation is correct? [duplicate] | There are various metrics for algorithm's performance (precision, recall, f1, etc.). I'd start by searching for a paper by the algorithm's authors where they mention what kind of data they have tested | How to make sure that a machine learning algorithm's implementation is correct? [duplicate]
There are various metrics for algorithm's performance (precision, recall, f1, etc.). I'd start by searching for a paper by the algorithm's authors where they mention what kind of data they have tested their algorithm on, what are the results (what metric do they mention) of their algorithm on that data. Then I'd search for the same or similar data, run my implementation on it and compare the results with theirs | How to make sure that a machine learning algorithm's implementation is correct? [duplicate]
There are various metrics for algorithm's performance (precision, recall, f1, etc.). I'd start by searching for a paper by the algorithm's authors where they mention what kind of data they have tested |
29,646 | How to make sure that a machine learning algorithm's implementation is correct? [duplicate] | On the Generalized Testing of Machine Learning Algorithms:
Yes, if there is a known working method, comparing your result to that method over all possible parameters will guarantee that your program is also a known working method. This is usually impossible and always pointless because there already is a known working method.
If there isn't a known working method, then in general no, as a counter point consider this "code" that calculates regression coefficients:
$\hat{\beta} = (X'X)^{-1}X'y + \delta$
where $\delta = 1000$ when $y[1] = \pi$ else 0.
This implementation is right almost all of the time (technically right a.s., but not under IEEE 754), and it is computationally intractable to find it's error.
On the Implementations of Methods:
Standard practice is the same as in all software development small test cases, and constant validation against something known. E.g. if the model under certain parameters has a known closed form solution or is equivalent to another method check that.
Also note that papers's aren't perfect, in most lit reviews I do I usually find a few typo's. Some of these typos actually would cause incorrect results, so always double check your sources.
There is a reason emails are on journal papers (HINT: it's so you can contact the authors). Also note that author's don't generally bite if you are nice to them. Just be courteous, and show that you have done some work. But don't expect them to step through your broken code to find a bug.
If you have the case where an author won't release the code, or won't respond to you, then don't use that method, more than likely the quality of the code was "good enough to publish" but that's about it. There certainly is no shortage of machine learning algorithms out there. It's also worth while checking who has cited the paper in question and see if they have some code. | How to make sure that a machine learning algorithm's implementation is correct? [duplicate] | On the Generalized Testing of Machine Learning Algorithms:
Yes, if there is a known working method, comparing your result to that method over all possible parameters will guarantee that your program i | How to make sure that a machine learning algorithm's implementation is correct? [duplicate]
On the Generalized Testing of Machine Learning Algorithms:
Yes, if there is a known working method, comparing your result to that method over all possible parameters will guarantee that your program is also a known working method. This is usually impossible and always pointless because there already is a known working method.
If there isn't a known working method, then in general no, as a counter point consider this "code" that calculates regression coefficients:
$\hat{\beta} = (X'X)^{-1}X'y + \delta$
where $\delta = 1000$ when $y[1] = \pi$ else 0.
This implementation is right almost all of the time (technically right a.s., but not under IEEE 754), and it is computationally intractable to find it's error.
On the Implementations of Methods:
Standard practice is the same as in all software development small test cases, and constant validation against something known. E.g. if the model under certain parameters has a known closed form solution or is equivalent to another method check that.
Also note that papers's aren't perfect, in most lit reviews I do I usually find a few typo's. Some of these typos actually would cause incorrect results, so always double check your sources.
There is a reason emails are on journal papers (HINT: it's so you can contact the authors). Also note that author's don't generally bite if you are nice to them. Just be courteous, and show that you have done some work. But don't expect them to step through your broken code to find a bug.
If you have the case where an author won't release the code, or won't respond to you, then don't use that method, more than likely the quality of the code was "good enough to publish" but that's about it. There certainly is no shortage of machine learning algorithms out there. It's also worth while checking who has cited the paper in question and see if they have some code. | How to make sure that a machine learning algorithm's implementation is correct? [duplicate]
On the Generalized Testing of Machine Learning Algorithms:
Yes, if there is a known working method, comparing your result to that method over all possible parameters will guarantee that your program i |
29,647 | How to make sure that a machine learning algorithm's implementation is correct? [duplicate] | Do you know what "correct" is for your situation? Determine what correct means then test your implementation against your data and see how close you are.
Unless your test coverage is 100% you'll never know if you have a nasty edge case bug in your code. You wouldn't if you had the initial parameters of the algorithm you are modeling unless your test touched the code where the bug lives. | How to make sure that a machine learning algorithm's implementation is correct? [duplicate] | Do you know what "correct" is for your situation? Determine what correct means then test your implementation against your data and see how close you are.
Unless your test coverage is 100% you'll neve | How to make sure that a machine learning algorithm's implementation is correct? [duplicate]
Do you know what "correct" is for your situation? Determine what correct means then test your implementation against your data and see how close you are.
Unless your test coverage is 100% you'll never know if you have a nasty edge case bug in your code. You wouldn't if you had the initial parameters of the algorithm you are modeling unless your test touched the code where the bug lives. | How to make sure that a machine learning algorithm's implementation is correct? [duplicate]
Do you know what "correct" is for your situation? Determine what correct means then test your implementation against your data and see how close you are.
Unless your test coverage is 100% you'll neve |
29,648 | VC-Dimension of k-nearest neighbor | You say the algorithm is: k-nearest neighbor algorithm with k = number of training points used. I define this as jms-k-nearest-neighbor.
Since the VC dimension is the biggest number of training points which can be shattered by the algorithm with train error 0, the VC dimension of jms-k-nearest-neighbor can only be k or 0.
1 training instance => k=1: During training the jms-1-nearest-neighbor stores exactly this instance. During application on exactly the same training set, the one instance is the nearest to the stored training instance (because they are the same), so the training error is 0.
So I agree, the VC dimension is at least 1.
2 training instances => k=2: There only might be a problem if the labels are differing. In this case the question is, how the decision for a class label is made. Majority vote does not lead to a result (VC = 0?), if we use majority vote weighted inversely by distance, the VC dimension is 2 (assuming that it is not allowed to have the same training instance twice with differing labels, in that case the VC dimension of all algorithms would be 0 (I guess)).
There is no standard k-nearest neighbor algorithm, it is more of a family with the same basic idea but different flavors when it comes to implementation details.
Resources used: VC dimension slides by Andrew Moore | VC-Dimension of k-nearest neighbor | You say the algorithm is: k-nearest neighbor algorithm with k = number of training points used. I define this as jms-k-nearest-neighbor.
Since the VC dimension is the biggest number of training points | VC-Dimension of k-nearest neighbor
You say the algorithm is: k-nearest neighbor algorithm with k = number of training points used. I define this as jms-k-nearest-neighbor.
Since the VC dimension is the biggest number of training points which can be shattered by the algorithm with train error 0, the VC dimension of jms-k-nearest-neighbor can only be k or 0.
1 training instance => k=1: During training the jms-1-nearest-neighbor stores exactly this instance. During application on exactly the same training set, the one instance is the nearest to the stored training instance (because they are the same), so the training error is 0.
So I agree, the VC dimension is at least 1.
2 training instances => k=2: There only might be a problem if the labels are differing. In this case the question is, how the decision for a class label is made. Majority vote does not lead to a result (VC = 0?), if we use majority vote weighted inversely by distance, the VC dimension is 2 (assuming that it is not allowed to have the same training instance twice with differing labels, in that case the VC dimension of all algorithms would be 0 (I guess)).
There is no standard k-nearest neighbor algorithm, it is more of a family with the same basic idea but different flavors when it comes to implementation details.
Resources used: VC dimension slides by Andrew Moore | VC-Dimension of k-nearest neighbor
You say the algorithm is: k-nearest neighbor algorithm with k = number of training points used. I define this as jms-k-nearest-neighbor.
Since the VC dimension is the biggest number of training points |
29,649 | Is $H_0$ being a closed set a convention in hypothesis testing? | If by open/closed you mean $[a,b]$ vs $(a,b)$, then it's in a continuous domain it doesn't make a difference. Consider a continuous pdf defined in the domain $a$ to $b$. The integral over $[a,b]$ will be equal to the integral over $(a,b)$ because the integral over a single point is zero, so excluding any countable set of points from the integrand won't change its value at all.
Now, on to some philosophy: generally, our null hypothesis is either an assertion that some population parameter is the same across treatments, or that the parameters are within some defined tolerance of each other. Since we are fixing this tolerance, it makes sense to define it with a closed set, where the set is closed up to the maximum tolerance, e.g. $H_0: \theta \le \theta_0$ where $\theta_0$ defines the maximum allowable tolerance. Since we are parameterizing our hypothesis with respect to the maximum allowable tolerance, it makes sense to use closed notation here. But, as described above, this hypothesis is functionally equivalent to $H_0: \theta \lt \theta_0$, but the interpretation is a little weirder now: $\theta_0$ now denotes the minimum rejection value of the parameter, so the allowable tolerance is infinitesimally close to but not equal to $\theta_0$. I think you'll agree that it generally makes more sense for the purposes of interpretation to define the null hypothesis with respect to the permissible range of parameter values.
If you meant something different by closed vs. open (maybe you meant it in some technical topological sense that I missed), please elaborate. | Is $H_0$ being a closed set a convention in hypothesis testing? | If by open/closed you mean $[a,b]$ vs $(a,b)$, then it's in a continuous domain it doesn't make a difference. Consider a continuous pdf defined in the domain $a$ to $b$. The integral over $[a,b]$ will | Is $H_0$ being a closed set a convention in hypothesis testing?
If by open/closed you mean $[a,b]$ vs $(a,b)$, then it's in a continuous domain it doesn't make a difference. Consider a continuous pdf defined in the domain $a$ to $b$. The integral over $[a,b]$ will be equal to the integral over $(a,b)$ because the integral over a single point is zero, so excluding any countable set of points from the integrand won't change its value at all.
Now, on to some philosophy: generally, our null hypothesis is either an assertion that some population parameter is the same across treatments, or that the parameters are within some defined tolerance of each other. Since we are fixing this tolerance, it makes sense to define it with a closed set, where the set is closed up to the maximum tolerance, e.g. $H_0: \theta \le \theta_0$ where $\theta_0$ defines the maximum allowable tolerance. Since we are parameterizing our hypothesis with respect to the maximum allowable tolerance, it makes sense to use closed notation here. But, as described above, this hypothesis is functionally equivalent to $H_0: \theta \lt \theta_0$, but the interpretation is a little weirder now: $\theta_0$ now denotes the minimum rejection value of the parameter, so the allowable tolerance is infinitesimally close to but not equal to $\theta_0$. I think you'll agree that it generally makes more sense for the purposes of interpretation to define the null hypothesis with respect to the permissible range of parameter values.
If you meant something different by closed vs. open (maybe you meant it in some technical topological sense that I missed), please elaborate. | Is $H_0$ being a closed set a convention in hypothesis testing?
If by open/closed you mean $[a,b]$ vs $(a,b)$, then it's in a continuous domain it doesn't make a difference. Consider a continuous pdf defined in the domain $a$ to $b$. The integral over $[a,b]$ will |
29,650 | What guidelines should be followed for using Neural Networks with sparse inputs | You can try using feature embeddings to reduce the dimension of the input space. Sort of the word2vec approach in NLP, it seems like it could apply in your case since your features are binary (On/Off). | What guidelines should be followed for using Neural Networks with sparse inputs | You can try using feature embeddings to reduce the dimension of the input space. Sort of the word2vec approach in NLP, it seems like it could apply in your case since your features are binary (On/Off) | What guidelines should be followed for using Neural Networks with sparse inputs
You can try using feature embeddings to reduce the dimension of the input space. Sort of the word2vec approach in NLP, it seems like it could apply in your case since your features are binary (On/Off). | What guidelines should be followed for using Neural Networks with sparse inputs
You can try using feature embeddings to reduce the dimension of the input space. Sort of the word2vec approach in NLP, it seems like it could apply in your case since your features are binary (On/Off) |
29,651 | Likelihood and estimates for mixed effects Logistic regression | I did not see how "the vectors won't be of the same length", please clarify your question.
First of all, for the integral with dimension less than 4, the direct numerical methods like quadrature are more efficient than MCMC. I studied these questions for a while, and I would be happy to discuss this problem with you.
For mixed-effects logistic regression, the only explicit R code I have found is from Prof. Demidenko's book, Mixed Models: Theory and Applications, you can download the code via the column of "SOFTWARE AND DATA" on the webpage. The logMLEgh() can be found in \mixed_models_data.zip\MixedModels\Chapter07. He did not use the statmod package to obtain the quadratures, but wrote his own function gauher(). There are some minor errors in the code and I have discussed them with the author, but it is still very helpful to start from his code and book. I can provide the corrected version if needed.
Another issue is that, if you want to get accurate estimates, optim() is not enough, you may need to use methods like Fisher scoring, as in glm(). | Likelihood and estimates for mixed effects Logistic regression | I did not see how "the vectors won't be of the same length", please clarify your question.
First of all, for the integral with dimension less than 4, the direct numerical methods like quadrature are m | Likelihood and estimates for mixed effects Logistic regression
I did not see how "the vectors won't be of the same length", please clarify your question.
First of all, for the integral with dimension less than 4, the direct numerical methods like quadrature are more efficient than MCMC. I studied these questions for a while, and I would be happy to discuss this problem with you.
For mixed-effects logistic regression, the only explicit R code I have found is from Prof. Demidenko's book, Mixed Models: Theory and Applications, you can download the code via the column of "SOFTWARE AND DATA" on the webpage. The logMLEgh() can be found in \mixed_models_data.zip\MixedModels\Chapter07. He did not use the statmod package to obtain the quadratures, but wrote his own function gauher(). There are some minor errors in the code and I have discussed them with the author, but it is still very helpful to start from his code and book. I can provide the corrected version if needed.
Another issue is that, if you want to get accurate estimates, optim() is not enough, you may need to use methods like Fisher scoring, as in glm(). | Likelihood and estimates for mixed effects Logistic regression
I did not see how "the vectors won't be of the same length", please clarify your question.
First of all, for the integral with dimension less than 4, the direct numerical methods like quadrature are m |
29,652 | Calculating NBA shooting consistency | As another user stated in the comments above, a runs test is the way to analyze your shooting data. It tests the hypothesis that the elements of the sequence are mutually independent. If the hypothesis is rejected, then you could say that the player's 3-point shooting is inconsistent.
I would like to also point you towards this article since it's directly related to your analysis. | Calculating NBA shooting consistency | As another user stated in the comments above, a runs test is the way to analyze your shooting data. It tests the hypothesis that the elements of the sequence are mutually independent. If the hypothe | Calculating NBA shooting consistency
As another user stated in the comments above, a runs test is the way to analyze your shooting data. It tests the hypothesis that the elements of the sequence are mutually independent. If the hypothesis is rejected, then you could say that the player's 3-point shooting is inconsistent.
I would like to also point you towards this article since it's directly related to your analysis. | Calculating NBA shooting consistency
As another user stated in the comments above, a runs test is the way to analyze your shooting data. It tests the hypothesis that the elements of the sequence are mutually independent. If the hypothe |
29,653 | Calculating NBA shooting consistency | I think a runs test is a good idea. To me, by analysing the data in "chunks," your intention is to create a proxy for or control for "hot hands" in player consistency. There's a huge literature on this phenomenon out there. One of the best papers was discussed by Gelman on his blog back in July 2015. The title of his post was, "Hey-guess what? There really is a hot hand!" (http://andrewgelman.com/2015/07/09/hey-guess-what-there-really-is-a-hot-hand/). The paper Gelman reports on is a rebuttal to much of the previous literature insofar as it details the errors made by previous analyses of the hot hands phenomenon. The earlier work focused on overall as opposed to conditional probabilities. This paper posits a new sequential probability model (see the link for a reference to the paper).
One good metric of consistency which should control for differences in, e.g., number of shots taken, is the coefficient of variation. The CV is a dimensionless, scale invariant measure of variability and is calculated by dividing the std deviation by the mean. The problem it attempts to solve is that std deviations are expressed in the scale of the unit under measure, i.e., it is not scale invariant. This means that metrics with high average values will also tend to have higher std deviations than metrics with low average values. So, for instance, due to differences in their average values, measures of the variability in diastolic and systolic blood pressure are not directly comparable. By taking the CV, their variability becomes comparable. The same thing holds for many other metrics such as stock prices, online metrics such as the number of impressions or hits to a web page, and so on.
Thus, the CV can be calculated for many metrics and scale types, excluding categorical information and measures with negative values. | Calculating NBA shooting consistency | I think a runs test is a good idea. To me, by analysing the data in "chunks," your intention is to create a proxy for or control for "hot hands" in player consistency. There's a huge literature on thi | Calculating NBA shooting consistency
I think a runs test is a good idea. To me, by analysing the data in "chunks," your intention is to create a proxy for or control for "hot hands" in player consistency. There's a huge literature on this phenomenon out there. One of the best papers was discussed by Gelman on his blog back in July 2015. The title of his post was, "Hey-guess what? There really is a hot hand!" (http://andrewgelman.com/2015/07/09/hey-guess-what-there-really-is-a-hot-hand/). The paper Gelman reports on is a rebuttal to much of the previous literature insofar as it details the errors made by previous analyses of the hot hands phenomenon. The earlier work focused on overall as opposed to conditional probabilities. This paper posits a new sequential probability model (see the link for a reference to the paper).
One good metric of consistency which should control for differences in, e.g., number of shots taken, is the coefficient of variation. The CV is a dimensionless, scale invariant measure of variability and is calculated by dividing the std deviation by the mean. The problem it attempts to solve is that std deviations are expressed in the scale of the unit under measure, i.e., it is not scale invariant. This means that metrics with high average values will also tend to have higher std deviations than metrics with low average values. So, for instance, due to differences in their average values, measures of the variability in diastolic and systolic blood pressure are not directly comparable. By taking the CV, their variability becomes comparable. The same thing holds for many other metrics such as stock prices, online metrics such as the number of impressions or hits to a web page, and so on.
Thus, the CV can be calculated for many metrics and scale types, excluding categorical information and measures with negative values. | Calculating NBA shooting consistency
I think a runs test is a good idea. To me, by analysing the data in "chunks," your intention is to create a proxy for or control for "hot hands" in player consistency. There's a huge literature on thi |
29,654 | Statistical test to compare precision of two devices | The first thing you will need to think about is what it means (quantitatively) to have "good precision" in such a device. I would suggest that, in a medical context, the goal is to avoid temperature deviations that go into a dangerous range for the patient, so "good precision" is probably going to translate into avoiding dangerously low or high temperatures. This means you are going to be looking for a metric that heavily penalises large deviations from your optimal temperature of 37$^\text{o}$C. In view of this, measurement based on fluctuations in median temperatures is going to be a bad measure of precision, whereas measures that highlight large deviations will be better.
When you are formulating this kind of metric, you are implicitly adopting a "penalty function" that penalises temperatures that deviate from your desired temperature. One option would be to measure "precision" by lower variance around the desired temperature (treating this as the fixed mean for the variance calculation). The variance penalises by squared error, so that gives reasonable penalisation for high deviations. Another option would be to penalise more heavily (e.g., cubed-error). Another option would be to simply measure the amount of time each device has the patient outside the temperature range that is medically safe. In any case, whatever you choose should reflect the perceived dangers of deviation from the desired temperature.
Once you have determined what constitutes a metric of "good precision", you are going to be formulating some kind of "heteroscedasticity test", formulated in the wider sense of allowing whatever measure of precision you are using. I'm not sure I agree with whuber's comment of adjusting for autocorrelation. It really depends on your formulation of loss - after all, staying in a high temperature range for an extended period of time could be exactly the thing that is the most dangerous, so if you adjust back to account for auto-correlation, you might end up failing to penalise highly dangerous outcomes sufficiently. | Statistical test to compare precision of two devices | The first thing you will need to think about is what it means (quantitatively) to have "good precision" in such a device. I would suggest that, in a medical context, the goal is to avoid temperature | Statistical test to compare precision of two devices
The first thing you will need to think about is what it means (quantitatively) to have "good precision" in such a device. I would suggest that, in a medical context, the goal is to avoid temperature deviations that go into a dangerous range for the patient, so "good precision" is probably going to translate into avoiding dangerously low or high temperatures. This means you are going to be looking for a metric that heavily penalises large deviations from your optimal temperature of 37$^\text{o}$C. In view of this, measurement based on fluctuations in median temperatures is going to be a bad measure of precision, whereas measures that highlight large deviations will be better.
When you are formulating this kind of metric, you are implicitly adopting a "penalty function" that penalises temperatures that deviate from your desired temperature. One option would be to measure "precision" by lower variance around the desired temperature (treating this as the fixed mean for the variance calculation). The variance penalises by squared error, so that gives reasonable penalisation for high deviations. Another option would be to penalise more heavily (e.g., cubed-error). Another option would be to simply measure the amount of time each device has the patient outside the temperature range that is medically safe. In any case, whatever you choose should reflect the perceived dangers of deviation from the desired temperature.
Once you have determined what constitutes a metric of "good precision", you are going to be formulating some kind of "heteroscedasticity test", formulated in the wider sense of allowing whatever measure of precision you are using. I'm not sure I agree with whuber's comment of adjusting for autocorrelation. It really depends on your formulation of loss - after all, staying in a high temperature range for an extended period of time could be exactly the thing that is the most dangerous, so if you adjust back to account for auto-correlation, you might end up failing to penalise highly dangerous outcomes sufficiently. | Statistical test to compare precision of two devices
The first thing you will need to think about is what it means (quantitatively) to have "good precision" in such a device. I would suggest that, in a medical context, the goal is to avoid temperature |
29,655 | Statistical test to compare precision of two devices | This is a test of homoscedasticity. And because this is a time-series, the appropriate choice is the Breusch–Pagan test, not the F-test. This test only answers ONLY the question of equality of precision between the two devices. Level of precision is another way of thinking of variance.
[Edit: Changed the test to the correct one, considering the time-dependence] | Statistical test to compare precision of two devices | This is a test of homoscedasticity. And because this is a time-series, the appropriate choice is the Breusch–Pagan test, not the F-test. This test only answers ONLY the question of equality of precisi | Statistical test to compare precision of two devices
This is a test of homoscedasticity. And because this is a time-series, the appropriate choice is the Breusch–Pagan test, not the F-test. This test only answers ONLY the question of equality of precision between the two devices. Level of precision is another way of thinking of variance.
[Edit: Changed the test to the correct one, considering the time-dependence] | Statistical test to compare precision of two devices
This is a test of homoscedasticity. And because this is a time-series, the appropriate choice is the Breusch–Pagan test, not the F-test. This test only answers ONLY the question of equality of precisi |
29,656 | Statistical test to compare precision of two devices | If you are interested in how well devices maintain a 37C temperature, you can either:
Use all available data from each person as is or
Estimate the mean deviation per person from 37C using each person's 36 trials.
The data naturally lends itself to repeated measures treatment. By treating within-person trials as clusters, you will reduce the likelihood of a falsely estimated confidence interval around the effect of device. In addition, you can test the effect of time among both devices or as an interaction with device to ascertain whether maintenance of temperature over time was good. Finding a way to visualize all this is of key importance and may suggest one approach over another. Something along the lines of:
library(dplyr)
library(lme4)
set.seed(42)
id <- rep(1:500, each=36)
time <- rep(1:36,500)
temp <- c(rnorm(36*400, 38,0.5), rnorm(36*100,37.25,0.5))
temp <- temp + 1/time
prox_37 <- temp - 37
group <- c(rep("A",36*400), rep("B",36*100))
graph_t <- ifelse(group=="A", time-0.25, time+0.25)
df <- data.frame(id,time,temp,prox_37,group, graph_t)
id_means <- group_by(df, id) %>% summarize(mean_37 = mean(prox_37))
id_means$group <- c(rep("A",400), rep("B",100))
boxplot(id_means$mean_37 ~ id_means$group)
plot(graph_t, prox_37, col=as.factor(group))
loess_fit <- loess(prox_37 ~ time, data = df)
lines(c(1:36), predict(loess_fit, newdata= c(1:36)) , col = "blue")
summary(t.test(mean_37 ~group, data=id_means))
model1 <- glm(prox_37 ~ as.factor(group), family = "gaussian", data=df)
model2 <- lmer(prox_37 ~ as.factor(group) + (1 | id), data=df)
model3 <- lmer(prox_37 ~ as.factor(group) + time + (1 | id), data=df)
model4 <- lmer(prox_37 ~ as.factor(group) + time + time*as.factor(group) + (1 | id), data=df)
AIC(model1)
summary(model2)
summary(model3)
summary(model4) | Statistical test to compare precision of two devices | If you are interested in how well devices maintain a 37C temperature, you can either:
Use all available data from each person as is or
Estimate the mean deviation per person from 37C using each perso | Statistical test to compare precision of two devices
If you are interested in how well devices maintain a 37C temperature, you can either:
Use all available data from each person as is or
Estimate the mean deviation per person from 37C using each person's 36 trials.
The data naturally lends itself to repeated measures treatment. By treating within-person trials as clusters, you will reduce the likelihood of a falsely estimated confidence interval around the effect of device. In addition, you can test the effect of time among both devices or as an interaction with device to ascertain whether maintenance of temperature over time was good. Finding a way to visualize all this is of key importance and may suggest one approach over another. Something along the lines of:
library(dplyr)
library(lme4)
set.seed(42)
id <- rep(1:500, each=36)
time <- rep(1:36,500)
temp <- c(rnorm(36*400, 38,0.5), rnorm(36*100,37.25,0.5))
temp <- temp + 1/time
prox_37 <- temp - 37
group <- c(rep("A",36*400), rep("B",36*100))
graph_t <- ifelse(group=="A", time-0.25, time+0.25)
df <- data.frame(id,time,temp,prox_37,group, graph_t)
id_means <- group_by(df, id) %>% summarize(mean_37 = mean(prox_37))
id_means$group <- c(rep("A",400), rep("B",100))
boxplot(id_means$mean_37 ~ id_means$group)
plot(graph_t, prox_37, col=as.factor(group))
loess_fit <- loess(prox_37 ~ time, data = df)
lines(c(1:36), predict(loess_fit, newdata= c(1:36)) , col = "blue")
summary(t.test(mean_37 ~group, data=id_means))
model1 <- glm(prox_37 ~ as.factor(group), family = "gaussian", data=df)
model2 <- lmer(prox_37 ~ as.factor(group) + (1 | id), data=df)
model3 <- lmer(prox_37 ~ as.factor(group) + time + (1 | id), data=df)
model4 <- lmer(prox_37 ~ as.factor(group) + time + time*as.factor(group) + (1 | id), data=df)
AIC(model1)
summary(model2)
summary(model3)
summary(model4) | Statistical test to compare precision of two devices
If you are interested in how well devices maintain a 37C temperature, you can either:
Use all available data from each person as is or
Estimate the mean deviation per person from 37C using each perso |
29,657 | Incorporating more detailed explanatory variables over time | OK, from experience in using historical data, more history may make the regression fit appear better, but if predicting is the point of exercise, the general answer is be warned. In the case where the data reflects periods for which the 'world' was very different, the stability of correlations is questionable. This occurs especially in economics where markets and regulations are constantly evolving.
This holds for the real estate market also which, in addition, may have a long cycle. The invention of mortgage backed securities, for example, transformed the mortgage market and opened the flood gates for mortgage origination, and also, unfortunately, speculation (there was actually a whole class of no/low document loans called lier loans).
Methods that test for regime changes can be especially valuable in deciding in a non-subjective manner when to exclude history. | Incorporating more detailed explanatory variables over time | OK, from experience in using historical data, more history may make the regression fit appear better, but if predicting is the point of exercise, the general answer is be warned. In the case where the | Incorporating more detailed explanatory variables over time
OK, from experience in using historical data, more history may make the regression fit appear better, but if predicting is the point of exercise, the general answer is be warned. In the case where the data reflects periods for which the 'world' was very different, the stability of correlations is questionable. This occurs especially in economics where markets and regulations are constantly evolving.
This holds for the real estate market also which, in addition, may have a long cycle. The invention of mortgage backed securities, for example, transformed the mortgage market and opened the flood gates for mortgage origination, and also, unfortunately, speculation (there was actually a whole class of no/low document loans called lier loans).
Methods that test for regime changes can be especially valuable in deciding in a non-subjective manner when to exclude history. | Incorporating more detailed explanatory variables over time
OK, from experience in using historical data, more history may make the regression fit appear better, but if predicting is the point of exercise, the general answer is be warned. In the case where the |
29,658 | Incorporating more detailed explanatory variables over time | Typically, this can be viewed as a bounded parameter value problem. As I understand your question, you have a less informative parameter (collateral of unknown quality [Cu]) early in your data and more informative (collateral with high [Ch], medium [Cm], or low [Cl] quality) in your later data.
If you believe that the non-observed parameters for the model do not change over time, then the method can be simple where you assume that the point estimates of each are Cl < Cm < Ch and Cl <= Cu <= Ch. The logic is that Cl is the worst and Ch is the best, so when the data are unknown it must be be between or equal to those. If you are willing to be slightly restrictive and assume that not all collateral was either high or low quality during the first 15 years, you can assume that Cl < Cu < Ch which makes it significantly simpler to estimate.
Mathematically, these can be estimated with something like:
$$
\begin{array}{lcl}
C_l &=& \exp(\beta_1) \\
C_m &=& \exp(\beta_1) + \exp(\beta_2) \\
C_u &=& \exp(\beta_1) + \frac{\exp(\beta_3)}{1+\exp(-\beta_4)} \\
C_h &=& \exp(\beta_1) + \exp(\beta_2) + \exp(\beta_3)
\end{array}
$$
Where the logit function in Cu restricts the value to be between Cl and Ch without restricting it relative to Cm. (Other functions bounding between 0 and 1 can also be used.)
Another difference in the model should be that the variance should be structured so that the residual variance is dependent on time period because the information within each period is different. | Incorporating more detailed explanatory variables over time | Typically, this can be viewed as a bounded parameter value problem. As I understand your question, you have a less informative parameter (collateral of unknown quality [Cu]) early in your data and mo | Incorporating more detailed explanatory variables over time
Typically, this can be viewed as a bounded parameter value problem. As I understand your question, you have a less informative parameter (collateral of unknown quality [Cu]) early in your data and more informative (collateral with high [Ch], medium [Cm], or low [Cl] quality) in your later data.
If you believe that the non-observed parameters for the model do not change over time, then the method can be simple where you assume that the point estimates of each are Cl < Cm < Ch and Cl <= Cu <= Ch. The logic is that Cl is the worst and Ch is the best, so when the data are unknown it must be be between or equal to those. If you are willing to be slightly restrictive and assume that not all collateral was either high or low quality during the first 15 years, you can assume that Cl < Cu < Ch which makes it significantly simpler to estimate.
Mathematically, these can be estimated with something like:
$$
\begin{array}{lcl}
C_l &=& \exp(\beta_1) \\
C_m &=& \exp(\beta_1) + \exp(\beta_2) \\
C_u &=& \exp(\beta_1) + \frac{\exp(\beta_3)}{1+\exp(-\beta_4)} \\
C_h &=& \exp(\beta_1) + \exp(\beta_2) + \exp(\beta_3)
\end{array}
$$
Where the logit function in Cu restricts the value to be between Cl and Ch without restricting it relative to Cm. (Other functions bounding between 0 and 1 can also be used.)
Another difference in the model should be that the variance should be structured so that the residual variance is dependent on time period because the information within each period is different. | Incorporating more detailed explanatory variables over time
Typically, this can be viewed as a bounded parameter value problem. As I understand your question, you have a less informative parameter (collateral of unknown quality [Cu]) early in your data and mo |
29,659 | Expectation of the Sum of K Numbers without replacement | This is probably in the nature of an answer that, while accurate, is
probably not that useful. Horvitz and Thompson (1952) provide results that cover this situation in general. These results are given in terms of the
combinatorial expressions one might expect.
To keep consistent with their notation, and also to correspond better with more widely used notation, let me redefine some quantities. Let $N$ be the number of elements in the population and $n$ be the sample size.
Let $u_i$, $i=1,...,N$, represent the $N$ elements of the population, with given values $V_i$, $i=1,...,N$ and probabilities of selection $p_1,...,p_N$. For a given sample of size $n$, let the observed values in the sample be $v_1,..., v_n$.
What is desired are the mean and variance of the sample total
$$\sum_{i=1}^n v_i.$$
As mentioned in the comments, the probability of selecting a particular sample $s = \{u_i, u_j, ..., u_t\}$ drawn in that order is
$$\textrm{Pr}(s) = p_{i_1}p_{j_2}\cdots p_{t_n},$$
where the initial probability $p_{i_1}$ of drawing $u_i$ is given by $p_i$, the second probability $p_{j_2}$ of drawing $u_j$ is conditional on having removed $u_i$ from the population, and so forth. So each subsequent unit drawn results in a new probability distribution for the next unit (hence, the choice of different indicial letters, because each represents a different distribution.)
There are
$$S^{(i)} = n! \binom{N-1}{n-1}$$
samples of size $n$ that contain $u_i$ out of the entire population. Note that this takes into account the $n!$ permutations of the sample.
Let $s_n^{(i)}$ denote a specific sample of size $n$ which includes $u_i$.
Then, the probability of selecting element $u_i$ is given by
$$P(u_i) = \sum \textrm{Pr}(s_n^{(i)}),$$
where the summation is over the set of size $S^{(i)}$ of all possible samples $s_n^{(i)}$ of size $n$ that contain $u_i$. (I changed the notation a little from the paper since it seemed confusing to me.)
Similarly, define
$$S^{(ij)} = n! \binom{N-2}{n-2}$$
as the number of samples containing both $u_i$ and $u_j$. Then we can define the probability of a sample containing both as
$$\textrm{P}(u_i u_j) = \sum \textrm{Pr}(s_n^{(ij)}),$$
where the summation is over the set of size $S^{(ij)}$ of all possible samples $s_n^{(ij)}$ of size $n$ that contain $u_i$ and $u_j$.
The expected value is then derived as
$$E \left( \sum_{i=1}^n v_i \right) =
\sum_{i=1}^N \textrm{P}(u_i) V_i.$$
Although the variance is not derived explicitly in the paper, it could be obtained from expections of the $q$th moment
$$E \left( \sum_{i=1}^n v_i^q \right) =
\sum_{i=1}^N \textrm{P}(u_i) V_i^q$$
and the cross-products
$$E \left( \sum_{i \ne j}^n v_iv_j \right) =
\sum_{i \ne j} \textrm{P}(u_i u_j) V_i V_j.$$
In other words, it looks as though one would would need to go through all possible subsets to do these calculations. Maybe this could be done for smaller values of $n$, though.
Horvitz, D.G. and Thompson, D.J. (1952) A generalization of
sampling without replacement from a finite universe. Journal of the
American Statistical Association 47(260): 663-685. | Expectation of the Sum of K Numbers without replacement | This is probably in the nature of an answer that, while accurate, is
probably not that useful. Horvitz and Thompson (1952) provide results that cover this situation in general. These results are give | Expectation of the Sum of K Numbers without replacement
This is probably in the nature of an answer that, while accurate, is
probably not that useful. Horvitz and Thompson (1952) provide results that cover this situation in general. These results are given in terms of the
combinatorial expressions one might expect.
To keep consistent with their notation, and also to correspond better with more widely used notation, let me redefine some quantities. Let $N$ be the number of elements in the population and $n$ be the sample size.
Let $u_i$, $i=1,...,N$, represent the $N$ elements of the population, with given values $V_i$, $i=1,...,N$ and probabilities of selection $p_1,...,p_N$. For a given sample of size $n$, let the observed values in the sample be $v_1,..., v_n$.
What is desired are the mean and variance of the sample total
$$\sum_{i=1}^n v_i.$$
As mentioned in the comments, the probability of selecting a particular sample $s = \{u_i, u_j, ..., u_t\}$ drawn in that order is
$$\textrm{Pr}(s) = p_{i_1}p_{j_2}\cdots p_{t_n},$$
where the initial probability $p_{i_1}$ of drawing $u_i$ is given by $p_i$, the second probability $p_{j_2}$ of drawing $u_j$ is conditional on having removed $u_i$ from the population, and so forth. So each subsequent unit drawn results in a new probability distribution for the next unit (hence, the choice of different indicial letters, because each represents a different distribution.)
There are
$$S^{(i)} = n! \binom{N-1}{n-1}$$
samples of size $n$ that contain $u_i$ out of the entire population. Note that this takes into account the $n!$ permutations of the sample.
Let $s_n^{(i)}$ denote a specific sample of size $n$ which includes $u_i$.
Then, the probability of selecting element $u_i$ is given by
$$P(u_i) = \sum \textrm{Pr}(s_n^{(i)}),$$
where the summation is over the set of size $S^{(i)}$ of all possible samples $s_n^{(i)}$ of size $n$ that contain $u_i$. (I changed the notation a little from the paper since it seemed confusing to me.)
Similarly, define
$$S^{(ij)} = n! \binom{N-2}{n-2}$$
as the number of samples containing both $u_i$ and $u_j$. Then we can define the probability of a sample containing both as
$$\textrm{P}(u_i u_j) = \sum \textrm{Pr}(s_n^{(ij)}),$$
where the summation is over the set of size $S^{(ij)}$ of all possible samples $s_n^{(ij)}$ of size $n$ that contain $u_i$ and $u_j$.
The expected value is then derived as
$$E \left( \sum_{i=1}^n v_i \right) =
\sum_{i=1}^N \textrm{P}(u_i) V_i.$$
Although the variance is not derived explicitly in the paper, it could be obtained from expections of the $q$th moment
$$E \left( \sum_{i=1}^n v_i^q \right) =
\sum_{i=1}^N \textrm{P}(u_i) V_i^q$$
and the cross-products
$$E \left( \sum_{i \ne j}^n v_iv_j \right) =
\sum_{i \ne j} \textrm{P}(u_i u_j) V_i V_j.$$
In other words, it looks as though one would would need to go through all possible subsets to do these calculations. Maybe this could be done for smaller values of $n$, though.
Horvitz, D.G. and Thompson, D.J. (1952) A generalization of
sampling without replacement from a finite universe. Journal of the
American Statistical Association 47(260): 663-685. | Expectation of the Sum of K Numbers without replacement
This is probably in the nature of an answer that, while accurate, is
probably not that useful. Horvitz and Thompson (1952) provide results that cover this situation in general. These results are give |
29,660 | MLE on a restricted parameter space | Although the OP did not respond, I am answering this to showcase the method I proposed (and indicate what statistical intuition it may contain).
First, it is important to distinguish on which entity is the constraint imposed. In a deterministic optimization setting, there is no such issue : there is no "true value", and an estimator of it. We just have to find the optimizer. But in a stochastic setting, there are conceivably two different cases:
a) "Estimate the parameter given a sample that has been generated by a population that has a non-negative mean" (i.e. $\theta \ge 0$) and
b) "Estimate the parameter under the constraint that your estimator cannot take negative values"(i.e. $\hat \theta \ge 0$).
In the first case, imposing the constraint is including prior knowledge on the unknown parameter. In the second case, the constraint can be seen as reflecting a prior belief on the unknown parameter (or some technical, or "strategic", limitation of the estimator).
The mechanics of the solution are the same, though:The objective function, (the log-likelihood augmented by the non-negativity constraint on $\theta$) is
$$\tilde L(\theta|\mathbf{x})=-\frac n2 \ln(2\pi)-\frac{1}{2}\sum_{i=1}^{n}(x_i-\theta)^2 +\xi\theta,\qquad \xi\ge 0 $$
Given concavity, f.o.c is also sufficient for a global maximum. We have
$$\frac {\partial}{\partial \theta}\tilde L(\theta|\mathbf{x})=\sum_{i=1}^{n}(x_i-\theta) +\xi = 0 \Rightarrow \hat \theta = \bar x+\frac{\xi}{n} $$
1) If the solution lies in an interior point ($\Rightarrow \hat \theta >0$), then $\xi=0$ and so the solution is $\{\hat \theta= \bar x>0,\; \xi^*=0\}$.
2) If the solution lies on the boundary ($\Rightarrow \hat \theta =0$) then we obtain the value of the multiplier at the solution $\xi^* = -n\hat x$, and so the full solution is $\{\hat \theta= 0,\; \xi^*=-n\bar x\}$. But since the multiplier must be non-negative, this necessarily implies that in this case we would have $\bar x\le 0$
(There is nothing special about setting the constraint to zero. If say the constraint was $\theta \ge -2$, then if the solution lied on the boundary, $\hat \theta = -2$, it would imply (in order for the multiplier to have a positive value), that $\bar x \le -2$).
So, if the optimizer is $0$ what are we facing here?
If we are in "constraint type-a", i.e we have been told that the sample comes from a population that it has a non-negative mean, then with $\hat \theta =0$ chances are that the sample may not be representative of this population.
If we are in "constraint type-b", i.e. we had the belief that the population has a non-negative mean, with $\hat \theta =0$ this belief is questioned.
(This is essentially an alternative way to deal with prior beliefs, outside the formal bayesian approach).
Regarding the properties of the estimator, one should carefully distinguish this constrained estimation case, with the case where the true parameter lies on the boundary of the parameter space. | MLE on a restricted parameter space | Although the OP did not respond, I am answering this to showcase the method I proposed (and indicate what statistical intuition it may contain).
First, it is important to distinguish on which entity i | MLE on a restricted parameter space
Although the OP did not respond, I am answering this to showcase the method I proposed (and indicate what statistical intuition it may contain).
First, it is important to distinguish on which entity is the constraint imposed. In a deterministic optimization setting, there is no such issue : there is no "true value", and an estimator of it. We just have to find the optimizer. But in a stochastic setting, there are conceivably two different cases:
a) "Estimate the parameter given a sample that has been generated by a population that has a non-negative mean" (i.e. $\theta \ge 0$) and
b) "Estimate the parameter under the constraint that your estimator cannot take negative values"(i.e. $\hat \theta \ge 0$).
In the first case, imposing the constraint is including prior knowledge on the unknown parameter. In the second case, the constraint can be seen as reflecting a prior belief on the unknown parameter (or some technical, or "strategic", limitation of the estimator).
The mechanics of the solution are the same, though:The objective function, (the log-likelihood augmented by the non-negativity constraint on $\theta$) is
$$\tilde L(\theta|\mathbf{x})=-\frac n2 \ln(2\pi)-\frac{1}{2}\sum_{i=1}^{n}(x_i-\theta)^2 +\xi\theta,\qquad \xi\ge 0 $$
Given concavity, f.o.c is also sufficient for a global maximum. We have
$$\frac {\partial}{\partial \theta}\tilde L(\theta|\mathbf{x})=\sum_{i=1}^{n}(x_i-\theta) +\xi = 0 \Rightarrow \hat \theta = \bar x+\frac{\xi}{n} $$
1) If the solution lies in an interior point ($\Rightarrow \hat \theta >0$), then $\xi=0$ and so the solution is $\{\hat \theta= \bar x>0,\; \xi^*=0\}$.
2) If the solution lies on the boundary ($\Rightarrow \hat \theta =0$) then we obtain the value of the multiplier at the solution $\xi^* = -n\hat x$, and so the full solution is $\{\hat \theta= 0,\; \xi^*=-n\bar x\}$. But since the multiplier must be non-negative, this necessarily implies that in this case we would have $\bar x\le 0$
(There is nothing special about setting the constraint to zero. If say the constraint was $\theta \ge -2$, then if the solution lied on the boundary, $\hat \theta = -2$, it would imply (in order for the multiplier to have a positive value), that $\bar x \le -2$).
So, if the optimizer is $0$ what are we facing here?
If we are in "constraint type-a", i.e we have been told that the sample comes from a population that it has a non-negative mean, then with $\hat \theta =0$ chances are that the sample may not be representative of this population.
If we are in "constraint type-b", i.e. we had the belief that the population has a non-negative mean, with $\hat \theta =0$ this belief is questioned.
(This is essentially an alternative way to deal with prior beliefs, outside the formal bayesian approach).
Regarding the properties of the estimator, one should carefully distinguish this constrained estimation case, with the case where the true parameter lies on the boundary of the parameter space. | MLE on a restricted parameter space
Although the OP did not respond, I am answering this to showcase the method I proposed (and indicate what statistical intuition it may contain).
First, it is important to distinguish on which entity i |
29,661 | Interpretation of Bayesian 95% prediction interval | The interval accommodates all of the uncertainty in the problem. In your description of the problem, the only things you don't know are $\beta$ and $u$. The prediction interval that you derived accommodates the uncertainty in both of these. So there is no uncertainty left for the interval to "fail to accommodate". | Interpretation of Bayesian 95% prediction interval | The interval accommodates all of the uncertainty in the problem. In your description of the problem, the only things you don't know are $\beta$ and $u$. The prediction interval that you derived acco | Interpretation of Bayesian 95% prediction interval
The interval accommodates all of the uncertainty in the problem. In your description of the problem, the only things you don't know are $\beta$ and $u$. The prediction interval that you derived accommodates the uncertainty in both of these. So there is no uncertainty left for the interval to "fail to accommodate". | Interpretation of Bayesian 95% prediction interval
The interval accommodates all of the uncertainty in the problem. In your description of the problem, the only things you don't know are $\beta$ and $u$. The prediction interval that you derived acco |
29,662 | Comparing distributions of generalization performance | If there are only two methods, A and B, I would calculate the probability that for an arbitrary training/test partition that the error (according to some suitable performance metric) for model A was lower than the error for model B. If this probability were greater than 0.5, I'd chose model A and otherwise model B (c.f. Mann-Whitney U test?) However, I strongly suspect that will end up choosing the model with the lower mean unless the distributions of the performance statistic are very non-symmetric.
For grid search on the other hand, the situation is a bit different as you are not really comparing different methods, but instead tuning the (hyper-) parameters of the same model to fit a finite sample of data (in this case indirectly via cross-validation). I have found that this kind of tuning can be very prone to over-fitting, see my paper
Gavin C. Cawley, Nicola L. C. Talbot, "On Over-fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation", Journal of Machine Learning Research, 11(Jul):2079−2107, 2010. (www)
I have a paper in review that shows that it is probably best to use a relatively coarse grid for kernel machines (e.g. SVMs) to avoid over-fitting the model selection criterion. Another approach (which I haven't investigated, so caveat lector!) would be to choose the model with the highest error that is not statistically inferior to the best model found in the grid search (although that may be a rather pessimistic approach, especially for small datasets).
The real solution though is probably not to optimise the parameters using grid-search, but to average over the parameter values, either in a Bayesian approach, or just as an ensemble method. If you don't optimise, it is more difficult to over-fit! | Comparing distributions of generalization performance | If there are only two methods, A and B, I would calculate the probability that for an arbitrary training/test partition that the error (according to some suitable performance metric) for model A was l | Comparing distributions of generalization performance
If there are only two methods, A and B, I would calculate the probability that for an arbitrary training/test partition that the error (according to some suitable performance metric) for model A was lower than the error for model B. If this probability were greater than 0.5, I'd chose model A and otherwise model B (c.f. Mann-Whitney U test?) However, I strongly suspect that will end up choosing the model with the lower mean unless the distributions of the performance statistic are very non-symmetric.
For grid search on the other hand, the situation is a bit different as you are not really comparing different methods, but instead tuning the (hyper-) parameters of the same model to fit a finite sample of data (in this case indirectly via cross-validation). I have found that this kind of tuning can be very prone to over-fitting, see my paper
Gavin C. Cawley, Nicola L. C. Talbot, "On Over-fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation", Journal of Machine Learning Research, 11(Jul):2079−2107, 2010. (www)
I have a paper in review that shows that it is probably best to use a relatively coarse grid for kernel machines (e.g. SVMs) to avoid over-fitting the model selection criterion. Another approach (which I haven't investigated, so caveat lector!) would be to choose the model with the highest error that is not statistically inferior to the best model found in the grid search (although that may be a rather pessimistic approach, especially for small datasets).
The real solution though is probably not to optimise the parameters using grid-search, but to average over the parameter values, either in a Bayesian approach, or just as an ensemble method. If you don't optimise, it is more difficult to over-fit! | Comparing distributions of generalization performance
If there are only two methods, A and B, I would calculate the probability that for an arbitrary training/test partition that the error (according to some suitable performance metric) for model A was l |
29,663 | Prediction with randomForest (R) when some inputs have missing values (NA) | You have no choice but to impute the values or to change models. A good choice could be aregImpute in the Hmisc package. I think its less heavy than rfimpute which is what is detaining you, first package example (there are others):
# Check that aregImpute can almost exactly estimate missing values when
# there is a perfect nonlinear relationship between two variables
# Fit restricted cubic splines with 4 knots for x1 and x2, linear for x3
set.seed(3)
x1 <- rnorm(200)
x2 <- x1^2
x3 <- runif(200)
m <- 30
x2[1:m] <- NA
a <- aregImpute(~x1+x2+I(x3), n.impute=5, nk=4, match='closest')
a
matplot(x1[1:m]^2, a$imputed$x2)
abline(a=0, b=1, lty=2)
x1[1:m]^2
a$imputed$x2
# Multiple imputation and estimation of variances and covariances of
# regression coefficient estimates accounting for imputation
# Example 1: large sample size, much missing data, no overlap in
# NAs across variables
x1 <- factor(sample(c('a','b','c'),1000,TRUE))
x2 <- (x1=='b') + 3*(x1=='c') + rnorm(1000,0,2)
x3 <- rnorm(1000)
y <- x2 + 1*(x1=='c') + .2*x3 + rnorm(1000,0,2)
orig.x1 <- x1[1:250]
orig.x2 <- x2[251:350]
x1[1:250] <- NA
x2[251:350] <- NA
d <- data.frame(x1,x2,x3,y)
# Find value of nk that yields best validating imputation models
# tlinear=FALSE means to not force the target variable to be linear
f <- aregImpute(~y + x1 + x2 + x3, nk=c(0,3:5), tlinear=FALSE,
data=d, B=10) # normally B=75
f
# Try forcing target variable (x1, then x2) to be linear while allowing
# predictors to be nonlinear (could also say tlinear=TRUE)
f <- aregImpute(~y + x1 + x2 + x3, nk=c(0,3:5), data=d, B=10)
f
# Use 100 imputations to better check against individual true values
f <- aregImpute(~y + x1 + x2 + x3, n.impute=100, data=d)
f
par(mfrow=c(2,1))
plot(f)
modecat <- function(u) {
tab <- table(u)
as.numeric(names(tab)[tab==max(tab)][1])
}
table(orig.x1,apply(f$imputed$x1, 1, modecat))
par(mfrow=c(1,1))
plot(orig.x2, apply(f$imputed$x2, 1, mean))
fmi <- fit.mult.impute(y ~ x1 + x2 + x3, lm, f,
data=d)
sqrt(diag(vcov(fmi)))
fcc <- lm(y ~ x1 + x2 + x3)
summary(fcc) # SEs are larger than from mult. imputation
You mention that you have many new observations that have missing values on the independant variables. Even though you have many cases like this, if for each new observation there is only missings in one or two of its variables and your amount of variables is not tiny maybe just filling the holes up with a median or average (are they continuous?) could work.
Another thing that could be interesting is to do a minor variable importance analysis. The random forest R implementation calculates two importance measures and respective plots:
varImpPlot(yourRandomForestModel) # yourRandomForestModel must have the argument importance=TRUE
And you can play around with just including "important" variables in the model training, till the prediction accuracy isn't all that affected in comparison to the "full model". Maybe you keep variables with a low number of missings. It could help you reduce the size of your problem. | Prediction with randomForest (R) when some inputs have missing values (NA) | You have no choice but to impute the values or to change models. A good choice could be aregImpute in the Hmisc package. I think its less heavy than rfimpute which is what is detaining you, first pack | Prediction with randomForest (R) when some inputs have missing values (NA)
You have no choice but to impute the values or to change models. A good choice could be aregImpute in the Hmisc package. I think its less heavy than rfimpute which is what is detaining you, first package example (there are others):
# Check that aregImpute can almost exactly estimate missing values when
# there is a perfect nonlinear relationship between two variables
# Fit restricted cubic splines with 4 knots for x1 and x2, linear for x3
set.seed(3)
x1 <- rnorm(200)
x2 <- x1^2
x3 <- runif(200)
m <- 30
x2[1:m] <- NA
a <- aregImpute(~x1+x2+I(x3), n.impute=5, nk=4, match='closest')
a
matplot(x1[1:m]^2, a$imputed$x2)
abline(a=0, b=1, lty=2)
x1[1:m]^2
a$imputed$x2
# Multiple imputation and estimation of variances and covariances of
# regression coefficient estimates accounting for imputation
# Example 1: large sample size, much missing data, no overlap in
# NAs across variables
x1 <- factor(sample(c('a','b','c'),1000,TRUE))
x2 <- (x1=='b') + 3*(x1=='c') + rnorm(1000,0,2)
x3 <- rnorm(1000)
y <- x2 + 1*(x1=='c') + .2*x3 + rnorm(1000,0,2)
orig.x1 <- x1[1:250]
orig.x2 <- x2[251:350]
x1[1:250] <- NA
x2[251:350] <- NA
d <- data.frame(x1,x2,x3,y)
# Find value of nk that yields best validating imputation models
# tlinear=FALSE means to not force the target variable to be linear
f <- aregImpute(~y + x1 + x2 + x3, nk=c(0,3:5), tlinear=FALSE,
data=d, B=10) # normally B=75
f
# Try forcing target variable (x1, then x2) to be linear while allowing
# predictors to be nonlinear (could also say tlinear=TRUE)
f <- aregImpute(~y + x1 + x2 + x3, nk=c(0,3:5), data=d, B=10)
f
# Use 100 imputations to better check against individual true values
f <- aregImpute(~y + x1 + x2 + x3, n.impute=100, data=d)
f
par(mfrow=c(2,1))
plot(f)
modecat <- function(u) {
tab <- table(u)
as.numeric(names(tab)[tab==max(tab)][1])
}
table(orig.x1,apply(f$imputed$x1, 1, modecat))
par(mfrow=c(1,1))
plot(orig.x2, apply(f$imputed$x2, 1, mean))
fmi <- fit.mult.impute(y ~ x1 + x2 + x3, lm, f,
data=d)
sqrt(diag(vcov(fmi)))
fcc <- lm(y ~ x1 + x2 + x3)
summary(fcc) # SEs are larger than from mult. imputation
You mention that you have many new observations that have missing values on the independant variables. Even though you have many cases like this, if for each new observation there is only missings in one or two of its variables and your amount of variables is not tiny maybe just filling the holes up with a median or average (are they continuous?) could work.
Another thing that could be interesting is to do a minor variable importance analysis. The random forest R implementation calculates two importance measures and respective plots:
varImpPlot(yourRandomForestModel) # yourRandomForestModel must have the argument importance=TRUE
And you can play around with just including "important" variables in the model training, till the prediction accuracy isn't all that affected in comparison to the "full model". Maybe you keep variables with a low number of missings. It could help you reduce the size of your problem. | Prediction with randomForest (R) when some inputs have missing values (NA)
You have no choice but to impute the values or to change models. A good choice could be aregImpute in the Hmisc package. I think its less heavy than rfimpute which is what is detaining you, first pack |
29,664 | Prediction with randomForest (R) when some inputs have missing values (NA) | You can use na.roughfix when you are predicting more than 1 sample (i.e. predicting for >1 row of data).
For example:
data(iris)
# Make some of the data missing
na.row<-c(146,150)
na.col<-c(3,5)
iris[na.row,na.col]<-NA
# Look at NAs
tail(iris)
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species
# 145 6.7 3.3 5.7 2.5 virginica
# 146 6.7 3.0 NA 2.3 <NA>
# 147 6.3 2.5 5.0 1.9 virginica
# 148 6.5 3.0 5.2 2.0 virginica
# 149 6.2 3.4 5.4 2.3 virginica
# 150 5.9 3.0 NA 1.8 <NA>
# Run Random Forest on a subset of iris
set.seed(100)
iris.rf <- randomForest(Species ~ ., data=iris[1:120,]) #use argument na.action="na.roughfix" if there's NAs in your training set
iris.rf
# Call:
# randomForest(formula = Species ~ ., data = iris[1:120, ])
# Type of random forest: classification
# Number of trees: 500
# No. of variables tried at each split: 2
#
# OOB estimate of error rate: 4.17%
# Confusion matrix:
# setosa versicolor virginica class.error
# setosa 50 0 0 0.00
# versicolor 0 47 3 0.06
# virginica 0 2 18 0.10
# Run prediction on test set, using na.roughfix()
myrf.pred <- predict(iris.rf, na.roughfix(iris[121:150,]), type="response")
myrf.pred
# 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
# virginica versicolor virginica versicolor virginica virginica versicolor versicolor virginica versicolor virginica virginica virginica versicolor versicolor virginica
# 137 138 139 140 141 142 143 144 145 146 147 148 149 150
# virginica virginica versicolor virginica virginica virginica virginica virginica virginica virginica virginica virginica virginica virginica
# Levels: setosa versicolor virginica
You can see it dealt fine with the NAs. | Prediction with randomForest (R) when some inputs have missing values (NA) | You can use na.roughfix when you are predicting more than 1 sample (i.e. predicting for >1 row of data).
For example:
data(iris)
# Make some of the data missing
na.row<-c(146,150)
na.col<-c(3,5)
iris | Prediction with randomForest (R) when some inputs have missing values (NA)
You can use na.roughfix when you are predicting more than 1 sample (i.e. predicting for >1 row of data).
For example:
data(iris)
# Make some of the data missing
na.row<-c(146,150)
na.col<-c(3,5)
iris[na.row,na.col]<-NA
# Look at NAs
tail(iris)
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species
# 145 6.7 3.3 5.7 2.5 virginica
# 146 6.7 3.0 NA 2.3 <NA>
# 147 6.3 2.5 5.0 1.9 virginica
# 148 6.5 3.0 5.2 2.0 virginica
# 149 6.2 3.4 5.4 2.3 virginica
# 150 5.9 3.0 NA 1.8 <NA>
# Run Random Forest on a subset of iris
set.seed(100)
iris.rf <- randomForest(Species ~ ., data=iris[1:120,]) #use argument na.action="na.roughfix" if there's NAs in your training set
iris.rf
# Call:
# randomForest(formula = Species ~ ., data = iris[1:120, ])
# Type of random forest: classification
# Number of trees: 500
# No. of variables tried at each split: 2
#
# OOB estimate of error rate: 4.17%
# Confusion matrix:
# setosa versicolor virginica class.error
# setosa 50 0 0 0.00
# versicolor 0 47 3 0.06
# virginica 0 2 18 0.10
# Run prediction on test set, using na.roughfix()
myrf.pred <- predict(iris.rf, na.roughfix(iris[121:150,]), type="response")
myrf.pred
# 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
# virginica versicolor virginica versicolor virginica virginica versicolor versicolor virginica versicolor virginica virginica virginica versicolor versicolor virginica
# 137 138 139 140 141 142 143 144 145 146 147 148 149 150
# virginica virginica versicolor virginica virginica virginica virginica virginica virginica virginica virginica virginica virginica virginica
# Levels: setosa versicolor virginica
You can see it dealt fine with the NAs. | Prediction with randomForest (R) when some inputs have missing values (NA)
You can use na.roughfix when you are predicting more than 1 sample (i.e. predicting for >1 row of data).
For example:
data(iris)
# Make some of the data missing
na.row<-c(146,150)
na.col<-c(3,5)
iris |
29,665 | How to test if two samples are distributed from the same Gaussian process | This sounds like an application for the two-sample KS test, which evaluates whether two samples were taken from the same continuous probability distribution. For more information, you might want to start here, which explains it in some detail: http://www.itl.nist.gov/div898/handbook/eda/section3/eda35g.htm. | How to test if two samples are distributed from the same Gaussian process | This sounds like an application for the two-sample KS test, which evaluates whether two samples were taken from the same continuous probability distribution. For more information, you might want to st | How to test if two samples are distributed from the same Gaussian process
This sounds like an application for the two-sample KS test, which evaluates whether two samples were taken from the same continuous probability distribution. For more information, you might want to start here, which explains it in some detail: http://www.itl.nist.gov/div898/handbook/eda/section3/eda35g.htm. | How to test if two samples are distributed from the same Gaussian process
This sounds like an application for the two-sample KS test, which evaluates whether two samples were taken from the same continuous probability distribution. For more information, you might want to st |
29,666 | How to test if two samples are distributed from the same Gaussian process | Let the null hypothesis be that $\mathbf x$ and $\mathbf y$ have the same distribution. Let $\mathbf z = \mathbf x - \mathbf y.$ Under the null, $\mathbf z$ will have a mean of zero and be symmetric. Test the hypothesis that $\mathbf z = \mathbf 0$ using the traditional test. If you reject, you are done.
If you fail to reject, then divide the $x_i - y_i$ into two subsets: those realizations less than zero and those greater than zero. Now use the two-sample KS test on the two halves of your data.
You will need to use your judgment for high dimensions since you are performing a multitude of tests, but at least this deals with the potential dependence. | How to test if two samples are distributed from the same Gaussian process | Let the null hypothesis be that $\mathbf x$ and $\mathbf y$ have the same distribution. Let $\mathbf z = \mathbf x - \mathbf y.$ Under the null, $\mathbf z$ will have a mean of zero and be symmetric. | How to test if two samples are distributed from the same Gaussian process
Let the null hypothesis be that $\mathbf x$ and $\mathbf y$ have the same distribution. Let $\mathbf z = \mathbf x - \mathbf y.$ Under the null, $\mathbf z$ will have a mean of zero and be symmetric. Test the hypothesis that $\mathbf z = \mathbf 0$ using the traditional test. If you reject, you are done.
If you fail to reject, then divide the $x_i - y_i$ into two subsets: those realizations less than zero and those greater than zero. Now use the two-sample KS test on the two halves of your data.
You will need to use your judgment for high dimensions since you are performing a multitude of tests, but at least this deals with the potential dependence. | How to test if two samples are distributed from the same Gaussian process
Let the null hypothesis be that $\mathbf x$ and $\mathbf y$ have the same distribution. Let $\mathbf z = \mathbf x - \mathbf y.$ Under the null, $\mathbf z$ will have a mean of zero and be symmetric. |
29,667 | Time line analysis | You might consider using multilevel models (mixed regression) to estimate the between and within family effects. One possible strategy is to use a planned hierarchical model building approach. For example, test each potential predictor in a univariate model. If the between family effects remove the birth order effect, then it would strongly suggest birth order is not important but that other influences are. An example of citation for this for birth order effects on IQ:
Wichman, A. L., Rodgers, J., & MacCallum, R. C. (2006). A Multilevel Approach to the Relationship Between Birth Order and Intelligence. Personality And Social Psychology Bulletin, 32(1), 117-127. doi:10.1177/0146167205279581
I hope that this helpful. | Time line analysis | You might consider using multilevel models (mixed regression) to estimate the between and within family effects. One possible strategy is to use a planned hierarchical model building approach. For exa | Time line analysis
You might consider using multilevel models (mixed regression) to estimate the between and within family effects. One possible strategy is to use a planned hierarchical model building approach. For example, test each potential predictor in a univariate model. If the between family effects remove the birth order effect, then it would strongly suggest birth order is not important but that other influences are. An example of citation for this for birth order effects on IQ:
Wichman, A. L., Rodgers, J., & MacCallum, R. C. (2006). A Multilevel Approach to the Relationship Between Birth Order and Intelligence. Personality And Social Psychology Bulletin, 32(1), 117-127. doi:10.1177/0146167205279581
I hope that this helpful. | Time line analysis
You might consider using multilevel models (mixed regression) to estimate the between and within family effects. One possible strategy is to use a planned hierarchical model building approach. For exa |
29,668 | Time line analysis | I am approaching this as a statistical question and have no special knowledge of the medical issues.
Looking at the article you refer to I see that one cohort contained 970 individuals. If you have data on several cohorts of roughly that size, then the overall size of your dataset offers the opportunity to select reasonably large subsets in which each individual's timeline meets specific conditions. For example, a subset might include, say, all male individuals with maternal age 25-29. A regression, for such a subset, of a suitable measure of later obesity against birth order would eliminate any possible effect on later obesity of differences in gender of the index child and largely eliminate any possible effect of maternal age.
It is not straightforward to extend this approach to the gender of siblings since if one condition for a subset were, say, that the index child has an older female sibling, that implies that the index child is not itself an eldest child, narrowing the range of the independent variable in the regression. However, a way round this might be to define conditions using "if any". For example, a subset could be defined to include all male individuals with maternal age 25-29 and with older siblings, if any, all female. Such a subset would still include individuals with any birth order.
If a subset were defined by too complex a set of conditions, then the number of individuals it contained might be so small that the resulting estimates of coefficients would be too imprecise to be useful. If this approach were adopted, there would probably be a need for a judgmental trade-off, in defining subsets, between eliminating as many possible effects as possible and including enough individuals to yield a useful result. | Time line analysis | I am approaching this as a statistical question and have no special knowledge of the medical issues.
Looking at the article you refer to I see that one cohort contained 970 individuals. If you have d | Time line analysis
I am approaching this as a statistical question and have no special knowledge of the medical issues.
Looking at the article you refer to I see that one cohort contained 970 individuals. If you have data on several cohorts of roughly that size, then the overall size of your dataset offers the opportunity to select reasonably large subsets in which each individual's timeline meets specific conditions. For example, a subset might include, say, all male individuals with maternal age 25-29. A regression, for such a subset, of a suitable measure of later obesity against birth order would eliminate any possible effect on later obesity of differences in gender of the index child and largely eliminate any possible effect of maternal age.
It is not straightforward to extend this approach to the gender of siblings since if one condition for a subset were, say, that the index child has an older female sibling, that implies that the index child is not itself an eldest child, narrowing the range of the independent variable in the regression. However, a way round this might be to define conditions using "if any". For example, a subset could be defined to include all male individuals with maternal age 25-29 and with older siblings, if any, all female. Such a subset would still include individuals with any birth order.
If a subset were defined by too complex a set of conditions, then the number of individuals it contained might be so small that the resulting estimates of coefficients would be too imprecise to be useful. If this approach were adopted, there would probably be a need for a judgmental trade-off, in defining subsets, between eliminating as many possible effects as possible and including enough individuals to yield a useful result. | Time line analysis
I am approaching this as a statistical question and have no special knowledge of the medical issues.
Looking at the article you refer to I see that one cohort contained 970 individuals. If you have d |
29,669 | Time line analysis | I would suggest functional data analysis but I suspect you might have a lot of families with too few children to get reasonable estimates. Go ahead and read into it though, as it addresses your needs. Perhaps someone has used it with similar data already.
If you don't want to do something as massively non parametric as that, you should use your clinical expertise to reduce the dimensionality of the data. For example, one variable in your model could be number of children, another could be average number of years between children, and so on. If there is any effect in these variables, it may show up even if you haven't correctly specified the functional form immediately. Further knowledge-driven model building may allow you to build a highly predictive model--just make sure you keep a validation set! | Time line analysis | I would suggest functional data analysis but I suspect you might have a lot of families with too few children to get reasonable estimates. Go ahead and read into it though, as it addresses your needs. | Time line analysis
I would suggest functional data analysis but I suspect you might have a lot of families with too few children to get reasonable estimates. Go ahead and read into it though, as it addresses your needs. Perhaps someone has used it with similar data already.
If you don't want to do something as massively non parametric as that, you should use your clinical expertise to reduce the dimensionality of the data. For example, one variable in your model could be number of children, another could be average number of years between children, and so on. If there is any effect in these variables, it may show up even if you haven't correctly specified the functional form immediately. Further knowledge-driven model building may allow you to build a highly predictive model--just make sure you keep a validation set! | Time line analysis
I would suggest functional data analysis but I suspect you might have a lot of families with too few children to get reasonable estimates. Go ahead and read into it though, as it addresses your needs. |
29,670 | Statistics for machine learning, papers to start? | I would recommend Andrew Ngs Machine Learning course on Coursera, it does a brilliant coverage on all the basics. If you are studying anything to do with probabilistic graphical models Daphne Kollers course would be good to have a look at too.
This is a treasure trove for self-study resources too http://ragle.sanukcode.net/articles/machine-learning-self-study-resources/ Herb Grossman's lectures are awesome.
I've also been recommended this book https://www.openintro.org/stat/textbook.php as I'm always still learning myself and stats is not my background!
My two cents re the maths side of things and papers though is don't get too caught up on the background maths. Learn the basics and reference the papers that those papers you mentioned are built on and see are they easier (maybe you'll have to go back a few papers to get something you can understand -it's what I do myself) there are a lot of different elements of maths in ML and it's easy to get sucked down a rabbit hole (again something I've done myself more than once!).
Best of luck, it's a really interesting field! | Statistics for machine learning, papers to start? | I would recommend Andrew Ngs Machine Learning course on Coursera, it does a brilliant coverage on all the basics. If you are studying anything to do with probabilistic graphical models Daphne Kollers | Statistics for machine learning, papers to start?
I would recommend Andrew Ngs Machine Learning course on Coursera, it does a brilliant coverage on all the basics. If you are studying anything to do with probabilistic graphical models Daphne Kollers course would be good to have a look at too.
This is a treasure trove for self-study resources too http://ragle.sanukcode.net/articles/machine-learning-self-study-resources/ Herb Grossman's lectures are awesome.
I've also been recommended this book https://www.openintro.org/stat/textbook.php as I'm always still learning myself and stats is not my background!
My two cents re the maths side of things and papers though is don't get too caught up on the background maths. Learn the basics and reference the papers that those papers you mentioned are built on and see are they easier (maybe you'll have to go back a few papers to get something you can understand -it's what I do myself) there are a lot of different elements of maths in ML and it's easy to get sucked down a rabbit hole (again something I've done myself more than once!).
Best of luck, it's a really interesting field! | Statistics for machine learning, papers to start?
I would recommend Andrew Ngs Machine Learning course on Coursera, it does a brilliant coverage on all the basics. If you are studying anything to do with probabilistic graphical models Daphne Kollers |
29,671 | What is iterative bootstrap? How is it used? | That paper you mention in comments refers to Davidson and MacKinnon, who give this motivation:
Although bootstrap P values will often be very reliable, this will not be true in every
case. For an asymptotic test, one way to check whether it is reliable is simply to use
the bootstrap. If the asymptotic and bootstrap P values associated with a given test
statistic are similar, we can be fairly confident that the asymptotic one is reasonably
accurate. Of course, having gone to the trouble of computing the bootstrap P value,
we may well want to use it instead of the asymptotic one.
In a great many cases, however, asymptotic and bootstrap P values are quite different.
When this happens, it is almost certain that the asymptotic P value is inaccurate,
but we cannot be sure that the bootstrap one is accurate. In this paper, we discuss
techniques for computing modified bootstrap P values which will tend to be similar
to the ordinary bootstrap P value when the latter is reliable, but which should often
be more accurate when it is unreliable. These techniques are closely related to the
double bootstrap originally proposed by Beran (1988), but they are far less expensive
to compute. In fact, the amount of computational effort beyond that needed to obtain
ordinary bootstrap P values is roughly equal to the amount needed to compute the
latter in the first place.
That looks like a pretty clear reason to (i) perform iterative bootstrapping and (ii) to try to pursue efficient methods for doing it -- which is what the paper you point to and this paper seem to be trying to do.
(So far this answer only relates to the 'what's the point?' part of the question.) | What is iterative bootstrap? How is it used? | That paper you mention in comments refers to Davidson and MacKinnon, who give this motivation:
Although bootstrap P values will often be very reliable, this will not be true in every
case. For an a | What is iterative bootstrap? How is it used?
That paper you mention in comments refers to Davidson and MacKinnon, who give this motivation:
Although bootstrap P values will often be very reliable, this will not be true in every
case. For an asymptotic test, one way to check whether it is reliable is simply to use
the bootstrap. If the asymptotic and bootstrap P values associated with a given test
statistic are similar, we can be fairly confident that the asymptotic one is reasonably
accurate. Of course, having gone to the trouble of computing the bootstrap P value,
we may well want to use it instead of the asymptotic one.
In a great many cases, however, asymptotic and bootstrap P values are quite different.
When this happens, it is almost certain that the asymptotic P value is inaccurate,
but we cannot be sure that the bootstrap one is accurate. In this paper, we discuss
techniques for computing modified bootstrap P values which will tend to be similar
to the ordinary bootstrap P value when the latter is reliable, but which should often
be more accurate when it is unreliable. These techniques are closely related to the
double bootstrap originally proposed by Beran (1988), but they are far less expensive
to compute. In fact, the amount of computational effort beyond that needed to obtain
ordinary bootstrap P values is roughly equal to the amount needed to compute the
latter in the first place.
That looks like a pretty clear reason to (i) perform iterative bootstrapping and (ii) to try to pursue efficient methods for doing it -- which is what the paper you point to and this paper seem to be trying to do.
(So far this answer only relates to the 'what's the point?' part of the question.) | What is iterative bootstrap? How is it used?
That paper you mention in comments refers to Davidson and MacKinnon, who give this motivation:
Although bootstrap P values will often be very reliable, this will not be true in every
case. For an a |
29,672 | Long-tailed distribution of time events | You really should plot the logarithm of the inter-click intervals instead of the raw values; this will flatten your distribution and might even reveal the multiple modes in your distribution.
More advanced approaches have been developed by neuroscientists to solve a very similar problem in identifying bursts of neuronal spikes. This classic paper or the many other related papers on google scholar. | Long-tailed distribution of time events | You really should plot the logarithm of the inter-click intervals instead of the raw values; this will flatten your distribution and might even reveal the multiple modes in your distribution.
More adv | Long-tailed distribution of time events
You really should plot the logarithm of the inter-click intervals instead of the raw values; this will flatten your distribution and might even reveal the multiple modes in your distribution.
More advanced approaches have been developed by neuroscientists to solve a very similar problem in identifying bursts of neuronal spikes. This classic paper or the many other related papers on google scholar. | Long-tailed distribution of time events
You really should plot the logarithm of the inter-click intervals instead of the raw values; this will flatten your distribution and might even reveal the multiple modes in your distribution.
More adv |
29,673 | Calculating prediction intervals when using cross validation | I'm concerned that the prediction accuracy calculated between each fold are dependent because of the substantial overlap between training sets (although the prediction sets are independent).
IMHO the overlap between the training sets does not need to be a big concern here. That is, it is of course important to check whether the models are stable. Stable implies that the cross validation surrogate models' predictions are equivalent (i.e. an independent case would get the same prediction by all those models), and in fact cross validaton usually claims equivalence not only between the surrogate models but also to the model trained on all cases.
So this dependence is rather a consequence of what we want to have.
This applies for the typical question: if I train a model on these data, what are the prediction intervals? If the question is instead, if we train a model on $n$ cases of this population, what are the prediction intervals?, we cannot answer it because that overlap in the training sets means we underestimate variance by an unknown amount.
What are the consequences compared to testing with an independent test set?
Cross validation estimates may have higher variance than testing the final model with an independent test set of the same size, because in addition to the variance due to test cases we face variance due to instability of the surrogate models.
However, if the models are stable, this variance is small/negligible. Moreover this type of stability can be measured.
What can not be measured is how representative the whole data set is compared to the population it was drawn from. This includes part of the bias of the final model (however, also a small independent test set may have a bias) and it means that the corresponding variance cannot be estimated by cross validation.
In application practice (performance of model trained on these data), the prediction interval calculation would face issues that IMHO are more important than what part of variance cross validation cannot detect: e.g.
cross validation cannot test performance for cases that are independent in time (predictions are usually needed for cases that are measured in the future)
the data may contain unknown clusters, and out-of-cluster performance may be important. Clustered data is in priciple something you can account for in cross validation, but you need to know about the clustering.
These are more than just a cross validation vs. independent test set thing: basically you'd need to sit down and design a validation study, otherwise there's a high risk that the "independent" test set is not all that independent. Once that is done, one can think about which factors are likely to be of practical importance and which can be neglected. You may arrive at the conclusion that after thorough consideration, cross valiation is good enough and the sensible thing to do because the independent validation would be far too expensive compared to the possible information gain.
All things put together, I'd use the usual formula for the standard deviation, call it $s_{CV}$ in analogy to $RMSE_{CV}$ and report in detail how the testing was done. | Calculating prediction intervals when using cross validation | I'm concerned that the prediction accuracy calculated between each fold are dependent because of the substantial overlap between training sets (although the prediction sets are independent).
IMHO the | Calculating prediction intervals when using cross validation
I'm concerned that the prediction accuracy calculated between each fold are dependent because of the substantial overlap between training sets (although the prediction sets are independent).
IMHO the overlap between the training sets does not need to be a big concern here. That is, it is of course important to check whether the models are stable. Stable implies that the cross validation surrogate models' predictions are equivalent (i.e. an independent case would get the same prediction by all those models), and in fact cross validaton usually claims equivalence not only between the surrogate models but also to the model trained on all cases.
So this dependence is rather a consequence of what we want to have.
This applies for the typical question: if I train a model on these data, what are the prediction intervals? If the question is instead, if we train a model on $n$ cases of this population, what are the prediction intervals?, we cannot answer it because that overlap in the training sets means we underestimate variance by an unknown amount.
What are the consequences compared to testing with an independent test set?
Cross validation estimates may have higher variance than testing the final model with an independent test set of the same size, because in addition to the variance due to test cases we face variance due to instability of the surrogate models.
However, if the models are stable, this variance is small/negligible. Moreover this type of stability can be measured.
What can not be measured is how representative the whole data set is compared to the population it was drawn from. This includes part of the bias of the final model (however, also a small independent test set may have a bias) and it means that the corresponding variance cannot be estimated by cross validation.
In application practice (performance of model trained on these data), the prediction interval calculation would face issues that IMHO are more important than what part of variance cross validation cannot detect: e.g.
cross validation cannot test performance for cases that are independent in time (predictions are usually needed for cases that are measured in the future)
the data may contain unknown clusters, and out-of-cluster performance may be important. Clustered data is in priciple something you can account for in cross validation, but you need to know about the clustering.
These are more than just a cross validation vs. independent test set thing: basically you'd need to sit down and design a validation study, otherwise there's a high risk that the "independent" test set is not all that independent. Once that is done, one can think about which factors are likely to be of practical importance and which can be neglected. You may arrive at the conclusion that after thorough consideration, cross valiation is good enough and the sensible thing to do because the independent validation would be far too expensive compared to the possible information gain.
All things put together, I'd use the usual formula for the standard deviation, call it $s_{CV}$ in analogy to $RMSE_{CV}$ and report in detail how the testing was done. | Calculating prediction intervals when using cross validation
I'm concerned that the prediction accuracy calculated between each fold are dependent because of the substantial overlap between training sets (although the prediction sets are independent).
IMHO the |
29,674 | On cophenetic correlation for dendrogram clustering | ... is a "suitability index" of the classification
To me it's not right clear what is meant by that. The way I got it, is that
the correlation between the original dissimilarities and the cophenetic dissimilarities (called cophenetic correlation)
is a measure of the hierarchical structure among the observations, i. e. their distances. That is to say the dissimilarities to observations in a different cluster are preferably similar.
Considering to datasets A and B clustered using euclidean distance and complete linkage...
...even without having a look at the cophenetic distance map or computing cophenetic correlation, one can see, that the cophenetic correlation of A is higher than that of B.
In a hierarchy there are levels. So the CC tells about whether distances to observations on the same level (cluster) are similar.
For the sake of completeness: The cophenetic correlations are CC(A) = 0.936 and CC(B) = 0.691 | On cophenetic correlation for dendrogram clustering | ... is a "suitability index" of the classification
To me it's not right clear what is meant by that. The way I got it, is that
the correlation between the original dissimilarities and the cophenetic | On cophenetic correlation for dendrogram clustering
... is a "suitability index" of the classification
To me it's not right clear what is meant by that. The way I got it, is that
the correlation between the original dissimilarities and the cophenetic dissimilarities (called cophenetic correlation)
is a measure of the hierarchical structure among the observations, i. e. their distances. That is to say the dissimilarities to observations in a different cluster are preferably similar.
Considering to datasets A and B clustered using euclidean distance and complete linkage...
...even without having a look at the cophenetic distance map or computing cophenetic correlation, one can see, that the cophenetic correlation of A is higher than that of B.
In a hierarchy there are levels. So the CC tells about whether distances to observations on the same level (cluster) are similar.
For the sake of completeness: The cophenetic correlations are CC(A) = 0.936 and CC(B) = 0.691 | On cophenetic correlation for dendrogram clustering
... is a "suitability index" of the classification
To me it's not right clear what is meant by that. The way I got it, is that
the correlation between the original dissimilarities and the cophenetic |
29,675 | Is there a generalization of Pillai trace and the Hotelling-Lawley trace? | I imagine that productive generalizations would come out from observations that
some of these tests are norms of the vector ${\rm spec}[HE^{-1}]=\{\lambda_1, \ldots, \lambda_p\}$, so Hotelling-Lawley's trace is the $l_1$ norm, $\| \{\lambda_1, \ldots, \lambda_p\} \|_1$, and Roy's largest root is the $l_\infty$ norm, $\| \{\lambda_1, \ldots, \lambda_p\} \|_\infty$.
some of these tests may be a norm of the matrix $HE^{-1}$, e.g., Roy's largest root is the spectral, or $l_2$, norm $\| H E^{-1} \|_2$.
some of the tests may be of the generalized entropy form, e.g., Hotelling-Lawley's trace is GE(1), Roy's largest root is GE($\infty$), and Wilks' $\Lambda$ is GE(-1) on $\{1+\lambda_1, \ldots, 1+\lambda_p\}$, up to a monotone transformation each.
When other norms or other generalized entropy parameters are entertained, other statistics may be arrived at that might be meaningful. I doubt that any of them would produce your $\psi_2$, though. | Is there a generalization of Pillai trace and the Hotelling-Lawley trace? | I imagine that productive generalizations would come out from observations that
some of these tests are norms of the vector ${\rm spec}[HE^{-1}]=\{\lambda_1, \ldots, \lambda_p\}$, so Hotelling-Lawle | Is there a generalization of Pillai trace and the Hotelling-Lawley trace?
I imagine that productive generalizations would come out from observations that
some of these tests are norms of the vector ${\rm spec}[HE^{-1}]=\{\lambda_1, \ldots, \lambda_p\}$, so Hotelling-Lawley's trace is the $l_1$ norm, $\| \{\lambda_1, \ldots, \lambda_p\} \|_1$, and Roy's largest root is the $l_\infty$ norm, $\| \{\lambda_1, \ldots, \lambda_p\} \|_\infty$.
some of these tests may be a norm of the matrix $HE^{-1}$, e.g., Roy's largest root is the spectral, or $l_2$, norm $\| H E^{-1} \|_2$.
some of the tests may be of the generalized entropy form, e.g., Hotelling-Lawley's trace is GE(1), Roy's largest root is GE($\infty$), and Wilks' $\Lambda$ is GE(-1) on $\{1+\lambda_1, \ldots, 1+\lambda_p\}$, up to a monotone transformation each.
When other norms or other generalized entropy parameters are entertained, other statistics may be arrived at that might be meaningful. I doubt that any of them would produce your $\psi_2$, though. | Is there a generalization of Pillai trace and the Hotelling-Lawley trace?
I imagine that productive generalizations would come out from observations that
some of these tests are norms of the vector ${\rm spec}[HE^{-1}]=\{\lambda_1, \ldots, \lambda_p\}$, so Hotelling-Lawle |
29,676 | Is it acceptable to run two linear models on the same data set? | Let me start by saying that I think your first question and first R model are incompatible with each other. In R, when we write a formula with either -1 or +0, we are suppressing the intercept. Thus, lm(y ~ group + x:group - 1) prevents you from being able to tell if the intercepts significantly differ from 0. In the same vein, in your following two models, th +1 is superfluous, the intercept is automatically estimated in R. I would advise you to use reference cell coding (also called 'dummy coding') to represent your groups. That is, with $g$ groups, create $g-1$ new variables, pick one group as the default and assign 0's to the units of that group in each of the new variables. Then each new variable is used to represent membership in one of the other groups; units that fall within a given group are indicated with a 1 in the corresponding variable and 0's elsewhere. When your coefficients are returned, if the intercept is 'significant', then your default group has a non-zero intercept. Unfortunately, the standard significance tests for the other groups will not tell you if they differ from 0, but rather if they differ from the default group. To determine if they differ from 0, add their coefficients to the intercept and divide the sum by their standard errors to get their t-values. The situation with the slopes will be similar: That is, the test of $X$ will tell you if the default group's slope differs significantly from 0, and the interaction terms tell you if those groups' slopes differ from the default groups. Tests for the slopes of the other groups against 0 can be constructed just as for the intercepts. Even better would be to just fit a 'restricted' model without any of the group indicator variables or the interaction terms, and test this model against the full model with anova(), which will tell you if your groups differ meaningfully at all.
These things having been said, your main question is whether doing all of this is acceptable. The underlying issue here is the problem of multiple comparisons. This is a long-standing and thorny issue, with many opinions. (You can find more information on this topic on CV by perusing the questions tagged with this keyword.) While opinions have certainly varied on this topic, I think no one would fault you for running many analyses over the same dataset provided the analyses were orthogonal. Generally, orthogonal contrasts are thought about in the context of figuring out how to compare a set of $g$ groups to each other, however, that is not the case here; your question is unusual (and, I think, interesting). So far as I can see, if you simply wanted to partition your dataset into $g$ separate subsets and run a simple regression model on each that should be OK. The more interesting question is whether the 'collapsed' analysis can be considered orthogonal to the set of individual analyses; I don't think so, because you should be able to recreate the collapsed analysis with a linear combination of the group analyses.
A slightly different question is whether doing this is really meaningful. Image that you run an initial analysis and discover that the groups differ from each other in a substantively meaningful way; what sense does it make to put these divergent groups together into a discombobulated whole? For example, imagine that the groups differ (somehow) on their intercepts, then, at least some group does not have a 0 intercept. If there is only one such group, then the intercept for the whole will only be 0 if that group has $n_g=0$ in the relevant population. Alternatively, lets say that there are exactly 2 groups with non-zero intercepts with one positive and one negative, then the whole will have a 0 intercept only if the $n$'s of these groups are in inverse proportion to the magnitudes of the intercepts' divergences. I could go on here (there are many more possibilities), but the point is you are asking questions about how the groups sizes relate to the differences in parameter values. Frankly, these are weird questions to me.
I would suggest you follow the protocol I outline above. Namely, dummy code your groups. Then fit a full model with all the dummies and interaction terms included. Fit a reduced model without these terms, and perform a nested model test. If the groups do differ somehow, follow up with (hopefully) a-priori (theoretically driven) orthogonal contrasts to better understand how the groups differ. (And plot--always, always plot.) | Is it acceptable to run two linear models on the same data set? | Let me start by saying that I think your first question and first R model are incompatible with each other. In R, when we write a formula with either -1 or +0, we are suppressing the intercept. Thus | Is it acceptable to run two linear models on the same data set?
Let me start by saying that I think your first question and first R model are incompatible with each other. In R, when we write a formula with either -1 or +0, we are suppressing the intercept. Thus, lm(y ~ group + x:group - 1) prevents you from being able to tell if the intercepts significantly differ from 0. In the same vein, in your following two models, th +1 is superfluous, the intercept is automatically estimated in R. I would advise you to use reference cell coding (also called 'dummy coding') to represent your groups. That is, with $g$ groups, create $g-1$ new variables, pick one group as the default and assign 0's to the units of that group in each of the new variables. Then each new variable is used to represent membership in one of the other groups; units that fall within a given group are indicated with a 1 in the corresponding variable and 0's elsewhere. When your coefficients are returned, if the intercept is 'significant', then your default group has a non-zero intercept. Unfortunately, the standard significance tests for the other groups will not tell you if they differ from 0, but rather if they differ from the default group. To determine if they differ from 0, add their coefficients to the intercept and divide the sum by their standard errors to get their t-values. The situation with the slopes will be similar: That is, the test of $X$ will tell you if the default group's slope differs significantly from 0, and the interaction terms tell you if those groups' slopes differ from the default groups. Tests for the slopes of the other groups against 0 can be constructed just as for the intercepts. Even better would be to just fit a 'restricted' model without any of the group indicator variables or the interaction terms, and test this model against the full model with anova(), which will tell you if your groups differ meaningfully at all.
These things having been said, your main question is whether doing all of this is acceptable. The underlying issue here is the problem of multiple comparisons. This is a long-standing and thorny issue, with many opinions. (You can find more information on this topic on CV by perusing the questions tagged with this keyword.) While opinions have certainly varied on this topic, I think no one would fault you for running many analyses over the same dataset provided the analyses were orthogonal. Generally, orthogonal contrasts are thought about in the context of figuring out how to compare a set of $g$ groups to each other, however, that is not the case here; your question is unusual (and, I think, interesting). So far as I can see, if you simply wanted to partition your dataset into $g$ separate subsets and run a simple regression model on each that should be OK. The more interesting question is whether the 'collapsed' analysis can be considered orthogonal to the set of individual analyses; I don't think so, because you should be able to recreate the collapsed analysis with a linear combination of the group analyses.
A slightly different question is whether doing this is really meaningful. Image that you run an initial analysis and discover that the groups differ from each other in a substantively meaningful way; what sense does it make to put these divergent groups together into a discombobulated whole? For example, imagine that the groups differ (somehow) on their intercepts, then, at least some group does not have a 0 intercept. If there is only one such group, then the intercept for the whole will only be 0 if that group has $n_g=0$ in the relevant population. Alternatively, lets say that there are exactly 2 groups with non-zero intercepts with one positive and one negative, then the whole will have a 0 intercept only if the $n$'s of these groups are in inverse proportion to the magnitudes of the intercepts' divergences. I could go on here (there are many more possibilities), but the point is you are asking questions about how the groups sizes relate to the differences in parameter values. Frankly, these are weird questions to me.
I would suggest you follow the protocol I outline above. Namely, dummy code your groups. Then fit a full model with all the dummies and interaction terms included. Fit a reduced model without these terms, and perform a nested model test. If the groups do differ somehow, follow up with (hopefully) a-priori (theoretically driven) orthogonal contrasts to better understand how the groups differ. (And plot--always, always plot.) | Is it acceptable to run two linear models on the same data set?
Let me start by saying that I think your first question and first R model are incompatible with each other. In R, when we write a formula with either -1 or +0, we are suppressing the intercept. Thus |
29,677 | Model stability in cross-validation of regression models | You could treat the regression coefficients resulting from each test fold in the CV as independent observations and then calculate their reliability/stability using intra-class correlation coefficient (ICC) as reported by Shrout & Fleiss. | Model stability in cross-validation of regression models | You could treat the regression coefficients resulting from each test fold in the CV as independent observations and then calculate their reliability/stability using intra-class correlation coefficien | Model stability in cross-validation of regression models
You could treat the regression coefficients resulting from each test fold in the CV as independent observations and then calculate their reliability/stability using intra-class correlation coefficient (ICC) as reported by Shrout & Fleiss. | Model stability in cross-validation of regression models
You could treat the regression coefficients resulting from each test fold in the CV as independent observations and then calculate their reliability/stability using intra-class correlation coefficien |
29,678 | Model stability in cross-validation of regression models | I assume you in your cross-validation you divide the data in two parts, a training set and a test set. In one fold you fit a model from the training set and use it to predict the response of the test set, right? This will give you an error rate for the whole model, not for a single predictor.
I do not know if it is possible to find p-values for predictors using something like the F-tests used in ordinary linear regression.
You can try remove predictors from the model using for example backward or forward selection if that is your aim.
You could instead of CV use bootstrap to find a confidence interval for each predictor and then see how stable it is.
How many folds do you use in your CV, is it leave-one-out cross-validation?
Perhaps more details of what your aim is would help to answer this question. | Model stability in cross-validation of regression models | I assume you in your cross-validation you divide the data in two parts, a training set and a test set. In one fold you fit a model from the training set and use it to predict the response of the test | Model stability in cross-validation of regression models
I assume you in your cross-validation you divide the data in two parts, a training set and a test set. In one fold you fit a model from the training set and use it to predict the response of the test set, right? This will give you an error rate for the whole model, not for a single predictor.
I do not know if it is possible to find p-values for predictors using something like the F-tests used in ordinary linear regression.
You can try remove predictors from the model using for example backward or forward selection if that is your aim.
You could instead of CV use bootstrap to find a confidence interval for each predictor and then see how stable it is.
How many folds do you use in your CV, is it leave-one-out cross-validation?
Perhaps more details of what your aim is would help to answer this question. | Model stability in cross-validation of regression models
I assume you in your cross-validation you divide the data in two parts, a training set and a test set. In one fold you fit a model from the training set and use it to predict the response of the test |
29,679 | Tree size in gradient tree boosting | The solution in R's gbm is not a typical one.
Other packages, like scikit-learn or LightGBM use so-called (in scikit-learn) BestFirstTreeBuilder, when the number of leaves is restricted. It supports a priority queue of all the leaves and at each iteration splits the leaf that brings the best impurity decrease. So it is neither depth-first nor breadth-first, but a third algorithm, based on calculations in the leaves.
In some sense, this approach is more optimal than blindly split all the leaves in turn. However, it is still a greedy heuristic, because the choice whether to split the $i$'th node now depends only on the first split of $i$ and not the possible succesive splits that may decrease impurity much more than the current split. | Tree size in gradient tree boosting | The solution in R's gbm is not a typical one.
Other packages, like scikit-learn or LightGBM use so-called (in scikit-learn) BestFirstTreeBuilder, when the number of leaves is restricted. It supports a | Tree size in gradient tree boosting
The solution in R's gbm is not a typical one.
Other packages, like scikit-learn or LightGBM use so-called (in scikit-learn) BestFirstTreeBuilder, when the number of leaves is restricted. It supports a priority queue of all the leaves and at each iteration splits the leaf that brings the best impurity decrease. So it is neither depth-first nor breadth-first, but a third algorithm, based on calculations in the leaves.
In some sense, this approach is more optimal than blindly split all the leaves in turn. However, it is still a greedy heuristic, because the choice whether to split the $i$'th node now depends only on the first split of $i$ and not the possible succesive splits that may decrease impurity much more than the current split. | Tree size in gradient tree boosting
The solution in R's gbm is not a typical one.
Other packages, like scikit-learn or LightGBM use so-called (in scikit-learn) BestFirstTreeBuilder, when the number of leaves is restricted. It supports a |
29,680 | An estimation problem in GPS tracking | I agree that as posed the question is incomplete. I am also puzzled about the mention of CEP (which is the circle centered at the mean that contains 50% of the distribution. Knowing the mean and covariance matrix would be enough to characterize a bivariate normal distribution. Are you assuming bivariate normal for the GPS accuracy? Maybe circular normal because x and y coordinates are independent. Of course if you know the mean and covariance of a bivariate normal the CEP is then determined. Having worked in the Aerospace industry in the 1980s study the GPS user equipment accuracy based on how many satellites can pick up the signal i know that CEP is a commonly used parameter. What is the mechanism that the follower uses? Perhaps he moves toward the point estimate from his GPS device? In that case he would be moving toward the GPS estimated center for the location of the leader. He would probably follow a straight line until he sees a position update and would then move toward that updated position. In that way he would be following a broken line with the number of chnages in the direction of the line dictated by the frequency of the update. | An estimation problem in GPS tracking | I agree that as posed the question is incomplete. I am also puzzled about the mention of CEP (which is the circle centered at the mean that contains 50% of the distribution. Knowing the mean and cova | An estimation problem in GPS tracking
I agree that as posed the question is incomplete. I am also puzzled about the mention of CEP (which is the circle centered at the mean that contains 50% of the distribution. Knowing the mean and covariance matrix would be enough to characterize a bivariate normal distribution. Are you assuming bivariate normal for the GPS accuracy? Maybe circular normal because x and y coordinates are independent. Of course if you know the mean and covariance of a bivariate normal the CEP is then determined. Having worked in the Aerospace industry in the 1980s study the GPS user equipment accuracy based on how many satellites can pick up the signal i know that CEP is a commonly used parameter. What is the mechanism that the follower uses? Perhaps he moves toward the point estimate from his GPS device? In that case he would be moving toward the GPS estimated center for the location of the leader. He would probably follow a straight line until he sees a position update and would then move toward that updated position. In that way he would be following a broken line with the number of chnages in the direction of the line dictated by the frequency of the update. | An estimation problem in GPS tracking
I agree that as posed the question is incomplete. I am also puzzled about the mention of CEP (which is the circle centered at the mean that contains 50% of the distribution. Knowing the mean and cova |
29,681 | An estimation problem in GPS tracking | IMHO, the problem definition is incomplete. The answer would depend on the frequency of communication between L and F, and the speed of travel. If you can calculate the GPS position very frequently, if the readings are independent of each other and the communication frequency is also high, then both vehicles can traverse almost identical path. Also, if the vehicles are traveling very slowly, there would be enough communication between the cars to avoid discrepancy in path.
It also depends on plethora of other parameters, the skewness of the path etc. So this is the way I would go about it. I would simulate the scenario as accurately as possible and estimate the discrepancy using sampling.
Since you say this is a real world problem, you should also consider the fact that there are only specified number of paths (also called "roads") and that would reduce the discrepancy even further. | An estimation problem in GPS tracking | IMHO, the problem definition is incomplete. The answer would depend on the frequency of communication between L and F, and the speed of travel. If you can calculate the GPS position very frequently, i | An estimation problem in GPS tracking
IMHO, the problem definition is incomplete. The answer would depend on the frequency of communication between L and F, and the speed of travel. If you can calculate the GPS position very frequently, if the readings are independent of each other and the communication frequency is also high, then both vehicles can traverse almost identical path. Also, if the vehicles are traveling very slowly, there would be enough communication between the cars to avoid discrepancy in path.
It also depends on plethora of other parameters, the skewness of the path etc. So this is the way I would go about it. I would simulate the scenario as accurately as possible and estimate the discrepancy using sampling.
Since you say this is a real world problem, you should also consider the fact that there are only specified number of paths (also called "roads") and that would reduce the discrepancy even further. | An estimation problem in GPS tracking
IMHO, the problem definition is incomplete. The answer would depend on the frequency of communication between L and F, and the speed of travel. If you can calculate the GPS position very frequently, i |
29,682 | An estimation problem in GPS tracking | This is an incomplete question. For the first question, the control policy or algorithm is necessary. For the second question, the optimal estimate will depend upon whether there is global knowledge (F knows L's observations), and more critically, the metric for optimality. Optimality metrics may emphasize energy consumption, deviation from the leader trajectory, etc.
As a first step, separate the estimation problem from the control problem, and then you can approach simultaneous methods. | An estimation problem in GPS tracking | This is an incomplete question. For the first question, the control policy or algorithm is necessary. For the second question, the optimal estimate will depend upon whether there is global knowledge | An estimation problem in GPS tracking
This is an incomplete question. For the first question, the control policy or algorithm is necessary. For the second question, the optimal estimate will depend upon whether there is global knowledge (F knows L's observations), and more critically, the metric for optimality. Optimality metrics may emphasize energy consumption, deviation from the leader trajectory, etc.
As a first step, separate the estimation problem from the control problem, and then you can approach simultaneous methods. | An estimation problem in GPS tracking
This is an incomplete question. For the first question, the control policy or algorithm is necessary. For the second question, the optimal estimate will depend upon whether there is global knowledge |
29,683 | State of the art method(s) to find zero mean portions of a time series | It seems that the main issue here is efficient change-point detection, as after that the mean of the segment can be found trivially with increasing accuracy in the number of samples. Once recent approach that might be interesting is Z. Harchaoui, F. Bach, and E. Moulines. Kernel change-point analysis, Advances in Neural Information Processing Systems (NIPS), 2008. | State of the art method(s) to find zero mean portions of a time series | It seems that the main issue here is efficient change-point detection, as after that the mean of the segment can be found trivially with increasing accuracy in the number of samples. Once recent appro | State of the art method(s) to find zero mean portions of a time series
It seems that the main issue here is efficient change-point detection, as after that the mean of the segment can be found trivially with increasing accuracy in the number of samples. Once recent approach that might be interesting is Z. Harchaoui, F. Bach, and E. Moulines. Kernel change-point analysis, Advances in Neural Information Processing Systems (NIPS), 2008. | State of the art method(s) to find zero mean portions of a time series
It seems that the main issue here is efficient change-point detection, as after that the mean of the segment can be found trivially with increasing accuracy in the number of samples. Once recent appro |
29,684 | State of the art method(s) to find zero mean portions of a time series | This may not be state of the art, but an intuitive method would be smoothing the data by placing weights on the observations close to each point in time.
So if you want to know whether sample R has a zero mean at time T:
mu(R,T)=w1*Sample(R,T)+w2*Sample(R,T-1)+w3*Sample(R,T+1)....
Perhaps exponential weights can be a good choice, depending on the definition of where the boundry lies.
After taking care of some technical details like the definition at the start and end of each somple you can now simply test whether each mu is close enough to zero to find the points where the mean is zero. | State of the art method(s) to find zero mean portions of a time series | This may not be state of the art, but an intuitive method would be smoothing the data by placing weights on the observations close to each point in time.
So if you want to know whether sample R has a | State of the art method(s) to find zero mean portions of a time series
This may not be state of the art, but an intuitive method would be smoothing the data by placing weights on the observations close to each point in time.
So if you want to know whether sample R has a zero mean at time T:
mu(R,T)=w1*Sample(R,T)+w2*Sample(R,T-1)+w3*Sample(R,T+1)....
Perhaps exponential weights can be a good choice, depending on the definition of where the boundry lies.
After taking care of some technical details like the definition at the start and end of each somple you can now simply test whether each mu is close enough to zero to find the points where the mean is zero. | State of the art method(s) to find zero mean portions of a time series
This may not be state of the art, but an intuitive method would be smoothing the data by placing weights on the observations close to each point in time.
So if you want to know whether sample R has a |
29,685 | How to assess goodness of fit of a particular nonlinear model? [closed] | Use the "npcmstest" package in library "NP" if you are using the R platform. Warning: The function may take several minutes to evaluate your model.
You can also consider an information-theoretic comparison of the response distribution and the predictive distribution (i.e. KL divergence, cross-entropy, etc.) | How to assess goodness of fit of a particular nonlinear model? [closed] | Use the "npcmstest" package in library "NP" if you are using the R platform. Warning: The function may take several minutes to evaluate your model.
You can also consider an information-theoretic compa | How to assess goodness of fit of a particular nonlinear model? [closed]
Use the "npcmstest" package in library "NP" if you are using the R platform. Warning: The function may take several minutes to evaluate your model.
You can also consider an information-theoretic comparison of the response distribution and the predictive distribution (i.e. KL divergence, cross-entropy, etc.) | How to assess goodness of fit of a particular nonlinear model? [closed]
Use the "npcmstest" package in library "NP" if you are using the R platform. Warning: The function may take several minutes to evaluate your model.
You can also consider an information-theoretic compa |
29,686 | How to assess goodness of fit of a particular nonlinear model? [closed] | Here's how I would do it, basically a likelihood ratio test. But remember they "key" to understanding a goodness of fit test, is to understand the class of alternatives that you are testing against. Now we have the likelihood for each individual data point as:
$$p(y_i|x_i,a,I)=g(\epsilon_i)=g(y_i-f_i)$$
Where $g(\epsilon)$ is the likelihood of the error term in your model, and $f_i=\frac{x_i-1}{a\sqrt{x^2_i+1}}$ is the model prediction for the ith data point, given $x_i$ and $a$. Now for each data point $(x_i,y_i)$ we can choose an $a$ such that $f_i=y_i$ - the "saturated model" as you call it. So you're $\chi^2$ test is appropriate here, if you only want to test to alternatives within the class of those with the same error likelihood, $g(\epsilon)$, and you have independence of each of the likelihoods (i.e. knowing another $x_j,y_j$ would be of no help in predicting $y_i$, given $a$). | How to assess goodness of fit of a particular nonlinear model? [closed] | Here's how I would do it, basically a likelihood ratio test. But remember they "key" to understanding a goodness of fit test, is to understand the class of alternatives that you are testing against. | How to assess goodness of fit of a particular nonlinear model? [closed]
Here's how I would do it, basically a likelihood ratio test. But remember they "key" to understanding a goodness of fit test, is to understand the class of alternatives that you are testing against. Now we have the likelihood for each individual data point as:
$$p(y_i|x_i,a,I)=g(\epsilon_i)=g(y_i-f_i)$$
Where $g(\epsilon)$ is the likelihood of the error term in your model, and $f_i=\frac{x_i-1}{a\sqrt{x^2_i+1}}$ is the model prediction for the ith data point, given $x_i$ and $a$. Now for each data point $(x_i,y_i)$ we can choose an $a$ such that $f_i=y_i$ - the "saturated model" as you call it. So you're $\chi^2$ test is appropriate here, if you only want to test to alternatives within the class of those with the same error likelihood, $g(\epsilon)$, and you have independence of each of the likelihoods (i.e. knowing another $x_j,y_j$ would be of no help in predicting $y_i$, given $a$). | How to assess goodness of fit of a particular nonlinear model? [closed]
Here's how I would do it, basically a likelihood ratio test. But remember they "key" to understanding a goodness of fit test, is to understand the class of alternatives that you are testing against. |
29,687 | How to assess goodness of fit of a particular nonlinear model? [closed] | In linear regression context, goodness of fit testing is often conducted against a more complicated alternative. You have a linear regression -- throw in some polynomial terms to test if the linear form is enough. Since you already have a nonlinear functional form, the complicated alternative you would need to consider would have to be that of non-parametric regression. I won't try to provide an introduction to the topic, as it requires a mindset of its own, and it is worth a separate proper introduction. For the test of parametric vs. nonparametric regressions, Wooldridge (1992) or Hardle and Mammen (1993), they do very similar things. Hardle also wrote a great book on the topic. | How to assess goodness of fit of a particular nonlinear model? [closed] | In linear regression context, goodness of fit testing is often conducted against a more complicated alternative. You have a linear regression -- throw in some polynomial terms to test if the linear fo | How to assess goodness of fit of a particular nonlinear model? [closed]
In linear regression context, goodness of fit testing is often conducted against a more complicated alternative. You have a linear regression -- throw in some polynomial terms to test if the linear form is enough. Since you already have a nonlinear functional form, the complicated alternative you would need to consider would have to be that of non-parametric regression. I won't try to provide an introduction to the topic, as it requires a mindset of its own, and it is worth a separate proper introduction. For the test of parametric vs. nonparametric regressions, Wooldridge (1992) or Hardle and Mammen (1993), they do very similar things. Hardle also wrote a great book on the topic. | How to assess goodness of fit of a particular nonlinear model? [closed]
In linear regression context, goodness of fit testing is often conducted against a more complicated alternative. You have a linear regression -- throw in some polynomial terms to test if the linear fo |
29,688 | Looking for pattern of events in a time series | I think an HMM-based analysis could be helpful for you. Since you know that you are looking for a distinction between rest and motion, you can just postulate a 2-state model. For HMMs, you need to specify the emission probability for each state. My first try would be to use an exponential (or a gamma?) for the resting phase (since it bounded by zero from below and a normal distribution for the other state (you should set the initial parameters to a some reasonable value).
You can then calculate the posterior state distribution along with the maximum-likelihood estimates for your parameters. The posterior-state sequence can give you the estimated lengths of the resting and activity periods (just count the number of successive states). You could even put the dark/light period as covariate into the model.
This http://cran.r-project.org/web/packages/depmixS4/index.html is a great package for HMMs.
This http://cran.r-project.org/web/packages/depmixS4/vignettes/depmixS4.pdf vignette has very useful information about its application and the usage of constraints and covariates with HMMs as well.
One problem I'm seeing is that you have multiple fish. You should start by fitting a HMM for each fish separately. Maybe you could combine fish if you could somehow "normalize" the activity such that they could yield the same emission probability parameters. Or you could use the fish-number as a covariate.
Some example code:
require(depmixS4)
set.seed(1)
mod <- depmix( activity~1, data=yourdata, nstates=2,
family=gaussian() );
fitted <- fit(mod)
but there are many, many possibilities, check out the above links!
Good luck with your project! | Looking for pattern of events in a time series | I think an HMM-based analysis could be helpful for you. Since you know that you are looking for a distinction between rest and motion, you can just postulate a 2-state model. For HMMs, you need to spe | Looking for pattern of events in a time series
I think an HMM-based analysis could be helpful for you. Since you know that you are looking for a distinction between rest and motion, you can just postulate a 2-state model. For HMMs, you need to specify the emission probability for each state. My first try would be to use an exponential (or a gamma?) for the resting phase (since it bounded by zero from below and a normal distribution for the other state (you should set the initial parameters to a some reasonable value).
You can then calculate the posterior state distribution along with the maximum-likelihood estimates for your parameters. The posterior-state sequence can give you the estimated lengths of the resting and activity periods (just count the number of successive states). You could even put the dark/light period as covariate into the model.
This http://cran.r-project.org/web/packages/depmixS4/index.html is a great package for HMMs.
This http://cran.r-project.org/web/packages/depmixS4/vignettes/depmixS4.pdf vignette has very useful information about its application and the usage of constraints and covariates with HMMs as well.
One problem I'm seeing is that you have multiple fish. You should start by fitting a HMM for each fish separately. Maybe you could combine fish if you could somehow "normalize" the activity such that they could yield the same emission probability parameters. Or you could use the fish-number as a covariate.
Some example code:
require(depmixS4)
set.seed(1)
mod <- depmix( activity~1, data=yourdata, nstates=2,
family=gaussian() );
fitted <- fit(mod)
but there are many, many possibilities, check out the above links!
Good luck with your project! | Looking for pattern of events in a time series
I think an HMM-based analysis could be helpful for you. Since you know that you are looking for a distinction between rest and motion, you can just postulate a 2-state model. For HMMs, you need to spe |
29,689 | Fast computation/estimation of a low-rank linear system | "Matrix Computations" by Golub & van Loan has a detailed discussion in chapter 12.5.1 on updating QR and Cholesky factorizations after rank-p updates. | Fast computation/estimation of a low-rank linear system | "Matrix Computations" by Golub & van Loan has a detailed discussion in chapter 12.5.1 on updating QR and Cholesky factorizations after rank-p updates. | Fast computation/estimation of a low-rank linear system
"Matrix Computations" by Golub & van Loan has a detailed discussion in chapter 12.5.1 on updating QR and Cholesky factorizations after rank-p updates. | Fast computation/estimation of a low-rank linear system
"Matrix Computations" by Golub & van Loan has a detailed discussion in chapter 12.5.1 on updating QR and Cholesky factorizations after rank-p updates. |
29,690 | Is there an easy way to combine two glm models in R? | Do you want to take the average of the predicted probabilities, or the average of the coefficients? They will give different results, because a logistic regression involves a nonlinear transform of the linear predictor.
A function to do either would be something like this. Set avg to "prob" to get the former, or something else for the latter.
pred_comb <- function(mod1, mod2, dat, avg="prob", ...)
{
xb1 <- predict(mod1, dat, type="link", ...)
xb2 <- predict(mod2, dat, type="link", ...)
if(avg == "prob")
(plogis(xb1) + plogis(xb2))/2
else plogis((xb1 + xb2)/2)
} | Is there an easy way to combine two glm models in R? | Do you want to take the average of the predicted probabilities, or the average of the coefficients? They will give different results, because a logistic regression involves a nonlinear transform of th | Is there an easy way to combine two glm models in R?
Do you want to take the average of the predicted probabilities, or the average of the coefficients? They will give different results, because a logistic regression involves a nonlinear transform of the linear predictor.
A function to do either would be something like this. Set avg to "prob" to get the former, or something else for the latter.
pred_comb <- function(mod1, mod2, dat, avg="prob", ...)
{
xb1 <- predict(mod1, dat, type="link", ...)
xb2 <- predict(mod2, dat, type="link", ...)
if(avg == "prob")
(plogis(xb1) + plogis(xb2))/2
else plogis((xb1 + xb2)/2)
} | Is there an easy way to combine two glm models in R?
Do you want to take the average of the predicted probabilities, or the average of the coefficients? They will give different results, because a logistic regression involves a nonlinear transform of th |
29,691 | R implementation of coefficient of partial determination | Well, r^2 is really just covariance squared over the product of the variances, so you could probably do something like cov(Yfull, Ytrue)/var(Ytrue)var(Yfull) - cov(YReduced, Ytrue)/var(Ytrue)var(YRed) regardless of model type; check to verify that gives you the same answer in the lm case though.
http://www.stator-afm.com/image-files/r-squared.gif | R implementation of coefficient of partial determination | Well, r^2 is really just covariance squared over the product of the variances, so you could probably do something like cov(Yfull, Ytrue)/var(Ytrue)var(Yfull) - cov(YReduced, Ytrue)/var(Ytrue)var(YRed) | R implementation of coefficient of partial determination
Well, r^2 is really just covariance squared over the product of the variances, so you could probably do something like cov(Yfull, Ytrue)/var(Ytrue)var(Yfull) - cov(YReduced, Ytrue)/var(Ytrue)var(YRed) regardless of model type; check to verify that gives you the same answer in the lm case though.
http://www.stator-afm.com/image-files/r-squared.gif | R implementation of coefficient of partial determination
Well, r^2 is really just covariance squared over the product of the variances, so you could probably do something like cov(Yfull, Ytrue)/var(Ytrue)var(Yfull) - cov(YReduced, Ytrue)/var(Ytrue)var(YRed) |
29,692 | R implementation of coefficient of partial determination | You could also do:
partialR2 <- function(model.full, model.reduced){
s <- deviance(model.reduced)
(s - deviance(model.full)) / s
} | R implementation of coefficient of partial determination | You could also do:
partialR2 <- function(model.full, model.reduced){
s <- deviance(model.reduced)
(s - deviance(model.full)) / s
} | R implementation of coefficient of partial determination
You could also do:
partialR2 <- function(model.full, model.reduced){
s <- deviance(model.reduced)
(s - deviance(model.full)) / s
} | R implementation of coefficient of partial determination
You could also do:
partialR2 <- function(model.full, model.reduced){
s <- deviance(model.reduced)
(s - deviance(model.full)) / s
} |
29,693 | R implementation of coefficient of partial determination | There's also the etasq function in the heplots package. The advantage is you don't have to set up the 2 models | R implementation of coefficient of partial determination | There's also the etasq function in the heplots package. The advantage is you don't have to set up the 2 models | R implementation of coefficient of partial determination
There's also the etasq function in the heplots package. The advantage is you don't have to set up the 2 models | R implementation of coefficient of partial determination
There's also the etasq function in the heplots package. The advantage is you don't have to set up the 2 models |
29,694 | How to deal with survey question with multiple response? | You can still use logistic regression because your outcome is dichotomous, infected vs not-infected. I would just simply take a dummy variable approach and use no travel as the reference category (i.e. for each of your places you have a variable coded as 1 if they visited that place and coded as 0 if they did not visit that place). As such if you transform your beta coefficients to odds (i.e. exponentiate the log odds) the interpretation of the dummy variable for location A would be the odds ratio of visiting location A over not visiting location A controlling for other places one visited. Also note in this approach multi-collinearity is a concern (e.g. if many of the people who travel to A also travel to B it may bias each of their coefficients). | How to deal with survey question with multiple response? | You can still use logistic regression because your outcome is dichotomous, infected vs not-infected. I would just simply take a dummy variable approach and use no travel as the reference category (i.e | How to deal with survey question with multiple response?
You can still use logistic regression because your outcome is dichotomous, infected vs not-infected. I would just simply take a dummy variable approach and use no travel as the reference category (i.e. for each of your places you have a variable coded as 1 if they visited that place and coded as 0 if they did not visit that place). As such if you transform your beta coefficients to odds (i.e. exponentiate the log odds) the interpretation of the dummy variable for location A would be the odds ratio of visiting location A over not visiting location A controlling for other places one visited. Also note in this approach multi-collinearity is a concern (e.g. if many of the people who travel to A also travel to B it may bias each of their coefficients). | How to deal with survey question with multiple response?
You can still use logistic regression because your outcome is dichotomous, infected vs not-infected. I would just simply take a dummy variable approach and use no travel as the reference category (i.e |
29,695 | Is there any difference between a Logistic Regression for inference and for prediction? | So as you point out in your question, individuals interested in only predictions are often not interested in verifying assumptions of their models. Another way to put this is that they are not interested in looking at (or computing, for that matter) standard errors corresponding to the coefficients they estimated for prediction. Standard errors are what allow an analyst to go beyond interpreting the coefficient itself and make inferences. Large coefficients and small standard errors signify confidence that a true (population) effect exists. Small coefficients accompanied by large standard errors suggest no true effect in the population.
See the link below for a more detailed conversation on standard errors and logistic regression.
Understanding standard errors in logistic regression | Is there any difference between a Logistic Regression for inference and for prediction? | So as you point out in your question, individuals interested in only predictions are often not interested in verifying assumptions of their models. Another way to put this is that they are not interes | Is there any difference between a Logistic Regression for inference and for prediction?
So as you point out in your question, individuals interested in only predictions are often not interested in verifying assumptions of their models. Another way to put this is that they are not interested in looking at (or computing, for that matter) standard errors corresponding to the coefficients they estimated for prediction. Standard errors are what allow an analyst to go beyond interpreting the coefficient itself and make inferences. Large coefficients and small standard errors signify confidence that a true (population) effect exists. Small coefficients accompanied by large standard errors suggest no true effect in the population.
See the link below for a more detailed conversation on standard errors and logistic regression.
Understanding standard errors in logistic regression | Is there any difference between a Logistic Regression for inference and for prediction?
So as you point out in your question, individuals interested in only predictions are often not interested in verifying assumptions of their models. Another way to put this is that they are not interes |
29,696 | Confusion about 1- vs 2-tailed tests for feature selection by hypothesis testing | This is one thought that $(B)$ is true:
You have two classes $Z=0, 1$ and usually we classify such that $P(Z=1| X) >0.5$. You need to choose a feature that increase the $P(Z=1|feature)$.
I think if you assume normality and use LDA (I mean assume variance of the features different classes are equal), then you should be able to relate the problem to the mean of the features. I also think 2 is the only correct answer if you look at the problem this way.
Suppose $P(Z=1| feature) =$ a $\mu_{feature} + b$ with $a>0$. Then $P(Z=1|x) > P(Z=1|Y)$ if $\mu_x > \mu_y$. | Confusion about 1- vs 2-tailed tests for feature selection by hypothesis testing | This is one thought that $(B)$ is true:
You have two classes $Z=0, 1$ and usually we classify such that $P(Z=1| X) >0.5$. You need to choose a feature that increase the $P(Z=1|feature)$.
I think if yo | Confusion about 1- vs 2-tailed tests for feature selection by hypothesis testing
This is one thought that $(B)$ is true:
You have two classes $Z=0, 1$ and usually we classify such that $P(Z=1| X) >0.5$. You need to choose a feature that increase the $P(Z=1|feature)$.
I think if you assume normality and use LDA (I mean assume variance of the features different classes are equal), then you should be able to relate the problem to the mean of the features. I also think 2 is the only correct answer if you look at the problem this way.
Suppose $P(Z=1| feature) =$ a $\mu_{feature} + b$ with $a>0$. Then $P(Z=1|x) > P(Z=1|Y)$ if $\mu_x > \mu_y$. | Confusion about 1- vs 2-tailed tests for feature selection by hypothesis testing
This is one thought that $(B)$ is true:
You have two classes $Z=0, 1$ and usually we classify such that $P(Z=1| X) >0.5$. You need to choose a feature that increase the $P(Z=1|feature)$.
I think if yo |
29,697 | Confusion about 1- vs 2-tailed tests for feature selection by hypothesis testing | Option B is false.
I'm assuming the purpose of feature selection is to identify predictors which help distinguish between classes. Ostensibly, if two classes have an observed difference in class conditional expectation which is larger than what could reasonably happen under chance + test assumptions, then that predictor should be used to construct a model.
Assume that the sign of $\mu_1 - \mu_2$ did matter, and assume further that we would select feature $x$ because we reject the null of the test. The labels of the classes are arbitrary, so permute them switching $W_1$ to $W_2$ and vice versa. It is important to stress that nothing changes about the data itself, only the class labels.
Under this permutation, the sign of $\mu_1 - \mu_2$ would flip, and we would fail to reject the null and hence not select $x$ as a feature. That isn't a desirable property of the procedure. What features we select should not depend on arbitrary labels.
Its very clear here that your TA has made an error, and if the TA is insistent they are correct then they would have to deal with the dilemma I've outlined here: either the procedure depends on arbitrary labels, or the sign of the difference is irrelevant (unless we've made it relevant, in which case the question here is moot and the exam question is to blame).
You've already provided a reputable source, so I don't think additional sources are needed. You're right, the answer should be A. | Confusion about 1- vs 2-tailed tests for feature selection by hypothesis testing | Option B is false.
I'm assuming the purpose of feature selection is to identify predictors which help distinguish between classes. Ostensibly, if two classes have an observed difference in class cond | Confusion about 1- vs 2-tailed tests for feature selection by hypothesis testing
Option B is false.
I'm assuming the purpose of feature selection is to identify predictors which help distinguish between classes. Ostensibly, if two classes have an observed difference in class conditional expectation which is larger than what could reasonably happen under chance + test assumptions, then that predictor should be used to construct a model.
Assume that the sign of $\mu_1 - \mu_2$ did matter, and assume further that we would select feature $x$ because we reject the null of the test. The labels of the classes are arbitrary, so permute them switching $W_1$ to $W_2$ and vice versa. It is important to stress that nothing changes about the data itself, only the class labels.
Under this permutation, the sign of $\mu_1 - \mu_2$ would flip, and we would fail to reject the null and hence not select $x$ as a feature. That isn't a desirable property of the procedure. What features we select should not depend on arbitrary labels.
Its very clear here that your TA has made an error, and if the TA is insistent they are correct then they would have to deal with the dilemma I've outlined here: either the procedure depends on arbitrary labels, or the sign of the difference is irrelevant (unless we've made it relevant, in which case the question here is moot and the exam question is to blame).
You've already provided a reputable source, so I don't think additional sources are needed. You're right, the answer should be A. | Confusion about 1- vs 2-tailed tests for feature selection by hypothesis testing
Option B is false.
I'm assuming the purpose of feature selection is to identify predictors which help distinguish between classes. Ostensibly, if two classes have an observed difference in class cond |
29,698 | Overfitting and underfitting in Neural Networks: Is total number of neurons or number of neurons per layer more relevant? | There are other important factors to consider for underfitting and overfitting discussion. They are regularization techniques. For example, L1, L2 regularization, pooling and data argumentation.
So, it is not only about number of neurons.
In recent work, people like to build a large network, at the same time, put a lot of regularizations on it. For example, it is OK to have a model that number of parameters is greater than number of data points.
For large number of neurons in one layer or large number of layers discussion:
Theoretically, MLP with one hidden layer, and the hidden layer with infinite number of neurons can approximate any functions.
In practice, especially in vision problems, people like to have more layers than large number of neurons in one layer (prefer deep but not wide).
Check this post for details.
Why are neural networks becoming deeper, but not wider?
EfficientNet paper is interesting to read for searching a better network structure.
EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks | Overfitting and underfitting in Neural Networks: Is total number of neurons or number of neurons per | There are other important factors to consider for underfitting and overfitting discussion. They are regularization techniques. For example, L1, L2 regularization, pooling and data argumentation.
So, i | Overfitting and underfitting in Neural Networks: Is total number of neurons or number of neurons per layer more relevant?
There are other important factors to consider for underfitting and overfitting discussion. They are regularization techniques. For example, L1, L2 regularization, pooling and data argumentation.
So, it is not only about number of neurons.
In recent work, people like to build a large network, at the same time, put a lot of regularizations on it. For example, it is OK to have a model that number of parameters is greater than number of data points.
For large number of neurons in one layer or large number of layers discussion:
Theoretically, MLP with one hidden layer, and the hidden layer with infinite number of neurons can approximate any functions.
In practice, especially in vision problems, people like to have more layers than large number of neurons in one layer (prefer deep but not wide).
Check this post for details.
Why are neural networks becoming deeper, but not wider?
EfficientNet paper is interesting to read for searching a better network structure.
EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks | Overfitting and underfitting in Neural Networks: Is total number of neurons or number of neurons per
There are other important factors to consider for underfitting and overfitting discussion. They are regularization techniques. For example, L1, L2 regularization, pooling and data argumentation.
So, i |
29,699 | Does imputation introduce unacceptable bias? | There is no clear cut answer here. The fun though is that one can verify the effects of the imputation using a validation procedure: let the data decide!
Should one throw away a feature if a few values are missing? Or the observations then? What if those observations have valuable information in the other features and your algorithm cannot handle missing values? And so on.
Imputation, like removing observations or features, is just a way of dealing with missing values. The decison of which one is best should be supported by good machine procedures like (cross-)validation. | Does imputation introduce unacceptable bias? | There is no clear cut answer here. The fun though is that one can verify the effects of the imputation using a validation procedure: let the data decide!
Should one throw away a feature if a few value | Does imputation introduce unacceptable bias?
There is no clear cut answer here. The fun though is that one can verify the effects of the imputation using a validation procedure: let the data decide!
Should one throw away a feature if a few values are missing? Or the observations then? What if those observations have valuable information in the other features and your algorithm cannot handle missing values? And so on.
Imputation, like removing observations or features, is just a way of dealing with missing values. The decison of which one is best should be supported by good machine procedures like (cross-)validation. | Does imputation introduce unacceptable bias?
There is no clear cut answer here. The fun though is that one can verify the effects of the imputation using a validation procedure: let the data decide!
Should one throw away a feature if a few value |
29,700 | Mini-Batch Gradient Descent - Why does sampling with replacement work? | It works (and we don’t care about sampling points multiple times) because it’s an unbiased estimator of the full gradient.
Gradient distributes over summation (and expectation). The expected value of the gradient of a mini-batch, over all possible mini-batches, is the full gradient.
More details are in Leon Bottou’s paper Stochastic Gradient Descent Tricks. Section 2 talks about SGD as an unbiased estimator, and the same argument holds for the minibatch estimator. | Mini-Batch Gradient Descent - Why does sampling with replacement work? | It works (and we don’t care about sampling points multiple times) because it’s an unbiased estimator of the full gradient.
Gradient distributes over summation (and expectation). The expected value of | Mini-Batch Gradient Descent - Why does sampling with replacement work?
It works (and we don’t care about sampling points multiple times) because it’s an unbiased estimator of the full gradient.
Gradient distributes over summation (and expectation). The expected value of the gradient of a mini-batch, over all possible mini-batches, is the full gradient.
More details are in Leon Bottou’s paper Stochastic Gradient Descent Tricks. Section 2 talks about SGD as an unbiased estimator, and the same argument holds for the minibatch estimator. | Mini-Batch Gradient Descent - Why does sampling with replacement work?
It works (and we don’t care about sampling points multiple times) because it’s an unbiased estimator of the full gradient.
Gradient distributes over summation (and expectation). The expected value of |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.