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 |
|---|---|---|---|---|---|---|
19,001 | How can a multiclass perceptron work? | Suppose we have data $(x_1, y_1), \dots, (x_k,y_k)$ where $x_i \in \mathbb{R}^n$ are input vectors and $y_i \in \{\text{red, blue, green} \}$ are the classifications.
We know how to build a classifier for binary outcomes, so we do this three times: group the outcomes together, $\{\text{red, blue or green} \}$,$\{\text{blue, red or green} \}$ and $\{\text{green, blue or red} \}$.
Each model takes the form of a function $f: \mathbb{R}^n \to \mathbb{R}$, call them $f_R, f_B, f_G$ respectively. This takes an input vector to the signed distance from the hyperplane associated to each model, where positive distance corresponds to a prediction of blue if $f_B$, red if $f_R$ and green if $f_G$. Basically the more positive $f_G(x)$ is, the more the model thinks that $x$ is green, and vice versa. We don't need the output to be a probability, we just need to be able to measure how confident the model is.
Given an input $x$, we classify it according to $\text{argmax}_{c} \ f_c(x)$, so if $f_G(x)$ is the largest amongst $\{f_G(x), f_B(x), f_R(x) \}$ we would predict green for $x$.
This strategy is called "one vs all", and you can read about it here. | How can a multiclass perceptron work? | Suppose we have data $(x_1, y_1), \dots, (x_k,y_k)$ where $x_i \in \mathbb{R}^n$ are input vectors and $y_i \in \{\text{red, blue, green} \}$ are the classifications.
We know how to build a classifier | How can a multiclass perceptron work?
Suppose we have data $(x_1, y_1), \dots, (x_k,y_k)$ where $x_i \in \mathbb{R}^n$ are input vectors and $y_i \in \{\text{red, blue, green} \}$ are the classifications.
We know how to build a classifier for binary outcomes, so we do this three times: group the outcomes together, $\{\text{red, blue or green} \}$,$\{\text{blue, red or green} \}$ and $\{\text{green, blue or red} \}$.
Each model takes the form of a function $f: \mathbb{R}^n \to \mathbb{R}$, call them $f_R, f_B, f_G$ respectively. This takes an input vector to the signed distance from the hyperplane associated to each model, where positive distance corresponds to a prediction of blue if $f_B$, red if $f_R$ and green if $f_G$. Basically the more positive $f_G(x)$ is, the more the model thinks that $x$ is green, and vice versa. We don't need the output to be a probability, we just need to be able to measure how confident the model is.
Given an input $x$, we classify it according to $\text{argmax}_{c} \ f_c(x)$, so if $f_G(x)$ is the largest amongst $\{f_G(x), f_B(x), f_R(x) \}$ we would predict green for $x$.
This strategy is called "one vs all", and you can read about it here. | How can a multiclass perceptron work?
Suppose we have data $(x_1, y_1), \dots, (x_k,y_k)$ where $x_i \in \mathbb{R}^n$ are input vectors and $y_i \in \{\text{red, blue, green} \}$ are the classifications.
We know how to build a classifier |
19,002 | How can a multiclass perceptron work? | I can't make sense of that Wiki article at all. Here's an alternative stab at explaining it.
A perceptron with one logistic output node is a classification network for 2 classes. It outputs $p$, the probability of being in one of the classes, with the probability of being in the other simply $1 - p$.
A perceptron with two output nodes is a classification network for 3 classes. The two nodes each output the probability of being in a class $p_i$, and the probability of being in the third class is $1 - \sum_{i=(1,2)} p_i$.
And so on; a perceptron with $m$ output nodes is a classifier for $m + 1$ classes. Indeed, if there is no hidden layer, such a perceptron is basically the same as a multinomial logistic regression model, just as a simple perceptron is the same as a logistic regression. | How can a multiclass perceptron work? | I can't make sense of that Wiki article at all. Here's an alternative stab at explaining it.
A perceptron with one logistic output node is a classification network for 2 classes. It outputs $p$, the p | How can a multiclass perceptron work?
I can't make sense of that Wiki article at all. Here's an alternative stab at explaining it.
A perceptron with one logistic output node is a classification network for 2 classes. It outputs $p$, the probability of being in one of the classes, with the probability of being in the other simply $1 - p$.
A perceptron with two output nodes is a classification network for 3 classes. The two nodes each output the probability of being in a class $p_i$, and the probability of being in the third class is $1 - \sum_{i=(1,2)} p_i$.
And so on; a perceptron with $m$ output nodes is a classifier for $m + 1$ classes. Indeed, if there is no hidden layer, such a perceptron is basically the same as a multinomial logistic regression model, just as a simple perceptron is the same as a logistic regression. | How can a multiclass perceptron work?
I can't make sense of that Wiki article at all. Here's an alternative stab at explaining it.
A perceptron with one logistic output node is a classification network for 2 classes. It outputs $p$, the p |
19,003 | Confidence interval for difference between proportions | My original answer that was accepted by OP assumes a two-sample setting. OP's question deals with a one-sample setting. Hence, @Robert Lew's answer is the correct one in this case.
Original answer
Your formulas and calculations are correct. Rs internal function to compare proportions yields the same result (without continuity correction though):
prop.test(x=c(19,15), n=c(34,34), correct=FALSE)
2-sample test for equality of proportions without continuity correction
data: c(19, 15) out of c(34, 34)
X-squared = 0.9412, df = 1, p-value = 0.332
alternative hypothesis: two.sided
95 percent confidence interval:
-0.1183829 0.3536770
sample estimates:
prop 1 prop 2
0.5588235 0.4411765 | Confidence interval for difference between proportions | My original answer that was accepted by OP assumes a two-sample setting. OP's question deals with a one-sample setting. Hence, @Robert Lew's answer is the correct one in this case.
Original answer
You | Confidence interval for difference between proportions
My original answer that was accepted by OP assumes a two-sample setting. OP's question deals with a one-sample setting. Hence, @Robert Lew's answer is the correct one in this case.
Original answer
Your formulas and calculations are correct. Rs internal function to compare proportions yields the same result (without continuity correction though):
prop.test(x=c(19,15), n=c(34,34), correct=FALSE)
2-sample test for equality of proportions without continuity correction
data: c(19, 15) out of c(34, 34)
X-squared = 0.9412, df = 1, p-value = 0.332
alternative hypothesis: two.sided
95 percent confidence interval:
-0.1183829 0.3536770
sample estimates:
prop 1 prop 2
0.5588235 0.4411765 | Confidence interval for difference between proportions
My original answer that was accepted by OP assumes a two-sample setting. OP's question deals with a one-sample setting. Hence, @Robert Lew's answer is the correct one in this case.
Original answer
You |
19,004 | Confidence interval for difference between proportions | In this case you have to use a one-sample test, as this is a single sample. Your question boils down to whether males (or females) are one half.
Here's how you'd do it using prop.test():
prop.test(x=19, n=34, p=0.5, correct=FALSE)
1-sample proportions test without continuity correction
data: 19 out of 34, null probability 0.5
X-squared = 0.47059, df = 1, p-value = 0.4927
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
0.3945390 0.7111652
sample estimates:
p
0.5588235 | Confidence interval for difference between proportions | In this case you have to use a one-sample test, as this is a single sample. Your question boils down to whether males (or females) are one half.
Here's how you'd do it using prop.test():
prop.test(x=1 | Confidence interval for difference between proportions
In this case you have to use a one-sample test, as this is a single sample. Your question boils down to whether males (or females) are one half.
Here's how you'd do it using prop.test():
prop.test(x=19, n=34, p=0.5, correct=FALSE)
1-sample proportions test without continuity correction
data: 19 out of 34, null probability 0.5
X-squared = 0.47059, df = 1, p-value = 0.4927
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
0.3945390 0.7111652
sample estimates:
p
0.5588235 | Confidence interval for difference between proportions
In this case you have to use a one-sample test, as this is a single sample. Your question boils down to whether males (or females) are one half.
Here's how you'd do it using prop.test():
prop.test(x=1 |
19,005 | Confidence interval for difference between proportions | Thought of small sample sizes, an exact CI can be computed using ExactCIdiff::BinomCI such that:
library(ExactCIdiff)
BinomCI(34,34,19,15)
$conf.level
[1] 0.95
$CItype
[1] "Two.sided"
$estimate
[1] 0.1176
$ExactCI
[1] -0.1107 0.3393 | Confidence interval for difference between proportions | Thought of small sample sizes, an exact CI can be computed using ExactCIdiff::BinomCI such that:
library(ExactCIdiff)
BinomCI(34,34,19,15)
$conf.level
[1] 0.95
$CItype
[1] "Two.sided"
$estimate
[1] | Confidence interval for difference between proportions
Thought of small sample sizes, an exact CI can be computed using ExactCIdiff::BinomCI such that:
library(ExactCIdiff)
BinomCI(34,34,19,15)
$conf.level
[1] 0.95
$CItype
[1] "Two.sided"
$estimate
[1] 0.1176
$ExactCI
[1] -0.1107 0.3393 | Confidence interval for difference between proportions
Thought of small sample sizes, an exact CI can be computed using ExactCIdiff::BinomCI such that:
library(ExactCIdiff)
BinomCI(34,34,19,15)
$conf.level
[1] 0.95
$CItype
[1] "Two.sided"
$estimate
[1] |
19,006 | How to find marginal distribution from joint distribution with multi-variable dependence? | As you correctly pointed out in your question $f_{Y}(y)$ is calculated by integrating the joint density, $f_{X,Y}(x,y)$ with respect to X. The critical part here is identifying the area on which you integrate. You have already clearly showed graphically the support of the joint distribution function $f_{X,Y}(x,y)$. So, now, you can note that the range of $X$ in the shaded region is from $X=y$ to $X=1$ (i.e. graphically, you can visualize horizontal lines, parallel to the x-axis, going from the diagonal line $Y=X$ to the vertical line at $X=1$).
Thus, the lower and upper limits of the integration are going to be $X=y$ and $X=1$. Thus, the solution to the problem is as follows:
$$f_{Y}(y)= \int_{y}^{1} f_{X,Y}(x,y) dx= \int_{y}^{1} 15xy^{2} dx=15y^{2}\int_{y}^{1} x dx=15y^{2}\left(\frac{1}{2}x^2\Big|_y^1\right)\\=\frac{15}{2}y^2(1-y^2).
$$ | How to find marginal distribution from joint distribution with multi-variable dependence? | As you correctly pointed out in your question $f_{Y}(y)$ is calculated by integrating the joint density, $f_{X,Y}(x,y)$ with respect to X. The critical part here is identifying the area on which you i | How to find marginal distribution from joint distribution with multi-variable dependence?
As you correctly pointed out in your question $f_{Y}(y)$ is calculated by integrating the joint density, $f_{X,Y}(x,y)$ with respect to X. The critical part here is identifying the area on which you integrate. You have already clearly showed graphically the support of the joint distribution function $f_{X,Y}(x,y)$. So, now, you can note that the range of $X$ in the shaded region is from $X=y$ to $X=1$ (i.e. graphically, you can visualize horizontal lines, parallel to the x-axis, going from the diagonal line $Y=X$ to the vertical line at $X=1$).
Thus, the lower and upper limits of the integration are going to be $X=y$ and $X=1$. Thus, the solution to the problem is as follows:
$$f_{Y}(y)= \int_{y}^{1} f_{X,Y}(x,y) dx= \int_{y}^{1} 15xy^{2} dx=15y^{2}\int_{y}^{1} x dx=15y^{2}\left(\frac{1}{2}x^2\Big|_y^1\right)\\=\frac{15}{2}y^2(1-y^2).
$$ | How to find marginal distribution from joint distribution with multi-variable dependence?
As you correctly pointed out in your question $f_{Y}(y)$ is calculated by integrating the joint density, $f_{X,Y}(x,y)$ with respect to X. The critical part here is identifying the area on which you i |
19,007 | How to find marginal distribution from joint distribution with multi-variable dependence? | The reason for integrating for $f_{XY}(x,y)\,dx$ from the range $y$ to $1$ is that it gives you the $(1-y^2)$ term.
The marginal distribution is when for any constant value of fixed $y$ we sum over all the possible values of $x.$
So here if we fix $y,$ say, at $0.6,$ then $f_{XY}(x,y)\,dx$ has to be integrated for all the values of $x$ in $(-\infty, +\infty).$ But for this case it must also satisfy two more bounding constraints on the random variable $X.$ $X$ should be such that it's greater than $Y$ only when the joint pdf is defined (see your definition of the joint pdf).
Now here I took $0.6$ as the fixed $Y.$
I get
$$f_Y(0.6) = \int_{0.6}^1 f_{XY}(x,y)\,dx.$$
So if we want for any arbitrary value of $y$ then we integrate $x$ from limits $y$ to $1.$
I hope that helps
Cheers | How to find marginal distribution from joint distribution with multi-variable dependence? | The reason for integrating for $f_{XY}(x,y)\,dx$ from the range $y$ to $1$ is that it gives you the $(1-y^2)$ term.
The marginal distribution is when for any constant value of fixed $y$ we sum over al | How to find marginal distribution from joint distribution with multi-variable dependence?
The reason for integrating for $f_{XY}(x,y)\,dx$ from the range $y$ to $1$ is that it gives you the $(1-y^2)$ term.
The marginal distribution is when for any constant value of fixed $y$ we sum over all the possible values of $x.$
So here if we fix $y,$ say, at $0.6,$ then $f_{XY}(x,y)\,dx$ has to be integrated for all the values of $x$ in $(-\infty, +\infty).$ But for this case it must also satisfy two more bounding constraints on the random variable $X.$ $X$ should be such that it's greater than $Y$ only when the joint pdf is defined (see your definition of the joint pdf).
Now here I took $0.6$ as the fixed $Y.$
I get
$$f_Y(0.6) = \int_{0.6}^1 f_{XY}(x,y)\,dx.$$
So if we want for any arbitrary value of $y$ then we integrate $x$ from limits $y$ to $1.$
I hope that helps
Cheers | How to find marginal distribution from joint distribution with multi-variable dependence?
The reason for integrating for $f_{XY}(x,y)\,dx$ from the range $y$ to $1$ is that it gives you the $(1-y^2)$ term.
The marginal distribution is when for any constant value of fixed $y$ we sum over al |
19,008 | Why do we stabilize variance? | Here's one answer: usually, the most efficient way to conduct statistical inference is when your data are i.i.d. If they are not, you are getting different amounts of information from different observations, and that's less efficient. Another way to view that is to say that if you can add extra information to your inference (i.e., the functional form of the variance, via the variance-stabilizing transformation), you will generally improve the accuracy of your estimates, at least asymptotically. In very small samples, bothering with modeling of variance may increase your small sample bias. This is a sort of econometric GMM-type argument: if you add additional moments, your asymptotic variance cannot go up; and your finite sample bias increases with the overidentified degrees of freedom.
Another answer was given by cardinal: if you have an unknown variance hanging around in your asymptotic variance expression, the convergence onto the asymptotic distribution will be slower, and you would have to estimate that variance somehow. Pre-pivoting your data or your statistics usually helps improve the accuracy of asymptotic approximations. | Why do we stabilize variance? | Here's one answer: usually, the most efficient way to conduct statistical inference is when your data are i.i.d. If they are not, you are getting different amounts of information from different observ | Why do we stabilize variance?
Here's one answer: usually, the most efficient way to conduct statistical inference is when your data are i.i.d. If they are not, you are getting different amounts of information from different observations, and that's less efficient. Another way to view that is to say that if you can add extra information to your inference (i.e., the functional form of the variance, via the variance-stabilizing transformation), you will generally improve the accuracy of your estimates, at least asymptotically. In very small samples, bothering with modeling of variance may increase your small sample bias. This is a sort of econometric GMM-type argument: if you add additional moments, your asymptotic variance cannot go up; and your finite sample bias increases with the overidentified degrees of freedom.
Another answer was given by cardinal: if you have an unknown variance hanging around in your asymptotic variance expression, the convergence onto the asymptotic distribution will be slower, and you would have to estimate that variance somehow. Pre-pivoting your data or your statistics usually helps improve the accuracy of asymptotic approximations. | Why do we stabilize variance?
Here's one answer: usually, the most efficient way to conduct statistical inference is when your data are i.i.d. If they are not, you are getting different amounts of information from different observ |
19,009 | Box-Jenkins model selection | Any model selection procedure will affect the standard errors and this is hardly ever accounted for. For example, prediction intervals are computed conditionally on the estimated model and the parameter estimation and model selection are usually ignored.
It should be possible to bootstrap the whole procedure in order to estimate the effect of the model selection process. But remember that time series bootstrapping is trickier than normal bootstrapping because you have to preserve the serial correlation. The block bootstrap is one possible approach although it loses some serial correlation due to the block structure. | Box-Jenkins model selection | Any model selection procedure will affect the standard errors and this is hardly ever accounted for. For example, prediction intervals are computed conditionally on the estimated model and the paramet | Box-Jenkins model selection
Any model selection procedure will affect the standard errors and this is hardly ever accounted for. For example, prediction intervals are computed conditionally on the estimated model and the parameter estimation and model selection are usually ignored.
It should be possible to bootstrap the whole procedure in order to estimate the effect of the model selection process. But remember that time series bootstrapping is trickier than normal bootstrapping because you have to preserve the serial correlation. The block bootstrap is one possible approach although it loses some serial correlation due to the block structure. | Box-Jenkins model selection
Any model selection procedure will affect the standard errors and this is hardly ever accounted for. For example, prediction intervals are computed conditionally on the estimated model and the paramet |
19,010 | Box-Jenkins model selection | In my opinion selecting the appropriate number of lags is no different than selecting the number of input series in a stepwise forward regression procedure. The incremental importance of lags or a specific input series is the basis for the tentative model specification.
Since you have asserted that the acf/pacf is the only basis for Box-Jenkins model selection, let me tell you what some experience has taught me. If a series exhibits an acf that doesn't decay, the Box-Jenkins approach (circa 1965) suggests differencing the data. But if a series has a level shift, like the Nile data, then the "visually apparent" non-stationarity is a symptom of needed structure but differencing is not the remedy. This Nile dataset can be modeled without differencing by simply identifying the need for a level shift first. In a similar vein we are taught using 1960 concepts that if the acf exhibits a seasonal structure (i.e. significant values at lags of s,2s,3s,...) then we should incorporate a seasonal ARIMA component. For discussion purposes, consider a series that is stationary around a mean and at fixed intervals, say every June there is a "high value". This series is properly treated by incorporating an "old-fashioned" dummy series of 0 and 1's (at June) in order to treat the seasonal structure. A seasonal ARIMA model would incorrectly use memory instead of an unspecified but waiting-to-be-found X variable. These two concepts of identifying/incorporating unspecified deterministic structure are direct applications of the work of I. Chang, William Bell, George Tiao, R.Tsay, Chen et al (starting in 1978) under the general concept of Intervention Detection.
Even today some analysts are mindlessly performing memory maximization strategies, calling them Automatic ARIMA, without recognizing that "mindless memory modeling" assumes that deterministic structure such as pulses, level shifts, seasonal pulses and local time trends are non-existent or worse yet play no role in model identification. This is akin to putting one's head in the sand, IMHO. | Box-Jenkins model selection | In my opinion selecting the appropriate number of lags is no different than selecting the number of input series in a stepwise forward regression procedure. The incremental importance of lags or a spe | Box-Jenkins model selection
In my opinion selecting the appropriate number of lags is no different than selecting the number of input series in a stepwise forward regression procedure. The incremental importance of lags or a specific input series is the basis for the tentative model specification.
Since you have asserted that the acf/pacf is the only basis for Box-Jenkins model selection, let me tell you what some experience has taught me. If a series exhibits an acf that doesn't decay, the Box-Jenkins approach (circa 1965) suggests differencing the data. But if a series has a level shift, like the Nile data, then the "visually apparent" non-stationarity is a symptom of needed structure but differencing is not the remedy. This Nile dataset can be modeled without differencing by simply identifying the need for a level shift first. In a similar vein we are taught using 1960 concepts that if the acf exhibits a seasonal structure (i.e. significant values at lags of s,2s,3s,...) then we should incorporate a seasonal ARIMA component. For discussion purposes, consider a series that is stationary around a mean and at fixed intervals, say every June there is a "high value". This series is properly treated by incorporating an "old-fashioned" dummy series of 0 and 1's (at June) in order to treat the seasonal structure. A seasonal ARIMA model would incorrectly use memory instead of an unspecified but waiting-to-be-found X variable. These two concepts of identifying/incorporating unspecified deterministic structure are direct applications of the work of I. Chang, William Bell, George Tiao, R.Tsay, Chen et al (starting in 1978) under the general concept of Intervention Detection.
Even today some analysts are mindlessly performing memory maximization strategies, calling them Automatic ARIMA, without recognizing that "mindless memory modeling" assumes that deterministic structure such as pulses, level shifts, seasonal pulses and local time trends are non-existent or worse yet play no role in model identification. This is akin to putting one's head in the sand, IMHO. | Box-Jenkins model selection
In my opinion selecting the appropriate number of lags is no different than selecting the number of input series in a stepwise forward regression procedure. The incremental importance of lags or a spe |
19,011 | Examples of text mining with R (tm package) | The PhD Dissertation from the Author of tm, Ingo Feinerer from Austria, is written in the English language. Chapters 7-10 of this document contain applications of the tm package, with increasing complexity.
http://epub.wu.ac.at/1923/
Chapter 7 presents an application of tm by analyzing the R-devel 2006
mailing list. Chapter 8 shows an application of text mining for
business to consumer electronic commerce. Chapter 9 is an application
of tm to investigate Austrian supreme administrative court
jurisdictions concerning dues and taxes. [...]. Chapter 10
shows an application for stylometry and authorship attribution on the
Wizard of Oz data set.
Read the whole document cover to cover. Note, however, that the document was written in 2008, and since then there have been a few API changes, for instance, the PhD thesis mentions a function tmMap() that has been renamed to tm_map(). So the code examples won't work as-is, you cannot use cut-and-paste to try them.
You can also go to
http://tm.r-forge.r-project.org/users.html
"In an attempt to inform new users about existing tm applications this
site aims to provide (an incomplete alphabetical) list of tm users and
their comments. Known users range from research institutes over
companies to individuals. "
and search on that page for the phrase "wrote a paper" and you'll find many links. I've read only one of the papers, "automatic topic detection in song lyrics". Quite interesting, and funny. | Examples of text mining with R (tm package) | The PhD Dissertation from the Author of tm, Ingo Feinerer from Austria, is written in the English language. Chapters 7-10 of this document contain applications of the tm package, with increasing compl | Examples of text mining with R (tm package)
The PhD Dissertation from the Author of tm, Ingo Feinerer from Austria, is written in the English language. Chapters 7-10 of this document contain applications of the tm package, with increasing complexity.
http://epub.wu.ac.at/1923/
Chapter 7 presents an application of tm by analyzing the R-devel 2006
mailing list. Chapter 8 shows an application of text mining for
business to consumer electronic commerce. Chapter 9 is an application
of tm to investigate Austrian supreme administrative court
jurisdictions concerning dues and taxes. [...]. Chapter 10
shows an application for stylometry and authorship attribution on the
Wizard of Oz data set.
Read the whole document cover to cover. Note, however, that the document was written in 2008, and since then there have been a few API changes, for instance, the PhD thesis mentions a function tmMap() that has been renamed to tm_map(). So the code examples won't work as-is, you cannot use cut-and-paste to try them.
You can also go to
http://tm.r-forge.r-project.org/users.html
"In an attempt to inform new users about existing tm applications this
site aims to provide (an incomplete alphabetical) list of tm users and
their comments. Known users range from research institutes over
companies to individuals. "
and search on that page for the phrase "wrote a paper" and you'll find many links. I've read only one of the papers, "automatic topic detection in song lyrics". Quite interesting, and funny. | Examples of text mining with R (tm package)
The PhD Dissertation from the Author of tm, Ingo Feinerer from Austria, is written in the English language. Chapters 7-10 of this document contain applications of the tm package, with increasing compl |
19,012 | Examples of text mining with R (tm package) | A good place to start might be the list of publications at the website for tm, such as this one:
Text Mining Infrastructure in R. http://www.jstatsoft.org/v25/i05
The references list at the end of each of these publications includes successful applications of tm, which is what you seem to be looking for. There are many -- especially if you then follow the references of the references.
For example, Here's one that might be of relevance:
Feinerer I, Hornik K (2007). \Text Mining of Supreme Administrative Court Jurisdictions."
In C Preisach, H Burkhardt, L Schmidt-Thieme, R Decker (eds.), \Data Analysis, Machine
Learning, and Applications (Proceedings of the 31st Annual Conference of the Gesellschaft
f ur Klassikation e.V., March 7{9, 2007, Freiburg, Germany)," Studies in Classication,
Data Analysis, and Knowledge Organization. Springer-Verlag.
Good luck. | Examples of text mining with R (tm package) | A good place to start might be the list of publications at the website for tm, such as this one:
Text Mining Infrastructure in R. http://www.jstatsoft.org/v25/i05
The references list at the end of | Examples of text mining with R (tm package)
A good place to start might be the list of publications at the website for tm, such as this one:
Text Mining Infrastructure in R. http://www.jstatsoft.org/v25/i05
The references list at the end of each of these publications includes successful applications of tm, which is what you seem to be looking for. There are many -- especially if you then follow the references of the references.
For example, Here's one that might be of relevance:
Feinerer I, Hornik K (2007). \Text Mining of Supreme Administrative Court Jurisdictions."
In C Preisach, H Burkhardt, L Schmidt-Thieme, R Decker (eds.), \Data Analysis, Machine
Learning, and Applications (Proceedings of the 31st Annual Conference of the Gesellschaft
f ur Klassikation e.V., March 7{9, 2007, Freiburg, Germany)," Studies in Classication,
Data Analysis, and Knowledge Organization. Springer-Verlag.
Good luck. | Examples of text mining with R (tm package)
A good place to start might be the list of publications at the website for tm, such as this one:
Text Mining Infrastructure in R. http://www.jstatsoft.org/v25/i05
The references list at the end of |
19,013 | Applying logistic regression with low event rate | I'm going to answer your questions out of order:
3 Would deleting my nonevent population would be good for the accuracy of my model ?
Each observation will provide some additional information about the parameter (through the likelihood function). Therefore there is no point in deleting data, as you would just be losing information.
1 Does accuracy of logistic regression depend on event rate or is there any minimum event rate which is recommended ?
Technically, yes: a rare observation is much more informative (that is, the likelihood function will be steeper). If your event ratio was 50:50, then you would get much tighter confidence bands (or credible intervals if you're being Bayesian) for the same amount of data. However you don't get to choose your event rate (unless you're doing a case-control study), so you'll have to make do with what you have.
2 Is there any special technique for low event rate data ?
The biggest problem that might arise is perfect separation: this happens when some combination of variables gives all non-events (or all events): in this case, the maximum likelihood parameter estimates (and their standard errors), will approach infinity (although usually the algorithm will stop beforehand). There are two possible solutions:
a) removing predictors from the model: though this will make your algorithm converge, you will be removing the variable with the most explanatory power, so this only makes sense if your model was overfitting to begin with (such as fitting too many complicated interactions).
b) use some sort of penalisation, such as a prior distribution, which will shrink the estimates back to more reasonable values. | Applying logistic regression with low event rate | I'm going to answer your questions out of order:
3 Would deleting my nonevent population would be good for the accuracy of my model ?
Each observation will provide some additional information about | Applying logistic regression with low event rate
I'm going to answer your questions out of order:
3 Would deleting my nonevent population would be good for the accuracy of my model ?
Each observation will provide some additional information about the parameter (through the likelihood function). Therefore there is no point in deleting data, as you would just be losing information.
1 Does accuracy of logistic regression depend on event rate or is there any minimum event rate which is recommended ?
Technically, yes: a rare observation is much more informative (that is, the likelihood function will be steeper). If your event ratio was 50:50, then you would get much tighter confidence bands (or credible intervals if you're being Bayesian) for the same amount of data. However you don't get to choose your event rate (unless you're doing a case-control study), so you'll have to make do with what you have.
2 Is there any special technique for low event rate data ?
The biggest problem that might arise is perfect separation: this happens when some combination of variables gives all non-events (or all events): in this case, the maximum likelihood parameter estimates (and their standard errors), will approach infinity (although usually the algorithm will stop beforehand). There are two possible solutions:
a) removing predictors from the model: though this will make your algorithm converge, you will be removing the variable with the most explanatory power, so this only makes sense if your model was overfitting to begin with (such as fitting too many complicated interactions).
b) use some sort of penalisation, such as a prior distribution, which will shrink the estimates back to more reasonable values. | Applying logistic regression with low event rate
I'm going to answer your questions out of order:
3 Would deleting my nonevent population would be good for the accuracy of my model ?
Each observation will provide some additional information about |
19,014 | Applying logistic regression with low event rate | There is a better alternative to deleting nonevents for temporal or spatial data: you can aggregate your data across time/space, and model the counts as Poisson. For example, if your event is "volcanic eruption happens on day X", then not many days will have a volcanic eruption. However, if you group together the days into weeks or months, e.g. "number of volcanic eruptions on month X", then you will have reduced the number of events, and more of the events will have nonzero values. | Applying logistic regression with low event rate | There is a better alternative to deleting nonevents for temporal or spatial data: you can aggregate your data across time/space, and model the counts as Poisson. For example, if your event is "volcan | Applying logistic regression with low event rate
There is a better alternative to deleting nonevents for temporal or spatial data: you can aggregate your data across time/space, and model the counts as Poisson. For example, if your event is "volcanic eruption happens on day X", then not many days will have a volcanic eruption. However, if you group together the days into weeks or months, e.g. "number of volcanic eruptions on month X", then you will have reduced the number of events, and more of the events will have nonzero values. | Applying logistic regression with low event rate
There is a better alternative to deleting nonevents for temporal or spatial data: you can aggregate your data across time/space, and model the counts as Poisson. For example, if your event is "volcan |
19,015 | What is the practical application of variance? | In practice, you calculate the SD through calculating the variance (as abutcher indicated). I believe the variance is used more often (apart from interpretation, as you indicated yourself) because it has a lot of statistically interesting properties: it has unbiased estimators in a lot of cases, leads to known distributions for hypothesis testing etc.
As to the variance being bigger: if the variance were 1/4, the SD would be 1/2. As soon as your variance/SD are smaller than 1, this order reverses. | What is the practical application of variance? | In practice, you calculate the SD through calculating the variance (as abutcher indicated). I believe the variance is used more often (apart from interpretation, as you indicated yourself) because it | What is the practical application of variance?
In practice, you calculate the SD through calculating the variance (as abutcher indicated). I believe the variance is used more often (apart from interpretation, as you indicated yourself) because it has a lot of statistically interesting properties: it has unbiased estimators in a lot of cases, leads to known distributions for hypothesis testing etc.
As to the variance being bigger: if the variance were 1/4, the SD would be 1/2. As soon as your variance/SD are smaller than 1, this order reverses. | What is the practical application of variance?
In practice, you calculate the SD through calculating the variance (as abutcher indicated). I believe the variance is used more often (apart from interpretation, as you indicated yourself) because it |
19,016 | What is the practical application of variance? | In portfolio theory, variance is additive. In other words, just as the return of a portfolio is the weighted average of the returns of its members, so to is the portfolio variance the weighted average of the securities' variances. However, this property does not hold true for standard deviation. | What is the practical application of variance? | In portfolio theory, variance is additive. In other words, just as the return of a portfolio is the weighted average of the returns of its members, so to is the portfolio variance the weighted average | What is the practical application of variance?
In portfolio theory, variance is additive. In other words, just as the return of a portfolio is the weighted average of the returns of its members, so to is the portfolio variance the weighted average of the securities' variances. However, this property does not hold true for standard deviation. | What is the practical application of variance?
In portfolio theory, variance is additive. In other words, just as the return of a portfolio is the weighted average of the returns of its members, so to is the portfolio variance the weighted average |
19,017 | What is the practical application of variance? | Variance is the most basic of the two measures... stddev = sqrt(variance). While exaggerated, it's good enough for a comparison and grows very large when there is mixed-up-ness in the distribution.
variance(22, 25, 29, 30, 37) = 32.3
variance(22, 25, 29, 30, 900) = 152611.0
Standard deviation is used way more often because the result has the same units as the data, making standard deviation more appropriate for any sort of visual analysis. | What is the practical application of variance? | Variance is the most basic of the two measures... stddev = sqrt(variance). While exaggerated, it's good enough for a comparison and grows very large when there is mixed-up-ness in the distribution.
v | What is the practical application of variance?
Variance is the most basic of the two measures... stddev = sqrt(variance). While exaggerated, it's good enough for a comparison and grows very large when there is mixed-up-ness in the distribution.
variance(22, 25, 29, 30, 37) = 32.3
variance(22, 25, 29, 30, 900) = 152611.0
Standard deviation is used way more often because the result has the same units as the data, making standard deviation more appropriate for any sort of visual analysis. | What is the practical application of variance?
Variance is the most basic of the two measures... stddev = sqrt(variance). While exaggerated, it's good enough for a comparison and grows very large when there is mixed-up-ness in the distribution.
v |
19,018 | What is the practical application of variance? | I think you have to really qualify your question when you refer to the practical use of the variance. For instance, in business there's no practical use for the variance. The standard deviation has more of a practical use by giving a mathematical representation of variation that can be understood and applied. For instance, the standard deviation can be used to quantify risk as indicated in the calculation of the Beta for a stock. The variance has no practical application comparable with the standard deviation. If we move to higher level statistical analysis then the variance has many practical applications, but only when dealing with higher level analysis, which is not the focus of the vast majority. So it truly depends on the area in which one may be a practitioner. For business practitioners, the only use for the variance is to find the standard devotion. | What is the practical application of variance? | I think you have to really qualify your question when you refer to the practical use of the variance. For instance, in business there's no practical use for the variance. The standard deviation has mo | What is the practical application of variance?
I think you have to really qualify your question when you refer to the practical use of the variance. For instance, in business there's no practical use for the variance. The standard deviation has more of a practical use by giving a mathematical representation of variation that can be understood and applied. For instance, the standard deviation can be used to quantify risk as indicated in the calculation of the Beta for a stock. The variance has no practical application comparable with the standard deviation. If we move to higher level statistical analysis then the variance has many practical applications, but only when dealing with higher level analysis, which is not the focus of the vast majority. So it truly depends on the area in which one may be a practitioner. For business practitioners, the only use for the variance is to find the standard devotion. | What is the practical application of variance?
I think you have to really qualify your question when you refer to the practical use of the variance. For instance, in business there's no practical use for the variance. The standard deviation has mo |
19,019 | How to determine if a sample is within a standard deviation of a multivariate normal distribution | The usual metric to use here is the scaled Mahalanobis distance:
$$S(\mathbf{x}) \equiv \frac{D(\mathbf{x})}{\sqrt{n}} = \sqrt{\frac{(\mathbf{x} - \boldsymbol{\mu})^\text{T} \mathbf{\Sigma}^{-1} (\mathbf{x} - \boldsymbol{\mu})}{n}}.$$
If we let $\mathbf{\Sigma}^{1/2}$ denote the multivariate "standard deviation matrix" (i.e., the principal square root of the variance matrix) then this distance can be written in alternative form as:
$$S(\mathbf{x}) = \frac{||\mathbf{\Sigma}^{-1/2} (\mathbf{x} - \boldsymbol{\mu})||}{\sqrt{n}},$$
which is a scaled version of the norm of the standardised vector (with scaling adjusting to remove the effect on the norm from the number of elements in the vector). This measure has a few useful properties that make it a good measure of standardised distance from the mean. In particular, in the special case where $n=1$ you get $S(\mathbf{x}) = |x - \mu|/\sigma$, which is the absolute standardised distance from the mean. (Consequently, you get $x = \mu \pm S(\mathbf{x}) \sigma$ in this special case.) The broader distance measure generalises the univariate notion of the standardised distance from the sample mean in a way that accounts for the variance and covariance in the variance matrix, and the length of the random vector.
Using the scaled Mahalanobis distance you can compute whether or not the value $\mathbf{x}$ lies within an elliptical region centred on the mean vector within a particular scaled distance $r$. This region can be determined as:
$$\begin{align}
\mathscr{X}(r)
&\equiv \{ \mathbf{x} \in \mathbb{R}^n | S(\mathbf{x}) \leqslant r \} \\[6pt]
&= \{ \mathbf{x} \in \mathbb{R}^n | S(\mathbf{x})^2 \leqslant r^2 \} \\[6pt]
&= \{ \mathbf{x} \in \mathbb{R}^n | (\mathbf{x} - \boldsymbol{\mu})^\text{T} \mathbf{\Sigma}^{-1} (\mathbf{x} - \boldsymbol{\mu}) \leqslant n r^2 \}. \\[6pt]
\end{align}$$
In the case of normal data you have $S(\mathbf{X}) \sim \text{Chi}(n)/\sqrt{n}$ using the chi distribution, so it is possible to compute the probability of lying in one of these regions for a specific value of $r$. Specifically, you get:
$$\begin{align}
\mathbb{P}(X \in \mathscr{X}(r))
&= \mathbb{P}(S(\mathbf{X}) \leqslant r) \\[16pt]
&= \int \limits_0^{r} \text{Chi}(s|n) \ ds \\[6pt]
&= \frac{2 (n/2)^{n/2}}{\Gamma(n/2)} \int \limits_0^{r} s^{n-1} \exp \Big( - \frac{n s^2}{2} \Big) \ ds. \\[6pt]
\end{align}$$ | How to determine if a sample is within a standard deviation of a multivariate normal distribution | The usual metric to use here is the scaled Mahalanobis distance:
$$S(\mathbf{x}) \equiv \frac{D(\mathbf{x})}{\sqrt{n}} = \sqrt{\frac{(\mathbf{x} - \boldsymbol{\mu})^\text{T} \mathbf{\Sigma}^{-1} (\mat | How to determine if a sample is within a standard deviation of a multivariate normal distribution
The usual metric to use here is the scaled Mahalanobis distance:
$$S(\mathbf{x}) \equiv \frac{D(\mathbf{x})}{\sqrt{n}} = \sqrt{\frac{(\mathbf{x} - \boldsymbol{\mu})^\text{T} \mathbf{\Sigma}^{-1} (\mathbf{x} - \boldsymbol{\mu})}{n}}.$$
If we let $\mathbf{\Sigma}^{1/2}$ denote the multivariate "standard deviation matrix" (i.e., the principal square root of the variance matrix) then this distance can be written in alternative form as:
$$S(\mathbf{x}) = \frac{||\mathbf{\Sigma}^{-1/2} (\mathbf{x} - \boldsymbol{\mu})||}{\sqrt{n}},$$
which is a scaled version of the norm of the standardised vector (with scaling adjusting to remove the effect on the norm from the number of elements in the vector). This measure has a few useful properties that make it a good measure of standardised distance from the mean. In particular, in the special case where $n=1$ you get $S(\mathbf{x}) = |x - \mu|/\sigma$, which is the absolute standardised distance from the mean. (Consequently, you get $x = \mu \pm S(\mathbf{x}) \sigma$ in this special case.) The broader distance measure generalises the univariate notion of the standardised distance from the sample mean in a way that accounts for the variance and covariance in the variance matrix, and the length of the random vector.
Using the scaled Mahalanobis distance you can compute whether or not the value $\mathbf{x}$ lies within an elliptical region centred on the mean vector within a particular scaled distance $r$. This region can be determined as:
$$\begin{align}
\mathscr{X}(r)
&\equiv \{ \mathbf{x} \in \mathbb{R}^n | S(\mathbf{x}) \leqslant r \} \\[6pt]
&= \{ \mathbf{x} \in \mathbb{R}^n | S(\mathbf{x})^2 \leqslant r^2 \} \\[6pt]
&= \{ \mathbf{x} \in \mathbb{R}^n | (\mathbf{x} - \boldsymbol{\mu})^\text{T} \mathbf{\Sigma}^{-1} (\mathbf{x} - \boldsymbol{\mu}) \leqslant n r^2 \}. \\[6pt]
\end{align}$$
In the case of normal data you have $S(\mathbf{X}) \sim \text{Chi}(n)/\sqrt{n}$ using the chi distribution, so it is possible to compute the probability of lying in one of these regions for a specific value of $r$. Specifically, you get:
$$\begin{align}
\mathbb{P}(X \in \mathscr{X}(r))
&= \mathbb{P}(S(\mathbf{X}) \leqslant r) \\[16pt]
&= \int \limits_0^{r} \text{Chi}(s|n) \ ds \\[6pt]
&= \frac{2 (n/2)^{n/2}}{\Gamma(n/2)} \int \limits_0^{r} s^{n-1} \exp \Big( - \frac{n s^2}{2} \Big) \ ds. \\[6pt]
\end{align}$$ | How to determine if a sample is within a standard deviation of a multivariate normal distribution
The usual metric to use here is the scaled Mahalanobis distance:
$$S(\mathbf{x}) \equiv \frac{D(\mathbf{x})}{\sqrt{n}} = \sqrt{\frac{(\mathbf{x} - \boldsymbol{\mu})^\text{T} \mathbf{\Sigma}^{-1} (\mat |
19,020 | Why Some Algorithms Produce Calibrated Probabilities | Calibration reflects how well the predicted class probabilities match the 'true' probabilities according to the underlying distribution of the data. As a consequence, the properties of a learning algorithm itself don't universally determine how well- or poorly calibrated the results will be. Rather, it depends on how well suited the learning algorithm is to the particular problem.
To illustrate the point, here's a toy example using a Gaussian naive Bayes classifier. Let's generate two datasets, where points in each class are sampled from a 2D Gaussian distribution. In the first dataset, points are generated using full covariance matrices. This violates the naive Bayes assumptions because input features are not conditionally independent, given the class. In the second dataset, points are generated using diagonal covariance matrices. In this case, the naive Bayes hypothesis space actually contains the true model. Here are the data and calibration results:
Calibration is poor on the first dataset, but fairly good on the second dataset. This shows that being well calibrated or poorly calibrated depends on the problem, and is not a universal property. It also supports the idea that well-calibratedness has to do with how closely the model approximates the underlying distribution.
That said, this doesn't contradict the notion that particular learning algorithms might tend to produce well calibrated or poorly calibrated results on real-world problems, which may share certain common features. For example, the conditional independence assumption doesn't hold in many problems we care about, so naive Bayes would be expected to give poorly calibrated results across these problems.
For more on probability calibration and a comparison of different classifiers on benchmark datasets, see:
Niculescu-Mizil, A., & Caruana, R. (2005). Predicting good probabilities with supervised learning. In Proceedings of the 22nd international conference on Machine learning (pp. 625-632). | Why Some Algorithms Produce Calibrated Probabilities | Calibration reflects how well the predicted class probabilities match the 'true' probabilities according to the underlying distribution of the data. As a consequence, the properties of a learning algo | Why Some Algorithms Produce Calibrated Probabilities
Calibration reflects how well the predicted class probabilities match the 'true' probabilities according to the underlying distribution of the data. As a consequence, the properties of a learning algorithm itself don't universally determine how well- or poorly calibrated the results will be. Rather, it depends on how well suited the learning algorithm is to the particular problem.
To illustrate the point, here's a toy example using a Gaussian naive Bayes classifier. Let's generate two datasets, where points in each class are sampled from a 2D Gaussian distribution. In the first dataset, points are generated using full covariance matrices. This violates the naive Bayes assumptions because input features are not conditionally independent, given the class. In the second dataset, points are generated using diagonal covariance matrices. In this case, the naive Bayes hypothesis space actually contains the true model. Here are the data and calibration results:
Calibration is poor on the first dataset, but fairly good on the second dataset. This shows that being well calibrated or poorly calibrated depends on the problem, and is not a universal property. It also supports the idea that well-calibratedness has to do with how closely the model approximates the underlying distribution.
That said, this doesn't contradict the notion that particular learning algorithms might tend to produce well calibrated or poorly calibrated results on real-world problems, which may share certain common features. For example, the conditional independence assumption doesn't hold in many problems we care about, so naive Bayes would be expected to give poorly calibrated results across these problems.
For more on probability calibration and a comparison of different classifiers on benchmark datasets, see:
Niculescu-Mizil, A., & Caruana, R. (2005). Predicting good probabilities with supervised learning. In Proceedings of the 22nd international conference on Machine learning (pp. 625-632). | Why Some Algorithms Produce Calibrated Probabilities
Calibration reflects how well the predicted class probabilities match the 'true' probabilities according to the underlying distribution of the data. As a consequence, the properties of a learning algo |
19,021 | Lack of Batch Normalization Before Last Fully Connected Layer | I am pretty sure that batch norm before the last FC layer not only does not help, but it hurts performance pretty severely.
My intuition is that the network has to learn a representation which is mostly invariant to the stochasticity inherent in batch norm. At the same time, by the time it reaches the last layer, it has to convert that representation back into a fairly precise prediction. It's likely that a single FC layer is not powerful enough to perform that conversion.
Another way to say it is that batch norm (like dropout) adds stochasticity to the network, and the network learns to be robust to this stochasticity. However it's simply impossible for the network to cope with stochasticity right before the output. | Lack of Batch Normalization Before Last Fully Connected Layer | I am pretty sure that batch norm before the last FC layer not only does not help, but it hurts performance pretty severely.
My intuition is that the network has to learn a representation which is mos | Lack of Batch Normalization Before Last Fully Connected Layer
I am pretty sure that batch norm before the last FC layer not only does not help, but it hurts performance pretty severely.
My intuition is that the network has to learn a representation which is mostly invariant to the stochasticity inherent in batch norm. At the same time, by the time it reaches the last layer, it has to convert that representation back into a fairly precise prediction. It's likely that a single FC layer is not powerful enough to perform that conversion.
Another way to say it is that batch norm (like dropout) adds stochasticity to the network, and the network learns to be robust to this stochasticity. However it's simply impossible for the network to cope with stochasticity right before the output. | Lack of Batch Normalization Before Last Fully Connected Layer
I am pretty sure that batch norm before the last FC layer not only does not help, but it hurts performance pretty severely.
My intuition is that the network has to learn a representation which is mos |
19,022 | Correcting log-transformation bias in a linear model | To understand the bias correction used in Miller (1984) you need to understand a little bit about the log-normal distribution. From the properties of the log-normal distribution, if $\ln Y \sim \text{N}(\mu, \sigma^2)$ then we have $Y \sim \text{Log-N}(\mu, \sigma^2)$, which has median and mean given respectively by:
$$\text{M}(Y) = \exp (\mu) \quad \quad \quad \quad \quad
\mathbb{E}(Y) = \exp \Big( \mu + \frac{\sigma^2}{2} \Big).$$
In a log-linear regression model you have the log-mean estimator $\hat{\mu} = \hat{\beta}_0 + \hat{\beta}_1 X$, so substitution of your estimators gives the estimated values:
$$\begin{equation} \begin{aligned}
\hat{M}(Y) &= \exp ( \hat{\mu} ) = \exp \Big( \hat{\beta}_0 + \hat{\beta}_1 X \Big) = \hat{\beta}_0^* \cdot e^{\hat{\beta}_1 X} , \\[6pt]
\hat{\mathbb{E}}(Y) &= \exp \Big( \hat{\mu} + \frac{\hat{\sigma}^2}{2} \Big) = \exp \Big( \hat{\beta}_0 + \hat{\beta}_1 X + \frac{\hat{\sigma}^2}{2} \Big) = \hat{\beta}_0^* \cdot e^{\hat{\beta}_1 X} e^{\hat{\sigma}^2 / 2}.
\end{aligned} \end{equation}$$
where $\hat{\beta}_0^* = \exp(\hat{\beta}_0)$. Under some mild asymptotic conditions, the OLS coefficient estimators and corresponding error-variance estimator are consistent estimators of their respective parameters, which means that $\exp (\hat{\mu}) \rightarrow \text{M}(Y) < \mathbb{E}(Y)$. Hence, Miller is right to assert that the uncorrected de-transformed estimator $\exp (\hat{\mu})$ is a consistent estimator of the median response, but is not a consistent estimator of the mean response.
In regard to bias, the situation is trickier. The OLS coefficient estimators and corresponding error-variance estimator are unbiased for their respective parameters under standard model conditions. However, since you are substituting these estimator into an exponential, any overestimation is going to be exacerbated by the exponential and any underestimation is going to be mitigated. This means that your estimated mean response is generally going to be a positively biased estimator of the true mean response, and the estimated median response is generally going to be a positively biased estimator of the true median response. This means that it is theoretically possible, in some cases, for the substituted median estimator to be closer in expected value to the true mean response than the substituted mean estimator.
The above results are all predicated on the assumption that the log-linear model form is correct. As to the effect of departure from log-normal shape, this gives you an entirely different model form, so it is really impossible to say. If the log-normal form does not hold in your data then you may get results that are different to the above. | Correcting log-transformation bias in a linear model | To understand the bias correction used in Miller (1984) you need to understand a little bit about the log-normal distribution. From the properties of the log-normal distribution, if $\ln Y \sim \text | Correcting log-transformation bias in a linear model
To understand the bias correction used in Miller (1984) you need to understand a little bit about the log-normal distribution. From the properties of the log-normal distribution, if $\ln Y \sim \text{N}(\mu, \sigma^2)$ then we have $Y \sim \text{Log-N}(\mu, \sigma^2)$, which has median and mean given respectively by:
$$\text{M}(Y) = \exp (\mu) \quad \quad \quad \quad \quad
\mathbb{E}(Y) = \exp \Big( \mu + \frac{\sigma^2}{2} \Big).$$
In a log-linear regression model you have the log-mean estimator $\hat{\mu} = \hat{\beta}_0 + \hat{\beta}_1 X$, so substitution of your estimators gives the estimated values:
$$\begin{equation} \begin{aligned}
\hat{M}(Y) &= \exp ( \hat{\mu} ) = \exp \Big( \hat{\beta}_0 + \hat{\beta}_1 X \Big) = \hat{\beta}_0^* \cdot e^{\hat{\beta}_1 X} , \\[6pt]
\hat{\mathbb{E}}(Y) &= \exp \Big( \hat{\mu} + \frac{\hat{\sigma}^2}{2} \Big) = \exp \Big( \hat{\beta}_0 + \hat{\beta}_1 X + \frac{\hat{\sigma}^2}{2} \Big) = \hat{\beta}_0^* \cdot e^{\hat{\beta}_1 X} e^{\hat{\sigma}^2 / 2}.
\end{aligned} \end{equation}$$
where $\hat{\beta}_0^* = \exp(\hat{\beta}_0)$. Under some mild asymptotic conditions, the OLS coefficient estimators and corresponding error-variance estimator are consistent estimators of their respective parameters, which means that $\exp (\hat{\mu}) \rightarrow \text{M}(Y) < \mathbb{E}(Y)$. Hence, Miller is right to assert that the uncorrected de-transformed estimator $\exp (\hat{\mu})$ is a consistent estimator of the median response, but is not a consistent estimator of the mean response.
In regard to bias, the situation is trickier. The OLS coefficient estimators and corresponding error-variance estimator are unbiased for their respective parameters under standard model conditions. However, since you are substituting these estimator into an exponential, any overestimation is going to be exacerbated by the exponential and any underestimation is going to be mitigated. This means that your estimated mean response is generally going to be a positively biased estimator of the true mean response, and the estimated median response is generally going to be a positively biased estimator of the true median response. This means that it is theoretically possible, in some cases, for the substituted median estimator to be closer in expected value to the true mean response than the substituted mean estimator.
The above results are all predicated on the assumption that the log-linear model form is correct. As to the effect of departure from log-normal shape, this gives you an entirely different model form, so it is really impossible to say. If the log-normal form does not hold in your data then you may get results that are different to the above. | Correcting log-transformation bias in a linear model
To understand the bias correction used in Miller (1984) you need to understand a little bit about the log-normal distribution. From the properties of the log-normal distribution, if $\ln Y \sim \text |
19,023 | Intuitive meaning of vector multiplication with covariance matrix | Your answer is good. Note that since $\Sigma$ is symmetric and square so is $\Sigma^{-1}$. The matrix, its transpose, or inverse all project your vector $\Sigma r$ in the same space.
Since $\Sigma$ and $\Sigma^{-1}$ are positive definite, all eigenvalues are positive. Thus a multiplication with a vector always ends up in the same halfplane of the space.
Now if $\Sigma$ or $\Sigma^{-1}$ would be a diagonal matrix, then the multiplication would reweigh (or undo the reweigh) of only the lengths of the target vector in each dimension (as you noticed). If they are full matrices, then indeed the matrix is full rank as it is PSD, the eigendecomposition exists and $\Sigma = V \Lambda V^{-1}$, here $V$ is an orthonormal eigenvector matrix by the virtue of $\Sigma$ being PSD, and $\Lambda$ the diagonal with eigenvalues. Thus $r$ is first rotated by $V^{-1}$, and then reweighed by $\Lambda$, then rotated back by $V$. The same thing goes for $\Sigma^{-1}$, but then $r$ is rotated the other way around and the scaled by the diagonal of reciprocals $\Lambda^{-1}$ and rotated back with $V^{-1}$. It is easy to see they are opposite processes.
Additionally, you may think of
$$
r^T \Sigma^{-1} r = (\Lambda^{-1/2} V^T r)^T(\Lambda^{-1/2} V^T r) = \big\|\Lambda^{-1/2} V^T r\big\|^2
$$
as the length of your vector $r$ reweighed by the "standard deviations" after correction for cross-correlations.
Hope that helps. | Intuitive meaning of vector multiplication with covariance matrix | Your answer is good. Note that since $\Sigma$ is symmetric and square so is $\Sigma^{-1}$. The matrix, its transpose, or inverse all project your vector $\Sigma r$ in the same space.
Since $\Sigma$ an | Intuitive meaning of vector multiplication with covariance matrix
Your answer is good. Note that since $\Sigma$ is symmetric and square so is $\Sigma^{-1}$. The matrix, its transpose, or inverse all project your vector $\Sigma r$ in the same space.
Since $\Sigma$ and $\Sigma^{-1}$ are positive definite, all eigenvalues are positive. Thus a multiplication with a vector always ends up in the same halfplane of the space.
Now if $\Sigma$ or $\Sigma^{-1}$ would be a diagonal matrix, then the multiplication would reweigh (or undo the reweigh) of only the lengths of the target vector in each dimension (as you noticed). If they are full matrices, then indeed the matrix is full rank as it is PSD, the eigendecomposition exists and $\Sigma = V \Lambda V^{-1}$, here $V$ is an orthonormal eigenvector matrix by the virtue of $\Sigma$ being PSD, and $\Lambda$ the diagonal with eigenvalues. Thus $r$ is first rotated by $V^{-1}$, and then reweighed by $\Lambda$, then rotated back by $V$. The same thing goes for $\Sigma^{-1}$, but then $r$ is rotated the other way around and the scaled by the diagonal of reciprocals $\Lambda^{-1}$ and rotated back with $V^{-1}$. It is easy to see they are opposite processes.
Additionally, you may think of
$$
r^T \Sigma^{-1} r = (\Lambda^{-1/2} V^T r)^T(\Lambda^{-1/2} V^T r) = \big\|\Lambda^{-1/2} V^T r\big\|^2
$$
as the length of your vector $r$ reweighed by the "standard deviations" after correction for cross-correlations.
Hope that helps. | Intuitive meaning of vector multiplication with covariance matrix
Your answer is good. Note that since $\Sigma$ is symmetric and square so is $\Sigma^{-1}$. The matrix, its transpose, or inverse all project your vector $\Sigma r$ in the same space.
Since $\Sigma$ an |
19,024 | Intuitive meaning of vector multiplication with covariance matrix | After some further thinking I now came to a (sort of) intuitive interpretation myself. It is actually not that hard if one is familiar with PCA in the context of covariance and variance.
We denote by $X$ a dataset $X_1 \dots X_n$ with $X_i$ being a random vector of dimension $d$ (this is a slightly different notation than I used in my question).
If we look at the eigendecomposition of $\Sigma$ one observes that multiplying $r$ with $\Sigma$ just stretches $r$ in the directions of the principle components of the dataset $X$ by the according eigenvalues component (the variances of the dataset in the directions of the principle components).
A nice property of this linear mapping is, that $r^T \Sigma r$ returns the variance of the dataset in direction of $r$ (assuming $|r| = 1$, otherwise it returns the variance times $|r|^2$).
With this being said, lets look at the term $r^T \Sigma^{-1} r$. The term $\Sigma^{-1} r$ now retracts the vector $r$ to $r' = \Sigma^{-1} r$ again according to the principle components (scales by the reciprocal value of the eigenvalues of $\Sigma$ along the principle components (eigenvectors)), as this is just the reversed operation. This means, that we receive with the previous term just the variance along $r'$ (again assuming $|r'| = 1$.
A small proof of this statement: $$r^T \Sigma^{-1} r = \left( \Sigma^{-1} r \right)^T r = \left( \Sigma^{-1} r \right)^T \Sigma \Sigma^{-1} r = r'^T \Sigma r'$$ which is equal to the variance of $X$ along $r'$. | Intuitive meaning of vector multiplication with covariance matrix | After some further thinking I now came to a (sort of) intuitive interpretation myself. It is actually not that hard if one is familiar with PCA in the context of covariance and variance.
We denote by | Intuitive meaning of vector multiplication with covariance matrix
After some further thinking I now came to a (sort of) intuitive interpretation myself. It is actually not that hard if one is familiar with PCA in the context of covariance and variance.
We denote by $X$ a dataset $X_1 \dots X_n$ with $X_i$ being a random vector of dimension $d$ (this is a slightly different notation than I used in my question).
If we look at the eigendecomposition of $\Sigma$ one observes that multiplying $r$ with $\Sigma$ just stretches $r$ in the directions of the principle components of the dataset $X$ by the according eigenvalues component (the variances of the dataset in the directions of the principle components).
A nice property of this linear mapping is, that $r^T \Sigma r$ returns the variance of the dataset in direction of $r$ (assuming $|r| = 1$, otherwise it returns the variance times $|r|^2$).
With this being said, lets look at the term $r^T \Sigma^{-1} r$. The term $\Sigma^{-1} r$ now retracts the vector $r$ to $r' = \Sigma^{-1} r$ again according to the principle components (scales by the reciprocal value of the eigenvalues of $\Sigma$ along the principle components (eigenvectors)), as this is just the reversed operation. This means, that we receive with the previous term just the variance along $r'$ (again assuming $|r'| = 1$.
A small proof of this statement: $$r^T \Sigma^{-1} r = \left( \Sigma^{-1} r \right)^T r = \left( \Sigma^{-1} r \right)^T \Sigma \Sigma^{-1} r = r'^T \Sigma r'$$ which is equal to the variance of $X$ along $r'$. | Intuitive meaning of vector multiplication with covariance matrix
After some further thinking I now came to a (sort of) intuitive interpretation myself. It is actually not that hard if one is familiar with PCA in the context of covariance and variance.
We denote by |
19,025 | Intuitive meaning of vector multiplication with covariance matrix | Eigenvectors of the empirical covariance matrix are directions where data has maximal variance.
We know that the eigenvector basis of a linear operator is the basis where the operator has diagonal representation.
combining these two facts above I conclude:
If the vector $x$ were drawn from normal distribution $\mathcal{N}(0, I)$ then multiplication with the covariance matrix would result in a vector drawn from normal distribution but according to the empirical covariance matrix.
I believe there are other intuitions. Please share it with us. | Intuitive meaning of vector multiplication with covariance matrix | Eigenvectors of the empirical covariance matrix are directions where data has maximal variance.
We know that the eigenvector basis of a linear operator is the basis where the operator has diagonal rep | Intuitive meaning of vector multiplication with covariance matrix
Eigenvectors of the empirical covariance matrix are directions where data has maximal variance.
We know that the eigenvector basis of a linear operator is the basis where the operator has diagonal representation.
combining these two facts above I conclude:
If the vector $x$ were drawn from normal distribution $\mathcal{N}(0, I)$ then multiplication with the covariance matrix would result in a vector drawn from normal distribution but according to the empirical covariance matrix.
I believe there are other intuitions. Please share it with us. | Intuitive meaning of vector multiplication with covariance matrix
Eigenvectors of the empirical covariance matrix are directions where data has maximal variance.
We know that the eigenvector basis of a linear operator is the basis where the operator has diagonal rep |
19,026 | Intuitive meaning of vector multiplication with covariance matrix | Note that $x^TAx$ is a just number, in many cases, we want this number to be small, i.e., try to solve the optimization problem. The nice property of this term is if $A$ SPD, then $\frac 1 2 x^TAx - b^Tx$ will have the same solution with the linear system $Ax=b$.
More discussions can be found here.
Why are symmetric positive definite (SPD) matrices so important?
I strongly recommend following 2 tutorials that helped me a lot.
essence of linear algebra
An Introduction to the Conjugate Gradient Method Without the Agonizing Pain | Intuitive meaning of vector multiplication with covariance matrix | Note that $x^TAx$ is a just number, in many cases, we want this number to be small, i.e., try to solve the optimization problem. The nice property of this term is if $A$ SPD, then $\frac 1 2 x^TAx - b | Intuitive meaning of vector multiplication with covariance matrix
Note that $x^TAx$ is a just number, in many cases, we want this number to be small, i.e., try to solve the optimization problem. The nice property of this term is if $A$ SPD, then $\frac 1 2 x^TAx - b^Tx$ will have the same solution with the linear system $Ax=b$.
More discussions can be found here.
Why are symmetric positive definite (SPD) matrices so important?
I strongly recommend following 2 tutorials that helped me a lot.
essence of linear algebra
An Introduction to the Conjugate Gradient Method Without the Agonizing Pain | Intuitive meaning of vector multiplication with covariance matrix
Note that $x^TAx$ is a just number, in many cases, we want this number to be small, i.e., try to solve the optimization problem. The nice property of this term is if $A$ SPD, then $\frac 1 2 x^TAx - b |
19,027 | How to convert fully connected layer into convolutional layer? [duplicate] | Inspired by @dk14 's answer, now I have a clearer mind on this question, though I don't completely agree with his answer. And I hope to post mine online for more confirmation.
On a vanilla case, where the input of original AlexNet is still (224,224,3), after a series of Conv layer and pooling, we reach the last Conv layer. At this moment, the size of the image turns into (7,7,512).
At the converted Conv layer(converted from FC1), we have 4096 * (7,7,512) filters overall, which generates (1,1,4096) vector for us. At the second converted Conv layer(converted from FC2), we have 4096 * (1,1,4096) filters, and they give us a output vector (1,1,4096). It's very important for us to remember that, in the conversion, filter size must match the input volume size. That's why we have one by one filter here. Similarily, the last converted Conv layer have 1000 * (1,1,4096) filters and will give us a result for 1000 classes.
The processed is summarized in the post: http://cs231n.github.io/convolutional-networks/#convert.
In FC1, the original matrix size should be (7*7*512, 4096), meaning each one of the 4096 neuron in FC2 is connected with every neuron in FC1. While after conversion, the matrix size becomes (7,7,512,4096), meaning we have 4096 (7,7,512) matrixes. It's like taking out each row of the original gigantic matrix, and reshape it accordingly. | How to convert fully connected layer into convolutional layer? [duplicate] | Inspired by @dk14 's answer, now I have a clearer mind on this question, though I don't completely agree with his answer. And I hope to post mine online for more confirmation.
On a vanilla case, wher | How to convert fully connected layer into convolutional layer? [duplicate]
Inspired by @dk14 's answer, now I have a clearer mind on this question, though I don't completely agree with his answer. And I hope to post mine online for more confirmation.
On a vanilla case, where the input of original AlexNet is still (224,224,3), after a series of Conv layer and pooling, we reach the last Conv layer. At this moment, the size of the image turns into (7,7,512).
At the converted Conv layer(converted from FC1), we have 4096 * (7,7,512) filters overall, which generates (1,1,4096) vector for us. At the second converted Conv layer(converted from FC2), we have 4096 * (1,1,4096) filters, and they give us a output vector (1,1,4096). It's very important for us to remember that, in the conversion, filter size must match the input volume size. That's why we have one by one filter here. Similarily, the last converted Conv layer have 1000 * (1,1,4096) filters and will give us a result for 1000 classes.
The processed is summarized in the post: http://cs231n.github.io/convolutional-networks/#convert.
In FC1, the original matrix size should be (7*7*512, 4096), meaning each one of the 4096 neuron in FC2 is connected with every neuron in FC1. While after conversion, the matrix size becomes (7,7,512,4096), meaning we have 4096 (7,7,512) matrixes. It's like taking out each row of the original gigantic matrix, and reshape it accordingly. | How to convert fully connected layer into convolutional layer? [duplicate]
Inspired by @dk14 's answer, now I have a clearer mind on this question, though I don't completely agree with his answer. And I hope to post mine online for more confirmation.
On a vanilla case, wher |
19,028 | How to convert fully connected layer into convolutional layer? [duplicate] | Let's start with $F = 7$, $P = 0$, $S = 1$ notion. What does it actually mean:
$F = 7$: receptive field size is set to a maximum value (7 for 1D, 7x7 for 2D) which implies no parameter sharing (as there is only one receptive field), which is default for MLP. If F was equal to 1, all connections (from the image above) would always have an identical weight.
$S = 1$: stride equals to 1, which means that no neurons on the next layer is going to be removed (see figure below). Given $F = 7$ if we had stride = 2, the number of next-layer nodes would be twice smaller.
Source: http://cs231n.github.io/convolutional-networks
$P = 0$: no zero padding, as we don't need it for a full receptive field (there is no uncovered units as you can see from image above).
Those three conditions basically guarantee that connectivity architecture is exactly same as for canonical MLP.
Attempt to answer your question about reshaping matrices:
Example of reshaping in Python's Numpy library: numpy.reshape
My guess is that the author meant that FCN usually has 1D output "vector" (from each layer) instead of 2D matrix.
Let's say, the first layer of FC-network returns 1x1x4096 output matrix as it doesn't care about image's dimensions - it stacks all dimensions into one vector (put each rows on top of another). You can guess that next layer's weight matrix is gonna have corresponding shape (4096x4096) that combines all possible outputs). So when you convert it to a convolutional receptive field - you'll probably have to move your activations to 2D, so you need 64x64 activations and, I guess, something like 64x64x4096 tensor for receptive field's weights (since $S=1$).
The quote from the article that demonstrates "reshaping":
For example, if 224x224 image gives a volume of size [7x7x512] - i.e. a reduction by 32, then forwarding an image of size 384x384 through the converted architecture would give the equivalent volume in size [12x12x512], since 384/32 = 12. Following through with the next 3 CONV layers that we just converted from FC layers would now give the final volume of size [6x6x1000], since (12 - 7)/1 + 1 = 6. Note that instead of a single vector of class scores of size [1x1x1000], we’re now getting and entire 6x6 array of class scores across the 384x384 image
Example (for activations of some layer):
1
2
3
4
|
|
\/
1 3
2 4
In order to show weights reshaping (to fit 2D image), I'd have to draw square into cube conversion. However, there is some demos on the internet:
Source: http://nuit-blanche.blogspot.com/2016/09/low-rank-tensor-networks-for.html
P.S. However, I have some confusion about AlexNet example: it seems like mentioned $F=1$ just means "full" parameter sharing across non-existent dimensions (1x1). Otherwise, it won't be completely equivalent to an MLP with no parameter sharing - but maybe that's what was implied (scaling small FC-network into a large CNN).
So, what's the point?
to “slide” the original ConvNet very efficiently across many spatial positions in a larger image
Basically it allows you to scale a FC-network trained on small portions/images into a larger CNN. So in that case only small window of resulting CNN will be initially equivalent to an original FCN. This approach gives you ability to share parameters (learned from small networks) across large networks in order to save computational resources and apply some kind of regularization (by managing network's capacity).
Edit1 in response to your comment.
Example of $N = 5$ (sorry I was lazy to draw 7 neurons), $F=5$, $S=2$ :
So you can see that S = 2 can be applied even for receptive field with maximum size, so striding can be applied without parameter sharing as all it does is just removing neurons.
And parameter sharing strategies could be different. For instance, you can't tell about my last figure wether parameter are shared between neurons or not. | How to convert fully connected layer into convolutional layer? [duplicate] | Let's start with $F = 7$, $P = 0$, $S = 1$ notion. What does it actually mean:
$F = 7$: receptive field size is set to a maximum value (7 for 1D, 7x7 for 2D) which implies no parameter sharing (as th | How to convert fully connected layer into convolutional layer? [duplicate]
Let's start with $F = 7$, $P = 0$, $S = 1$ notion. What does it actually mean:
$F = 7$: receptive field size is set to a maximum value (7 for 1D, 7x7 for 2D) which implies no parameter sharing (as there is only one receptive field), which is default for MLP. If F was equal to 1, all connections (from the image above) would always have an identical weight.
$S = 1$: stride equals to 1, which means that no neurons on the next layer is going to be removed (see figure below). Given $F = 7$ if we had stride = 2, the number of next-layer nodes would be twice smaller.
Source: http://cs231n.github.io/convolutional-networks
$P = 0$: no zero padding, as we don't need it for a full receptive field (there is no uncovered units as you can see from image above).
Those three conditions basically guarantee that connectivity architecture is exactly same as for canonical MLP.
Attempt to answer your question about reshaping matrices:
Example of reshaping in Python's Numpy library: numpy.reshape
My guess is that the author meant that FCN usually has 1D output "vector" (from each layer) instead of 2D matrix.
Let's say, the first layer of FC-network returns 1x1x4096 output matrix as it doesn't care about image's dimensions - it stacks all dimensions into one vector (put each rows on top of another). You can guess that next layer's weight matrix is gonna have corresponding shape (4096x4096) that combines all possible outputs). So when you convert it to a convolutional receptive field - you'll probably have to move your activations to 2D, so you need 64x64 activations and, I guess, something like 64x64x4096 tensor for receptive field's weights (since $S=1$).
The quote from the article that demonstrates "reshaping":
For example, if 224x224 image gives a volume of size [7x7x512] - i.e. a reduction by 32, then forwarding an image of size 384x384 through the converted architecture would give the equivalent volume in size [12x12x512], since 384/32 = 12. Following through with the next 3 CONV layers that we just converted from FC layers would now give the final volume of size [6x6x1000], since (12 - 7)/1 + 1 = 6. Note that instead of a single vector of class scores of size [1x1x1000], we’re now getting and entire 6x6 array of class scores across the 384x384 image
Example (for activations of some layer):
1
2
3
4
|
|
\/
1 3
2 4
In order to show weights reshaping (to fit 2D image), I'd have to draw square into cube conversion. However, there is some demos on the internet:
Source: http://nuit-blanche.blogspot.com/2016/09/low-rank-tensor-networks-for.html
P.S. However, I have some confusion about AlexNet example: it seems like mentioned $F=1$ just means "full" parameter sharing across non-existent dimensions (1x1). Otherwise, it won't be completely equivalent to an MLP with no parameter sharing - but maybe that's what was implied (scaling small FC-network into a large CNN).
So, what's the point?
to “slide” the original ConvNet very efficiently across many spatial positions in a larger image
Basically it allows you to scale a FC-network trained on small portions/images into a larger CNN. So in that case only small window of resulting CNN will be initially equivalent to an original FCN. This approach gives you ability to share parameters (learned from small networks) across large networks in order to save computational resources and apply some kind of regularization (by managing network's capacity).
Edit1 in response to your comment.
Example of $N = 5$ (sorry I was lazy to draw 7 neurons), $F=5$, $S=2$ :
So you can see that S = 2 can be applied even for receptive field with maximum size, so striding can be applied without parameter sharing as all it does is just removing neurons.
And parameter sharing strategies could be different. For instance, you can't tell about my last figure wether parameter are shared between neurons or not. | How to convert fully connected layer into convolutional layer? [duplicate]
Let's start with $F = 7$, $P = 0$, $S = 1$ notion. What does it actually mean:
$F = 7$: receptive field size is set to a maximum value (7 for 1D, 7x7 for 2D) which implies no parameter sharing (as th |
19,029 | How to test an interaction effect with a non-parametric test (e.g. a permutation test)? | There are nonparametric tests for interaction. Roughly speaking, you replace the observed weights by their ranks and treat the resulting data set as heteroskedastic ANOVA. Look e.g. at "Nonparametric methods in factorial designs" by Brunner and Puri (2001).
However, the kind of nonparametric interaction you are interested in cannot be shown in this generality. You said:
In other words, I want to know if data prove that there are "2D effects" or, in other words, that age- and gender-effects are not independent. For example, it might be that becoming old for males increase the weight by factor 1.3 and for female the corresponding factor is 1.1.
The latter is impossible. Nonparametric interaction must involve a sign change, i.e. growing old increases males' weight but decreases females weight. Such a sign change remains even if you monotonically transform the weights.
But you can choose a monotonous transformation on the data that maps the weight increase by factor 1.1 as close as you want to 1.3. Of course, you will never show a difference to be significant if it can be as close as you want.
If you really are interested in interactions without sign change, you should stick to usual parametric analysis. There, monotonous transformations that "swallow the difference" aren't allowed. Of course, this is again something to keep in mind by modeling and interpreting your statistics. | How to test an interaction effect with a non-parametric test (e.g. a permutation test)? | There are nonparametric tests for interaction. Roughly speaking, you replace the observed weights by their ranks and treat the resulting data set as heteroskedastic ANOVA. Look e.g. at "Nonparametric | How to test an interaction effect with a non-parametric test (e.g. a permutation test)?
There are nonparametric tests for interaction. Roughly speaking, you replace the observed weights by their ranks and treat the resulting data set as heteroskedastic ANOVA. Look e.g. at "Nonparametric methods in factorial designs" by Brunner and Puri (2001).
However, the kind of nonparametric interaction you are interested in cannot be shown in this generality. You said:
In other words, I want to know if data prove that there are "2D effects" or, in other words, that age- and gender-effects are not independent. For example, it might be that becoming old for males increase the weight by factor 1.3 and for female the corresponding factor is 1.1.
The latter is impossible. Nonparametric interaction must involve a sign change, i.e. growing old increases males' weight but decreases females weight. Such a sign change remains even if you monotonically transform the weights.
But you can choose a monotonous transformation on the data that maps the weight increase by factor 1.1 as close as you want to 1.3. Of course, you will never show a difference to be significant if it can be as close as you want.
If you really are interested in interactions without sign change, you should stick to usual parametric analysis. There, monotonous transformations that "swallow the difference" aren't allowed. Of course, this is again something to keep in mind by modeling and interpreting your statistics. | How to test an interaction effect with a non-parametric test (e.g. a permutation test)?
There are nonparametric tests for interaction. Roughly speaking, you replace the observed weights by their ranks and treat the resulting data set as heteroskedastic ANOVA. Look e.g. at "Nonparametric |
19,030 | How to test an interaction effect with a non-parametric test (e.g. a permutation test)? | As others have noted, this can be modeled linearly with an interaction. You're interacting two dummies, and there's nothing non-linear about this. Given the model:
$$
wt = \alpha +b_1age+b_2gender+b_3age*gender+\epsilon
$$
The 'gender' marginal effect is the partial derivative:
$$\frac{\partial wt}{\partial gender} = b_2 + b_3age$$
See how if gender and age can only take values of 0 or 1, we're essentially only looking at a difference in means for four different groups? That is, we only have the four different combinations we can plug into the above equations: (1) $gender = 0$ and $age=0$, (2) $gender = 1$ and $age = 1$, (3) $gender = 0$ and $age = 1$, and (4) $gender = 1$ and $age = 0$. Thus, your specific example is equivalent to a comparison between four group means.
It might also be helpful to see this discussion to understand how the above is equivalent to ANOVA with two interacted nominal variables. As another way to restate the fact that with your specific example, (again, because there are only four possible combinations of age and gender) we could also specify a model like the following, without an explicit interaction term:
$$
wt = \alpha + b_1young.male + b_2old.male + b_3young.female + \epsilon
$$
Where $old.female$ is omitted as your reference category, and for example, the coefficient $b_1$ will be a difference in means between $old.female$ and $young.male$. Where the intercept $\alpha$ will also be equal to average $wt$ within $old.female$ (again, the reference category).
Try it out with your own data. With a linear model with an interaction, an ANOVA with an interaction, or using dummies for each of the groups with no interaction, you'll get the same results. Pretty cool, huh? A statistics book might discuss each of these methods in a diferent chapter$\dots$ but all roads lead to Rome. Really, seeing how this works with your own data is one of the best ways to learn.
The above examples are thus an overly complicated way to get at this conclusion (that we're really just comparing four group means), but for learning about how interactions work, I think this is a helpful excercise. There are other very good posts on CV about interacting a continuous variable with a nominal variable, or interacting two continutous variables. Even though your question has been edited to specify non-parametric tests, I think it's helpful to think through your problem from a more conventional (i.e., parametric) approach, because most non-parametric approaches to hypothesis testing have the same logic but generally with fewer assumptions about specific distributions.
But the question asked specifically for a non-parametric approach, which might be more appropriate, for example, if we didn't want to make certain assumptions about the normality of $wt$. An appropriate non-parametric test would be Dunn's test. This test is similar to the Wilcoxon-Mann-Whitney rank-sum test but with more than two categories.
Other permutation tests might also be appropriate if you had a specific difference in means you were testing, for example, $old.men$ vs. $young.women$. Whether or not you use R, the 'coin' package documenation provides a good summary of different non-parametric tests, and under what circumstances these tests might be appropriate.
Short aside on "significant" interactions
Sometimes, you'll see statments like, "the interaction between $x_1$ and $x_2$ was statistically significant." Such statements are not necessarily wrong, but they are misleading. Usually, when an author writes this, they are saying that the coefficient on the interaction term was statistically signficant. But this is an unconditional effect in a conditional model. A more accurate report would say that "$x_1$ was statistically signficant over 'some values' of $x_2$," where all other covariates were held constant at some reasonable value, like a mean, median or mode. But once more, if we only have two covariates that can only take values of 0 or 1, that means that we're essentially looking at four group means.
Worked Example
Let's compare results from the interaction model with results from Dunn's test. First, let's generate some data where (a) men weigh more than women, (b) younger men weight less than older men, and (c) there is no difference between younger and older women.
set.seed(405)
old.men<-rnorm(50,mean=80,sd=15)
young.men<-rnorm(50,mean=70,sd=15)
young.women<-rnorm(50,mean=60,sd=15)
old.women<-rnorm(50,mean=60,sd=15)
cat<-rep(1:4, c(50,50,50,50))
gender<-rep(1:2, c(100,100))
age<-c(rep(1,50),rep(2,100),rep(1,50))
wt<-c(old.men,young.men,young.women,old.women)
data<-data.frame(cbind(wt,cat,age,gender))
data$cat<-factor(data$cat,labels=c("old.men","young.men","young.women","old.women"))
data$age<-factor(data$age,labels=c("old","young"))
data$gender<-factor(data$gender,labels=c("male","female"))
Estimate the interaction model and get predicted $wt$ from marginal effect (w/ 'effects' package). See here for why we don't want to interpret the unconditional effects in a model like this. Instead, we want to interpret marginal effects. The model does a decent job of detecting the differences we imposed when we generated our example data.
mod<-lm(wt~age*gender,data)
library(effects)
allEffects(mod)
model: wt ~ age * gender
age*gender effect
gender
age male female
old 80.61897 57.70635
young 67.78351 56.01228
Need to calculate a standard error or confidence interval for your marginal effect? The 'effects' package referenced above can do this for you, but better yet, Aiken and West (1991) give you the formulas, even for much more complicated interaction models. Their tables are conveniently printed here, along with very good commentary by Matt Golder.
Now to implement Dunn's test.
#install.packages("dunn.test")
dunn.test(data$wt, data$cat, method="bh")
Kruskal-Wallis chi-squared = 65.9549, df = 3, p-value = 0
Comparison of x by group
(Benjamini-Hochberg)
Col Mean-|
Row Mean | old.men young.me young.wo
---------+---------------------------------
young.me | 3.662802
| 0.0002*
|
young.wo | 7.185657 3.522855
| 0.0000* 0.0003*
|
old.wome | 6.705346 3.042544 -0.480310
| 0.0000* 0.0014* 0.3155
The p-value on the Kruskal-Wallis chi-squared test result suggests that at least one of our groups 'comes from a different population.' For the group-by-group comparisons, the top number is Dunn's z-test statistic, and the bottom number is a p-value, which has been adjusted for multiple comparisons. As our example data were rather artificial, it's unsurprising that we have so many small p-values. But note the bottom-right comparison between younger and older women. The test correctly supports the null hypothesis that there is no difference between these two groups.
So, both the interaction model and Dunn's test lead us to similar conclusions. In all of the examples given above, we are somehow comparing group means. And, while there are certainly more strait-forward approaches to comparing group means, I have tried to illustrate how comparing group means can also be understood as an interaction or "2D effect," with some model specifications, specifically with nominal interactions. I think that understanding this is helpful for understanding more complicated models with interaction effects. I'm going to link to this artice once more, just because I think it should be required reading for anyone working with interactions (there's a reason this article has been cited over 3k times$\dots$).
UPDATE: Given other answers, this answer has been updated to dispute the idea that this requires any form of non-linear modeling, or that -- given OP's specific example of two binary covariates, i.e., four groups -- that there must be a sign change to asesses this non-parametrically. If age were continuous, for instance, there would be other ways to approach this problem, but that was not the example given by OP. | How to test an interaction effect with a non-parametric test (e.g. a permutation test)? | As others have noted, this can be modeled linearly with an interaction. You're interacting two dummies, and there's nothing non-linear about this. Given the model:
$$
wt = \alpha +b_1age+b_2gender+b_3 | How to test an interaction effect with a non-parametric test (e.g. a permutation test)?
As others have noted, this can be modeled linearly with an interaction. You're interacting two dummies, and there's nothing non-linear about this. Given the model:
$$
wt = \alpha +b_1age+b_2gender+b_3age*gender+\epsilon
$$
The 'gender' marginal effect is the partial derivative:
$$\frac{\partial wt}{\partial gender} = b_2 + b_3age$$
See how if gender and age can only take values of 0 or 1, we're essentially only looking at a difference in means for four different groups? That is, we only have the four different combinations we can plug into the above equations: (1) $gender = 0$ and $age=0$, (2) $gender = 1$ and $age = 1$, (3) $gender = 0$ and $age = 1$, and (4) $gender = 1$ and $age = 0$. Thus, your specific example is equivalent to a comparison between four group means.
It might also be helpful to see this discussion to understand how the above is equivalent to ANOVA with two interacted nominal variables. As another way to restate the fact that with your specific example, (again, because there are only four possible combinations of age and gender) we could also specify a model like the following, without an explicit interaction term:
$$
wt = \alpha + b_1young.male + b_2old.male + b_3young.female + \epsilon
$$
Where $old.female$ is omitted as your reference category, and for example, the coefficient $b_1$ will be a difference in means between $old.female$ and $young.male$. Where the intercept $\alpha$ will also be equal to average $wt$ within $old.female$ (again, the reference category).
Try it out with your own data. With a linear model with an interaction, an ANOVA with an interaction, or using dummies for each of the groups with no interaction, you'll get the same results. Pretty cool, huh? A statistics book might discuss each of these methods in a diferent chapter$\dots$ but all roads lead to Rome. Really, seeing how this works with your own data is one of the best ways to learn.
The above examples are thus an overly complicated way to get at this conclusion (that we're really just comparing four group means), but for learning about how interactions work, I think this is a helpful excercise. There are other very good posts on CV about interacting a continuous variable with a nominal variable, or interacting two continutous variables. Even though your question has been edited to specify non-parametric tests, I think it's helpful to think through your problem from a more conventional (i.e., parametric) approach, because most non-parametric approaches to hypothesis testing have the same logic but generally with fewer assumptions about specific distributions.
But the question asked specifically for a non-parametric approach, which might be more appropriate, for example, if we didn't want to make certain assumptions about the normality of $wt$. An appropriate non-parametric test would be Dunn's test. This test is similar to the Wilcoxon-Mann-Whitney rank-sum test but with more than two categories.
Other permutation tests might also be appropriate if you had a specific difference in means you were testing, for example, $old.men$ vs. $young.women$. Whether or not you use R, the 'coin' package documenation provides a good summary of different non-parametric tests, and under what circumstances these tests might be appropriate.
Short aside on "significant" interactions
Sometimes, you'll see statments like, "the interaction between $x_1$ and $x_2$ was statistically significant." Such statements are not necessarily wrong, but they are misleading. Usually, when an author writes this, they are saying that the coefficient on the interaction term was statistically signficant. But this is an unconditional effect in a conditional model. A more accurate report would say that "$x_1$ was statistically signficant over 'some values' of $x_2$," where all other covariates were held constant at some reasonable value, like a mean, median or mode. But once more, if we only have two covariates that can only take values of 0 or 1, that means that we're essentially looking at four group means.
Worked Example
Let's compare results from the interaction model with results from Dunn's test. First, let's generate some data where (a) men weigh more than women, (b) younger men weight less than older men, and (c) there is no difference between younger and older women.
set.seed(405)
old.men<-rnorm(50,mean=80,sd=15)
young.men<-rnorm(50,mean=70,sd=15)
young.women<-rnorm(50,mean=60,sd=15)
old.women<-rnorm(50,mean=60,sd=15)
cat<-rep(1:4, c(50,50,50,50))
gender<-rep(1:2, c(100,100))
age<-c(rep(1,50),rep(2,100),rep(1,50))
wt<-c(old.men,young.men,young.women,old.women)
data<-data.frame(cbind(wt,cat,age,gender))
data$cat<-factor(data$cat,labels=c("old.men","young.men","young.women","old.women"))
data$age<-factor(data$age,labels=c("old","young"))
data$gender<-factor(data$gender,labels=c("male","female"))
Estimate the interaction model and get predicted $wt$ from marginal effect (w/ 'effects' package). See here for why we don't want to interpret the unconditional effects in a model like this. Instead, we want to interpret marginal effects. The model does a decent job of detecting the differences we imposed when we generated our example data.
mod<-lm(wt~age*gender,data)
library(effects)
allEffects(mod)
model: wt ~ age * gender
age*gender effect
gender
age male female
old 80.61897 57.70635
young 67.78351 56.01228
Need to calculate a standard error or confidence interval for your marginal effect? The 'effects' package referenced above can do this for you, but better yet, Aiken and West (1991) give you the formulas, even for much more complicated interaction models. Their tables are conveniently printed here, along with very good commentary by Matt Golder.
Now to implement Dunn's test.
#install.packages("dunn.test")
dunn.test(data$wt, data$cat, method="bh")
Kruskal-Wallis chi-squared = 65.9549, df = 3, p-value = 0
Comparison of x by group
(Benjamini-Hochberg)
Col Mean-|
Row Mean | old.men young.me young.wo
---------+---------------------------------
young.me | 3.662802
| 0.0002*
|
young.wo | 7.185657 3.522855
| 0.0000* 0.0003*
|
old.wome | 6.705346 3.042544 -0.480310
| 0.0000* 0.0014* 0.3155
The p-value on the Kruskal-Wallis chi-squared test result suggests that at least one of our groups 'comes from a different population.' For the group-by-group comparisons, the top number is Dunn's z-test statistic, and the bottom number is a p-value, which has been adjusted for multiple comparisons. As our example data were rather artificial, it's unsurprising that we have so many small p-values. But note the bottom-right comparison between younger and older women. The test correctly supports the null hypothesis that there is no difference between these two groups.
So, both the interaction model and Dunn's test lead us to similar conclusions. In all of the examples given above, we are somehow comparing group means. And, while there are certainly more strait-forward approaches to comparing group means, I have tried to illustrate how comparing group means can also be understood as an interaction or "2D effect," with some model specifications, specifically with nominal interactions. I think that understanding this is helpful for understanding more complicated models with interaction effects. I'm going to link to this artice once more, just because I think it should be required reading for anyone working with interactions (there's a reason this article has been cited over 3k times$\dots$).
UPDATE: Given other answers, this answer has been updated to dispute the idea that this requires any form of non-linear modeling, or that -- given OP's specific example of two binary covariates, i.e., four groups -- that there must be a sign change to asesses this non-parametrically. If age were continuous, for instance, there would be other ways to approach this problem, but that was not the example given by OP. | How to test an interaction effect with a non-parametric test (e.g. a permutation test)?
As others have noted, this can be modeled linearly with an interaction. You're interacting two dummies, and there's nothing non-linear about this. Given the model:
$$
wt = \alpha +b_1age+b_2gender+b_3 |
19,031 | How to test an interaction effect with a non-parametric test (e.g. a permutation test)? | If you believe that the effects of age and gender are more than just the individual effects, you may consider the model $weight_i = \alpha \cdot age_i + \beta \cdot gender_i + \gamma \cdot (gender_i\cdot age_i).$ The $\gamma$ coefficient captures the size of the "2D" effect of age and gender. You can check the t-statistic of $\gamma$ to get a rough idea on whether the $\gamma$ you observe in your model is significantly different from $\gamma = 0$.
Here's a very rough graphical example to show what this additional multiplicative term $gender_i\cdot age_i$ does.
In the model $response = x_1 + x_2$, we essentially try to fit a simple hyperplane to the data
This is model is linear in the covariates, hence the linear shape you see in the plot above.
On the other hand, the model $response = x_1 + x_2 + x_1\cdot x_2$ is non-linear in $x_1$ and $x_2$ and hence allows for some level of curvature
Failing to reject the hypothesis that $\gamma = 0$ is like failing to reject that there is some curvature of this form in the model.
In terms of a non-parametric test, you can do something along the lines of what you suggested by obtaining bootstrap standard errors for $\gamma$. This means that, several times you: 1) sample your data with replacement, 2) recalculate the linear mode, 3) get an estimate $\hat{\gamma}$. After you have many estimates of $\hat{\gamma}$, you can use the $50 \pm p\%$ quantile to set up a non-parametric $2p\%$ confidence interval for $\gamma$. For more on this, google "bootstrap standard errors". | How to test an interaction effect with a non-parametric test (e.g. a permutation test)? | If you believe that the effects of age and gender are more than just the individual effects, you may consider the model $weight_i = \alpha \cdot age_i + \beta \cdot gender_i + \gamma \cdot (gender_i\c | How to test an interaction effect with a non-parametric test (e.g. a permutation test)?
If you believe that the effects of age and gender are more than just the individual effects, you may consider the model $weight_i = \alpha \cdot age_i + \beta \cdot gender_i + \gamma \cdot (gender_i\cdot age_i).$ The $\gamma$ coefficient captures the size of the "2D" effect of age and gender. You can check the t-statistic of $\gamma$ to get a rough idea on whether the $\gamma$ you observe in your model is significantly different from $\gamma = 0$.
Here's a very rough graphical example to show what this additional multiplicative term $gender_i\cdot age_i$ does.
In the model $response = x_1 + x_2$, we essentially try to fit a simple hyperplane to the data
This is model is linear in the covariates, hence the linear shape you see in the plot above.
On the other hand, the model $response = x_1 + x_2 + x_1\cdot x_2$ is non-linear in $x_1$ and $x_2$ and hence allows for some level of curvature
Failing to reject the hypothesis that $\gamma = 0$ is like failing to reject that there is some curvature of this form in the model.
In terms of a non-parametric test, you can do something along the lines of what you suggested by obtaining bootstrap standard errors for $\gamma$. This means that, several times you: 1) sample your data with replacement, 2) recalculate the linear mode, 3) get an estimate $\hat{\gamma}$. After you have many estimates of $\hat{\gamma}$, you can use the $50 \pm p\%$ quantile to set up a non-parametric $2p\%$ confidence interval for $\gamma$. For more on this, google "bootstrap standard errors". | How to test an interaction effect with a non-parametric test (e.g. a permutation test)?
If you believe that the effects of age and gender are more than just the individual effects, you may consider the model $weight_i = \alpha \cdot age_i + \beta \cdot gender_i + \gamma \cdot (gender_i\c |
19,032 | How to test an interaction effect with a non-parametric test (e.g. a permutation test)? | So you have these random variables:
$A$ - takes values in $\mathbb{N}$. This is what we call age.
$S$ - takes values in $\{\text{male},\text{female}\}$. This is what we call sex.
$W$ - takes values in $]0, \infty[$. This is what we call weight.
And you have these probability mass/density functions:
$f_W$ - density of r.v. $W$.
$f_{W,A}$ - joint density of r.v. $W,A$.
$f_{W,S}$ - joint density of r.v. of $W,S$.
$f_{W,A,S}$ - joint density of r.v. $W,A,S$.
You know that there exists weight $w$, age $a$ and sex $s$ such that:
$f_{W,A}(w,a) \ne f_W(w)$, therefore weight is not independent of age.
$f_{W,S}(w,s) \ne f_W(w)$, therefore weight is not independent of sex.
Now, you wish to find out whether age and sex are independent as they are jointly/combinatorially related to weight. In other words, you wish to find this:
$$
f_{W,A,S}(w,a,s) \ne f_{W,A}(w,a) \ne f_{W,S}(w,s)
$$
If you show that there exists weight $w$, age $a$ and sex $s$ that satisfy the above, then you will show that age and sex have a combinatoric effect on weight.
However, you don't know the true joint PDFs above. Since you want to limit yourself to non-parametric methods, your task now is to find these non-parametric estimations:
$\hat f_{W,A}(w,a)$.
$\hat f_{W,S}(w,s)$.
$\hat f_{W,A,S}(w,a,s)$.
And then show that:
Your density estimations are accurate enough.
The probability that $\hat f_{W,A,S}(w,a,s) \ne \hat f_{W,A}(w,a) \ne \hat f_{W,S}(w,s)$ is very high.
Or that the probability that $\hat f_{W,A,S}(w,a,s) = \hat f_{W,A}(w,a) = \hat f_{W,S}(w,s)$ is very low. | How to test an interaction effect with a non-parametric test (e.g. a permutation test)? | So you have these random variables:
$A$ - takes values in $\mathbb{N}$. This is what we call age.
$S$ - takes values in $\{\text{male},\text{female}\}$. This is what we call sex.
$W$ - takes values i | How to test an interaction effect with a non-parametric test (e.g. a permutation test)?
So you have these random variables:
$A$ - takes values in $\mathbb{N}$. This is what we call age.
$S$ - takes values in $\{\text{male},\text{female}\}$. This is what we call sex.
$W$ - takes values in $]0, \infty[$. This is what we call weight.
And you have these probability mass/density functions:
$f_W$ - density of r.v. $W$.
$f_{W,A}$ - joint density of r.v. $W,A$.
$f_{W,S}$ - joint density of r.v. of $W,S$.
$f_{W,A,S}$ - joint density of r.v. $W,A,S$.
You know that there exists weight $w$, age $a$ and sex $s$ such that:
$f_{W,A}(w,a) \ne f_W(w)$, therefore weight is not independent of age.
$f_{W,S}(w,s) \ne f_W(w)$, therefore weight is not independent of sex.
Now, you wish to find out whether age and sex are independent as they are jointly/combinatorially related to weight. In other words, you wish to find this:
$$
f_{W,A,S}(w,a,s) \ne f_{W,A}(w,a) \ne f_{W,S}(w,s)
$$
If you show that there exists weight $w$, age $a$ and sex $s$ that satisfy the above, then you will show that age and sex have a combinatoric effect on weight.
However, you don't know the true joint PDFs above. Since you want to limit yourself to non-parametric methods, your task now is to find these non-parametric estimations:
$\hat f_{W,A}(w,a)$.
$\hat f_{W,S}(w,s)$.
$\hat f_{W,A,S}(w,a,s)$.
And then show that:
Your density estimations are accurate enough.
The probability that $\hat f_{W,A,S}(w,a,s) \ne \hat f_{W,A}(w,a) \ne \hat f_{W,S}(w,s)$ is very high.
Or that the probability that $\hat f_{W,A,S}(w,a,s) = \hat f_{W,A}(w,a) = \hat f_{W,S}(w,s)$ is very low. | How to test an interaction effect with a non-parametric test (e.g. a permutation test)?
So you have these random variables:
$A$ - takes values in $\mathbb{N}$. This is what we call age.
$S$ - takes values in $\{\text{male},\text{female}\}$. This is what we call sex.
$W$ - takes values i |
19,033 | How to test an interaction effect with a non-parametric test (e.g. a permutation test)? | That would be checking for interaction effects. Linear Modeling would be able to check such thing but it is not non-parametric so I guess another tool must be used.
How are you checking your age and gendereffect up until now ?
EDIT : This answer looks like it would help you | How to test an interaction effect with a non-parametric test (e.g. a permutation test)? | That would be checking for interaction effects. Linear Modeling would be able to check such thing but it is not non-parametric so I guess another tool must be used.
How are you checking your age and g | How to test an interaction effect with a non-parametric test (e.g. a permutation test)?
That would be checking for interaction effects. Linear Modeling would be able to check such thing but it is not non-parametric so I guess another tool must be used.
How are you checking your age and gendereffect up until now ?
EDIT : This answer looks like it would help you | How to test an interaction effect with a non-parametric test (e.g. a permutation test)?
That would be checking for interaction effects. Linear Modeling would be able to check such thing but it is not non-parametric so I guess another tool must be used.
How are you checking your age and g |
19,034 | What are some good interview questions for statistical algorithm developer candidates? | What do you want your statistical developer to do?
The US Army says "train you will fight, because you will fight like you were trained". Test them on what you want them to do all day long. Really, you want them to "create value" or "make money" for the company.
Boss 101
Think "show me the money."
Money grows on trees called employees. You put in a "dime" (their wages) and they pay you a "quarter" (their value).
If you can't relate their job to how they make money for the company then neither you nor they are doing their job correctly.
Note: If your symbolic manipulation question doesn't cleanly connect to the "money" then you might be asking the wrong question.
There are 3 things every employee has to do to be an employee:
Be actually able to do the job
Work well with the team
Be willing/motivated to actually do the job
If you don't get these down rock solid, no other answer is going to do you any good.
If you can replace them with a good piece of software or a well-trained teenager, then you will eventually have to do it, and it will cost you.
Data 101
What they should be able to do:
use your internal flavors of software (network, os, office,
presentation, and analysis)
use some industry standard flavors of software (Excel, R, JMP, MatLab,
pick_three)
get the data themselves. They should know basic data sets for basic
tasks. They should know repositories. They should know which famous
data is used for which task. Fisher Iris. Pearson Crab. ... there
are perhaps 20 elements that should go here. UCI, NIST, NOAA.
They should know rules of handling data. binary data (T/F) has very
different information content than categorical (A,B,C,D) or
continuous. Proper handling of the data by data-type is important.
A few Basic statistical tasks include: are these two the same or
different (aka cluster/classify), how does this relate to that
(regression/fitting including linear models, glm, radial basis,
difference equations), is it true that "x" (hypothesis testing), how
many samples do I need (acceptance sampling), how do I get the most
data from few/cheap/efficient experiments (statistical Design of
experiment) - disclaimer, I'm engineer not statistician You might
ask them the question "what are the different fundamental tasks, and
how do you test that the statistician can do them efficiently and
correctly?
access/use the data themselves. This is about formats and tools.
They should be able to read from csv, xlsx (excel), SQL, and
pictures. (HDF5, Rdata) If you have a custom format, they should
be able to read through it and work with the tools quickly and
efficiently. They should know strength/weakness of the format. CSV
is quick use, been around forever, fast prototype, but bloated,
inefficient and slow to run.
process the data properly, using best practices, and not committing
sins. Don't throw away data, ever. Don't fit binomial data with a
continuous line. Don't defy physics.
come up with results that are repeatable and reproducible. Some
folks say "there are lies, damn lies, and statistics" but not at my
company. The same good input gives the same good output. The output
isn't a number, it is always a business decision that informs a
technical action and results in a business result. Different tests
may set the dial at 5.5, or 6.5, but the capability is always
above 1.33.
present findings in the language and at the level that the decision
makers, and/or minion-developers, and/or themselves in a year, can
understand with the least errors. A beautiful thing is being able to
explain it so your grandma gets it. This (link) is my answer, but I like it.
Analytic zingers:
I think impossible questions are great. They are impossible for a reason. Being able to know whether something is impossible out the gate is a good thing. Knowing why, having some ways of engaging it, or being able to ask a different question can be better.
Other CV questions. (link)
On reddit. (link)
others (link)
BTW: this was a good question. I might have to update this answer over time. | What are some good interview questions for statistical algorithm developer candidates? | What do you want your statistical developer to do?
The US Army says "train you will fight, because you will fight like you were trained". Test them on what you want them to do all day long. Real | What are some good interview questions for statistical algorithm developer candidates?
What do you want your statistical developer to do?
The US Army says "train you will fight, because you will fight like you were trained". Test them on what you want them to do all day long. Really, you want them to "create value" or "make money" for the company.
Boss 101
Think "show me the money."
Money grows on trees called employees. You put in a "dime" (their wages) and they pay you a "quarter" (their value).
If you can't relate their job to how they make money for the company then neither you nor they are doing their job correctly.
Note: If your symbolic manipulation question doesn't cleanly connect to the "money" then you might be asking the wrong question.
There are 3 things every employee has to do to be an employee:
Be actually able to do the job
Work well with the team
Be willing/motivated to actually do the job
If you don't get these down rock solid, no other answer is going to do you any good.
If you can replace them with a good piece of software or a well-trained teenager, then you will eventually have to do it, and it will cost you.
Data 101
What they should be able to do:
use your internal flavors of software (network, os, office,
presentation, and analysis)
use some industry standard flavors of software (Excel, R, JMP, MatLab,
pick_three)
get the data themselves. They should know basic data sets for basic
tasks. They should know repositories. They should know which famous
data is used for which task. Fisher Iris. Pearson Crab. ... there
are perhaps 20 elements that should go here. UCI, NIST, NOAA.
They should know rules of handling data. binary data (T/F) has very
different information content than categorical (A,B,C,D) or
continuous. Proper handling of the data by data-type is important.
A few Basic statistical tasks include: are these two the same or
different (aka cluster/classify), how does this relate to that
(regression/fitting including linear models, glm, radial basis,
difference equations), is it true that "x" (hypothesis testing), how
many samples do I need (acceptance sampling), how do I get the most
data from few/cheap/efficient experiments (statistical Design of
experiment) - disclaimer, I'm engineer not statistician You might
ask them the question "what are the different fundamental tasks, and
how do you test that the statistician can do them efficiently and
correctly?
access/use the data themselves. This is about formats and tools.
They should be able to read from csv, xlsx (excel), SQL, and
pictures. (HDF5, Rdata) If you have a custom format, they should
be able to read through it and work with the tools quickly and
efficiently. They should know strength/weakness of the format. CSV
is quick use, been around forever, fast prototype, but bloated,
inefficient and slow to run.
process the data properly, using best practices, and not committing
sins. Don't throw away data, ever. Don't fit binomial data with a
continuous line. Don't defy physics.
come up with results that are repeatable and reproducible. Some
folks say "there are lies, damn lies, and statistics" but not at my
company. The same good input gives the same good output. The output
isn't a number, it is always a business decision that informs a
technical action and results in a business result. Different tests
may set the dial at 5.5, or 6.5, but the capability is always
above 1.33.
present findings in the language and at the level that the decision
makers, and/or minion-developers, and/or themselves in a year, can
understand with the least errors. A beautiful thing is being able to
explain it so your grandma gets it. This (link) is my answer, but I like it.
Analytic zingers:
I think impossible questions are great. They are impossible for a reason. Being able to know whether something is impossible out the gate is a good thing. Knowing why, having some ways of engaging it, or being able to ask a different question can be better.
Other CV questions. (link)
On reddit. (link)
others (link)
BTW: this was a good question. I might have to update this answer over time. | What are some good interview questions for statistical algorithm developer candidates?
What do you want your statistical developer to do?
The US Army says "train you will fight, because you will fight like you were trained". Test them on what you want them to do all day long. Real |
19,035 | Regularization and feature scaling in online learning? | The open-source project vowpal wabbit includes an implementation of online SGD which is enhanced by on the fly (online) computation of 3 additional factors affecting the weight updates. These factors can be enabled/disabled by their respective command line options (by default all three are turned on, the --sgd option, turns them all off, i.e: falls-back on "classic" SGD).
The 3 SGD enhancing options are:
--normalized updates adjusted for scale of each feature
--adaptive uses adaptive gradient (AdaGrad) (Duchi, Hazan, Singer)
--invariant importance aware updates (Karampatziakis, Langford)
Together, they ensure that the online learning process does a 3-way automatic compensation/adjustment for:
per-feature scaling (large vs small values)
per-feature learning rate decay based on feature importance
per feature adaptive learning rate adjustment for feature prevalence/rarity in examples
The upshot is that there's no need to pre-normalize or scale different features to make the learner less biased and more effective.
In addition, vowpal wabbit also implements online regularization via truncated gradient descent with the regularization options:
--l1 (L1-norm)
--l2 (L2-norm)
My experience with these enhancements on multiple data-sets, was that they significantly improved model accuracy and smoother convergence when each of them was introduced into the code.
Here are some academic papers for more detail related to these enhancements:
Online Importance Weight Aware Updates by Nikos Karampatziakis and John Langford + Slides of talk about this paper
Sparse online learning via truncated gradient by John Langford, Lihong Li, and Tong Zhang
Adaptive Subgradient Methods for Online Learning and Stochastic Optimization by John Duchi, Elad Hazan, Yoram Singer | Regularization and feature scaling in online learning? | The open-source project vowpal wabbit includes an implementation of online SGD which is enhanced by on the fly (online) computation of 3 additional factors affecting the weight updates. These factors | Regularization and feature scaling in online learning?
The open-source project vowpal wabbit includes an implementation of online SGD which is enhanced by on the fly (online) computation of 3 additional factors affecting the weight updates. These factors can be enabled/disabled by their respective command line options (by default all three are turned on, the --sgd option, turns them all off, i.e: falls-back on "classic" SGD).
The 3 SGD enhancing options are:
--normalized updates adjusted for scale of each feature
--adaptive uses adaptive gradient (AdaGrad) (Duchi, Hazan, Singer)
--invariant importance aware updates (Karampatziakis, Langford)
Together, they ensure that the online learning process does a 3-way automatic compensation/adjustment for:
per-feature scaling (large vs small values)
per-feature learning rate decay based on feature importance
per feature adaptive learning rate adjustment for feature prevalence/rarity in examples
The upshot is that there's no need to pre-normalize or scale different features to make the learner less biased and more effective.
In addition, vowpal wabbit also implements online regularization via truncated gradient descent with the regularization options:
--l1 (L1-norm)
--l2 (L2-norm)
My experience with these enhancements on multiple data-sets, was that they significantly improved model accuracy and smoother convergence when each of them was introduced into the code.
Here are some academic papers for more detail related to these enhancements:
Online Importance Weight Aware Updates by Nikos Karampatziakis and John Langford + Slides of talk about this paper
Sparse online learning via truncated gradient by John Langford, Lihong Li, and Tong Zhang
Adaptive Subgradient Methods for Online Learning and Stochastic Optimization by John Duchi, Elad Hazan, Yoram Singer | Regularization and feature scaling in online learning?
The open-source project vowpal wabbit includes an implementation of online SGD which is enhanced by on the fly (online) computation of 3 additional factors affecting the weight updates. These factors |
19,036 | Regularization and feature scaling in online learning? | This paper describes a technique for online regularization which they apply to various algorithms, including logistic regression: http://ai.stanford.edu/~chuongdo/papers/proximal.pdf | Regularization and feature scaling in online learning? | This paper describes a technique for online regularization which they apply to various algorithms, including logistic regression: http://ai.stanford.edu/~chuongdo/papers/proximal.pdf | Regularization and feature scaling in online learning?
This paper describes a technique for online regularization which they apply to various algorithms, including logistic regression: http://ai.stanford.edu/~chuongdo/papers/proximal.pdf | Regularization and feature scaling in online learning?
This paper describes a technique for online regularization which they apply to various algorithms, including logistic regression: http://ai.stanford.edu/~chuongdo/papers/proximal.pdf |
19,037 | Regularization and feature scaling in online learning? | yes you certainly need regularisation... it also helps the gradient descent ( and initialise learning rate to 1/C)
see eg SGD-QN paper http://leon.bottou.org/papers bottou's papers
you haven't really explained what you mean by online learning: eg for each point do you get target value?
I don't know how you would incorporate... searching for C ... I guess you would have multiple classifiers with different regularisation terms and track the prediction error ( before you update weights) | Regularization and feature scaling in online learning? | yes you certainly need regularisation... it also helps the gradient descent ( and initialise learning rate to 1/C)
see eg SGD-QN paper http://leon.bottou.org/papers bottou's papers
you haven't really | Regularization and feature scaling in online learning?
yes you certainly need regularisation... it also helps the gradient descent ( and initialise learning rate to 1/C)
see eg SGD-QN paper http://leon.bottou.org/papers bottou's papers
you haven't really explained what you mean by online learning: eg for each point do you get target value?
I don't know how you would incorporate... searching for C ... I guess you would have multiple classifiers with different regularisation terms and track the prediction error ( before you update weights) | Regularization and feature scaling in online learning?
yes you certainly need regularisation... it also helps the gradient descent ( and initialise learning rate to 1/C)
see eg SGD-QN paper http://leon.bottou.org/papers bottou's papers
you haven't really |
19,038 | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing? | This is the bootstrap analogy principle. The (unknown) underlying true distribution $F$ produced a sample at hand $x_1, \ldots, x_n$ with cdf $F_n$, which in turn produced the statistic $\hat\theta=T(F_n)$ for some functional $T(\cdot)$. Your idea of using the bootstrap is to make statements about the sampling distribution based on a known distribution $\tilde F$, where you try to use an identical sampling protocol (which is exactly possible only for i.i.d. data; dependent data always lead to limitations in how accurately one can reproduce the sampling process), and apply the same functional $T(\cdot)$. I demonstrated it in another post with (what I think is) a neat diagram. So the bootstrap analogue of the (sampling + systematic) deviation $\hat\theta - \theta_0$, the quantity of your central interest, is the deviation of the bootstrap replicate $\hat\theta^*$ from what is known to be true for the distribution $\tilde F$, the sampling process you applied, and the functional $T(\cdot)$, i.e. your measure of central tendency is $T(\tilde F)$. If you used the standard nonparametric bootstrap with replacement from the original data, your $\tilde F=F_n$, so your measure of the central tendency has to be $T(F_n) \equiv \hat
\theta$ based on the original data.
Besides the translation, there are subtler issues going on with the bootstrap tests which are sometimes difficult to overcome. The distribution of a test statistic under the null may be drastically different from the distribution of the test statistic under the alternative (e.g., in tests on the boundary of the parameter space which fail with the bootstrap). The simple tests you learn in undergraduate classes like $t$-test are invariant under shift, but thinking, "Heck, I just shift everything" fails once you have to move to the next level of conceptual complexity, the asymptotic $\chi^2$ tests. Think about this: you are testing that $\mu=0$, and your observed $\bar x=0.78$. Then when you construct a $\chi^2$ test $(\bar x-\mu)^2/(s^2/n) \equiv \bar x^2/(s^2/n)$ with the bootstrap analogue $\bar x_*^2/(s_*^2/n)$, then this test has a built-in non-centrality of $n \bar x^2/s^2$ from the outset, instead of being a central test as we would expect it to be. To make the bootstrap test central, you really have to subtract the original estimate.
The $\chi^2$ tests are unavoidable in multivariate contexts, ranging from Pearson $\chi^2$ for contingency tables to Bollen-Stine bootstrap of the test statistic in structural equation models. The concept of shifting the distribution is extremely difficult to define well in these situations... although in case of the tests on the multivariate covariance matrices, this is doable by an appropriate rotation. | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing? | This is the bootstrap analogy principle. The (unknown) underlying true distribution $F$ produced a sample at hand $x_1, \ldots, x_n$ with cdf $F_n$, which in turn produced the statistic $\hat\theta=T( | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing?
This is the bootstrap analogy principle. The (unknown) underlying true distribution $F$ produced a sample at hand $x_1, \ldots, x_n$ with cdf $F_n$, which in turn produced the statistic $\hat\theta=T(F_n)$ for some functional $T(\cdot)$. Your idea of using the bootstrap is to make statements about the sampling distribution based on a known distribution $\tilde F$, where you try to use an identical sampling protocol (which is exactly possible only for i.i.d. data; dependent data always lead to limitations in how accurately one can reproduce the sampling process), and apply the same functional $T(\cdot)$. I demonstrated it in another post with (what I think is) a neat diagram. So the bootstrap analogue of the (sampling + systematic) deviation $\hat\theta - \theta_0$, the quantity of your central interest, is the deviation of the bootstrap replicate $\hat\theta^*$ from what is known to be true for the distribution $\tilde F$, the sampling process you applied, and the functional $T(\cdot)$, i.e. your measure of central tendency is $T(\tilde F)$. If you used the standard nonparametric bootstrap with replacement from the original data, your $\tilde F=F_n$, so your measure of the central tendency has to be $T(F_n) \equiv \hat
\theta$ based on the original data.
Besides the translation, there are subtler issues going on with the bootstrap tests which are sometimes difficult to overcome. The distribution of a test statistic under the null may be drastically different from the distribution of the test statistic under the alternative (e.g., in tests on the boundary of the parameter space which fail with the bootstrap). The simple tests you learn in undergraduate classes like $t$-test are invariant under shift, but thinking, "Heck, I just shift everything" fails once you have to move to the next level of conceptual complexity, the asymptotic $\chi^2$ tests. Think about this: you are testing that $\mu=0$, and your observed $\bar x=0.78$. Then when you construct a $\chi^2$ test $(\bar x-\mu)^2/(s^2/n) \equiv \bar x^2/(s^2/n)$ with the bootstrap analogue $\bar x_*^2/(s_*^2/n)$, then this test has a built-in non-centrality of $n \bar x^2/s^2$ from the outset, instead of being a central test as we would expect it to be. To make the bootstrap test central, you really have to subtract the original estimate.
The $\chi^2$ tests are unavoidable in multivariate contexts, ranging from Pearson $\chi^2$ for contingency tables to Bollen-Stine bootstrap of the test statistic in structural equation models. The concept of shifting the distribution is extremely difficult to define well in these situations... although in case of the tests on the multivariate covariance matrices, this is doable by an appropriate rotation. | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing?
This is the bootstrap analogy principle. The (unknown) underlying true distribution $F$ produced a sample at hand $x_1, \ldots, x_n$ with cdf $F_n$, which in turn produced the statistic $\hat\theta=T( |
19,039 | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing? | OK, I've got it. Thank you, StasK, for such a good answer. I'll keep it accepted for others to learn, but in my particular case I was missing a very simple fact:
The procedure of bootstrap in accordance to Hall&Wilson guidelines for simple one-sampled mean test is this (in R-inspired pseudo code):
1function(data, $\theta_0$ ) {
2 $\hat{\theta} \leftarrow $ t.test(data, mu = $\theta_0$ )$statistic
3 count $\leftarrow 0$
4for(i in 1:1000){
5 bdata $\leftarrow$ sample(data)
6 $\hat{\theta^*} \leftarrow $ t.test(bdata, mu = $\hat{\theta}$ )$statistic
7 if ( $\hat{\theta^*} \le \hat{\theta} $ ) count++
8 }
9 count/1000
10 }
The part I missed was that the $\theta_0$ was "used" in line 2 (where we set the reference $\hat{\theta}$).
It is interesting to note, that in the line 2 and 6 we could equally easily use p.value instead of statistic. In that case we should also change the $\le$ into $\ge$ in line 7. | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing? | OK, I've got it. Thank you, StasK, for such a good answer. I'll keep it accepted for others to learn, but in my particular case I was missing a very simple fact:
The procedure of bootstrap in accordan | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing?
OK, I've got it. Thank you, StasK, for such a good answer. I'll keep it accepted for others to learn, but in my particular case I was missing a very simple fact:
The procedure of bootstrap in accordance to Hall&Wilson guidelines for simple one-sampled mean test is this (in R-inspired pseudo code):
1function(data, $\theta_0$ ) {
2 $\hat{\theta} \leftarrow $ t.test(data, mu = $\theta_0$ )$statistic
3 count $\leftarrow 0$
4for(i in 1:1000){
5 bdata $\leftarrow$ sample(data)
6 $\hat{\theta^*} \leftarrow $ t.test(bdata, mu = $\hat{\theta}$ )$statistic
7 if ( $\hat{\theta^*} \le \hat{\theta} $ ) count++
8 }
9 count/1000
10 }
The part I missed was that the $\theta_0$ was "used" in line 2 (where we set the reference $\hat{\theta}$).
It is interesting to note, that in the line 2 and 6 we could equally easily use p.value instead of statistic. In that case we should also change the $\le$ into $\ge$ in line 7. | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing?
OK, I've got it. Thank you, StasK, for such a good answer. I'll keep it accepted for others to learn, but in my particular case I was missing a very simple fact:
The procedure of bootstrap in accordan |
19,040 | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing? | Based on the paper and hall-pass's comment, this is how I understood the code in R..
I'm not completely confident I have this correct.
time = c(14,18,11,13,18,17,21,9,16,17,14,15,
12,12,14,13,6,18,14,16,10,7,15,10)
group=c(rep(1:2, each=12))
sleep = data.frame(time, group)
Mean= tapply(X=sleep$time, INDEX=sleep$group, mean)
t0 = (Mean[1] - Mean[2]) / (sqrt(var(subset(sleep, group == 1)$time) / nrow(subset(sleep, group == 1))))
require(boot)
diff = function(d1,i){
d = d1[i,]
(mean(d$time) - Mean[1]) / (sqrt(var(d$time) / nrow(d)))
}
set.seed(1234)
b3 = boot(data = subset(sleep, group == 1), statistic = diff, R = 10000)
pvalue = mean(b3$t > t0)
pvalue | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing? | Based on the paper and hall-pass's comment, this is how I understood the code in R..
I'm not completely confident I have this correct.
time = c(14,18,11,13,18,17,21,9,16,17,14,15,
12,12,14,13 | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing?
Based on the paper and hall-pass's comment, this is how I understood the code in R..
I'm not completely confident I have this correct.
time = c(14,18,11,13,18,17,21,9,16,17,14,15,
12,12,14,13,6,18,14,16,10,7,15,10)
group=c(rep(1:2, each=12))
sleep = data.frame(time, group)
Mean= tapply(X=sleep$time, INDEX=sleep$group, mean)
t0 = (Mean[1] - Mean[2]) / (sqrt(var(subset(sleep, group == 1)$time) / nrow(subset(sleep, group == 1))))
require(boot)
diff = function(d1,i){
d = d1[i,]
(mean(d$time) - Mean[1]) / (sqrt(var(d$time) / nrow(d)))
}
set.seed(1234)
b3 = boot(data = subset(sleep, group == 1), statistic = diff, R = 10000)
pvalue = mean(b3$t > t0)
pvalue | Why the data should be resampled under null hypothesis in bootstrap hypothesis testing?
Based on the paper and hall-pass's comment, this is how I understood the code in R..
I'm not completely confident I have this correct.
time = c(14,18,11,13,18,17,21,9,16,17,14,15,
12,12,14,13 |
19,041 | How to get real-valued continous output from Neural Network? | 1. Should I still scale the input features using feature scaling? What range?
Scaling does not make anything worse. Read this answer from Sarle's neural network FAQ: Subject: Should I normalize/standardize/rescale the data? .
2. What transformation function should I use in place of the sigmoid?
You could use logistic sigmoid or tanh as activation function. That doesn't matter. You don't have to change the learning algorithm. You just have to scale the outputs of your training set down to the range of the output layer activation function ($[0,1]$ or $[-1,1]$) and when you trained your network, you have to scale the output of your network to $[-5,5]$. You really don't have to change anything else. | How to get real-valued continous output from Neural Network? | 1. Should I still scale the input features using feature scaling? What range?
Scaling does not make anything worse. Read this answer from Sarle's neural network FAQ: Subject: Should I normalize/standa | How to get real-valued continous output from Neural Network?
1. Should I still scale the input features using feature scaling? What range?
Scaling does not make anything worse. Read this answer from Sarle's neural network FAQ: Subject: Should I normalize/standardize/rescale the data? .
2. What transformation function should I use in place of the sigmoid?
You could use logistic sigmoid or tanh as activation function. That doesn't matter. You don't have to change the learning algorithm. You just have to scale the outputs of your training set down to the range of the output layer activation function ($[0,1]$ or $[-1,1]$) and when you trained your network, you have to scale the output of your network to $[-5,5]$. You really don't have to change anything else. | How to get real-valued continous output from Neural Network?
1. Should I still scale the input features using feature scaling? What range?
Scaling does not make anything worse. Read this answer from Sarle's neural network FAQ: Subject: Should I normalize/standa |
19,042 | How to get real-valued continous output from Neural Network? | Disclaimer: the approach presented is not feasible for continuous values, but I do believe bears some weight in decision making for the project
Smarty77 brings up a good point about utilizing a rescaled sigmoid function. Inherently, the sigmoid function produces a probability, which describes a sampling success rate (ie 95 out of 100 photos with these features are successfully 'dog'). The final outcome described is a binary one, and the training, using 'binary cross-entropy' describes a process of separating diametrically opposed outcomes, which inherently discourages results in the middle-range. The continuum of the output is merely there for scaling based on number of samples (ie a result of 0.9761 means that 9761 out of 10000 samples displaying those or similar triats are 'dog'), but each result itself must still be considered to be binary and not arbitrarily granular. As such, it should not be mistaken for and applied as one would real numbers and may not be applicable here. Though I am not sure of the utilization of the network, I would normalize the output vector w.r.t. itself. This can be done with softmax. This will also require there to be 11 linear outputs (bins) from the network (one for each output -5 to +5), one for each class. It will provide an assurance value for any one 'bin' being the correct answer. This architecture would be trainable with one-hot encoding, with the 1 indicating the correct bin. The result is interpretable then in a manner of ways, like a greedy strategy or probabilistic sampling.
However, to recast it into a continuous variable, the assuredness of each index can be used as a weight to place a marker on a number-line (similar to the behavior of the sigmoid unit), but this also highlights the primary issue: if the network is fairly certain the result is -2 or +3, but absolutely certain that it is not anything else, is +1 a viable result? Thank you for your consideration. Good luck on your project. | How to get real-valued continous output from Neural Network? | Disclaimer: the approach presented is not feasible for continuous values, but I do believe bears some weight in decision making for the project
Smarty77 brings up a good point about utilizing a rescal | How to get real-valued continous output from Neural Network?
Disclaimer: the approach presented is not feasible for continuous values, but I do believe bears some weight in decision making for the project
Smarty77 brings up a good point about utilizing a rescaled sigmoid function. Inherently, the sigmoid function produces a probability, which describes a sampling success rate (ie 95 out of 100 photos with these features are successfully 'dog'). The final outcome described is a binary one, and the training, using 'binary cross-entropy' describes a process of separating diametrically opposed outcomes, which inherently discourages results in the middle-range. The continuum of the output is merely there for scaling based on number of samples (ie a result of 0.9761 means that 9761 out of 10000 samples displaying those or similar triats are 'dog'), but each result itself must still be considered to be binary and not arbitrarily granular. As such, it should not be mistaken for and applied as one would real numbers and may not be applicable here. Though I am not sure of the utilization of the network, I would normalize the output vector w.r.t. itself. This can be done with softmax. This will also require there to be 11 linear outputs (bins) from the network (one for each output -5 to +5), one for each class. It will provide an assurance value for any one 'bin' being the correct answer. This architecture would be trainable with one-hot encoding, with the 1 indicating the correct bin. The result is interpretable then in a manner of ways, like a greedy strategy or probabilistic sampling.
However, to recast it into a continuous variable, the assuredness of each index can be used as a weight to place a marker on a number-line (similar to the behavior of the sigmoid unit), but this also highlights the primary issue: if the network is fairly certain the result is -2 or +3, but absolutely certain that it is not anything else, is +1 a viable result? Thank you for your consideration. Good luck on your project. | How to get real-valued continous output from Neural Network?
Disclaimer: the approach presented is not feasible for continuous values, but I do believe bears some weight in decision making for the project
Smarty77 brings up a good point about utilizing a rescal |
19,043 | Why it is often assumed Gaussian distribution? | At least for me, the assumption of normality arises from two (very powerfull) reasons:
The Central Limit Theorem.
The Gaussian distribution is a maximum entropy (with respect to the continuous version of Shannon's entropy) distribution.
I think you are aware of the first point: if your sample is the sum of many procceses, then as long as some mild conditions are satisfied, the distribution is pretty much gaussian (there are generalizations of the CLT where you in fact don't have to assume that the r.v.s of the sum are identically distributed, see, e.g., the Lyapunov CLT).
The second point is one that for some people (specially physicists) make more sense: given the first and second moments of a distribution, the distribution which less information assumes (i.e. the most conservative) with respect to the continuous Shannon's entropy measure (which is somewhat arbitrary on the continuous case, but, at least for me, totally objective in the discrete case, but that's other story), is the gaussian distribution. This is a form of the so called "maximum entropy principle", which is not so widespread because the actual usage of the form of the entropy is somewhat arbitrary (see this Wikipedia article for more information about this measure).
Of course, this last statement is true also for the multi-variate case, i.e., the maximum entropy distribution (again, with respect to the continuous version of Shannon's entropy) given first ($\vec{\mu}$) and second order information (i.e., the covariance matrix $\mathbf{\Sigma}$), can be shown to be a multivariate gaussian.
PD: I must add to the maximum entropy principle that, according to this paper, if you happen to known the range of variation of your variable, you have to make adjustments to the distribution you get by the maximum entropy principle. | Why it is often assumed Gaussian distribution? | At least for me, the assumption of normality arises from two (very powerfull) reasons:
The Central Limit Theorem.
The Gaussian distribution is a maximum entropy (with respect to the continuous versio | Why it is often assumed Gaussian distribution?
At least for me, the assumption of normality arises from two (very powerfull) reasons:
The Central Limit Theorem.
The Gaussian distribution is a maximum entropy (with respect to the continuous version of Shannon's entropy) distribution.
I think you are aware of the first point: if your sample is the sum of many procceses, then as long as some mild conditions are satisfied, the distribution is pretty much gaussian (there are generalizations of the CLT where you in fact don't have to assume that the r.v.s of the sum are identically distributed, see, e.g., the Lyapunov CLT).
The second point is one that for some people (specially physicists) make more sense: given the first and second moments of a distribution, the distribution which less information assumes (i.e. the most conservative) with respect to the continuous Shannon's entropy measure (which is somewhat arbitrary on the continuous case, but, at least for me, totally objective in the discrete case, but that's other story), is the gaussian distribution. This is a form of the so called "maximum entropy principle", which is not so widespread because the actual usage of the form of the entropy is somewhat arbitrary (see this Wikipedia article for more information about this measure).
Of course, this last statement is true also for the multi-variate case, i.e., the maximum entropy distribution (again, with respect to the continuous version of Shannon's entropy) given first ($\vec{\mu}$) and second order information (i.e., the covariance matrix $\mathbf{\Sigma}$), can be shown to be a multivariate gaussian.
PD: I must add to the maximum entropy principle that, according to this paper, if you happen to known the range of variation of your variable, you have to make adjustments to the distribution you get by the maximum entropy principle. | Why it is often assumed Gaussian distribution?
At least for me, the assumption of normality arises from two (very powerfull) reasons:
The Central Limit Theorem.
The Gaussian distribution is a maximum entropy (with respect to the continuous versio |
19,044 | Why it is often assumed Gaussian distribution? | The use of the CLT for justifying the use of the Gaussian distribution is a common fallacy because the CLT is applied to the sample mean, not to individual observations. Therefore, increasing your sample size, does not mean that the sample is closer to normallity.
The Gaussian distribution is commonly used because:
Maximum likelihood estimation is straightforward.
Bayesian inference is simple (using conjugate priors or Jeffreys-type priors).
It is implemented in most of the numerical packages.
There is a lot of theory about this distribution in terms of hypothesis testing.
Lack of knowledge about other options (more flexible).
...
Of course, the best option is to use a distribution that takes into account the characteristics of your context, but this can be challenging. However, is something that people should do
"Everything should be made as simple as possible, but not simpler." (Albert Einstein)
I hope this helps.
Best wishes. | Why it is often assumed Gaussian distribution? | The use of the CLT for justifying the use of the Gaussian distribution is a common fallacy because the CLT is applied to the sample mean, not to individual observations. Therefore, increasing your sam | Why it is often assumed Gaussian distribution?
The use of the CLT for justifying the use of the Gaussian distribution is a common fallacy because the CLT is applied to the sample mean, not to individual observations. Therefore, increasing your sample size, does not mean that the sample is closer to normallity.
The Gaussian distribution is commonly used because:
Maximum likelihood estimation is straightforward.
Bayesian inference is simple (using conjugate priors or Jeffreys-type priors).
It is implemented in most of the numerical packages.
There is a lot of theory about this distribution in terms of hypothesis testing.
Lack of knowledge about other options (more flexible).
...
Of course, the best option is to use a distribution that takes into account the characteristics of your context, but this can be challenging. However, is something that people should do
"Everything should be made as simple as possible, but not simpler." (Albert Einstein)
I hope this helps.
Best wishes. | Why it is often assumed Gaussian distribution?
The use of the CLT for justifying the use of the Gaussian distribution is a common fallacy because the CLT is applied to the sample mean, not to individual observations. Therefore, increasing your sam |
19,045 | Why it is often assumed Gaussian distribution? | My answer agrees with the first responder. The central limit theorem tells you that if your statistic is a sum or average it will be approximately normal under certain technical conditions regardless of the distribution of the individual samples. But you are right that sometimes people carry this too far just because it seems convenuent. If your statistic is a ratio and the denominator can be zero or close to it the ratio will be too heavytailed for the normal. Gosset found that even when you sample from a normal distribution a normalized average where the sample standard deviation is used for the normalization constant the distribution is the t distribution with n-1 degrees of freedom when n is the sample size. In his field experiments at the Guiness Brewery he has sample sizes that could be in the range of 5-10. In those cases the t distribution is similar to the standard normal distribution in that it is symmetric about 0 but it has much heavier tails. Note that the t distribution does converge to the standard normal as n gets large.
In many cases the distribution you have might be bimodal as it is a mixture of two populations. Some times these distributions can be fit as a mixture of normal distributions. But they certain do not look like a normal distribution. If you look at a basic statistics textbook you will find many parametric continuous and discrete distributions that often come up in inference problems. For discrete data we have the binomial, Poisson, geometric, hypergeometric and negative binomial to name a few. Continous examples include the chi square, lognormal, Cauchy, negative exponential, Weibull and Gumbel. | Why it is often assumed Gaussian distribution? | My answer agrees with the first responder. The central limit theorem tells you that if your statistic is a sum or average it will be approximately normal under certain technical conditions regardless | Why it is often assumed Gaussian distribution?
My answer agrees with the first responder. The central limit theorem tells you that if your statistic is a sum or average it will be approximately normal under certain technical conditions regardless of the distribution of the individual samples. But you are right that sometimes people carry this too far just because it seems convenuent. If your statistic is a ratio and the denominator can be zero or close to it the ratio will be too heavytailed for the normal. Gosset found that even when you sample from a normal distribution a normalized average where the sample standard deviation is used for the normalization constant the distribution is the t distribution with n-1 degrees of freedom when n is the sample size. In his field experiments at the Guiness Brewery he has sample sizes that could be in the range of 5-10. In those cases the t distribution is similar to the standard normal distribution in that it is symmetric about 0 but it has much heavier tails. Note that the t distribution does converge to the standard normal as n gets large.
In many cases the distribution you have might be bimodal as it is a mixture of two populations. Some times these distributions can be fit as a mixture of normal distributions. But they certain do not look like a normal distribution. If you look at a basic statistics textbook you will find many parametric continuous and discrete distributions that often come up in inference problems. For discrete data we have the binomial, Poisson, geometric, hypergeometric and negative binomial to name a few. Continous examples include the chi square, lognormal, Cauchy, negative exponential, Weibull and Gumbel. | Why it is often assumed Gaussian distribution?
My answer agrees with the first responder. The central limit theorem tells you that if your statistic is a sum or average it will be approximately normal under certain technical conditions regardless |
19,046 | Tobit model explanation | The wiki describes the Tobit model as follows:
$$y_i = \begin{cases} y_i^* &\text{if} \quad y_i^* > 0 \\
\ 0 &\text{if} \quad y_i^* \le 0 \end{cases}$$
$$y_i^* = \beta x_i + u_i$$
$$u_i \sim N(0,\sigma^2)$$
I will adapt the above model with to your context and offer a plain english interpretation of the equations which may be helpful.
$$y_i = \begin{cases}\ y_i^* &\text{if} \quad y_i^* \le 30 \\
30 &\text{if} \quad y_i^* > 30 \end{cases}$$
$$y_i^* = \beta x_i + u_i$$
$$u_i \sim N(0,\sigma^2)$$
In the above set of equations, $y_i^*$ represents a subject's ability. Thus, the first set of equations state the following:
Our measurements of ability is cut-off on the higher side at 30 (i.e., we capture the ceiling effect). In other words, if a person's ability is greater than 30 then our measurement instrument fails to record the actual value but instead records 30 for that person. Note that the model states $y_i = 30 \quad \text{if} \quad y_i^* > 30$.
If on the other hand a person's ability is less than 30 then our measurement instrument is capable of recording the actual measurement. Note that the model states $y_i = y_i^* \quad \text{if} \quad y_i^* \le 30$.
We model the ability, $y_i^*$, as a linear function of our covariates $x_i$ and an associated error term to capture noise.
I hope that is helpful. If some aspect is not clear feel free to ask in the comments. | Tobit model explanation | The wiki describes the Tobit model as follows:
$$y_i = \begin{cases} y_i^* &\text{if} \quad y_i^* > 0 \\
\ 0 &\text{if} \quad y_i^* \le 0 \end{cases}$$
$$y_i^* = \beta x_ | Tobit model explanation
The wiki describes the Tobit model as follows:
$$y_i = \begin{cases} y_i^* &\text{if} \quad y_i^* > 0 \\
\ 0 &\text{if} \quad y_i^* \le 0 \end{cases}$$
$$y_i^* = \beta x_i + u_i$$
$$u_i \sim N(0,\sigma^2)$$
I will adapt the above model with to your context and offer a plain english interpretation of the equations which may be helpful.
$$y_i = \begin{cases}\ y_i^* &\text{if} \quad y_i^* \le 30 \\
30 &\text{if} \quad y_i^* > 30 \end{cases}$$
$$y_i^* = \beta x_i + u_i$$
$$u_i \sim N(0,\sigma^2)$$
In the above set of equations, $y_i^*$ represents a subject's ability. Thus, the first set of equations state the following:
Our measurements of ability is cut-off on the higher side at 30 (i.e., we capture the ceiling effect). In other words, if a person's ability is greater than 30 then our measurement instrument fails to record the actual value but instead records 30 for that person. Note that the model states $y_i = 30 \quad \text{if} \quad y_i^* > 30$.
If on the other hand a person's ability is less than 30 then our measurement instrument is capable of recording the actual measurement. Note that the model states $y_i = y_i^* \quad \text{if} \quad y_i^* \le 30$.
We model the ability, $y_i^*$, as a linear function of our covariates $x_i$ and an associated error term to capture noise.
I hope that is helpful. If some aspect is not clear feel free to ask in the comments. | Tobit model explanation
The wiki describes the Tobit model as follows:
$$y_i = \begin{cases} y_i^* &\text{if} \quad y_i^* > 0 \\
\ 0 &\text{if} \quad y_i^* \le 0 \end{cases}$$
$$y_i^* = \beta x_ |
19,047 | Tobit model explanation | There's an article by Berk in the 1983 edition of American Sociological Review (3rd issue) - that's how I learned about censoring. The explanation is specifically about selection bias but is absolutely relevant to your issue. Selection bias as Berk discusses is just censoring via the sample selection process, in your case the censoring is a result of an insensitive instrument. There's some nice charts that show you exactly how you can expect your regression line to be biased when Y is censored in different ways. In general the article is logical and intuitive rather than mathematical (yes I treat them as separate, preferring the former). Tobit is discussed as one solution to the problem.
More generally, it sounds like tobit is the right tool for the job at hand. Basically, the way it works is by estimating the probability of being censored and then incorporating that into the equation predicting the score. There is another approach proposed by Heckman using probit and the inverse mills' ratio which is basically the same thing but allows you to have different variables predicting the likelihood of censoring and the score on the test - obviously that would not be apposite for the situation you have.
One other recommendation - you might consider a hierarchical tobit model where observations are nested within individuals. This would correctly account for the tendency for errors to be associated within individuals. Or if you don't use a hierarchical model, at least be sure to adjust your standard errors for the clustering of the observations within individuals. I know this all can be done in Stata and am confident R with all its versatility can do it too.. but as an avid Stata user I can't provide you with any guidance about how to go about it in R. | Tobit model explanation | There's an article by Berk in the 1983 edition of American Sociological Review (3rd issue) - that's how I learned about censoring. The explanation is specifically about selection bias but is absolute | Tobit model explanation
There's an article by Berk in the 1983 edition of American Sociological Review (3rd issue) - that's how I learned about censoring. The explanation is specifically about selection bias but is absolutely relevant to your issue. Selection bias as Berk discusses is just censoring via the sample selection process, in your case the censoring is a result of an insensitive instrument. There's some nice charts that show you exactly how you can expect your regression line to be biased when Y is censored in different ways. In general the article is logical and intuitive rather than mathematical (yes I treat them as separate, preferring the former). Tobit is discussed as one solution to the problem.
More generally, it sounds like tobit is the right tool for the job at hand. Basically, the way it works is by estimating the probability of being censored and then incorporating that into the equation predicting the score. There is another approach proposed by Heckman using probit and the inverse mills' ratio which is basically the same thing but allows you to have different variables predicting the likelihood of censoring and the score on the test - obviously that would not be apposite for the situation you have.
One other recommendation - you might consider a hierarchical tobit model where observations are nested within individuals. This would correctly account for the tendency for errors to be associated within individuals. Or if you don't use a hierarchical model, at least be sure to adjust your standard errors for the clustering of the observations within individuals. I know this all can be done in Stata and am confident R with all its versatility can do it too.. but as an avid Stata user I can't provide you with any guidance about how to go about it in R. | Tobit model explanation
There's an article by Berk in the 1983 edition of American Sociological Review (3rd issue) - that's how I learned about censoring. The explanation is specifically about selection bias but is absolute |
19,048 | Sane stepwise regression? | I would not recommend you use that procedure. My recommendation is: Abandon this project. Just give up and walk away. You have no hope of this working.
source for image
Setting aside the standard problems with stepwise selection (cf., here), in your case you are very likely to have perfect predictions due to separation in such a high-dimensional space.
I don't have specifics on your situation, but you state that you have "only a few 10s of samples". Let's be charitable and say you have 90. You further say you have "several thousand features". Let's imagine that you 'only' have 2,000. For the sake of simplicity, let's say that all your features are binary. You "believe that the class label can be accurately predicted using only a few features", let's say that you will look for sets of up to only 9 features max. Lastly, let's imagine that the relationship is deterministic, so that the true relationship will always be perfectly present in your data. (We can change these numbers and assumptions, but that should only make the problem worse.) Now, how well would you be able to recover that relationship under these (generous) conditions? That is, how often would the correct set be the only set that yields perfect accuracy? Or, put another way, how many sets of nine features will also fit by chance alone?
Some (overly) simple math and simulations should provide some clues to this question. First, with 9 variables, each of which could be 0 or 1, the number of patterns an observation could show are $2^9 = 512$, but you will have only 90 observations. Thus it is entirely possible that, for a given set of 9 binary variables, every observation has a different set of predictor values—there are no replicates. Without replicates with the same predictor values where some have y=0 and some y=1, you will have complete separation and perfect prediction of every observation will be possible.
Below, I have a simulation (coded in R) to see how often you might have no patterns of x-values with both 0s and 1s. The way it works is that I get a set of numbers from 1 to 512, which represent the possible patterns, and see if any of the patterns in the first 45 (that might be the 0s) match any of the pattern in the second 45 (that might be the 1s). This assumes that you have perfectly balanced response data, which gives you the best possible protection against this problem. Note that having some replicated x-vectors with differing y-values doesn't really get you out of the woods, it just means you wouldn't be able to perfectly predict every single observation in your dataset, which is the very stringent standard I'm using here.
set.seed(7938) # this makes the simulation exactly reproducible
my.fun = function(){
x = sample.int(512, size=90, replace=TRUE)
return(sum(x[1:45]%in%x[46:90])==0)
}
n.unique = replicate(10000, my.fun())
mean(n.unique) # [1] 0.0181
The simulation suggests you would have this issue with approximately 1.8% of the sets of 9 x-variables. Now, how many sets of 9 are there? Strictly, that would be $1991 \text{ choose } 9 = 1.3\times 10^{24}$ (since we've stipulated that the true 9 deterministic causal variables are in your set). However, many of those sets will be overlapping; there will be $1991 / 9 \approx 221$ non-overlapping sets of 9 within a specified partition of your variables (with many such partitions possible). Thus, within some given partition, we might expect there would be $221\times 0.018\approx 4$ sets of 9 x-variables that will perfectly predict every observation in your dataset.
Note that these results are only for cases where you have a relatively larger dataset (within the "tens"), a relatively smaller number of variables (within the "thousands"), only looks for cases where every single observation can be predicted perfectly (there will be many more sets that are nearly perfect), etc. Your actual case is unlikely to work out 'this well'. Moreover, we stipulated that the relationship is perfectly deterministic. What would happen if there is some random noise in the relationship? In that case, you will still have ~4 (null) sets that perfectly predict your data, but the right set may well not be among them.
Tl;dr, the basic point here is that your set of variables is way too large / high dimensional, and your amount of data is way too small, for anything to be possible. If it's really true that you have "tens" of samples, "thousands" of variables, and absolutely no earthly idea which variables might be right, you have no hope of getting anywhere with any procedure. Go do something else with your time. | Sane stepwise regression? | I would not recommend you use that procedure. My recommendation is: Abandon this project. Just give up and walk away. You have no hope of this working.
source for image
Setting aside the standar | Sane stepwise regression?
I would not recommend you use that procedure. My recommendation is: Abandon this project. Just give up and walk away. You have no hope of this working.
source for image
Setting aside the standard problems with stepwise selection (cf., here), in your case you are very likely to have perfect predictions due to separation in such a high-dimensional space.
I don't have specifics on your situation, but you state that you have "only a few 10s of samples". Let's be charitable and say you have 90. You further say you have "several thousand features". Let's imagine that you 'only' have 2,000. For the sake of simplicity, let's say that all your features are binary. You "believe that the class label can be accurately predicted using only a few features", let's say that you will look for sets of up to only 9 features max. Lastly, let's imagine that the relationship is deterministic, so that the true relationship will always be perfectly present in your data. (We can change these numbers and assumptions, but that should only make the problem worse.) Now, how well would you be able to recover that relationship under these (generous) conditions? That is, how often would the correct set be the only set that yields perfect accuracy? Or, put another way, how many sets of nine features will also fit by chance alone?
Some (overly) simple math and simulations should provide some clues to this question. First, with 9 variables, each of which could be 0 or 1, the number of patterns an observation could show are $2^9 = 512$, but you will have only 90 observations. Thus it is entirely possible that, for a given set of 9 binary variables, every observation has a different set of predictor values—there are no replicates. Without replicates with the same predictor values where some have y=0 and some y=1, you will have complete separation and perfect prediction of every observation will be possible.
Below, I have a simulation (coded in R) to see how often you might have no patterns of x-values with both 0s and 1s. The way it works is that I get a set of numbers from 1 to 512, which represent the possible patterns, and see if any of the patterns in the first 45 (that might be the 0s) match any of the pattern in the second 45 (that might be the 1s). This assumes that you have perfectly balanced response data, which gives you the best possible protection against this problem. Note that having some replicated x-vectors with differing y-values doesn't really get you out of the woods, it just means you wouldn't be able to perfectly predict every single observation in your dataset, which is the very stringent standard I'm using here.
set.seed(7938) # this makes the simulation exactly reproducible
my.fun = function(){
x = sample.int(512, size=90, replace=TRUE)
return(sum(x[1:45]%in%x[46:90])==0)
}
n.unique = replicate(10000, my.fun())
mean(n.unique) # [1] 0.0181
The simulation suggests you would have this issue with approximately 1.8% of the sets of 9 x-variables. Now, how many sets of 9 are there? Strictly, that would be $1991 \text{ choose } 9 = 1.3\times 10^{24}$ (since we've stipulated that the true 9 deterministic causal variables are in your set). However, many of those sets will be overlapping; there will be $1991 / 9 \approx 221$ non-overlapping sets of 9 within a specified partition of your variables (with many such partitions possible). Thus, within some given partition, we might expect there would be $221\times 0.018\approx 4$ sets of 9 x-variables that will perfectly predict every observation in your dataset.
Note that these results are only for cases where you have a relatively larger dataset (within the "tens"), a relatively smaller number of variables (within the "thousands"), only looks for cases where every single observation can be predicted perfectly (there will be many more sets that are nearly perfect), etc. Your actual case is unlikely to work out 'this well'. Moreover, we stipulated that the relationship is perfectly deterministic. What would happen if there is some random noise in the relationship? In that case, you will still have ~4 (null) sets that perfectly predict your data, but the right set may well not be among them.
Tl;dr, the basic point here is that your set of variables is way too large / high dimensional, and your amount of data is way too small, for anything to be possible. If it's really true that you have "tens" of samples, "thousands" of variables, and absolutely no earthly idea which variables might be right, you have no hope of getting anywhere with any procedure. Go do something else with your time. | Sane stepwise regression?
I would not recommend you use that procedure. My recommendation is: Abandon this project. Just give up and walk away. You have no hope of this working.
source for image
Setting aside the standar |
19,049 | Sane stepwise regression? | For the purposes of my answer, I will denote the binary variable of interest as $Y_i \text{ ;}(i=1,\dots,n)$ and the predictors $X_{ij} \text{ ;} (j=1,\dots,p)$ and assume that $Y$ has values of $Y=0$ and $Y=1$. It will also be convenient to define $\gamma_m$ to indicate the model $m \text{ ;}(m=1,..,M)$, such that $\gamma_m^TX_{ij}$ is equal to $X_{ij}$ if the jth variable is in the mth model, and $0$ otherwise.
I would make a modification to your method, and give a rationale. You are using a classifier model, which means you want to predict the value of a categorical variable into the future - so you should really be defining a prediction rule (given a new set of predictors $X_{j}$, how will you predict whether $Y=1$ or $Y=0$).
So I would suggest evaluating the prediction directly, rather than the likelihood ratio. However, the observation predicted should not be included in the estimation of the model (because this is exactly the situation you will face when actually using your model). So have a new step 1) (bold is my suggested change).
1) Given the features already in the model (or just the intercept on the first iteration), select the feature that produces the best predictions when added to the model.
Now you need to decide
what you want "best" to mean mathematically
how to split your data into "fitting" and "predicting" parts
I will make a suggestion for each:
An intuitive definition for a "good" classifier (and also computationally simple) is the proportion of correct classifications it makes. However, you may have some additional knowledge of the specific consequences of making a correct or incorrect classification (e.g. predicting correctly when $Y=1$ is twice as important than when $Y=0$). In this case you should incorporate this knowledge into the definition of "good". But for the equations in my answer I will use $F=\frac{C}{C+I}$ as the criterion ($F$="fraction" or "frequency" $C$="correct" $I$="incorrect")
Because you don't have a lot of data, you need as much as possible to fit the model, so a simple drop one jacknife procedure can be used. You leave observation $1$ out, fit the model with observations $2,\dots,n$, and use this to predict observation $1$. Then you leave observation $2$ out, fit the model with observations $1,3,\dots,n$, and use this to predict observation $2$; and so on until each observation has been "left out" and predicted. You will then have $n$ predictions, and you can now calculate $F=\frac{C}{n}$, the fraction of correctly predicted values for the particular model. Subscript this for the particular model $F_m$.
You would then calculate $F_m$ for each model $(m=1,\dots,M)$, and pick the model which predicts the best $m=\text{argmax}_{m\in M} F_m$. Note that the good thing about the above method is that you do not need to worry about how many variables are in your model or how correlated these variables are (unless it makes it impossible to actually fit the model). This is because the model is fit separately to the prediction, so bias due to over-fitting, or degradation due to numerical instability will show up in the poorer predictions.
In a step-wise situation it is done sequentially, so at the $sth$ you have $M_s=p+1$ models to choose between: one each for "removing" each $X_{j}$ which is in the model, one for "adding" each $X_{j}$ which is not in the model, and one for keeping the model unchanged (you stop the procedure when you choose this model, and this is your final model). If there is a tie, you need an additional criteria to split the winners (or you could let you algorithm "branch" off, and see where each "branch" ends up, then take the "branch" which had the best predictions at its final step)
Step-wise can be risky because you may find "local maximums" instead of "global maximums", especially because you have such a large number of predictors (this is a big "space" to optimise over, and is probably multi-modal - meaning there are many "best" models)
The good thing about this is that the model you choose has a clear, directly relevant interpretation: The model which predicted the highest proportion of results correctly, out of the alternatives considered. And you have a clear measure of exactly how good your binary classifier is (it classified $100F$ percent correctly).
I think you will find this a lot easier to justify your choice of final model to a non-statistician, rather than trying to explain why the p-value indicates the model is good.
And for hypothesis testing, you can declare any effect remaining in your final model as "significant" in that the relationships contained in this model we able to re-produce the data ($Y$) the most effectively.
Two final remarks:
You could also use this machinery to decide if step-wise is better than forward selection (only add variables) or backward selection (start from full model, and only remove variables).
You could fit the full model (or any model with $p\geq n$) by "ridging" the model, which amounts to adding a small number to the diagonal elements of the $X^TX$ matrix, or $X^TWX$ for GLMs before inverting when calculating your betas, to give $(X^TX+\lambda I)^{-1}X^TY$ or $(X^TWX+\lambda I)^{-1}X^TWY$. Basically, $\lambda$ constrains the sum of squares of the betas to be less than a particular value, increasing the value of $\lambda$ decreases this constraint (which is a "smooth" model selection procedure in its own right, if you think about it). | Sane stepwise regression? | For the purposes of my answer, I will denote the binary variable of interest as $Y_i \text{ ;}(i=1,\dots,n)$ and the predictors $X_{ij} \text{ ;} (j=1,\dots,p)$ and assume that $Y$ has values of $Y= | Sane stepwise regression?
For the purposes of my answer, I will denote the binary variable of interest as $Y_i \text{ ;}(i=1,\dots,n)$ and the predictors $X_{ij} \text{ ;} (j=1,\dots,p)$ and assume that $Y$ has values of $Y=0$ and $Y=1$. It will also be convenient to define $\gamma_m$ to indicate the model $m \text{ ;}(m=1,..,M)$, such that $\gamma_m^TX_{ij}$ is equal to $X_{ij}$ if the jth variable is in the mth model, and $0$ otherwise.
I would make a modification to your method, and give a rationale. You are using a classifier model, which means you want to predict the value of a categorical variable into the future - so you should really be defining a prediction rule (given a new set of predictors $X_{j}$, how will you predict whether $Y=1$ or $Y=0$).
So I would suggest evaluating the prediction directly, rather than the likelihood ratio. However, the observation predicted should not be included in the estimation of the model (because this is exactly the situation you will face when actually using your model). So have a new step 1) (bold is my suggested change).
1) Given the features already in the model (or just the intercept on the first iteration), select the feature that produces the best predictions when added to the model.
Now you need to decide
what you want "best" to mean mathematically
how to split your data into "fitting" and "predicting" parts
I will make a suggestion for each:
An intuitive definition for a "good" classifier (and also computationally simple) is the proportion of correct classifications it makes. However, you may have some additional knowledge of the specific consequences of making a correct or incorrect classification (e.g. predicting correctly when $Y=1$ is twice as important than when $Y=0$). In this case you should incorporate this knowledge into the definition of "good". But for the equations in my answer I will use $F=\frac{C}{C+I}$ as the criterion ($F$="fraction" or "frequency" $C$="correct" $I$="incorrect")
Because you don't have a lot of data, you need as much as possible to fit the model, so a simple drop one jacknife procedure can be used. You leave observation $1$ out, fit the model with observations $2,\dots,n$, and use this to predict observation $1$. Then you leave observation $2$ out, fit the model with observations $1,3,\dots,n$, and use this to predict observation $2$; and so on until each observation has been "left out" and predicted. You will then have $n$ predictions, and you can now calculate $F=\frac{C}{n}$, the fraction of correctly predicted values for the particular model. Subscript this for the particular model $F_m$.
You would then calculate $F_m$ for each model $(m=1,\dots,M)$, and pick the model which predicts the best $m=\text{argmax}_{m\in M} F_m$. Note that the good thing about the above method is that you do not need to worry about how many variables are in your model or how correlated these variables are (unless it makes it impossible to actually fit the model). This is because the model is fit separately to the prediction, so bias due to over-fitting, or degradation due to numerical instability will show up in the poorer predictions.
In a step-wise situation it is done sequentially, so at the $sth$ you have $M_s=p+1$ models to choose between: one each for "removing" each $X_{j}$ which is in the model, one for "adding" each $X_{j}$ which is not in the model, and one for keeping the model unchanged (you stop the procedure when you choose this model, and this is your final model). If there is a tie, you need an additional criteria to split the winners (or you could let you algorithm "branch" off, and see where each "branch" ends up, then take the "branch" which had the best predictions at its final step)
Step-wise can be risky because you may find "local maximums" instead of "global maximums", especially because you have such a large number of predictors (this is a big "space" to optimise over, and is probably multi-modal - meaning there are many "best" models)
The good thing about this is that the model you choose has a clear, directly relevant interpretation: The model which predicted the highest proportion of results correctly, out of the alternatives considered. And you have a clear measure of exactly how good your binary classifier is (it classified $100F$ percent correctly).
I think you will find this a lot easier to justify your choice of final model to a non-statistician, rather than trying to explain why the p-value indicates the model is good.
And for hypothesis testing, you can declare any effect remaining in your final model as "significant" in that the relationships contained in this model we able to re-produce the data ($Y$) the most effectively.
Two final remarks:
You could also use this machinery to decide if step-wise is better than forward selection (only add variables) or backward selection (start from full model, and only remove variables).
You could fit the full model (or any model with $p\geq n$) by "ridging" the model, which amounts to adding a small number to the diagonal elements of the $X^TX$ matrix, or $X^TWX$ for GLMs before inverting when calculating your betas, to give $(X^TX+\lambda I)^{-1}X^TY$ or $(X^TWX+\lambda I)^{-1}X^TWY$. Basically, $\lambda$ constrains the sum of squares of the betas to be less than a particular value, increasing the value of $\lambda$ decreases this constraint (which is a "smooth" model selection procedure in its own right, if you think about it). | Sane stepwise regression?
For the purposes of my answer, I will denote the binary variable of interest as $Y_i \text{ ;}(i=1,\dots,n)$ and the predictors $X_{ij} \text{ ;} (j=1,\dots,p)$ and assume that $Y$ has values of $Y= |
19,050 | What do high dimensional cauchy distributions look like? | The main challenge in this question lies in interpreting the sense of "accumulate around some manifold." The difficulty is that no such thing can happen, because as the vector length $d$ grows, the vector does not not even stay in the same space!
Interpreting the question
We need therefore to formulate a concept of a "sequence of manifolds" in the nested vector spaces $\mathbb{R}^0 \subset \mathbb{R}^1 \subset \mathbb{R}^2 \subset \cdots \subset \mathbb{R}^d \subset \cdots.$ Looking to the Normal distribution for guidance, that sequence would be something like the sequence of spheres $S^{d-1}(\sqrt d)$ defined by
$$\mathbb{R}^d \supset S^{d-1}(\sqrt{d}) = \{(x_1,x_2,\ldots, x_d)\mid x_1^2+x_2^2+\cdots + x_d^2=d\}$$
for $d=0,1,2,\ldots.$
Because accumulation of points near spheres is largely a geometric property of Euclidean distances in high-dimensional spaces, we ought first to wonder whether spheres will continue to work for Cauchy variables. Imagine a sequence of iid such variables $\mathbf X = X_1, X_2, \ldots, X_d, \ldots.$ In the standard Normal case, the distribution of
$$R_d^2(\mathbf X) = X_1^2 + X_2^2 + \cdots + X_d^2$$
is easy to study because it has a chi-squared distribution of $d$ degrees of freedom and elementary analysis shows this distribution has an expectation of $d$ and a variance of $2d.$ Thus $R_d(\mathbf X)$ has a Chi distribution which, for large $d,$ has a mean close to $\sqrt{d-1/2}$ and a standard deviation close to $\sqrt{1/2}.$ If we take $S^{d-1}(\sqrt{d-1/2})$ to be the approximating sphere, this standard deviation grows small relative to the sphere's radius. It is in this sense we can say that the sequence of vectors $(X_1,X_2,\ldots, X_d)$ approximates the sequence of manifolds $S^{d-1}(\sqrt{d-1/2}).$ Finally, since asymptotically these manifolds are arbitrarily close to $S^{d-1}(\sqrt{d}),$ we obtain the assertion in the question.
One important conclusion is that the sequence of approximating manifolds will not be unique.
First attempt at a solution
Emulating this approach, we would like to learn about the distribution of $R^2_d(\mathbf X)$ when the $X_i$ are iid with common Cauchy distributions. The Cauchy distribution has a positive density $$f(x)=\frac{1}{\pi(1+x^2)}$$ at any real number $x.$ Unfortunately that immediately implies that no power of $|X_i|$ of $1$ or greater has a finite expectation. In particular, $E[R^2_d(\mathbf X)]=\infty$ and $\operatorname{Var}(R^2_d(\mathbf X))=\infty.$
It nevertheless is possible for the samples to accumulate along a sequence of manifolds, provided a decreasing proportion of the components grow very large (to make the moments infinite). Rather than wading through difficult integral estimates, let's just take a quick look at some quantiles of these distributions. To make them all comparable across a large range of $d,$ I have examined $R_d(\mathbf X)/\sqrt d$ (which in the Normal case converges to unity).
The figure plots selected quantiles of these distributions for an interesting collection of distributions. The Cauchy is at the left, some other (suitably scaled) Student t distributions are next, then followed by the standard Normal and the Uniform$(-2,2)$ distribution. I have scaled the $t(4),$ Normal, and Uniform distributions to yield asymptotic values of $R^d$ approaching $1.$
(Notice the log-log scales.)
These distributions fall into two groups. The two at the left have infinite variances. The three at the right have finite variances, which means strong laws of averages (as well as the Central Limit Theorem) apply. The CLT informs us (1) the expectation of $R^d$ will converge and (2) its variance will shrink asymptotically to zero (at a rate proportional to $1/d$). You can see both these things occurring in the plot: from left to right in the panels, the quantiles converge to a common level value.
This convergence does not happen in the left two panels. Because the Student t(2) distribution has a finite expectation, the quantiles level off--but it looks like they might not all converge to the same value. At the left, because the Cauchy distribution has infinite expectation and infinite variance, the quantiles grow ever larger (according to some power law, it appears) and they grow exponentially further apart.
There is no collection of approximating spheres for the Cauchy distribution.
Second attempt at a solution
How, then, should be proceed? A natural way to interpret the question is to re-ask it a little more broadly:
Where do most of the data tend to be in large datasets?
The answer, of course, is they will be located where the joint distribution has the greatest probability density. Equivalently, the log density will be greatest. At the point $\mathbf x = (x_1,x_2,\ldots,x_d)\in\mathbb{R}^d,$ the independence of the $X_i$ implies the log density is the sum of logs of the individual (marginal) densities,
$$\log F_{{\mathbf X}_d}(\mathbf x) = -d\log(\pi) - \sum_{i=1}^d \log(1 + x_i^2).$$
Now, the previous simulations suggest that even very low percentiles of these samples grow arbitrarily large as $d$ increases. That is, for sufficiently large $d,$ almost all the components of $(X_1,X_2,\ldots, X_d)$ get pretty large. By that I mean in estimating $\log(1+x_i^2),$ we will do fine by ignoring the $1+$ term, because it's usually much smaller than $x_i^2$ for large $d.$ Thus, for huge $d,$
$$\log F_{{\mathbf X}_d}(\mathbf x) \approx -d\log(\pi) -2\sum_{i=1}^d 2\log(|x_i|).$$
This tells us the level sets of $F_{{\mathbf X}_d}$ will be those where the sum of logarithms of the $x_i$ is a constant. Equivalently,
For large $d,$ the level sets ("contours") of the joint distribution of $(X_1,X_2,\ldots, X_d)$ are well approximated by the manifolds defined by $x_1x_2\cdots x_d = \text{Constant}.$
How are these contour levels distributed? Let's examine another simulation. As before, to make results for widely differing values of $d$ comparable, I have tracked $\log F_{{\mathbf X}_d}(\mathbf x)/d,$ which is the average of the densities of the components. Recall that such an average will asymptotically approximate the expectation: that is,
$$\log F_{{\mathbf X}_d}(\mathbf x)/d \approx 2\int_0^\infty \log(f(x)) f(x)\,\mathrm{d}x = \int_{-\infty}^\infty \log(f(x)) f(x)\,\mathrm{d}x$$
(because $f$ is symmetric about $0$). This is, of course, the negative of the Entropy of the Cauchy distribution. It equals $\log(4\pi) \approx 2.53.$
The figure shows histograms of $\log F_{{\mathbf X}_d}(\mathbf x)/d$ for 10,000 independent samples of each indicated sample size from $d=1$ to $d=2500.$
Not only do the histograms approach a Normal distribution shape, they also shrink around their common expectation of $\log(4\pi)$ (shown as vertical blue bars). Look at the scales: for $d=1$ the range of values runs from almost $0$ to about $20.$ For $d=2500$ the range has shrunk steadily to the interval $[2.40, 2.70].$
This behavior looks like the Central Limit Theorem in action--and it is. The sequence of random variables $\log f(X_1), \log f(X_2), \ldots, \log f(X_d), \ldots$ is iid and each of these variables has finite expectation and finite variance. (That is a matter of computing two integrals for the first and second moments.)
Let's connect this back to the Normal case, where $\log f (x) = -x^2/2 - \log(2\pi)/2.$ The corresponding level curves are of the form $x_1^2 + \cdots + x_d^2 = \text{Constant},$ implicating the spheres (of suitably varying radius) as the sequence of approximating manifolds.
Because these results are all intended to be asymptotic, we could simplify matters a bit and propose that
the sequence of approximating manifolds can be chosen as the quasi-hyperboloids of the form $x_1x_2\cdots x_d = C(d)$ where $C(d)$ depends (in a readily computable way) on the entropy and $d.$
Here's a picture for $d=2.$
The colors (and labels) denote values of $\log F_{\mathbf X_2}.$ The gray curves are various level sets. The arrows point "downhill" towards smaller values of the joint density: they help show the shapes of these manifolds better.
You can already see how many of the level sets are "trying" to approximate hyperboloids of the form $x_1x_2=\text{Constant}.$ They don't do this too well near the center, where most of the density is. That doesn't matter: $d=2$ just isn't quite large enough to characterize asymptotic behavior! Nevertheless, this plot is very suggestive and sketches how things must look (qualitatively) in much higher dimensions.
In particular, notice how these level curves "spike outwards" along the coordinate planes (axes in 2D). Herein lies the resolution of an apparent paradox: if Cauchy samples must diverge rapidly from any sequence of spheres (as shown above), how can they possibly accumulate around any sequence of manifolds whatsoever? The answer is that those manifolds must diverge. Indeed, in 2D the approximating manifolds I have proposed, $x_1 x_2=\text{Constant},$ are all unbounded hyperbolae. The same holds in higher dimensions.
All these results (and much more) are routinely stated and demonstrated in a different form in courses on asymptotics and Maximum Likelihood. The present setting differs only in the focus on the question of what large iid samples "look like" when considered geometrically as vectors. | What do high dimensional cauchy distributions look like? | The main challenge in this question lies in interpreting the sense of "accumulate around some manifold." The difficulty is that no such thing can happen, because as the vector length $d$ grows, the v | What do high dimensional cauchy distributions look like?
The main challenge in this question lies in interpreting the sense of "accumulate around some manifold." The difficulty is that no such thing can happen, because as the vector length $d$ grows, the vector does not not even stay in the same space!
Interpreting the question
We need therefore to formulate a concept of a "sequence of manifolds" in the nested vector spaces $\mathbb{R}^0 \subset \mathbb{R}^1 \subset \mathbb{R}^2 \subset \cdots \subset \mathbb{R}^d \subset \cdots.$ Looking to the Normal distribution for guidance, that sequence would be something like the sequence of spheres $S^{d-1}(\sqrt d)$ defined by
$$\mathbb{R}^d \supset S^{d-1}(\sqrt{d}) = \{(x_1,x_2,\ldots, x_d)\mid x_1^2+x_2^2+\cdots + x_d^2=d\}$$
for $d=0,1,2,\ldots.$
Because accumulation of points near spheres is largely a geometric property of Euclidean distances in high-dimensional spaces, we ought first to wonder whether spheres will continue to work for Cauchy variables. Imagine a sequence of iid such variables $\mathbf X = X_1, X_2, \ldots, X_d, \ldots.$ In the standard Normal case, the distribution of
$$R_d^2(\mathbf X) = X_1^2 + X_2^2 + \cdots + X_d^2$$
is easy to study because it has a chi-squared distribution of $d$ degrees of freedom and elementary analysis shows this distribution has an expectation of $d$ and a variance of $2d.$ Thus $R_d(\mathbf X)$ has a Chi distribution which, for large $d,$ has a mean close to $\sqrt{d-1/2}$ and a standard deviation close to $\sqrt{1/2}.$ If we take $S^{d-1}(\sqrt{d-1/2})$ to be the approximating sphere, this standard deviation grows small relative to the sphere's radius. It is in this sense we can say that the sequence of vectors $(X_1,X_2,\ldots, X_d)$ approximates the sequence of manifolds $S^{d-1}(\sqrt{d-1/2}).$ Finally, since asymptotically these manifolds are arbitrarily close to $S^{d-1}(\sqrt{d}),$ we obtain the assertion in the question.
One important conclusion is that the sequence of approximating manifolds will not be unique.
First attempt at a solution
Emulating this approach, we would like to learn about the distribution of $R^2_d(\mathbf X)$ when the $X_i$ are iid with common Cauchy distributions. The Cauchy distribution has a positive density $$f(x)=\frac{1}{\pi(1+x^2)}$$ at any real number $x.$ Unfortunately that immediately implies that no power of $|X_i|$ of $1$ or greater has a finite expectation. In particular, $E[R^2_d(\mathbf X)]=\infty$ and $\operatorname{Var}(R^2_d(\mathbf X))=\infty.$
It nevertheless is possible for the samples to accumulate along a sequence of manifolds, provided a decreasing proportion of the components grow very large (to make the moments infinite). Rather than wading through difficult integral estimates, let's just take a quick look at some quantiles of these distributions. To make them all comparable across a large range of $d,$ I have examined $R_d(\mathbf X)/\sqrt d$ (which in the Normal case converges to unity).
The figure plots selected quantiles of these distributions for an interesting collection of distributions. The Cauchy is at the left, some other (suitably scaled) Student t distributions are next, then followed by the standard Normal and the Uniform$(-2,2)$ distribution. I have scaled the $t(4),$ Normal, and Uniform distributions to yield asymptotic values of $R^d$ approaching $1.$
(Notice the log-log scales.)
These distributions fall into two groups. The two at the left have infinite variances. The three at the right have finite variances, which means strong laws of averages (as well as the Central Limit Theorem) apply. The CLT informs us (1) the expectation of $R^d$ will converge and (2) its variance will shrink asymptotically to zero (at a rate proportional to $1/d$). You can see both these things occurring in the plot: from left to right in the panels, the quantiles converge to a common level value.
This convergence does not happen in the left two panels. Because the Student t(2) distribution has a finite expectation, the quantiles level off--but it looks like they might not all converge to the same value. At the left, because the Cauchy distribution has infinite expectation and infinite variance, the quantiles grow ever larger (according to some power law, it appears) and they grow exponentially further apart.
There is no collection of approximating spheres for the Cauchy distribution.
Second attempt at a solution
How, then, should be proceed? A natural way to interpret the question is to re-ask it a little more broadly:
Where do most of the data tend to be in large datasets?
The answer, of course, is they will be located where the joint distribution has the greatest probability density. Equivalently, the log density will be greatest. At the point $\mathbf x = (x_1,x_2,\ldots,x_d)\in\mathbb{R}^d,$ the independence of the $X_i$ implies the log density is the sum of logs of the individual (marginal) densities,
$$\log F_{{\mathbf X}_d}(\mathbf x) = -d\log(\pi) - \sum_{i=1}^d \log(1 + x_i^2).$$
Now, the previous simulations suggest that even very low percentiles of these samples grow arbitrarily large as $d$ increases. That is, for sufficiently large $d,$ almost all the components of $(X_1,X_2,\ldots, X_d)$ get pretty large. By that I mean in estimating $\log(1+x_i^2),$ we will do fine by ignoring the $1+$ term, because it's usually much smaller than $x_i^2$ for large $d.$ Thus, for huge $d,$
$$\log F_{{\mathbf X}_d}(\mathbf x) \approx -d\log(\pi) -2\sum_{i=1}^d 2\log(|x_i|).$$
This tells us the level sets of $F_{{\mathbf X}_d}$ will be those where the sum of logarithms of the $x_i$ is a constant. Equivalently,
For large $d,$ the level sets ("contours") of the joint distribution of $(X_1,X_2,\ldots, X_d)$ are well approximated by the manifolds defined by $x_1x_2\cdots x_d = \text{Constant}.$
How are these contour levels distributed? Let's examine another simulation. As before, to make results for widely differing values of $d$ comparable, I have tracked $\log F_{{\mathbf X}_d}(\mathbf x)/d,$ which is the average of the densities of the components. Recall that such an average will asymptotically approximate the expectation: that is,
$$\log F_{{\mathbf X}_d}(\mathbf x)/d \approx 2\int_0^\infty \log(f(x)) f(x)\,\mathrm{d}x = \int_{-\infty}^\infty \log(f(x)) f(x)\,\mathrm{d}x$$
(because $f$ is symmetric about $0$). This is, of course, the negative of the Entropy of the Cauchy distribution. It equals $\log(4\pi) \approx 2.53.$
The figure shows histograms of $\log F_{{\mathbf X}_d}(\mathbf x)/d$ for 10,000 independent samples of each indicated sample size from $d=1$ to $d=2500.$
Not only do the histograms approach a Normal distribution shape, they also shrink around their common expectation of $\log(4\pi)$ (shown as vertical blue bars). Look at the scales: for $d=1$ the range of values runs from almost $0$ to about $20.$ For $d=2500$ the range has shrunk steadily to the interval $[2.40, 2.70].$
This behavior looks like the Central Limit Theorem in action--and it is. The sequence of random variables $\log f(X_1), \log f(X_2), \ldots, \log f(X_d), \ldots$ is iid and each of these variables has finite expectation and finite variance. (That is a matter of computing two integrals for the first and second moments.)
Let's connect this back to the Normal case, where $\log f (x) = -x^2/2 - \log(2\pi)/2.$ The corresponding level curves are of the form $x_1^2 + \cdots + x_d^2 = \text{Constant},$ implicating the spheres (of suitably varying radius) as the sequence of approximating manifolds.
Because these results are all intended to be asymptotic, we could simplify matters a bit and propose that
the sequence of approximating manifolds can be chosen as the quasi-hyperboloids of the form $x_1x_2\cdots x_d = C(d)$ where $C(d)$ depends (in a readily computable way) on the entropy and $d.$
Here's a picture for $d=2.$
The colors (and labels) denote values of $\log F_{\mathbf X_2}.$ The gray curves are various level sets. The arrows point "downhill" towards smaller values of the joint density: they help show the shapes of these manifolds better.
You can already see how many of the level sets are "trying" to approximate hyperboloids of the form $x_1x_2=\text{Constant}.$ They don't do this too well near the center, where most of the density is. That doesn't matter: $d=2$ just isn't quite large enough to characterize asymptotic behavior! Nevertheless, this plot is very suggestive and sketches how things must look (qualitatively) in much higher dimensions.
In particular, notice how these level curves "spike outwards" along the coordinate planes (axes in 2D). Herein lies the resolution of an apparent paradox: if Cauchy samples must diverge rapidly from any sequence of spheres (as shown above), how can they possibly accumulate around any sequence of manifolds whatsoever? The answer is that those manifolds must diverge. Indeed, in 2D the approximating manifolds I have proposed, $x_1 x_2=\text{Constant},$ are all unbounded hyperbolae. The same holds in higher dimensions.
All these results (and much more) are routinely stated and demonstrated in a different form in courses on asymptotics and Maximum Likelihood. The present setting differs only in the focus on the question of what large iid samples "look like" when considered geometrically as vectors. | What do high dimensional cauchy distributions look like?
The main challenge in this question lies in interpreting the sense of "accumulate around some manifold." The difficulty is that no such thing can happen, because as the vector length $d$ grows, the v |
19,051 | Proof/derivation for false discovery rate in Benjamini-Hochberg procedure | Intro
Let us start with some notation: We have $m$ simple hypotheses we test, with each null numbered $H_{0,i}$. The global null hypothesis can be written as an intersection of all the local nulls: $H_0=\bigcap_{i=1}^{m}{H_{0,i}}$. Next, we assume that each hypothesis $H_{0,i}$ has a test statistic $t_i$ for which we can compute the p-value $p_i$. More specifically, we assume that for each $i$ the distribution of $p_i$ under $H_{0,i}$ is $U[0,1]$.
For example (Chapter 3 of Efron), consider a comparison of 6033 genes in two groups: For each gene in $1\le i\le 6033$, we have $H_{0,i}:$ "no difference in the $i^{th}$ gene" and $H_{1,i}:$ "there is a difference in the $i^{th}$ gene". In this problem, $m=6033$. Our $m$ hypotheses can be divided into 4 groups:
$H_{0,i}$
Accepted
Rejected
Sum
Correct
$U$
$V$
$m_0$
Incorrect
$T$
$S$
$m-m_0$
Sum
$m-R$
$R$
$m$
We do not observe $S,T,U,V$ but we do observe $R$.
FWER
A classic criterion is the familywise error, denoted $FWE=I\{V\ge1\}$. The familywise error rate is then $FWER=E[I\{V\ge1\}]=P(V\ge1)$. A comparison method controls the level-$\alpha$ $FWER$ in the strong sense if $FWER\le\alpha$ for any combination $\tilde{H}\in\left\{H_{0,i},H_{1,i}\right\}_{i=1,...,m}$; It controls the level-$\alpha$ $FWER$ in the weak sense if $FWER\le\alpha$ under the global null.
Example - Holm's method:
Order the p-values $p_{(1)},...,p_{(m)}$ and then respectively the hypotheses $H_{0,(1)},...,H_{0,(m)}$.
One after the other, we check the hypotheses:
If $p_{(1)}\le\frac{\alpha}{m}$ we reject $H_{0,(1)}$ and continue, otherwise we stop.
If $p_{(2)}\le\frac{\alpha}{m-1}$ we reject $H_{0,(2)}$ and continue, otherwise we stop.
We keep rejecting $H_{0,(i)}$ if $p_{(i)}\le\frac{\alpha}{m-i+1}$
We stop the first time we get $p_{(i)}>\frac{\alpha}{m-i+1}$ and then reject $H_{0,(1)},...,H_{0,(i-1)}$.
Holm's method example: we've simulated $m=20$ p-values, then ordered them. Red circles indicate rejected hypotheses, green circles were not rejected, the blue line is the criterion $\frac{\alpha}{m-i+1}$:
The hypotheses rejected were $H_{0,(1)},H_{0,(2)},H_{0,(3)}$. You can see that $p_{(4)}$ is the smallest p-value larger than the criterion, so we reject all hypotheses with smaller p-values.
It is quite easy to prove that this method controls level-$\alpha$ $FWER$ in the strong sense. A counterexample would be the Simes method, which only controls the level-$\alpha$ $FWER$ in the weak sense.
FDR
The false discovery proportion ($FDP$) is a softer criterion than the $FWE$, and is defined as $FDP=\frac{V}{\max\{1,R\}}=\left\{\begin{matrix} \frac{V}{R} & R\ge1\\ 0 & o.w\end{matrix}\right.$. The false discovery rate is $FDR=E[FDP]$. Controlling level-$\alpha$ $FDR$ means that The false if we repeat the experiment and rejection criteria many times, $FDR=E[FDP]\le\alpha$.
It is very easy to prove that $FWER\ge FDR$: We start by claiming $I\{V\ge1\}\ge\left\{\begin{matrix} \frac{V}{R} & R\ge1\\ 0 & o.w\end{matrix}\right.$.
If $V=0$ then $I\{V\ge1\}=0=\left\{\begin{matrix} \frac{V}{R} & R\ge1\\ 0 & o.w\end{matrix}\right.$. In the above table, $R\ge V$ so for $V>0$ we get $\frac{V}{\max\{1,R\}}\le1$ and $I\{V\ge1\}\ge\frac{V}{\max\{1,R\}}$. This also means $E\left[I\{V\ge1\}\right]\ge E\left[\frac{V}{\max\{1,R\}}\right]$, which is exactly $FWER\ge FDR$.
Another very easy claim if that controlling level-$\alpha$ $FDR$ implies controlling level-$\alpha$ $FWER$ in the weak sense, meaning that under the global $H_0$ we get $FWER=FDR$: Under the global $H_0$ every rejection is a false rejection, meaning $V=R$, so $$FDP=\left\{\begin{matrix} \frac{V}{R} & R\ge1\\ 0 & o.w\end{matrix}\right.=\left\{\begin{matrix} \frac{V}{V} & V\ge1\\ 0 & o.w\end{matrix}\right.=\left\{\begin{matrix} 1 & V\ge1\\ 0 & o.w\end{matrix}\right.=I\{V\ge1\}$$ and then $$FDR=E[FDP]=E[I\{V\ge1\}]=P(V\ge1)=FWER.$$
B-H
The Benjamini-Hochberg method is as follows:
Order the p-values $p_{(1)},...,p_{(m)}$ and then respectively the hypotheses $H_{0,(1)},...,H_{0,(m)}$
Mark as $i_0$ the largest $i$ for which $p_{(i)}\le \frac{i}{m}\alpha$
Reject $H_{0,(1)},...,H_{0,(i_0)}$
Contrary to the previous claims, it is not trivial to show why the BH method keeps $FDR\le\alpha$ (to be more precise, it keeps $FDR=\frac{m_0}{m}\alpha$). It isn't a short proof either, ,his is some advanced statistical courses material (I've seen it in one of my Master of Statistics courses). I do think that for the extent of this question, we can simply assume it controls the FDR.
BH example: again we've simulated $m=20$ p-values, then ordered them. Red circles indicate rejected hypotheses, green circles were not rejected, the blue line is the criterion $\frac{i\cdot\alpha}{m}$:
The hypotheses rejected were $H_{0,(1)}$ to $H_{0,(10)}$. You can see that $p_{(11)}$ is the largest p-value larger than the criterion, so we reject all hypotheses with smaller p-values - even though some of them ($p_{(6)},p_{(7)}$) are larger than the criterion. Compare this (largest p-value larger than the criterion) and Holm's method (smallest p-value larger than the criterion).
Proving $FDR\le\alpha$ for BH
For $m_0=0$ (which means each $p_i$ is distributed under $H_{1,i}$) we get $FDR\le\alpha$ because $V=0$, so assume $m_0\ge1$. Denote $V_i=I\{H_{0,i}\text{ was rejected}\}$ and $\mathcal{H}_0\subseteq\{1,...,m\}$ the set of hypotheses for which $H_{0,i}$ is correct, so $FDP=\sum_{i\in\mathcal{H}_0}{\frac{V_i}{\max\{1,R\}}}=\sum_{i\in\mathcal{H}_0}{X_i}$. We start by proving that for $i\in\mathcal{H}_0$ we get $E[X_i]=\frac{\alpha}{m}$:
$$X_i=\sum_{k=0}^{m}{\frac{V_i}{\max\{1,R\}}I\{R=k\}}=\sum_{k=1}^{m}{\frac{I\{H_{0,i}\text{ was rejected}\}}{k}I\{R=k\}}=\sum_{k=1}^{m}{\frac{I\left\{ p_i\le\frac{k}{m}\alpha \right\}}{k}I\{R=k\}}$$
Let $R(p_i)$ the number of rejections we get if $p_i=0$ and the rest of the p-values unchanged. Assume $R=k^*$, if $p_i\le\frac{k^*}{m}\alpha$ then $R=R(p_i)=k^*$ so in this case, $I\left\{ p_i\le\frac{k^*}{m}\alpha \right\}\cdot I\{R=k^*\}=I\left\{ p_i\le\frac{k^*}{m}\alpha \right\}\cdot I\{R(p_i)=k^*\}$.
If $p_i>\frac{k^*}{m}\alpha$ we get $I\left\{ p_i\le\frac{k^*}{m}\alpha \right\}=0$ and again $I\left\{ p_i\le\frac{k^*}{m}\alpha \right\}\cdot I\{R=k^*\}=I\left\{ p_i\le\frac{k^*}{m}\alpha \right\}\cdot I\{R(p_i)=k^*\}$, so overall we can deduce
$$X_i=\sum_{k=1}^{m}{\frac{I\left\{ p_i\le\frac{k}{m}\alpha \right\}}{k}I\{R=k\}}=\sum_{k=1}^{m}{\frac{I\left\{ p_i\le\frac{k}{m}\alpha \right\}}{k}I\{R(p_i)=k\}},$$
and now we can calculate $E[X_i]$ conditional on all p-values except $p_i$. Under this condition, $I\{R(p_i)=k\}$ is deterministic and we overall get:
$$E\left[I\left\{ p_i\le\frac{k}{m}\alpha \right\}\cdot I\{R(p_i)=k\}\middle|p\backslash p_i\right]=E\left[I\left\{ p_i\le\frac{k}{m}\alpha \right\}\middle|p\backslash p_i\right]\cdot I\{R(p_i)=k\}$$
Because $p_i$ is independent of $p\backslash p_i$ we get
$$E\left[I\left\{ p_i\le\frac{k}{m}\alpha \right\}\middle|p\backslash p_i\right]\cdot I\{R(p_i)=k\}=E\left[I\left\{ p_i\le\frac{k}{m}\alpha \right\}\right]\cdot I\{R(p_i)=k\}\\=P\left(p_i\le\frac{k}{m}\alpha\right)\cdot I\{R(p_i)=k\}$$
We assumed before that under $H_{0,i}$, $p_i\sim U[0,1]$ so the last expression can be written as $\frac{k}{m}\alpha\cdot I\{R(p_i)=k\}$. Next,
$$E[X_i|p\backslash p_i]=\sum_{k=1}^m\frac{E\left[I\left\{ p_i\le\frac{k}{m}\alpha \right\}\cdot I\{R(p_i)=k\}\middle|p\backslash p_i\right]}{k}=\sum_{k=1}^m\frac{\frac{k}{m}\alpha\cdot I\{R(p_i)=k\}}{k}\\=\frac{\alpha}{m}\cdot\sum_{k=1}^m{I\{R(p_i)=k\}}=\frac{\alpha}{m}\cdot 1=\frac{\alpha}{m}.$$
Using the law of total expectation we get $E[X_i]=E[E[X_i|p\backslash p_i]]=E\left[\frac{\alpha}{m}\right]=\frac{\alpha}{m}$. We have previously obtained $FDP=\sum_{i\in\mathcal{H}_0}{X_i}$ so
$$FDR=E[FDP]=E\left[\sum_{i\in\mathcal{H}_0}{X_i}\right]=\sum_{i\in\mathcal{H}_0}{E[X_i]}=\sum_{i\in\mathcal{H}_0}{\frac{\alpha}{m}}=\frac{m_0}{m}\alpha\le\alpha\qquad\blacksquare$$
Summary
We've seen the differences between strong and weak sense of $FWER$ as well as the $DFR$. I think that you can now spot yourself the differences and understand why $FDR\le\alpha$ does not imply that $FWER\le\alpha$ in the strong sense. | Proof/derivation for false discovery rate in Benjamini-Hochberg procedure | Intro
Let us start with some notation: We have $m$ simple hypotheses we test, with each null numbered $H_{0,i}$. The global null hypothesis can be written as an intersection of all the local nulls: $H | Proof/derivation for false discovery rate in Benjamini-Hochberg procedure
Intro
Let us start with some notation: We have $m$ simple hypotheses we test, with each null numbered $H_{0,i}$. The global null hypothesis can be written as an intersection of all the local nulls: $H_0=\bigcap_{i=1}^{m}{H_{0,i}}$. Next, we assume that each hypothesis $H_{0,i}$ has a test statistic $t_i$ for which we can compute the p-value $p_i$. More specifically, we assume that for each $i$ the distribution of $p_i$ under $H_{0,i}$ is $U[0,1]$.
For example (Chapter 3 of Efron), consider a comparison of 6033 genes in two groups: For each gene in $1\le i\le 6033$, we have $H_{0,i}:$ "no difference in the $i^{th}$ gene" and $H_{1,i}:$ "there is a difference in the $i^{th}$ gene". In this problem, $m=6033$. Our $m$ hypotheses can be divided into 4 groups:
$H_{0,i}$
Accepted
Rejected
Sum
Correct
$U$
$V$
$m_0$
Incorrect
$T$
$S$
$m-m_0$
Sum
$m-R$
$R$
$m$
We do not observe $S,T,U,V$ but we do observe $R$.
FWER
A classic criterion is the familywise error, denoted $FWE=I\{V\ge1\}$. The familywise error rate is then $FWER=E[I\{V\ge1\}]=P(V\ge1)$. A comparison method controls the level-$\alpha$ $FWER$ in the strong sense if $FWER\le\alpha$ for any combination $\tilde{H}\in\left\{H_{0,i},H_{1,i}\right\}_{i=1,...,m}$; It controls the level-$\alpha$ $FWER$ in the weak sense if $FWER\le\alpha$ under the global null.
Example - Holm's method:
Order the p-values $p_{(1)},...,p_{(m)}$ and then respectively the hypotheses $H_{0,(1)},...,H_{0,(m)}$.
One after the other, we check the hypotheses:
If $p_{(1)}\le\frac{\alpha}{m}$ we reject $H_{0,(1)}$ and continue, otherwise we stop.
If $p_{(2)}\le\frac{\alpha}{m-1}$ we reject $H_{0,(2)}$ and continue, otherwise we stop.
We keep rejecting $H_{0,(i)}$ if $p_{(i)}\le\frac{\alpha}{m-i+1}$
We stop the first time we get $p_{(i)}>\frac{\alpha}{m-i+1}$ and then reject $H_{0,(1)},...,H_{0,(i-1)}$.
Holm's method example: we've simulated $m=20$ p-values, then ordered them. Red circles indicate rejected hypotheses, green circles were not rejected, the blue line is the criterion $\frac{\alpha}{m-i+1}$:
The hypotheses rejected were $H_{0,(1)},H_{0,(2)},H_{0,(3)}$. You can see that $p_{(4)}$ is the smallest p-value larger than the criterion, so we reject all hypotheses with smaller p-values.
It is quite easy to prove that this method controls level-$\alpha$ $FWER$ in the strong sense. A counterexample would be the Simes method, which only controls the level-$\alpha$ $FWER$ in the weak sense.
FDR
The false discovery proportion ($FDP$) is a softer criterion than the $FWE$, and is defined as $FDP=\frac{V}{\max\{1,R\}}=\left\{\begin{matrix} \frac{V}{R} & R\ge1\\ 0 & o.w\end{matrix}\right.$. The false discovery rate is $FDR=E[FDP]$. Controlling level-$\alpha$ $FDR$ means that The false if we repeat the experiment and rejection criteria many times, $FDR=E[FDP]\le\alpha$.
It is very easy to prove that $FWER\ge FDR$: We start by claiming $I\{V\ge1\}\ge\left\{\begin{matrix} \frac{V}{R} & R\ge1\\ 0 & o.w\end{matrix}\right.$.
If $V=0$ then $I\{V\ge1\}=0=\left\{\begin{matrix} \frac{V}{R} & R\ge1\\ 0 & o.w\end{matrix}\right.$. In the above table, $R\ge V$ so for $V>0$ we get $\frac{V}{\max\{1,R\}}\le1$ and $I\{V\ge1\}\ge\frac{V}{\max\{1,R\}}$. This also means $E\left[I\{V\ge1\}\right]\ge E\left[\frac{V}{\max\{1,R\}}\right]$, which is exactly $FWER\ge FDR$.
Another very easy claim if that controlling level-$\alpha$ $FDR$ implies controlling level-$\alpha$ $FWER$ in the weak sense, meaning that under the global $H_0$ we get $FWER=FDR$: Under the global $H_0$ every rejection is a false rejection, meaning $V=R$, so $$FDP=\left\{\begin{matrix} \frac{V}{R} & R\ge1\\ 0 & o.w\end{matrix}\right.=\left\{\begin{matrix} \frac{V}{V} & V\ge1\\ 0 & o.w\end{matrix}\right.=\left\{\begin{matrix} 1 & V\ge1\\ 0 & o.w\end{matrix}\right.=I\{V\ge1\}$$ and then $$FDR=E[FDP]=E[I\{V\ge1\}]=P(V\ge1)=FWER.$$
B-H
The Benjamini-Hochberg method is as follows:
Order the p-values $p_{(1)},...,p_{(m)}$ and then respectively the hypotheses $H_{0,(1)},...,H_{0,(m)}$
Mark as $i_0$ the largest $i$ for which $p_{(i)}\le \frac{i}{m}\alpha$
Reject $H_{0,(1)},...,H_{0,(i_0)}$
Contrary to the previous claims, it is not trivial to show why the BH method keeps $FDR\le\alpha$ (to be more precise, it keeps $FDR=\frac{m_0}{m}\alpha$). It isn't a short proof either, ,his is some advanced statistical courses material (I've seen it in one of my Master of Statistics courses). I do think that for the extent of this question, we can simply assume it controls the FDR.
BH example: again we've simulated $m=20$ p-values, then ordered them. Red circles indicate rejected hypotheses, green circles were not rejected, the blue line is the criterion $\frac{i\cdot\alpha}{m}$:
The hypotheses rejected were $H_{0,(1)}$ to $H_{0,(10)}$. You can see that $p_{(11)}$ is the largest p-value larger than the criterion, so we reject all hypotheses with smaller p-values - even though some of them ($p_{(6)},p_{(7)}$) are larger than the criterion. Compare this (largest p-value larger than the criterion) and Holm's method (smallest p-value larger than the criterion).
Proving $FDR\le\alpha$ for BH
For $m_0=0$ (which means each $p_i$ is distributed under $H_{1,i}$) we get $FDR\le\alpha$ because $V=0$, so assume $m_0\ge1$. Denote $V_i=I\{H_{0,i}\text{ was rejected}\}$ and $\mathcal{H}_0\subseteq\{1,...,m\}$ the set of hypotheses for which $H_{0,i}$ is correct, so $FDP=\sum_{i\in\mathcal{H}_0}{\frac{V_i}{\max\{1,R\}}}=\sum_{i\in\mathcal{H}_0}{X_i}$. We start by proving that for $i\in\mathcal{H}_0$ we get $E[X_i]=\frac{\alpha}{m}$:
$$X_i=\sum_{k=0}^{m}{\frac{V_i}{\max\{1,R\}}I\{R=k\}}=\sum_{k=1}^{m}{\frac{I\{H_{0,i}\text{ was rejected}\}}{k}I\{R=k\}}=\sum_{k=1}^{m}{\frac{I\left\{ p_i\le\frac{k}{m}\alpha \right\}}{k}I\{R=k\}}$$
Let $R(p_i)$ the number of rejections we get if $p_i=0$ and the rest of the p-values unchanged. Assume $R=k^*$, if $p_i\le\frac{k^*}{m}\alpha$ then $R=R(p_i)=k^*$ so in this case, $I\left\{ p_i\le\frac{k^*}{m}\alpha \right\}\cdot I\{R=k^*\}=I\left\{ p_i\le\frac{k^*}{m}\alpha \right\}\cdot I\{R(p_i)=k^*\}$.
If $p_i>\frac{k^*}{m}\alpha$ we get $I\left\{ p_i\le\frac{k^*}{m}\alpha \right\}=0$ and again $I\left\{ p_i\le\frac{k^*}{m}\alpha \right\}\cdot I\{R=k^*\}=I\left\{ p_i\le\frac{k^*}{m}\alpha \right\}\cdot I\{R(p_i)=k^*\}$, so overall we can deduce
$$X_i=\sum_{k=1}^{m}{\frac{I\left\{ p_i\le\frac{k}{m}\alpha \right\}}{k}I\{R=k\}}=\sum_{k=1}^{m}{\frac{I\left\{ p_i\le\frac{k}{m}\alpha \right\}}{k}I\{R(p_i)=k\}},$$
and now we can calculate $E[X_i]$ conditional on all p-values except $p_i$. Under this condition, $I\{R(p_i)=k\}$ is deterministic and we overall get:
$$E\left[I\left\{ p_i\le\frac{k}{m}\alpha \right\}\cdot I\{R(p_i)=k\}\middle|p\backslash p_i\right]=E\left[I\left\{ p_i\le\frac{k}{m}\alpha \right\}\middle|p\backslash p_i\right]\cdot I\{R(p_i)=k\}$$
Because $p_i$ is independent of $p\backslash p_i$ we get
$$E\left[I\left\{ p_i\le\frac{k}{m}\alpha \right\}\middle|p\backslash p_i\right]\cdot I\{R(p_i)=k\}=E\left[I\left\{ p_i\le\frac{k}{m}\alpha \right\}\right]\cdot I\{R(p_i)=k\}\\=P\left(p_i\le\frac{k}{m}\alpha\right)\cdot I\{R(p_i)=k\}$$
We assumed before that under $H_{0,i}$, $p_i\sim U[0,1]$ so the last expression can be written as $\frac{k}{m}\alpha\cdot I\{R(p_i)=k\}$. Next,
$$E[X_i|p\backslash p_i]=\sum_{k=1}^m\frac{E\left[I\left\{ p_i\le\frac{k}{m}\alpha \right\}\cdot I\{R(p_i)=k\}\middle|p\backslash p_i\right]}{k}=\sum_{k=1}^m\frac{\frac{k}{m}\alpha\cdot I\{R(p_i)=k\}}{k}\\=\frac{\alpha}{m}\cdot\sum_{k=1}^m{I\{R(p_i)=k\}}=\frac{\alpha}{m}\cdot 1=\frac{\alpha}{m}.$$
Using the law of total expectation we get $E[X_i]=E[E[X_i|p\backslash p_i]]=E\left[\frac{\alpha}{m}\right]=\frac{\alpha}{m}$. We have previously obtained $FDP=\sum_{i\in\mathcal{H}_0}{X_i}$ so
$$FDR=E[FDP]=E\left[\sum_{i\in\mathcal{H}_0}{X_i}\right]=\sum_{i\in\mathcal{H}_0}{E[X_i]}=\sum_{i\in\mathcal{H}_0}{\frac{\alpha}{m}}=\frac{m_0}{m}\alpha\le\alpha\qquad\blacksquare$$
Summary
We've seen the differences between strong and weak sense of $FWER$ as well as the $DFR$. I think that you can now spot yourself the differences and understand why $FDR\le\alpha$ does not imply that $FWER\le\alpha$ in the strong sense. | Proof/derivation for false discovery rate in Benjamini-Hochberg procedure
Intro
Let us start with some notation: We have $m$ simple hypotheses we test, with each null numbered $H_{0,i}$. The global null hypothesis can be written as an intersection of all the local nulls: $H |
19,052 | Proof/derivation for false discovery rate in Benjamini-Hochberg procedure | Geometric interpretation
The values of the different p-values $p_1,p_2,\dots, p_n$ are distributed in a hypercube and rejection occurs when the point falls inside a region.
The case of 2 variables
For this case we can see easily that the rejection rate is $\alpha$ by adding the area's in the below figure together
Algebraic computation for more variables
We can represent the above area's by the following product where each $x_k$ represents whether for a p-value we have $\alpha \frac{k-1}{n} < p<\alpha \frac{k}{n} $ and the last $x_{n+1}$ represents that the $p>\alpha$
$$(x_1+x_2+ \dots +x_{n+1})^n$$
... to be continued | Proof/derivation for false discovery rate in Benjamini-Hochberg procedure | Geometric interpretation
The values of the different p-values $p_1,p_2,\dots, p_n$ are distributed in a hypercube and rejection occurs when the point falls inside a region.
The case of 2 variables
For | Proof/derivation for false discovery rate in Benjamini-Hochberg procedure
Geometric interpretation
The values of the different p-values $p_1,p_2,\dots, p_n$ are distributed in a hypercube and rejection occurs when the point falls inside a region.
The case of 2 variables
For this case we can see easily that the rejection rate is $\alpha$ by adding the area's in the below figure together
Algebraic computation for more variables
We can represent the above area's by the following product where each $x_k$ represents whether for a p-value we have $\alpha \frac{k-1}{n} < p<\alpha \frac{k}{n} $ and the last $x_{n+1}$ represents that the $p>\alpha$
$$(x_1+x_2+ \dots +x_{n+1})^n$$
... to be continued | Proof/derivation for false discovery rate in Benjamini-Hochberg procedure
Geometric interpretation
The values of the different p-values $p_1,p_2,\dots, p_n$ are distributed in a hypercube and rejection occurs when the point falls inside a region.
The case of 2 variables
For |
19,053 | What does r, r squared and residual standard deviation tell us about a linear relationship? | Those statistics can tell you about whether there is a linear component to the relationship but not much about whether the relationship is strictly linear. A relationship with a small quadratic component can have an r^2 of 0.99. A plot of residuals as a function of predicted can be revealing. In Galileo's experiment here https://ww2.amstat.org/publications/jse/v3n1/datasets.dickey.html the correlation is very high but the relationship is clearly nonlinear. | What does r, r squared and residual standard deviation tell us about a linear relationship? | Those statistics can tell you about whether there is a linear component to the relationship but not much about whether the relationship is strictly linear. A relationship with a small quadratic compon | What does r, r squared and residual standard deviation tell us about a linear relationship?
Those statistics can tell you about whether there is a linear component to the relationship but not much about whether the relationship is strictly linear. A relationship with a small quadratic component can have an r^2 of 0.99. A plot of residuals as a function of predicted can be revealing. In Galileo's experiment here https://ww2.amstat.org/publications/jse/v3n1/datasets.dickey.html the correlation is very high but the relationship is clearly nonlinear. | What does r, r squared and residual standard deviation tell us about a linear relationship?
Those statistics can tell you about whether there is a linear component to the relationship but not much about whether the relationship is strictly linear. A relationship with a small quadratic compon |
19,054 | What does r, r squared and residual standard deviation tell us about a linear relationship? | Here's a second attempt at an answer after getting feedback on issues with my first answer.
Firstly, $r$, in your simple linear regression case, is equivalent to the Pearson correlation between plant density and cob weight. More generally, $|r|$ constitutes an upper bound on how good a predictor on the data can theoretically be constructed using a linear function. I.e. the best possible linear predictor would predict values with a correlation of $|r|$ with the observed values.
Secondly, $R^2$ in the simple linear regression case is just $r^2$. For multiple regression $R^2$ is sometimes computed differently, for instance by comparing the residuals (the difference between predicted and observed values of the response variable) in the fitted model to the residuals when the predicted response variable is set to a constant.
Usually, $r$ is interpreted as a measure of how linear the relationship between two variables is and $R^2$ is interpreted as the fraction of the variance in the dependent variable which is explained by the model. However, there are many situations where these interpretations do not hold. For example, if the mean of the cob weight given the plant density is not linear in plant density the value of $r$ might not correctly express the "linearity" of the relationship. For some general issues with $r$ see Anscombe's quartet. See also this answer by whuber on a question about the usefulness of $R^2$. To answer your question with regards to $r$ and $R^2$, these values do not tell us much at all about the dataset, unless we can make some fairly strong assumptions beyond what is usually done for linear regression (for instance we have to assume that there is no non-linear relationship between the variables besides the linear one we are modeling).
The Residual Standard Error is the standard deviation for a normal distribution, centered on the predicted regression line, representing the distribution of actually observed values. In other words, if we were to measure only the plant density for a new plot, we can predict the cob weight using the coefficients of the fitted model, this is the mean of that distribution. The RSE is the standard deviation of that distribution and thus a measure on how much we expect the actually observed cob weights to deviate from the values predicted by the model. An RSE of ~8 in this case has to be compared to the sample standard deviation of the cob weight but the smaller the RSE is compared to the sample SD the more predictive, or adequate, the model is. | What does r, r squared and residual standard deviation tell us about a linear relationship? | Here's a second attempt at an answer after getting feedback on issues with my first answer.
Firstly, $r$, in your simple linear regression case, is equivalent to the Pearson correlation between plant | What does r, r squared and residual standard deviation tell us about a linear relationship?
Here's a second attempt at an answer after getting feedback on issues with my first answer.
Firstly, $r$, in your simple linear regression case, is equivalent to the Pearson correlation between plant density and cob weight. More generally, $|r|$ constitutes an upper bound on how good a predictor on the data can theoretically be constructed using a linear function. I.e. the best possible linear predictor would predict values with a correlation of $|r|$ with the observed values.
Secondly, $R^2$ in the simple linear regression case is just $r^2$. For multiple regression $R^2$ is sometimes computed differently, for instance by comparing the residuals (the difference between predicted and observed values of the response variable) in the fitted model to the residuals when the predicted response variable is set to a constant.
Usually, $r$ is interpreted as a measure of how linear the relationship between two variables is and $R^2$ is interpreted as the fraction of the variance in the dependent variable which is explained by the model. However, there are many situations where these interpretations do not hold. For example, if the mean of the cob weight given the plant density is not linear in plant density the value of $r$ might not correctly express the "linearity" of the relationship. For some general issues with $r$ see Anscombe's quartet. See also this answer by whuber on a question about the usefulness of $R^2$. To answer your question with regards to $r$ and $R^2$, these values do not tell us much at all about the dataset, unless we can make some fairly strong assumptions beyond what is usually done for linear regression (for instance we have to assume that there is no non-linear relationship between the variables besides the linear one we are modeling).
The Residual Standard Error is the standard deviation for a normal distribution, centered on the predicted regression line, representing the distribution of actually observed values. In other words, if we were to measure only the plant density for a new plot, we can predict the cob weight using the coefficients of the fitted model, this is the mean of that distribution. The RSE is the standard deviation of that distribution and thus a measure on how much we expect the actually observed cob weights to deviate from the values predicted by the model. An RSE of ~8 in this case has to be compared to the sample standard deviation of the cob weight but the smaller the RSE is compared to the sample SD the more predictive, or adequate, the model is. | What does r, r squared and residual standard deviation tell us about a linear relationship?
Here's a second attempt at an answer after getting feedback on issues with my first answer.
Firstly, $r$, in your simple linear regression case, is equivalent to the Pearson correlation between plant |
19,055 | How to add up partial confidence intervals to create a total confidence interval? | In short:
Take as central point of your confidence interval the sum of central points of every confidence interval (45+70+35=150 minutes).
Take as radius of your interval the square root of the sum of the squares of the radius of every confidence interval $\sqrt{5^2+10^2+5^2}=12.25$
Therefore, a person does that triathlon in between 137.75 and 162.25 minutes with 95% probability. Anyway, beware of assumptions.
In long:
I assumed normal distribution and independence between disciplines, although first assumption may be reasonable as a rough approximation but second assumption is likely false, because I would expect that people performing well in one discipline are likely to perform well on the other ones (for example, I would expect myself to perform poorly in every discipline in a triathlon).
Assuming that times in every discipline is a normal variable, total time is just the sum of three random variables, and therefore normally distributed. Variance of the sum is also the sum of variances of the three variables, and since intervals radius is proportional to the square root of variance, you can just sum the squares of radius of every interval to get the square of the radius of the sum variable.
However, please notice that the (dubious) assumption that times for each discipline are independent narrows the resulting interval - I would say, unrealistically narrows it.
We could make the opposite assumption, that is that times for disciplines are absolutely correlated (that is, roughly, that the person who swam in 40 minutes is the same that cycled in 60 minutes and ran in 30 minutes). That assumption is probably as unrealistic as the assumption of independence was, but surely not a lot more unrealistic.
In this assumption, the radius of intervals just sum, and the triathlon is expected to be completed in between 130 and 170 minutes by 95% of athletes.
In the end, we should expect the real interval to be somewhere between [137.25,162.25] and [130,170] (both unrealistic extreme cases), but to give a more accurate result we would need to know (at least) what is the correlation between times in different discipline.
Edit after reviewing the answer a few years later: The assumption I made that results in different disciplines are likely positively correlated is reasonable if the sample includes people with different levels of fitness. However, if the sample only includes people with similar overall level in triathlon - for example, triathletes who took part in the 2020 Olympic Games - correlation between disciplines might be negative. Anyway, since assuming negative correlation yields smaller confidence intervals (or even zero length intervals), in case of lack of information about correlation I would take the conservative assumption that correlation is somewhere between 0 and 1. End of edit.
Edit about terminology
As Whuber points in his comments, it's not clear what is the meaning of the intervals given in the question. Although, the answer is valid interpreting the resulting intervals in the same way of the intervals in the question.
The two reasonable meanings of the intervals of the question are:
Intervals of confidence about the mean of each sport.
Or intervals containing the times of 95% of participants on each sport.
In spite of the wording of the question fitting better the second meaning (and hence the wording in my answer), the name "confidence interval" is usually not used with this meaning.
However, since individual times follow a normal distribution (according to assumption made in the question) and estimations of means also follow a normal distribution (if sample size is large enough or if we keep sticking to the assumption that individual times are normally distributed), the arithmetic of intervals is the same for both meanings and therefore the results given hold for both meanings. | How to add up partial confidence intervals to create a total confidence interval? | In short:
Take as central point of your confidence interval the sum of central points of every confidence interval (45+70+35=150 minutes).
Take as radius of your interval the square root of the sum o | How to add up partial confidence intervals to create a total confidence interval?
In short:
Take as central point of your confidence interval the sum of central points of every confidence interval (45+70+35=150 minutes).
Take as radius of your interval the square root of the sum of the squares of the radius of every confidence interval $\sqrt{5^2+10^2+5^2}=12.25$
Therefore, a person does that triathlon in between 137.75 and 162.25 minutes with 95% probability. Anyway, beware of assumptions.
In long:
I assumed normal distribution and independence between disciplines, although first assumption may be reasonable as a rough approximation but second assumption is likely false, because I would expect that people performing well in one discipline are likely to perform well on the other ones (for example, I would expect myself to perform poorly in every discipline in a triathlon).
Assuming that times in every discipline is a normal variable, total time is just the sum of three random variables, and therefore normally distributed. Variance of the sum is also the sum of variances of the three variables, and since intervals radius is proportional to the square root of variance, you can just sum the squares of radius of every interval to get the square of the radius of the sum variable.
However, please notice that the (dubious) assumption that times for each discipline are independent narrows the resulting interval - I would say, unrealistically narrows it.
We could make the opposite assumption, that is that times for disciplines are absolutely correlated (that is, roughly, that the person who swam in 40 minutes is the same that cycled in 60 minutes and ran in 30 minutes). That assumption is probably as unrealistic as the assumption of independence was, but surely not a lot more unrealistic.
In this assumption, the radius of intervals just sum, and the triathlon is expected to be completed in between 130 and 170 minutes by 95% of athletes.
In the end, we should expect the real interval to be somewhere between [137.25,162.25] and [130,170] (both unrealistic extreme cases), but to give a more accurate result we would need to know (at least) what is the correlation between times in different discipline.
Edit after reviewing the answer a few years later: The assumption I made that results in different disciplines are likely positively correlated is reasonable if the sample includes people with different levels of fitness. However, if the sample only includes people with similar overall level in triathlon - for example, triathletes who took part in the 2020 Olympic Games - correlation between disciplines might be negative. Anyway, since assuming negative correlation yields smaller confidence intervals (or even zero length intervals), in case of lack of information about correlation I would take the conservative assumption that correlation is somewhere between 0 and 1. End of edit.
Edit about terminology
As Whuber points in his comments, it's not clear what is the meaning of the intervals given in the question. Although, the answer is valid interpreting the resulting intervals in the same way of the intervals in the question.
The two reasonable meanings of the intervals of the question are:
Intervals of confidence about the mean of each sport.
Or intervals containing the times of 95% of participants on each sport.
In spite of the wording of the question fitting better the second meaning (and hence the wording in my answer), the name "confidence interval" is usually not used with this meaning.
However, since individual times follow a normal distribution (according to assumption made in the question) and estimations of means also follow a normal distribution (if sample size is large enough or if we keep sticking to the assumption that individual times are normally distributed), the arithmetic of intervals is the same for both meanings and therefore the results given hold for both meanings. | How to add up partial confidence intervals to create a total confidence interval?
In short:
Take as central point of your confidence interval the sum of central points of every confidence interval (45+70+35=150 minutes).
Take as radius of your interval the square root of the sum o |
19,056 | How to add up partial confidence intervals to create a total confidence interval? | Pere has given a good answer. Adding up of variances is what happens when you add distributions. However in your case, he has assumed the radius as the standard deviation. but in fact, it is 1.96 times the standard deviation. So you will need to divide the radius (pere's terminology) by 1.96 (95% conf int) and then square, sum and take sq-root. | How to add up partial confidence intervals to create a total confidence interval? | Pere has given a good answer. Adding up of variances is what happens when you add distributions. However in your case, he has assumed the radius as the standard deviation. but in fact, it is 1.96 time | How to add up partial confidence intervals to create a total confidence interval?
Pere has given a good answer. Adding up of variances is what happens when you add distributions. However in your case, he has assumed the radius as the standard deviation. but in fact, it is 1.96 times the standard deviation. So you will need to divide the radius (pere's terminology) by 1.96 (95% conf int) and then square, sum and take sq-root. | How to add up partial confidence intervals to create a total confidence interval?
Pere has given a good answer. Adding up of variances is what happens when you add distributions. However in your case, he has assumed the radius as the standard deviation. but in fact, it is 1.96 time |
19,057 | Why is left-skewed called negatively skewed and right-skewed called positively skewed? | My short answer is that it is by design. The skewness measures are usually constructed so that the positive skewness indicates right-skewed distributions.
Today the most common measure of skewness, that is also usually taught in schools, is based on the third central moment equation as follows:
$$\mu_3=E[(X-\mu)^3]$$
Look at the expression above. When there's more weight (of the distribution function) to the right of the mean then $(x-\mu)^3$ will contribute more positive values. The right of the mean is positive, because $x>\mu$ and the left is negative because $x<\mu$. So, mechanically it would seem to answer exactly your question.
However, as @Nick Cox brought up, there is more than one measure of skewness, such as Pearson's first coefficient of skewness, which is based on the difference $mean-mode$. Potentially, different measures of skewness could lead to different relations between positive skewness and the tendency to have heavier tails on the right.
Hence, it is interesting to look at why these measures of skewness were introduced in the first place, and why do they have their particular formulations.
In this context it is useful to look at the exposition of skewness by Yule in An Introduction to the Theory of Statistics (1912). In the following excerpt he describes the desired properties of a reasonable skewness measure. Basically, he requires that the positive skewness should correspond to right skewed distributions, like in your picture: | Why is left-skewed called negatively skewed and right-skewed called positively skewed? | My short answer is that it is by design. The skewness measures are usually constructed so that the positive skewness indicates right-skewed distributions.
Today the most common measure of skewness, th | Why is left-skewed called negatively skewed and right-skewed called positively skewed?
My short answer is that it is by design. The skewness measures are usually constructed so that the positive skewness indicates right-skewed distributions.
Today the most common measure of skewness, that is also usually taught in schools, is based on the third central moment equation as follows:
$$\mu_3=E[(X-\mu)^3]$$
Look at the expression above. When there's more weight (of the distribution function) to the right of the mean then $(x-\mu)^3$ will contribute more positive values. The right of the mean is positive, because $x>\mu$ and the left is negative because $x<\mu$. So, mechanically it would seem to answer exactly your question.
However, as @Nick Cox brought up, there is more than one measure of skewness, such as Pearson's first coefficient of skewness, which is based on the difference $mean-mode$. Potentially, different measures of skewness could lead to different relations between positive skewness and the tendency to have heavier tails on the right.
Hence, it is interesting to look at why these measures of skewness were introduced in the first place, and why do they have their particular formulations.
In this context it is useful to look at the exposition of skewness by Yule in An Introduction to the Theory of Statistics (1912). In the following excerpt he describes the desired properties of a reasonable skewness measure. Basically, he requires that the positive skewness should correspond to right skewed distributions, like in your picture: | Why is left-skewed called negatively skewed and right-skewed called positively skewed?
My short answer is that it is by design. The skewness measures are usually constructed so that the positive skewness indicates right-skewed distributions.
Today the most common measure of skewness, th |
19,058 | Performance benchmarks for MCMC | After some online searching, I have come under the impression that a comprehensive benchmark of established MCMC methods, analogous to what one can find in the optimization literature, does not exist. (I'd be happy to be wrong here.)
It is easy to find comparisons of a few MCMC methods on specific problems within an applied domain. This would be okay if we could pool this information -- however, the quality of such benchmarks is often insufficient (e.g., due to lack in the reported metrics or poor design choices).
In the following I will post what I believe are valuable contributions as I find them:
Nishihara, Murray and Adams, Parallel MCMC with Generalized Elliptical Slice Sampling, JMLR (2014). The authors propose a novel multi-state method, GESS, and perform a comparison with 6 other single-state and multi-state methods on 7 test functions. They evaluate performance as ESS (Effective Sample Size) per second and per function evaluation.
SamplerCompare is a R package with the goal of benchmarking MCMC algorithms -- exactly what was I was asking about in my original question. Unfortunately, the package contains only a few test functions; the accompanying paper reports no actual benchmarks (just a small example); and it seems there have been no follow-ups.
Thompson, Madeleine B. "Introduction to SamplerCompare." Journal of Statistical Software 43.12 (2011): 1-10 (link).
For an interesting take on multi-state aka ensemble methods, see this blog post by Bob Carpenter on Gelman's blog, and my comment referring to this CV post. | Performance benchmarks for MCMC | After some online searching, I have come under the impression that a comprehensive benchmark of established MCMC methods, analogous to what one can find in the optimization literature, does not exist. | Performance benchmarks for MCMC
After some online searching, I have come under the impression that a comprehensive benchmark of established MCMC methods, analogous to what one can find in the optimization literature, does not exist. (I'd be happy to be wrong here.)
It is easy to find comparisons of a few MCMC methods on specific problems within an applied domain. This would be okay if we could pool this information -- however, the quality of such benchmarks is often insufficient (e.g., due to lack in the reported metrics or poor design choices).
In the following I will post what I believe are valuable contributions as I find them:
Nishihara, Murray and Adams, Parallel MCMC with Generalized Elliptical Slice Sampling, JMLR (2014). The authors propose a novel multi-state method, GESS, and perform a comparison with 6 other single-state and multi-state methods on 7 test functions. They evaluate performance as ESS (Effective Sample Size) per second and per function evaluation.
SamplerCompare is a R package with the goal of benchmarking MCMC algorithms -- exactly what was I was asking about in my original question. Unfortunately, the package contains only a few test functions; the accompanying paper reports no actual benchmarks (just a small example); and it seems there have been no follow-ups.
Thompson, Madeleine B. "Introduction to SamplerCompare." Journal of Statistical Software 43.12 (2011): 1-10 (link).
For an interesting take on multi-state aka ensemble methods, see this blog post by Bob Carpenter on Gelman's blog, and my comment referring to this CV post. | Performance benchmarks for MCMC
After some online searching, I have come under the impression that a comprehensive benchmark of established MCMC methods, analogous to what one can find in the optimization literature, does not exist. |
19,059 | Performance benchmarks for MCMC | I would agree with your assessment that there are no comprehensive benchmarks established for MCMC methods. This is because every MCMC sampler has pros and cons, and are extremely problem specific.
In a typical Bayesian modeling setting, you can run the same sampler with diverse mixing rates when the data is different. I would go to the extent of saying that if in the future there comes out a comprehensive benchmark study of various MCMC samplers, I would not trust the results to be applicable outside of the examples shown.
Regarding the usage of ESS to assess sampling quality, it is worth mentioning that ESS depends on the quantity that is to be estimated from the sample. If you want to find the mean of the sample, the ESS obtained will be different from if you want to estimate the 25th quantile. Having said that, if the quantity of interest is fixed, ESS is a reasonable way of comparing samplers. Maybe a better idea is ESS per unit time.
One flaw with ESS is that for multivariate estimation problems, ESS returns an effective sample size for each component separately, ignoring all cross-correlations in the estimation process. In this paper recently, a multivariate ESS has been proposed, and implemented in R package mcmcsevia the function multiESS. It is unclear how this method compares to the ESS of the coda package, but at the very outset seems more reasonable than univariate ESS methods. | Performance benchmarks for MCMC | I would agree with your assessment that there are no comprehensive benchmarks established for MCMC methods. This is because every MCMC sampler has pros and cons, and are extremely problem specific.
I | Performance benchmarks for MCMC
I would agree with your assessment that there are no comprehensive benchmarks established for MCMC methods. This is because every MCMC sampler has pros and cons, and are extremely problem specific.
In a typical Bayesian modeling setting, you can run the same sampler with diverse mixing rates when the data is different. I would go to the extent of saying that if in the future there comes out a comprehensive benchmark study of various MCMC samplers, I would not trust the results to be applicable outside of the examples shown.
Regarding the usage of ESS to assess sampling quality, it is worth mentioning that ESS depends on the quantity that is to be estimated from the sample. If you want to find the mean of the sample, the ESS obtained will be different from if you want to estimate the 25th quantile. Having said that, if the quantity of interest is fixed, ESS is a reasonable way of comparing samplers. Maybe a better idea is ESS per unit time.
One flaw with ESS is that for multivariate estimation problems, ESS returns an effective sample size for each component separately, ignoring all cross-correlations in the estimation process. In this paper recently, a multivariate ESS has been proposed, and implemented in R package mcmcsevia the function multiESS. It is unclear how this method compares to the ESS of the coda package, but at the very outset seems more reasonable than univariate ESS methods. | Performance benchmarks for MCMC
I would agree with your assessment that there are no comprehensive benchmarks established for MCMC methods. This is because every MCMC sampler has pros and cons, and are extremely problem specific.
I |
19,060 | When to use Bayesian Networks over other machine learning approaches? | Bayesian Networks (BN's) are generative models. Assume you have a set of inputs, $X$, and output $Y$. BN's allow you to learn the joint distribution $P(X,Y)$, as opposed to let's say logistic regression or Support Vector Machine, which model the conditional distribution $P(Y|X)$.
Learning the joint probability distribution (generative model) of data is more difficult than learning the conditional probability (discriminative models). However, the former provides a more versatile model where you can run queries such as $P(X_1|Y)$ or $P(X_1|X_2=A, X_3=B)$, etc. With the discriminative model, your sole aim is to learn $P(Y|X)$.
BN's utilize DAG's to prescribe the joint distribution. Hence they are graphical models.
Advantages:
When you have a lot of missing data, e.g. in medicine, BN's can be very effective since modeling the joint distribution (i.e. your assertion on how the data was generated) reduces your dependency in having a fully observed dataset.
When you want to model a domain in a way that is visually transparent, and also aims to capture $\text{cause} \to \text{effect}$ relationships, BN's can be very powerful. Note that the causality assumption in BN's is open to debate though.
Learning the joint distribution is a difficult task, modeling it for discrete variables (through the calculation of conditional probability tables, i.e. CPT's) is substantially easier than trying to do the same for continuous variables though. So BN's are practically more common with discrete variables.
BN's not only allow observational inference (as all machine learning models allow) but also causal interventions. This is a commonly neglected and underappreciated advantage of BN's and is related to counterfactual reasoning. | When to use Bayesian Networks over other machine learning approaches? | Bayesian Networks (BN's) are generative models. Assume you have a set of inputs, $X$, and output $Y$. BN's allow you to learn the joint distribution $P(X,Y)$, as opposed to let's say logistic regressi | When to use Bayesian Networks over other machine learning approaches?
Bayesian Networks (BN's) are generative models. Assume you have a set of inputs, $X$, and output $Y$. BN's allow you to learn the joint distribution $P(X,Y)$, as opposed to let's say logistic regression or Support Vector Machine, which model the conditional distribution $P(Y|X)$.
Learning the joint probability distribution (generative model) of data is more difficult than learning the conditional probability (discriminative models). However, the former provides a more versatile model where you can run queries such as $P(X_1|Y)$ or $P(X_1|X_2=A, X_3=B)$, etc. With the discriminative model, your sole aim is to learn $P(Y|X)$.
BN's utilize DAG's to prescribe the joint distribution. Hence they are graphical models.
Advantages:
When you have a lot of missing data, e.g. in medicine, BN's can be very effective since modeling the joint distribution (i.e. your assertion on how the data was generated) reduces your dependency in having a fully observed dataset.
When you want to model a domain in a way that is visually transparent, and also aims to capture $\text{cause} \to \text{effect}$ relationships, BN's can be very powerful. Note that the causality assumption in BN's is open to debate though.
Learning the joint distribution is a difficult task, modeling it for discrete variables (through the calculation of conditional probability tables, i.e. CPT's) is substantially easier than trying to do the same for continuous variables though. So BN's are practically more common with discrete variables.
BN's not only allow observational inference (as all machine learning models allow) but also causal interventions. This is a commonly neglected and underappreciated advantage of BN's and is related to counterfactual reasoning. | When to use Bayesian Networks over other machine learning approaches?
Bayesian Networks (BN's) are generative models. Assume you have a set of inputs, $X$, and output $Y$. BN's allow you to learn the joint distribution $P(X,Y)$, as opposed to let's say logistic regressi |
19,061 | When to use Bayesian Networks over other machine learning approaches? | In my experience, Bayesian Networks work very well when there is high dimensional categorical data. They give interpret-able models, which (sometimes) aid in making sense of how the different variables interact. | When to use Bayesian Networks over other machine learning approaches? | In my experience, Bayesian Networks work very well when there is high dimensional categorical data. They give interpret-able models, which (sometimes) aid in making sense of how the different variable | When to use Bayesian Networks over other machine learning approaches?
In my experience, Bayesian Networks work very well when there is high dimensional categorical data. They give interpret-able models, which (sometimes) aid in making sense of how the different variables interact. | When to use Bayesian Networks over other machine learning approaches?
In my experience, Bayesian Networks work very well when there is high dimensional categorical data. They give interpret-able models, which (sometimes) aid in making sense of how the different variable |
19,062 | Calculate log-likelihood "by hand" for generalized nonlinear least squares regression (nlme) | Let's start with the simpler case where there is no correlation structure for the residuals:
fit <- gnls(model=model,data=data,start=start)
logLik(fit)
The log likelihood can then be easily computed by hand with:
N <- fit$dims$N
p <- fit$dims$p
sigma <- fit$sigma * sqrt((N-p)/N)
sum(dnorm(y, mean=fitted(fit), sd=sigma, log=TRUE))
Since the residuals are independent, we can just use dnorm(..., log=TRUE) to get the individual log likelihood terms (and then sum them up). Alternatively, we could use:
sum(dnorm(resid(fit), mean=0, sd=sigma, log=TRUE))
Note that fit$sigma is not the "less biased estimate of $\sigma^2$" -- so we need to make the correction manually first.
Now for the more complicated case where the residuals are correlated:
fit <- gnls(model=model,data=data,start=start,correlation=correlation)
logLik(fit)
Here, we need to use the multivariate normal distribution. I am sure there is a function for this somewhere, but let's just do this by hand:
N <- fit$dims$N
p <- fit$dims$p
yhat <- cbind(fitted(fit))
R <- vcv(tree, cor=TRUE)
sigma <- fit$sigma * sqrt((N-p)/N)
S <- diag(sigma, nrow=nrow(R)) %*% R %*% diag(sigma, nrow=nrow(R))
-1/2 * log(det(S)) - 1/2 * t(y - yhat) %*% solve(S) %*% (y - yhat) - N/2 * log(2*pi) | Calculate log-likelihood "by hand" for generalized nonlinear least squares regression (nlme) | Let's start with the simpler case where there is no correlation structure for the residuals:
fit <- gnls(model=model,data=data,start=start)
logLik(fit)
The log likelihood can then be easily computed | Calculate log-likelihood "by hand" for generalized nonlinear least squares regression (nlme)
Let's start with the simpler case where there is no correlation structure for the residuals:
fit <- gnls(model=model,data=data,start=start)
logLik(fit)
The log likelihood can then be easily computed by hand with:
N <- fit$dims$N
p <- fit$dims$p
sigma <- fit$sigma * sqrt((N-p)/N)
sum(dnorm(y, mean=fitted(fit), sd=sigma, log=TRUE))
Since the residuals are independent, we can just use dnorm(..., log=TRUE) to get the individual log likelihood terms (and then sum them up). Alternatively, we could use:
sum(dnorm(resid(fit), mean=0, sd=sigma, log=TRUE))
Note that fit$sigma is not the "less biased estimate of $\sigma^2$" -- so we need to make the correction manually first.
Now for the more complicated case where the residuals are correlated:
fit <- gnls(model=model,data=data,start=start,correlation=correlation)
logLik(fit)
Here, we need to use the multivariate normal distribution. I am sure there is a function for this somewhere, but let's just do this by hand:
N <- fit$dims$N
p <- fit$dims$p
yhat <- cbind(fitted(fit))
R <- vcv(tree, cor=TRUE)
sigma <- fit$sigma * sqrt((N-p)/N)
S <- diag(sigma, nrow=nrow(R)) %*% R %*% diag(sigma, nrow=nrow(R))
-1/2 * log(det(S)) - 1/2 * t(y - yhat) %*% solve(S) %*% (y - yhat) - N/2 * log(2*pi) | Calculate log-likelihood "by hand" for generalized nonlinear least squares regression (nlme)
Let's start with the simpler case where there is no correlation structure for the residuals:
fit <- gnls(model=model,data=data,start=start)
logLik(fit)
The log likelihood can then be easily computed |
19,063 | LogLikelihood Parameter Estimation for Linear Gaussian Kalman Filter | When you run the Kalman filter as you have, with given values of
$\sigma_\epsilon^2$ and $\sigma^2_\eta$, you get a sequence of innovations
$\nu_t$ and their covariances $\boldsymbol{F_t}$, hence you can calculate the value of $\log L(Y_n)$ using the formula you give.
In other words, you can regard the Kalman filter as a way to compute an implicit function of $\sigma_\epsilon^2$ and $\sigma^2_\eta$. The only thing that you need to do then is to package this computation into a function or subroutine and handle that function to an optimization routine --like optim in R. That function should accept as inputs $\sigma_\epsilon^2$ and $\sigma^2_\eta$ and return $\log L(Y_n)$.
Some packages in R (e.g. dlm) do this for you (see for instance function dlmMLE).
Edit: Link in one of my comments below, which I cannot edit, is now here. | LogLikelihood Parameter Estimation for Linear Gaussian Kalman Filter | When you run the Kalman filter as you have, with given values of
$\sigma_\epsilon^2$ and $\sigma^2_\eta$, you get a sequence of innovations
$\nu_t$ and their covariances $\boldsymbol{F_t}$, hence you | LogLikelihood Parameter Estimation for Linear Gaussian Kalman Filter
When you run the Kalman filter as you have, with given values of
$\sigma_\epsilon^2$ and $\sigma^2_\eta$, you get a sequence of innovations
$\nu_t$ and their covariances $\boldsymbol{F_t}$, hence you can calculate the value of $\log L(Y_n)$ using the formula you give.
In other words, you can regard the Kalman filter as a way to compute an implicit function of $\sigma_\epsilon^2$ and $\sigma^2_\eta$. The only thing that you need to do then is to package this computation into a function or subroutine and handle that function to an optimization routine --like optim in R. That function should accept as inputs $\sigma_\epsilon^2$ and $\sigma^2_\eta$ and return $\log L(Y_n)$.
Some packages in R (e.g. dlm) do this for you (see for instance function dlmMLE).
Edit: Link in one of my comments below, which I cannot edit, is now here. | LogLikelihood Parameter Estimation for Linear Gaussian Kalman Filter
When you run the Kalman filter as you have, with given values of
$\sigma_\epsilon^2$ and $\sigma^2_\eta$, you get a sequence of innovations
$\nu_t$ and their covariances $\boldsymbol{F_t}$, hence you |
19,064 | Fisher's Exact Test and Hypergeometric Distribution | Fisher's exact test works by conditioning upon the table margins (in this case, 5 males and females and 5 soda drinkers and non-drinkers). Under the assumptions of the null hypothesis, the cell probabilities for observing a male soda drinker, male non-soda drinker, female soda drinker, or female non-soda drinker are all equally likely (0.25) because of the margin totals.
The particular table you used for the FET has no table aside from its converse, 5 female non-soda drinkers and 5 male soda drinkers, which is "at least as unlikely" under the null hypothesis. So you'll notice that doubling the probability you obtained in your hypergeometric density gives you the FET p-value. | Fisher's Exact Test and Hypergeometric Distribution | Fisher's exact test works by conditioning upon the table margins (in this case, 5 males and females and 5 soda drinkers and non-drinkers). Under the assumptions of the null hypothesis, the cell probab | Fisher's Exact Test and Hypergeometric Distribution
Fisher's exact test works by conditioning upon the table margins (in this case, 5 males and females and 5 soda drinkers and non-drinkers). Under the assumptions of the null hypothesis, the cell probabilities for observing a male soda drinker, male non-soda drinker, female soda drinker, or female non-soda drinker are all equally likely (0.25) because of the margin totals.
The particular table you used for the FET has no table aside from its converse, 5 female non-soda drinkers and 5 male soda drinkers, which is "at least as unlikely" under the null hypothesis. So you'll notice that doubling the probability you obtained in your hypergeometric density gives you the FET p-value. | Fisher's Exact Test and Hypergeometric Distribution
Fisher's exact test works by conditioning upon the table margins (in this case, 5 males and females and 5 soda drinkers and non-drinkers). Under the assumptions of the null hypothesis, the cell probab |
19,065 | How to handle categorical predictors with too many levels? [duplicate] | I can't see that ordering the levels by frequency creates an ordinal variable.
Shrinkage is necessary to deal with this problem, either by using penalized maximum likelihood estimation (e.g., R rms package's ols and lrm functions for quadratic (ridge) L2 penalty) or using random effects. You can get predictions for individual levels easily using penalized maximum likelihood estimation, or by using BLUPS in the mixed effects modeling context. | How to handle categorical predictors with too many levels? [duplicate] | I can't see that ordering the levels by frequency creates an ordinal variable.
Shrinkage is necessary to deal with this problem, either by using penalized maximum likelihood estimation (e.g., R rms pa | How to handle categorical predictors with too many levels? [duplicate]
I can't see that ordering the levels by frequency creates an ordinal variable.
Shrinkage is necessary to deal with this problem, either by using penalized maximum likelihood estimation (e.g., R rms package's ols and lrm functions for quadratic (ridge) L2 penalty) or using random effects. You can get predictions for individual levels easily using penalized maximum likelihood estimation, or by using BLUPS in the mixed effects modeling context. | How to handle categorical predictors with too many levels? [duplicate]
I can't see that ordering the levels by frequency creates an ordinal variable.
Shrinkage is necessary to deal with this problem, either by using penalized maximum likelihood estimation (e.g., R rms pa |
19,066 | How to handle categorical predictors with too many levels? [duplicate] | If I understand your problem ( and the old post you linked too) - you are saying that some of the levels have very little data to accurately estimate the effect.
So either reduce the levels by "hand" (creating a new "other" level for all those levels with insufficient data) or what about using L2/L1 regularisation | How to handle categorical predictors with too many levels? [duplicate] | If I understand your problem ( and the old post you linked too) - you are saying that some of the levels have very little data to accurately estimate the effect.
So either reduce the levels by "hand" | How to handle categorical predictors with too many levels? [duplicate]
If I understand your problem ( and the old post you linked too) - you are saying that some of the levels have very little data to accurately estimate the effect.
So either reduce the levels by "hand" (creating a new "other" level for all those levels with insufficient data) or what about using L2/L1 regularisation | How to handle categorical predictors with too many levels? [duplicate]
If I understand your problem ( and the old post you linked too) - you are saying that some of the levels have very little data to accurately estimate the effect.
So either reduce the levels by "hand" |
19,067 | How to find out if an online poker-site is fair? | You can use Sklansky's starting hand ranking to know the strength of a dealt hand from 1 to 8. Generate a random sample with the first 100 hands, another with the next 100 hands and compare them with the Wilcoxon test. | How to find out if an online poker-site is fair? | You can use Sklansky's starting hand ranking to know the strength of a dealt hand from 1 to 8. Generate a random sample with the first 100 hands, another with the next 100 hands and compare them with | How to find out if an online poker-site is fair?
You can use Sklansky's starting hand ranking to know the strength of a dealt hand from 1 to 8. Generate a random sample with the first 100 hands, another with the next 100 hands and compare them with the Wilcoxon test. | How to find out if an online poker-site is fair?
You can use Sklansky's starting hand ranking to know the strength of a dealt hand from 1 to 8. Generate a random sample with the first 100 hands, another with the next 100 hands and compare them with |
19,068 | How to find out if an online poker-site is fair? | Procrastinator and Macro are clearly correct in saying that the house does not need to cheat to win on average and that a sufficiently skilled player will win enough money against amateurs to overcome the house's "rake". However, a greedy and dishonest house has lots of ways to cheat if it wants to. The house could create fake highly skilled electronic players who win often but are, in actuality, owned by the owner of the site. Those players could be given a further advantage by sometimes telling them the contents of the other players hands. And those are schemes that only took a few minutes to think up.
Question: Is there any sort of regulatory commission that audits the algorithms?
Even in the case of a perfectly honest game, unless your expectation is sufficiently positive and your bank account sufficiently large, a random walk will eventually wipe you out. | How to find out if an online poker-site is fair? | Procrastinator and Macro are clearly correct in saying that the house does not need to cheat to win on average and that a sufficiently skilled player will win enough money against amateurs to overcome | How to find out if an online poker-site is fair?
Procrastinator and Macro are clearly correct in saying that the house does not need to cheat to win on average and that a sufficiently skilled player will win enough money against amateurs to overcome the house's "rake". However, a greedy and dishonest house has lots of ways to cheat if it wants to. The house could create fake highly skilled electronic players who win often but are, in actuality, owned by the owner of the site. Those players could be given a further advantage by sometimes telling them the contents of the other players hands. And those are schemes that only took a few minutes to think up.
Question: Is there any sort of regulatory commission that audits the algorithms?
Even in the case of a perfectly honest game, unless your expectation is sufficiently positive and your bank account sufficiently large, a random walk will eventually wipe you out. | How to find out if an online poker-site is fair?
Procrastinator and Macro are clearly correct in saying that the house does not need to cheat to win on average and that a sufficiently skilled player will win enough money against amateurs to overcome |
19,069 | How to find out if an online poker-site is fair? | Here's a possible but expensive way to test your friend's suspicion. Let a group of people each start playing on the site in question. Record each person's net win/loss during two successive and predetermined periods of time. I would naively expect them to do as well or better during the second period because practice may improve there skill level. If the site is "suckering people in" the performance in the second period is apt to be worse and you might be able to detect it with a simple paired t-test or possibly an unpaired test.
But if the site is only a little bit greedy you may not have enough power to detect it. | How to find out if an online poker-site is fair? | Here's a possible but expensive way to test your friend's suspicion. Let a group of people each start playing on the site in question. Record each person's net win/loss during two successive and pre | How to find out if an online poker-site is fair?
Here's a possible but expensive way to test your friend's suspicion. Let a group of people each start playing on the site in question. Record each person's net win/loss during two successive and predetermined periods of time. I would naively expect them to do as well or better during the second period because practice may improve there skill level. If the site is "suckering people in" the performance in the second period is apt to be worse and you might be able to detect it with a simple paired t-test or possibly an unpaired test.
But if the site is only a little bit greedy you may not have enough power to detect it. | How to find out if an online poker-site is fair?
Here's a possible but expensive way to test your friend's suspicion. Let a group of people each start playing on the site in question. Record each person's net win/loss during two successive and pre |
19,070 | How to find out if an online poker-site is fair? | Question is flawed
If the game was fixed to excite new users they would not limit it to hole cards. It is way more exciting to suck out on a runner runner flush and you make more money. If anything they would give the hooked player good hole cards so they would put money in the pot.
The only way to access the fairness of the site is are the deals random. Given there are 80658175170943900000000000000000000000000000000000000000000000000000 shuffles that take a lot of deals. Yes in the hand 58 is the same as 85 but still look at randomness of the shuffle. Sites will submit shuffles / deals to independent audit agencies.
The assertion they will give new people good hands is flawed. You make money by retaining customers. Screw existing customers is a bad business model. Online sites are not stupid.
There is a lot of variance in poker and when people lose they want to blame it on the game is fixed. Watch pros that lose runner runner that is 1 in 990. They just get up and walk away. It happens. Draw Ace Ace is 1 in 221. | How to find out if an online poker-site is fair? | Question is flawed
If the game was fixed to excite new users they would not limit it to hole cards. It is way more exciting to suck out on a runner runner flush and you make more money. If anything | How to find out if an online poker-site is fair?
Question is flawed
If the game was fixed to excite new users they would not limit it to hole cards. It is way more exciting to suck out on a runner runner flush and you make more money. If anything they would give the hooked player good hole cards so they would put money in the pot.
The only way to access the fairness of the site is are the deals random. Given there are 80658175170943900000000000000000000000000000000000000000000000000000 shuffles that take a lot of deals. Yes in the hand 58 is the same as 85 but still look at randomness of the shuffle. Sites will submit shuffles / deals to independent audit agencies.
The assertion they will give new people good hands is flawed. You make money by retaining customers. Screw existing customers is a bad business model. Online sites are not stupid.
There is a lot of variance in poker and when people lose they want to blame it on the game is fixed. Watch pros that lose runner runner that is 1 in 990. They just get up and walk away. It happens. Draw Ace Ace is 1 in 221. | How to find out if an online poker-site is fair?
Question is flawed
If the game was fixed to excite new users they would not limit it to hole cards. It is way more exciting to suck out on a runner runner flush and you make more money. If anything |
19,071 | Why are derived features used in neural networks? | 1): Including derived features is a way to inject expert knowledge into the training process, and so to accelerate it. For example, I work with physicists a lot in my research. When I'm building an optimization model, they'll give me 3 or 4 parameters, but they usually also know certain forms that are supposed to appear in the equation. For example, I might get variables $n$ and $l$, but the expert knows that $n*l$ is important. By including it as a feature, I save the model the extra effort of finding out that $n*l$ is important. Granted, sometimes domain experts are wrong, but in my experience, they usually know what they're talking about.
2): There are two reasons I know of for this. First, if you have thousands of features supplied (as often happens in real world data), and are short on CPU time for training (also a common occurrence), you can use a number of different feature selection algorithms to pare down the feature space in advance. The principled approaches to this often use information-theoretic measures to select the features with the highest predictive power. Second, even if you can afford to train on all the data and all the features you have, neural networks are often criticized for being 'black box' models. Reducing the feature space in advance can help to mitigate this issue. For example, a user looking at the NN cannot easily tell whether a weight of 0.01 means "0, but the optimization process didn't quite get there" or "This feature is important, but has to be reduced in value prior to use". Using feature selection in advance to remove useless features makes this less of an issue. | Why are derived features used in neural networks? | 1): Including derived features is a way to inject expert knowledge into the training process, and so to accelerate it. For example, I work with physicists a lot in my research. When I'm building an op | Why are derived features used in neural networks?
1): Including derived features is a way to inject expert knowledge into the training process, and so to accelerate it. For example, I work with physicists a lot in my research. When I'm building an optimization model, they'll give me 3 or 4 parameters, but they usually also know certain forms that are supposed to appear in the equation. For example, I might get variables $n$ and $l$, but the expert knows that $n*l$ is important. By including it as a feature, I save the model the extra effort of finding out that $n*l$ is important. Granted, sometimes domain experts are wrong, but in my experience, they usually know what they're talking about.
2): There are two reasons I know of for this. First, if you have thousands of features supplied (as often happens in real world data), and are short on CPU time for training (also a common occurrence), you can use a number of different feature selection algorithms to pare down the feature space in advance. The principled approaches to this often use information-theoretic measures to select the features with the highest predictive power. Second, even if you can afford to train on all the data and all the features you have, neural networks are often criticized for being 'black box' models. Reducing the feature space in advance can help to mitigate this issue. For example, a user looking at the NN cannot easily tell whether a weight of 0.01 means "0, but the optimization process didn't quite get there" or "This feature is important, but has to be reduced in value prior to use". Using feature selection in advance to remove useless features makes this less of an issue. | Why are derived features used in neural networks?
1): Including derived features is a way to inject expert knowledge into the training process, and so to accelerate it. For example, I work with physicists a lot in my research. When I'm building an op |
19,072 | Why are derived features used in neural networks? | 1) Most neural networks cannot perform multiplications; they can only calculate sums (which are then individually fed through through an activation function). They must instead estimate those multiplications if they are important, which requires a lot of neurons, especially if the factors can span large ranges.
If it would turn out that the house area is in fact an important feature, you will help the network if you provide it with the area, because it can then use the neurons it would have required to estimate the multiplication of the width and the length to do other things.
Hence, including polynomial features may in some cases be beneficial to the network, but has in other cases no significant effect. Furthermore, polynomial features are only one type of derived features that may be helpful to the network. Another type of derived feature that may turn out to be helpful is for example the logarithms of the input variables (considered they are positive) which the network also must estimate to obtain.
An idea would be to allow the network to perform more operations between numbers than only additions, to enable it to efficiently calculate things like polynomial features itself, but it is not clear how that would work. One architecture that looks like it does something similar is the sum-product network.
2) Except from the computational cost which John mentioned, increasing the number of parameters in the model, which inevitable happens when you introduce more inputs, also increases the risk for the network to overfit, especially if you have little training data.
However, this can be made into much less of a problem if a good regularization method is used. (Dropout seems to work extremely well for that) Theoretically, with a good enough regularization method, overfitting shouldn't be a problem at all. As Hinton points out, a human has in the order of 10^14 synapses in the brain (corresponding to the connections in the neural network), but only lives in the order of 10^9 seconds, but we still seem to be able to generalize quite well. So clearly, having many parameters that can be tuned should with the right algorithm only be an advantage. | Why are derived features used in neural networks? | 1) Most neural networks cannot perform multiplications; they can only calculate sums (which are then individually fed through through an activation function). They must instead estimate those multipli | Why are derived features used in neural networks?
1) Most neural networks cannot perform multiplications; they can only calculate sums (which are then individually fed through through an activation function). They must instead estimate those multiplications if they are important, which requires a lot of neurons, especially if the factors can span large ranges.
If it would turn out that the house area is in fact an important feature, you will help the network if you provide it with the area, because it can then use the neurons it would have required to estimate the multiplication of the width and the length to do other things.
Hence, including polynomial features may in some cases be beneficial to the network, but has in other cases no significant effect. Furthermore, polynomial features are only one type of derived features that may be helpful to the network. Another type of derived feature that may turn out to be helpful is for example the logarithms of the input variables (considered they are positive) which the network also must estimate to obtain.
An idea would be to allow the network to perform more operations between numbers than only additions, to enable it to efficiently calculate things like polynomial features itself, but it is not clear how that would work. One architecture that looks like it does something similar is the sum-product network.
2) Except from the computational cost which John mentioned, increasing the number of parameters in the model, which inevitable happens when you introduce more inputs, also increases the risk for the network to overfit, especially if you have little training data.
However, this can be made into much less of a problem if a good regularization method is used. (Dropout seems to work extremely well for that) Theoretically, with a good enough regularization method, overfitting shouldn't be a problem at all. As Hinton points out, a human has in the order of 10^14 synapses in the brain (corresponding to the connections in the neural network), but only lives in the order of 10^9 seconds, but we still seem to be able to generalize quite well. So clearly, having many parameters that can be tuned should with the right algorithm only be an advantage. | Why are derived features used in neural networks?
1) Most neural networks cannot perform multiplications; they can only calculate sums (which are then individually fed through through an activation function). They must instead estimate those multipli |
19,073 | Dynamic recommender systems | I really recommend the paper Collaborative filtering with temporal dynamics by Yehuda Koren (Netflix Contest !) where this issue is discussed in detail.
I agree with the author, that the first option ("cutting off") is not the way to go. It is true that outdated preferences are ignored that way, but a) some preferences do never change, hence one kills data in order to identify the evergreens and b) some preferences in the past are required in order to understand the preferences of the future (e.g. buy season 1 -> you are likely to buy season 2).
However, Koren does not try to identify such trajectories explicitly (i.e. so that one can predict future change behaviors of a user), since this a very very hard task. You can imagine this by keeping that in mind, that preference "stations" along a trajectory are NOT bound to time, but to the personal development of a user, maybe interrupted or crossed by other trajectories or expressed simply in a different way. E.g. if one moves from hard action movies to action movies, there is no such a thing as a definite "entry soft action movie" or something like that. The user can enter this area at any point (in time and item space). This problems combined with the sparseness of the data makes it almost impossible to create a feasible model here.
Instead, Koren tries to separate the past data into long-term-pattern-signals and daily noise in order to increase the effectiveness of rating predictions. He applies this approach to both SVD and a simple collaborative neigborbood model. Unfortunately, I am not done with the math yet, so I cannot provide more details on this.
Additional note on explicit modelling of the trajectories
The area of Sequence Mining provides methods to do, but the critical point is to find a suitable abstract representation of the items (since using the items itself will not work due to sparseness), e.g. clustering into tags.
However, while this approach may provide some insights into the behavior of some users (Data Mining !) it might not be relevant when it comes to the application to all customers (i.e. the mass), so that implicit modelling as suggested by Koren might be better in the end. | Dynamic recommender systems | I really recommend the paper Collaborative filtering with temporal dynamics by Yehuda Koren (Netflix Contest !) where this issue is discussed in detail.
I agree with the author, that the first option | Dynamic recommender systems
I really recommend the paper Collaborative filtering with temporal dynamics by Yehuda Koren (Netflix Contest !) where this issue is discussed in detail.
I agree with the author, that the first option ("cutting off") is not the way to go. It is true that outdated preferences are ignored that way, but a) some preferences do never change, hence one kills data in order to identify the evergreens and b) some preferences in the past are required in order to understand the preferences of the future (e.g. buy season 1 -> you are likely to buy season 2).
However, Koren does not try to identify such trajectories explicitly (i.e. so that one can predict future change behaviors of a user), since this a very very hard task. You can imagine this by keeping that in mind, that preference "stations" along a trajectory are NOT bound to time, but to the personal development of a user, maybe interrupted or crossed by other trajectories or expressed simply in a different way. E.g. if one moves from hard action movies to action movies, there is no such a thing as a definite "entry soft action movie" or something like that. The user can enter this area at any point (in time and item space). This problems combined with the sparseness of the data makes it almost impossible to create a feasible model here.
Instead, Koren tries to separate the past data into long-term-pattern-signals and daily noise in order to increase the effectiveness of rating predictions. He applies this approach to both SVD and a simple collaborative neigborbood model. Unfortunately, I am not done with the math yet, so I cannot provide more details on this.
Additional note on explicit modelling of the trajectories
The area of Sequence Mining provides methods to do, but the critical point is to find a suitable abstract representation of the items (since using the items itself will not work due to sparseness), e.g. clustering into tags.
However, while this approach may provide some insights into the behavior of some users (Data Mining !) it might not be relevant when it comes to the application to all customers (i.e. the mass), so that implicit modelling as suggested by Koren might be better in the end. | Dynamic recommender systems
I really recommend the paper Collaborative filtering with temporal dynamics by Yehuda Koren (Netflix Contest !) where this issue is discussed in detail.
I agree with the author, that the first option |
19,074 | Dynamic recommender systems | I am not aware of a working system, but would not be surprised if Amazon, NetFlix or someone has such a system. Even the Google search engine might have a similar type of system.
I thought about this while taking Dr. Ng's course last semester. The approach I first thought would be optimal would be to add a weighting factor based on age. The more current a piece of data is, the more heavily it would be weighted. This approach would be relatively simple and computationally inexpensive to implement.
However, after thinking about this approach more carefully I think it has serious flaws for many applications. Personally, I will often follow a genre or show for some time, tire of it, move on to something else, but return to the original genre later. This burnout, rekindling cycle does appear in society as well.
Therefore, I am leaning towards a slightly more complicated system. Data would need to be divided into two sets; current data -- the threshold would need to vary depending on application plus length of the individual's interactions -- which would be weighted more heavily and "historical" data which would be rated lower with slow decline in values over time. Second, a factor would be included to try to detect "turn-off" where a heavy interest or involvement suddenly disappears. The "current" data which is similarly classified would be reclassified as if it were historical.
None of this approach has any rigor or validation, but I believe it would be worth constructing some trials of the hypothesis. | Dynamic recommender systems | I am not aware of a working system, but would not be surprised if Amazon, NetFlix or someone has such a system. Even the Google search engine might have a similar type of system.
I thought about this | Dynamic recommender systems
I am not aware of a working system, but would not be surprised if Amazon, NetFlix or someone has such a system. Even the Google search engine might have a similar type of system.
I thought about this while taking Dr. Ng's course last semester. The approach I first thought would be optimal would be to add a weighting factor based on age. The more current a piece of data is, the more heavily it would be weighted. This approach would be relatively simple and computationally inexpensive to implement.
However, after thinking about this approach more carefully I think it has serious flaws for many applications. Personally, I will often follow a genre or show for some time, tire of it, move on to something else, but return to the original genre later. This burnout, rekindling cycle does appear in society as well.
Therefore, I am leaning towards a slightly more complicated system. Data would need to be divided into two sets; current data -- the threshold would need to vary depending on application plus length of the individual's interactions -- which would be weighted more heavily and "historical" data which would be rated lower with slow decline in values over time. Second, a factor would be included to try to detect "turn-off" where a heavy interest or involvement suddenly disappears. The "current" data which is similarly classified would be reclassified as if it were historical.
None of this approach has any rigor or validation, but I believe it would be worth constructing some trials of the hypothesis. | Dynamic recommender systems
I am not aware of a working system, but would not be surprised if Amazon, NetFlix or someone has such a system. Even the Google search engine might have a similar type of system.
I thought about this |
19,075 | Dynamic recommender systems | As I see it, a modified version of collaborative filtering can work. However, you will need to keep a timestamp on each ranking, and pose a penalty while calculating the weight of a rank that is older. | Dynamic recommender systems | As I see it, a modified version of collaborative filtering can work. However, you will need to keep a timestamp on each ranking, and pose a penalty while calculating the weight of a rank that is olde | Dynamic recommender systems
As I see it, a modified version of collaborative filtering can work. However, you will need to keep a timestamp on each ranking, and pose a penalty while calculating the weight of a rank that is older. | Dynamic recommender systems
As I see it, a modified version of collaborative filtering can work. However, you will need to keep a timestamp on each ranking, and pose a penalty while calculating the weight of a rank that is olde |
19,076 | SVM, variable interaction and training data fit | As highBandwidth suggests, it depends whether you are using a linear SVM or a non-linear one (being pedantic if a kernel is not used it is a maximal margin linear classifier rather than an SVM).
A maximal margin linear classifier is no different from any other linear classifier in that if the data generating process means that there are interactions between the attributes, then providing those interaction terms is likely to improve performance. The maximal margin linear classifier is rather like ridge regression, with a slight difference in the penalty term that is designed to avoid overfitting (given suitable values for the regularisation parameter), and in most cases ridge regression and maximal margin classifier will give similar performance.
If you think that interaction terms are likely to be important, then you can introduce them into the feature space of an SVM by using the polynomial kernel $K(x,x') = (x\cdot x' + c)^d$, which will give a feature space in which each axis represents a monomial of order $d$ or less, the parameter $c$ affects the relative weighting of monomials of different orders. So an SVM with a polynomial kernel is equivalent to fitting a polynomial model in the attribute space, which implicitly incorporates those interactions.
Given enough features, any linear classifier can trivially fit the data. IIRC an $n$ points in "general position" in an $n-1$ dimensional space can be shattered (separated in any arbitrary manner) by a hyper-plane (c.f. VC dimension). Doing this will generally result in severe over-fitting, and so should be avoided. The point of maximal margin classifcation is to limit this over-fitting by adding a penalty term that means that the largest separation possible is achieved (which would require the greatest deviation from any training example to produce a misclassification). This means you can transform the data into a very high dimensional space (where a linear model is very powerful) without incurring too much over-fitting.
Note that some kernels give rise to an infinite dimensional feature space, where a "trivial" classification is guaranteed to be possible for any finite training sample in general position. For example, the radial basis function kernel, $K(x,x') = \exp{-\gamma\|x - x'\|^2}$, where the feature space is the positive orthant of an infinite dimensional hypersphere. Such kernels make the SVM a universal approximator, that can represent essentially any decision boundary.
However this is only part of the story. In practice, we generally use a soft-margin SVM, where the margin constrain is allowed to be violated, and there is a regularisation parameter that control the trade-off between maximising the margin (which is a penalty term, similar to that used in ridge regression) and the magnitude of the slack variables (which is akin to the loss on the training sample). We then avoid over-fitting by tuning the regularsation parameter, for example by minimising the cross-validation error (or some bound on the leave-one-out error), just as we would do in the case of ridge regression.
So while the SVM can trivially classify the training set, it will generally only do so if the regularisation and kernel parameters are badly chosen. The key to achieving good results with any kernel model lies in choosing an appropriate kernel, and then in tuning the kernel and regularisation parameters to avoid over- or under-fitting the data. | SVM, variable interaction and training data fit | As highBandwidth suggests, it depends whether you are using a linear SVM or a non-linear one (being pedantic if a kernel is not used it is a maximal margin linear classifier rather than an SVM).
A max | SVM, variable interaction and training data fit
As highBandwidth suggests, it depends whether you are using a linear SVM or a non-linear one (being pedantic if a kernel is not used it is a maximal margin linear classifier rather than an SVM).
A maximal margin linear classifier is no different from any other linear classifier in that if the data generating process means that there are interactions between the attributes, then providing those interaction terms is likely to improve performance. The maximal margin linear classifier is rather like ridge regression, with a slight difference in the penalty term that is designed to avoid overfitting (given suitable values for the regularisation parameter), and in most cases ridge regression and maximal margin classifier will give similar performance.
If you think that interaction terms are likely to be important, then you can introduce them into the feature space of an SVM by using the polynomial kernel $K(x,x') = (x\cdot x' + c)^d$, which will give a feature space in which each axis represents a monomial of order $d$ or less, the parameter $c$ affects the relative weighting of monomials of different orders. So an SVM with a polynomial kernel is equivalent to fitting a polynomial model in the attribute space, which implicitly incorporates those interactions.
Given enough features, any linear classifier can trivially fit the data. IIRC an $n$ points in "general position" in an $n-1$ dimensional space can be shattered (separated in any arbitrary manner) by a hyper-plane (c.f. VC dimension). Doing this will generally result in severe over-fitting, and so should be avoided. The point of maximal margin classifcation is to limit this over-fitting by adding a penalty term that means that the largest separation possible is achieved (which would require the greatest deviation from any training example to produce a misclassification). This means you can transform the data into a very high dimensional space (where a linear model is very powerful) without incurring too much over-fitting.
Note that some kernels give rise to an infinite dimensional feature space, where a "trivial" classification is guaranteed to be possible for any finite training sample in general position. For example, the radial basis function kernel, $K(x,x') = \exp{-\gamma\|x - x'\|^2}$, where the feature space is the positive orthant of an infinite dimensional hypersphere. Such kernels make the SVM a universal approximator, that can represent essentially any decision boundary.
However this is only part of the story. In practice, we generally use a soft-margin SVM, where the margin constrain is allowed to be violated, and there is a regularisation parameter that control the trade-off between maximising the margin (which is a penalty term, similar to that used in ridge regression) and the magnitude of the slack variables (which is akin to the loss on the training sample). We then avoid over-fitting by tuning the regularsation parameter, for example by minimising the cross-validation error (or some bound on the leave-one-out error), just as we would do in the case of ridge regression.
So while the SVM can trivially classify the training set, it will generally only do so if the regularisation and kernel parameters are badly chosen. The key to achieving good results with any kernel model lies in choosing an appropriate kernel, and then in tuning the kernel and regularisation parameters to avoid over- or under-fitting the data. | SVM, variable interaction and training data fit
As highBandwidth suggests, it depends whether you are using a linear SVM or a non-linear one (being pedantic if a kernel is not used it is a maximal margin linear classifier rather than an SVM).
A max |
19,077 | SVM, variable interaction and training data fit | The answers depend on whether you are using linear SVM or kernel SVM. With linear SVM, you are only using the features you give it, and it does not take into account interactions. With Kernel SVM, basically you are using a lot of different features, depending on which kernel you chose. If there is a separating hyperplane, i.e., if $sign(\sum_{i=1}^{K}\beta_i(x)-\beta_0)$ determines the class where $\beta_i,i \in \{1,2,...K\}$ are the features, then you can have complete fitting of the training data. Usually, you do not specify the features, but give a kernel $K$ that is related to the features as $K(x_1,x_2) = \sum_{i=1}^K \beta_i(x_1) \beta_i(x_2)$. Look up reproducing Kernel Hilbert spaces. | SVM, variable interaction and training data fit | The answers depend on whether you are using linear SVM or kernel SVM. With linear SVM, you are only using the features you give it, and it does not take into account interactions. With Kernel SVM, bas | SVM, variable interaction and training data fit
The answers depend on whether you are using linear SVM or kernel SVM. With linear SVM, you are only using the features you give it, and it does not take into account interactions. With Kernel SVM, basically you are using a lot of different features, depending on which kernel you chose. If there is a separating hyperplane, i.e., if $sign(\sum_{i=1}^{K}\beta_i(x)-\beta_0)$ determines the class where $\beta_i,i \in \{1,2,...K\}$ are the features, then you can have complete fitting of the training data. Usually, you do not specify the features, but give a kernel $K$ that is related to the features as $K(x_1,x_2) = \sum_{i=1}^K \beta_i(x_1) \beta_i(x_2)$. Look up reproducing Kernel Hilbert spaces. | SVM, variable interaction and training data fit
The answers depend on whether you are using linear SVM or kernel SVM. With linear SVM, you are only using the features you give it, and it does not take into account interactions. With Kernel SVM, bas |
19,078 | The frog problem with negative steps | Solution for $J_1$
But what is J1? What is the expected number of steps for a frog that has only one leaf to go?
The solution is $J_1 = 2(e-1)$ and other terms $J_n$ can be expressed as a sum.
Rewriting the recurrence relation as a sum
The recurrence relation is not gonna solve the problem entirely (because one term in the initial conditions is not known), but it does allow us to express $J_n$ as an expression in terms of a finite sum.
The recurrence relation can be rewritten. (for n>3)
$$J_n - J_{n-1} = n (J_{n-1} - J_{n-2})-1 $$
let $D_n = J_n - J_{n-1}$
$$D_n = n D_{n-1}-1 $$
and with starting point $D_2 = 2x $ and we can write (note the recurrence relation is a bit different for $n = 2$ as @quester noted in the comments):
$$\begin{array}{rcrcrcrcrcr}
D_1 &=& 3 + 2\,x \\\\
D_2 &=& 2\,x\\
D_3 &=& \overbrace{6 \,x}^{\times 3} &-&1\\
D_4 &=& \rlap{\overbrace{\hphantom{\begin{array}5040\,x&-&7\cdot 6\cdot 5\cdot 4 \end{array}}}^{\times 4}} 24\,x&-&4 &-& 1 \\
D_5&=& \rlap{\overbrace{\hphantom{\begin{array}5040\,x&-&7\cdot 6\cdot 5\cdot 4 &-& 7\cdot 6\cdot 5 \end{array}}}^{ \times 5}} 120\,x&-&5\cdot 4 &-& 5 &-& 1 \\\\
D_6&=& 720\,x&-&6\cdot 5\cdot 4 &-& 6\cdot 5 &-& 6 &- & 1 \\\\
D_7&=& 5040\,x&-&7\cdot 6\cdot 5\cdot 4 &-& 7\cdot 6\cdot 5 &-& 7\cdot 6 &- & 7 &-&- 1 \\\\
D_k &=& k! x &-&\rlap{\sum_{l=3}^{k} \frac{k!}{l!}} \\
\end{array}$$
and
$$ J_n = x \sum_{k=1}^n k! -\sum_{k=3}^n\sum_{l=3}^{k} \frac{k!}{l!} $$
Closed form expression for $x$
Lets rewrite $D_k$
$$\begin{array}{} D_k &=& k! x - \sum_{l=3}^{k} \frac{k!}{l!}\\ &=& k! \left(x - \sum_{l=0}^k \frac{1!}{l!} - 2.5 \right)\end{array}$$
If we conjecture that $\lim_{k \to \infty }D_k$ is positive and finite then this leads to the requirement $\lim_{k \to \infty }\left(x - \sum_{l=0}^k \frac{1!}{l!} - 2.5 \right)= 0$ and
$$x = \lim_{k \to \infty } \left(\sum_{l=0}^k \frac{1!}{l!} - 2.5\right) = e-2.5 \approx 0.2182818 $$
The argument that $\lim_{k \to \infty }D_k$ is finite is still a conjecture but it seems plausible to me.
Closed form expression for $D_k$
Filling in $x$ into the expression of $D_k$ will lead to:
$$\begin{array}{}
J_1 &=& D_1 & = & 2e-2 \\
&&D_2 & = & 2e-5 \\
&&D_k & = & k! \left( e - \sum_{l=0}^k \frac{1}{l!}\right) \\
\end{array}$$
Is $J_n$ finite?
We can argue that $J_n$ (the mean number of steps to reach the finish) is finite for any starting point $n$, because the mean position from the finish is decreasing to zero bounded by an exponential decay.
The mean distance from the finish: Say a frog starts in position $x$. Then after one jump the frog will be somewhere in position $0 \leq y \leq x+1$ (each option with probability $\frac{1}{x+2}$), and if $y \neq 0$ then after after two jumps the frog will be somewhere in position $0 \leq z \leq y+1$ (each option with probability $\frac{1}{y+2}$). Then the mean position $\bar{z}$ of a frog that started at $x$ and makes two jumps will be:
$$ \sum_{y=1}^{x+1}\sum_{z=1}^{y+1}\frac{z}{(x+2)(y+2)} = \frac{x^2+5x+4}{4x+8} \underbrace{\leq\frac{10}{12}x}_{\text{if $x\geq1$}}$$
So whatever the position of the frog, after two jumps, he will be on average at least 1/6 closer to the finish.
Probability a frog is still in the game: Note that the probability of a frog still in the game relates to the mean distance of a frog in the game. The mean distance after $k$ jumps is $\mu_{\bar{x},k} \sum_{x=1}^\infty x f(x,k)$, where $f(x,k)$ is the probability of the frog to be in position $x$ after $k$ jumps. The probability of a frog to be still in the game is: $$ 1-F_{(\text{finished at or before jump k})}(k)=\sum_{x=1}^\infty f(x,k) < \mu_{\bar{x},k} \leq x_{start} \left(\frac{10}{12} \right)^{k/2}$$.
Finiteness of $J_n$ The mean number of steps necessary can be found by $\sum_{k=0}^\infty k f(k)$ with $f(k)$ the probability that it takes $k$ steps. But you can also take $\sum_{k=0}^\infty 1-F(x)$ with $F(k)$ the probability that it takes $k$ or less steps (note that the integral of the CDF is related to the mean or more generaly the expected value of any quantity is related to the quantile function). And since $1−F(k)$ is smaller than some decreasing exponential function of $k$, so must be the sum smaller than the integral/sum of that function and that is finite.
Starting with a simpler problem
With the recurrence relation $D_n = n D_{n-1} - 1$ it is problematic to solve the case because the starting condition is not defined.
We can instead try to pose a simpler problem (suggested in the comments by @quester and @Hans). Let's say that there are only $m+2$ leaves (instead of infinite), and thus the frog with only $m$ leaves in front of him will not be able to jump backwards. Then $J_m = J_{m-1}$ (the frog in point $m$ has the same options as the frog in point $m-1$) and we will have
$$D_{m} = m! \left(x_m - \sum_{l=0}^m \frac{1!}{l!} - 2.5 \right) = 0$$
which gives a solution for $x_{m}$ as:
$$x_m = \sum_{l=0}^m \frac{1!}{l!} - 2.5 $$
and the limit of $x_m$ as we start adding leaves is:
$$\lim_{m\to \infty} x_m = \lim_{m\to \infty} \sum_{l=0}^m \frac{1!}{l!} -2.5 = e-2.5$$ | The frog problem with negative steps | Solution for $J_1$
But what is J1? What is the expected number of steps for a frog that has only one leaf to go?
The solution is $J_1 = 2(e-1)$ and other terms $J_n$ can be expressed as a sum.
Rewri | The frog problem with negative steps
Solution for $J_1$
But what is J1? What is the expected number of steps for a frog that has only one leaf to go?
The solution is $J_1 = 2(e-1)$ and other terms $J_n$ can be expressed as a sum.
Rewriting the recurrence relation as a sum
The recurrence relation is not gonna solve the problem entirely (because one term in the initial conditions is not known), but it does allow us to express $J_n$ as an expression in terms of a finite sum.
The recurrence relation can be rewritten. (for n>3)
$$J_n - J_{n-1} = n (J_{n-1} - J_{n-2})-1 $$
let $D_n = J_n - J_{n-1}$
$$D_n = n D_{n-1}-1 $$
and with starting point $D_2 = 2x $ and we can write (note the recurrence relation is a bit different for $n = 2$ as @quester noted in the comments):
$$\begin{array}{rcrcrcrcrcr}
D_1 &=& 3 + 2\,x \\\\
D_2 &=& 2\,x\\
D_3 &=& \overbrace{6 \,x}^{\times 3} &-&1\\
D_4 &=& \rlap{\overbrace{\hphantom{\begin{array}5040\,x&-&7\cdot 6\cdot 5\cdot 4 \end{array}}}^{\times 4}} 24\,x&-&4 &-& 1 \\
D_5&=& \rlap{\overbrace{\hphantom{\begin{array}5040\,x&-&7\cdot 6\cdot 5\cdot 4 &-& 7\cdot 6\cdot 5 \end{array}}}^{ \times 5}} 120\,x&-&5\cdot 4 &-& 5 &-& 1 \\\\
D_6&=& 720\,x&-&6\cdot 5\cdot 4 &-& 6\cdot 5 &-& 6 &- & 1 \\\\
D_7&=& 5040\,x&-&7\cdot 6\cdot 5\cdot 4 &-& 7\cdot 6\cdot 5 &-& 7\cdot 6 &- & 7 &-&- 1 \\\\
D_k &=& k! x &-&\rlap{\sum_{l=3}^{k} \frac{k!}{l!}} \\
\end{array}$$
and
$$ J_n = x \sum_{k=1}^n k! -\sum_{k=3}^n\sum_{l=3}^{k} \frac{k!}{l!} $$
Closed form expression for $x$
Lets rewrite $D_k$
$$\begin{array}{} D_k &=& k! x - \sum_{l=3}^{k} \frac{k!}{l!}\\ &=& k! \left(x - \sum_{l=0}^k \frac{1!}{l!} - 2.5 \right)\end{array}$$
If we conjecture that $\lim_{k \to \infty }D_k$ is positive and finite then this leads to the requirement $\lim_{k \to \infty }\left(x - \sum_{l=0}^k \frac{1!}{l!} - 2.5 \right)= 0$ and
$$x = \lim_{k \to \infty } \left(\sum_{l=0}^k \frac{1!}{l!} - 2.5\right) = e-2.5 \approx 0.2182818 $$
The argument that $\lim_{k \to \infty }D_k$ is finite is still a conjecture but it seems plausible to me.
Closed form expression for $D_k$
Filling in $x$ into the expression of $D_k$ will lead to:
$$\begin{array}{}
J_1 &=& D_1 & = & 2e-2 \\
&&D_2 & = & 2e-5 \\
&&D_k & = & k! \left( e - \sum_{l=0}^k \frac{1}{l!}\right) \\
\end{array}$$
Is $J_n$ finite?
We can argue that $J_n$ (the mean number of steps to reach the finish) is finite for any starting point $n$, because the mean position from the finish is decreasing to zero bounded by an exponential decay.
The mean distance from the finish: Say a frog starts in position $x$. Then after one jump the frog will be somewhere in position $0 \leq y \leq x+1$ (each option with probability $\frac{1}{x+2}$), and if $y \neq 0$ then after after two jumps the frog will be somewhere in position $0 \leq z \leq y+1$ (each option with probability $\frac{1}{y+2}$). Then the mean position $\bar{z}$ of a frog that started at $x$ and makes two jumps will be:
$$ \sum_{y=1}^{x+1}\sum_{z=1}^{y+1}\frac{z}{(x+2)(y+2)} = \frac{x^2+5x+4}{4x+8} \underbrace{\leq\frac{10}{12}x}_{\text{if $x\geq1$}}$$
So whatever the position of the frog, after two jumps, he will be on average at least 1/6 closer to the finish.
Probability a frog is still in the game: Note that the probability of a frog still in the game relates to the mean distance of a frog in the game. The mean distance after $k$ jumps is $\mu_{\bar{x},k} \sum_{x=1}^\infty x f(x,k)$, where $f(x,k)$ is the probability of the frog to be in position $x$ after $k$ jumps. The probability of a frog to be still in the game is: $$ 1-F_{(\text{finished at or before jump k})}(k)=\sum_{x=1}^\infty f(x,k) < \mu_{\bar{x},k} \leq x_{start} \left(\frac{10}{12} \right)^{k/2}$$.
Finiteness of $J_n$ The mean number of steps necessary can be found by $\sum_{k=0}^\infty k f(k)$ with $f(k)$ the probability that it takes $k$ steps. But you can also take $\sum_{k=0}^\infty 1-F(x)$ with $F(k)$ the probability that it takes $k$ or less steps (note that the integral of the CDF is related to the mean or more generaly the expected value of any quantity is related to the quantile function). And since $1−F(k)$ is smaller than some decreasing exponential function of $k$, so must be the sum smaller than the integral/sum of that function and that is finite.
Starting with a simpler problem
With the recurrence relation $D_n = n D_{n-1} - 1$ it is problematic to solve the case because the starting condition is not defined.
We can instead try to pose a simpler problem (suggested in the comments by @quester and @Hans). Let's say that there are only $m+2$ leaves (instead of infinite), and thus the frog with only $m$ leaves in front of him will not be able to jump backwards. Then $J_m = J_{m-1}$ (the frog in point $m$ has the same options as the frog in point $m-1$) and we will have
$$D_{m} = m! \left(x_m - \sum_{l=0}^m \frac{1!}{l!} - 2.5 \right) = 0$$
which gives a solution for $x_{m}$ as:
$$x_m = \sum_{l=0}^m \frac{1!}{l!} - 2.5 $$
and the limit of $x_m$ as we start adding leaves is:
$$\lim_{m\to \infty} x_m = \lim_{m\to \infty} \sum_{l=0}^m \frac{1!}{l!} -2.5 = e-2.5$$ | The frog problem with negative steps
Solution for $J_1$
But what is J1? What is the expected number of steps for a frog that has only one leaf to go?
The solution is $J_1 = 2(e-1)$ and other terms $J_n$ can be expressed as a sum.
Rewri |
19,079 | The frog problem with negative steps | No going back case only
I'm addressing the zero-length jumps case only, i.e. no going back and the frog is allowed to remain still at a given step. Without considering a clock-like device and assuming that remaining still in one clock tick counts as one jump means just considering the other's puzzle conditions. It does not have to be a precise clock or stick to equal time intervals, just give a tick every now and then which trigger the need for a jump by the frog.
When on leaf 1, there is a probability $\frac12$ to jump to the target leaf 0 and $\frac12$ to remain on leaf 1. The probability of taking exactly $k$ jumps to land on the target has probability $\left(\frac12\right)^k$, that is $\left(\frac12\right)^{k-1}$ of remaining still in the first $k-1$ ticks and $\frac12$ to land on leaf 1 on the $k$-th tick. So the expected value is:
$$J_1 = \sum_{k=1}^{\infty}k\left(\frac12\right)^k = \frac{\frac12}{\left(1-\frac12\right)^2} = 2$$
(thanks wikipedia).
Generalizing for $n > 1$, we can land on leaf $0..n$ at the next tick, each with probability $\frac1{n+1}$. Each case implies taking the jump of the tick, then taking the average number of jumps from the leaf we land on:
$$J_n = \sum_{k=0}^{n}\frac1{n+1}(1+J_k) = \frac1{n+1}\sum_{k=0}^{n}(1+J_k) = 1 + \frac1{n+1}\sum_{k=0}^{n}J_k$$
Interestingly, this allows us to find $J_1 = 1 + \frac12J_1 = 2$ but without much sweating with the harmonic series. Evolving the equation:
$$(n+1)J_n = n + 1 + \sum_{k=0}^{n}J_k$$
This relation does not hold for $n = 0$ because it would lead to $0 = 1$. Assuming $n > 1 \Rightarrow n - 1 > 0$:
$$nJ_{n-1} = n + \sum_{k=0}^{n-1}J_k$$
Subtracting the last two equations:
$$(n+1)J_n - nJ_{n-1} = 1 + J_n$$
$$nJ_n = 1 + nJ_{n-1}$$
$$J_n = \frac1n + J_{n-1}$$
that is exactly the same relation we have if the frog is only allowed to advance, although with different edge conditions ($n > 1$ and $J_1 = 2$). So, the bottom line is:
$$ J_0 = 0 $$
$$ n>0 : J_{n} = 1 + \sum_{k=1}^{n}\frac1k $$
i.e. on average there will be exactly 1 jump more than the previous case where the frog can only advance, except for $J_0$ in which case the frog will always just remain still.
It is interesting that the recurrent relation holds for $n>1$ but the non-recurrent formula holds also for $n = 1$.
A few simulations seem to support the result above. | The frog problem with negative steps | No going back case only
I'm addressing the zero-length jumps case only, i.e. no going back and the frog is allowed to remain still at a given step. Without considering a clock-like device and assuming | The frog problem with negative steps
No going back case only
I'm addressing the zero-length jumps case only, i.e. no going back and the frog is allowed to remain still at a given step. Without considering a clock-like device and assuming that remaining still in one clock tick counts as one jump means just considering the other's puzzle conditions. It does not have to be a precise clock or stick to equal time intervals, just give a tick every now and then which trigger the need for a jump by the frog.
When on leaf 1, there is a probability $\frac12$ to jump to the target leaf 0 and $\frac12$ to remain on leaf 1. The probability of taking exactly $k$ jumps to land on the target has probability $\left(\frac12\right)^k$, that is $\left(\frac12\right)^{k-1}$ of remaining still in the first $k-1$ ticks and $\frac12$ to land on leaf 1 on the $k$-th tick. So the expected value is:
$$J_1 = \sum_{k=1}^{\infty}k\left(\frac12\right)^k = \frac{\frac12}{\left(1-\frac12\right)^2} = 2$$
(thanks wikipedia).
Generalizing for $n > 1$, we can land on leaf $0..n$ at the next tick, each with probability $\frac1{n+1}$. Each case implies taking the jump of the tick, then taking the average number of jumps from the leaf we land on:
$$J_n = \sum_{k=0}^{n}\frac1{n+1}(1+J_k) = \frac1{n+1}\sum_{k=0}^{n}(1+J_k) = 1 + \frac1{n+1}\sum_{k=0}^{n}J_k$$
Interestingly, this allows us to find $J_1 = 1 + \frac12J_1 = 2$ but without much sweating with the harmonic series. Evolving the equation:
$$(n+1)J_n = n + 1 + \sum_{k=0}^{n}J_k$$
This relation does not hold for $n = 0$ because it would lead to $0 = 1$. Assuming $n > 1 \Rightarrow n - 1 > 0$:
$$nJ_{n-1} = n + \sum_{k=0}^{n-1}J_k$$
Subtracting the last two equations:
$$(n+1)J_n - nJ_{n-1} = 1 + J_n$$
$$nJ_n = 1 + nJ_{n-1}$$
$$J_n = \frac1n + J_{n-1}$$
that is exactly the same relation we have if the frog is only allowed to advance, although with different edge conditions ($n > 1$ and $J_1 = 2$). So, the bottom line is:
$$ J_0 = 0 $$
$$ n>0 : J_{n} = 1 + \sum_{k=1}^{n}\frac1k $$
i.e. on average there will be exactly 1 jump more than the previous case where the frog can only advance, except for $J_0$ in which case the frog will always just remain still.
It is interesting that the recurrent relation holds for $n>1$ but the non-recurrent formula holds also for $n = 1$.
A few simulations seem to support the result above. | The frog problem with negative steps
No going back case only
I'm addressing the zero-length jumps case only, i.e. no going back and the frog is allowed to remain still at a given step. Without considering a clock-like device and assuming |
19,080 | The frog problem with negative steps | Yes, your recurrence relation holds. I can confirm this with computational solution. Mine is not a simulation though, and can efficiently calculate the expected value with arbitrary precision.
I start with the probability transition matrix A. It's defined as follows:
A(i,j) = 1, for i=j=1
A(i,j) = 1/(i+1), for j <= i+1
A(i,j) = 0, otherwise
A(i,j) is the probability of jumping of a frog from a leave i to a leave j. I feel that there can be an analytical solution, but can't figure out how to find it. It involves the summation of series of $A^k k$, where the matrix A is lower triangular and has a very specific structure.
So, when a frog is one leave i and it already made K jumps by this time and so far the expected value is mu, then we update mu by adding (K+1)*A(i,1). Then we proceed to evaluate jumps to all other possible leaves. If you look at the algorithm, you'll realize that although the recurrence relation holds, it is not very useful in practical sense. Since, calculation of your $J_1$ quantity takes almost as much time as any other $J_n$.
In my algorithm I stop updating when the contribution of the step in recursion becomes small. Yes, I also use recursive algorithm but it's different than yours.
Here's Python code:
import numpy as np
def make_a(n):
# transition matrix
a = np.zeros((n, n+1))
a[0, 0] = 1
for i in np.arange(1, n):
a[i, :i+2] = 1 / (i+2)
return a
def tail(a, k, tol=0.0000001):
# contribution of k+1 jumps to expected value
a1 = np.dot(a[1:], make_a(a.shape[0])[1:, :])
step = a1[0] * (k+1)
mu = step
# print(mu)
if step > tol:
mu += tail(a1, k+1, tol)
return mu
print('check transition table\n', make_a(3))
print('\nexpected num of jumps')
nmax = 20
res = np.zeros(nmax+1)
for n in np.arange(1, nmax+1):
a = make_a(n+1)
mu = a[n, 0]
mu += tail(a[n, :], 1)
res[n] = mu
print(n, mu)
print('\ncheck recurrence')
for n in np.arange(3, n+1):
print(n, (n+1)*res[n-1] - n * res[n-2] - res[n] - 1)
Output:
check transition table
[[1. 0. 0. 0. ]
[0.33333333 0.33333333 0.33333333 0. ]
[0.25 0.25 0.25 0.25 ]]
expected num of jumps
1 3.436534083355339
2 3.8731001121305035
3 4.182794921405534
4 4.421556445498667
5 4.615373828428799
6 4.778288520921278
7 4.9187100088637985
8 5.042032360521892
9 5.151942546724475
10 5.2510537683227705
11 5.3412868828615885
12 5.4240942337384
13 5.500600055423081
14 5.57169208948773
15 5.638090948773811
16 5.70036294996792
17 5.758995464909636
18 5.814389400777605
19 5.866883015395631
20 5.916764301539716
check recurrence
1 3.277050462102693e-06
2 1.771300699093814e-05
3 -9.762464467044651e-06
4 -1.0394911689637354e-05
5 -1.8640495164312654e-05
6 4.9551882066012354e-05
7 -9.021279734788834e-06
8 -9.35957247438779e-06
9 -9.676957560600385e-06
10 -9.976410992429408e-06
11 -1.026028613448915e-05
12 -1.0530479119807978e-05
13 -1.8348316348060223e-05
14 0.00010974738318303423
15 -8.494641865475216e-06
16 -8.666917073796299e-06
17 -8.83312660171498e-06
18 -8.993783568556069e-06 | The frog problem with negative steps | Yes, your recurrence relation holds. I can confirm this with computational solution. Mine is not a simulation though, and can efficiently calculate the expected value with arbitrary precision.
I start | The frog problem with negative steps
Yes, your recurrence relation holds. I can confirm this with computational solution. Mine is not a simulation though, and can efficiently calculate the expected value with arbitrary precision.
I start with the probability transition matrix A. It's defined as follows:
A(i,j) = 1, for i=j=1
A(i,j) = 1/(i+1), for j <= i+1
A(i,j) = 0, otherwise
A(i,j) is the probability of jumping of a frog from a leave i to a leave j. I feel that there can be an analytical solution, but can't figure out how to find it. It involves the summation of series of $A^k k$, where the matrix A is lower triangular and has a very specific structure.
So, when a frog is one leave i and it already made K jumps by this time and so far the expected value is mu, then we update mu by adding (K+1)*A(i,1). Then we proceed to evaluate jumps to all other possible leaves. If you look at the algorithm, you'll realize that although the recurrence relation holds, it is not very useful in practical sense. Since, calculation of your $J_1$ quantity takes almost as much time as any other $J_n$.
In my algorithm I stop updating when the contribution of the step in recursion becomes small. Yes, I also use recursive algorithm but it's different than yours.
Here's Python code:
import numpy as np
def make_a(n):
# transition matrix
a = np.zeros((n, n+1))
a[0, 0] = 1
for i in np.arange(1, n):
a[i, :i+2] = 1 / (i+2)
return a
def tail(a, k, tol=0.0000001):
# contribution of k+1 jumps to expected value
a1 = np.dot(a[1:], make_a(a.shape[0])[1:, :])
step = a1[0] * (k+1)
mu = step
# print(mu)
if step > tol:
mu += tail(a1, k+1, tol)
return mu
print('check transition table\n', make_a(3))
print('\nexpected num of jumps')
nmax = 20
res = np.zeros(nmax+1)
for n in np.arange(1, nmax+1):
a = make_a(n+1)
mu = a[n, 0]
mu += tail(a[n, :], 1)
res[n] = mu
print(n, mu)
print('\ncheck recurrence')
for n in np.arange(3, n+1):
print(n, (n+1)*res[n-1] - n * res[n-2] - res[n] - 1)
Output:
check transition table
[[1. 0. 0. 0. ]
[0.33333333 0.33333333 0.33333333 0. ]
[0.25 0.25 0.25 0.25 ]]
expected num of jumps
1 3.436534083355339
2 3.8731001121305035
3 4.182794921405534
4 4.421556445498667
5 4.615373828428799
6 4.778288520921278
7 4.9187100088637985
8 5.042032360521892
9 5.151942546724475
10 5.2510537683227705
11 5.3412868828615885
12 5.4240942337384
13 5.500600055423081
14 5.57169208948773
15 5.638090948773811
16 5.70036294996792
17 5.758995464909636
18 5.814389400777605
19 5.866883015395631
20 5.916764301539716
check recurrence
1 3.277050462102693e-06
2 1.771300699093814e-05
3 -9.762464467044651e-06
4 -1.0394911689637354e-05
5 -1.8640495164312654e-05
6 4.9551882066012354e-05
7 -9.021279734788834e-06
8 -9.35957247438779e-06
9 -9.676957560600385e-06
10 -9.976410992429408e-06
11 -1.026028613448915e-05
12 -1.0530479119807978e-05
13 -1.8348316348060223e-05
14 0.00010974738318303423
15 -8.494641865475216e-06
16 -8.666917073796299e-06
17 -8.83312660171498e-06
18 -8.993783568556069e-06 | The frog problem with negative steps
Yes, your recurrence relation holds. I can confirm this with computational solution. Mine is not a simulation though, and can efficiently calculate the expected value with arbitrary precision.
I start |
19,081 | Do more object classes increase or decrease the accuracy of object detection | Specific classification behaviour will depend on the particular model form underlying a classification method. The exact response of a model to additional object classes can be derived mathematically in particular cases, though this may be complicated. Since you have not given details of a particular method, I will assume that you are more interested in the general response of classification models to adding or removing object classes. To answer this, I will provide an intuitive explanation of what you should expect in a rational model of this kind of situation. To the extent that the model departs from this intuitive outcome, under broad conditions, I regard that as a deficiency. Hence, I regard the following responses as a desideratum for an object prediction system.
Prediction in a model with arbitrary object classes: To help facilitate analysis of this problem, suppose you have $N$ images of street-signs (or anything else) that are each as single one of $m$ types. Without loss of generality, let $\theta_1, ..., \theta_N \in \mathscr{M} \equiv \{ 1, 2, ..., m \}$ be the true types of the objects that you are trying to classify, with $\mathscr{M}$ being the true object types. Suppose you impose a detection system that classifies each image into types in the finite set $\mathscr{S} \subset \mathbb{N}$, where we note that $\mathscr{S}$ can include labels that are in $\mathscr{M}$, but it can also include values that are not in this set (i.e., it is possible that your detection system may be trying to find object types that aren't there).
A detection system of this kind looks at image data from each of the images, and uses this data to classify each image into an estimated type, based on the allowable types in the model. In general terms, this can be described by the following components:
$$\begin{matrix}
\text{Data} & & & & & \text{Model Types} & & & & & \text{Estimates} \\
x_1, ..., x_N & & & & & \mathscr{S} & & & & & \hat{\theta}_1, ..., \hat{\theta}_N \in \mathscr{S}
\end{matrix}$$
The probability of correct classification of image $i$ for a model with types $\mathscr{S}$ is:
$$p_i(\mathscr{S}) \equiv \mathbb{P}(\hat{\theta}_i = \theta_i | \mathbf{x}, \mathscr{S}) = \sum_{s \in \mathscr{M} \ \cap \ \mathscr{S}} \mathbb{P}(\hat{\theta}_i = s | \mathbf{x}, \mathscr{S}) \mathbb{I}(\theta_i = s ).$$
The elements of the latter summation are subject to the probability constraint:
$$\sum_{s \in \mathscr{M} \ \cap \ \mathscr{S}} \mathbb{P}(\hat{\theta}_i = s | \mathbf{x}, \mathscr{S}) = 1.$$
Now, clearly if $\theta_i \notin\mathscr{S}$ then we have $p_i(\mathscr{S}) = 0$, since the true object type is not included in the model. Hence, if there are elements of $\mathscr{M}$ that are not in $\mathscr{S}$, this will lead to inability to correctly identify these missing element types. On the other hand, if we exclude an element from the set $\mathscr{S}$ then, ceteris paribus, this will increase the probability of prediction of the remaining object types, since the probabilities of predictions must sum to one. Hence, exclusion of an object type will tend to raise the probabilities of prediction for other object types, which raises the probability of correct prediction for true object types that are in $\mathscr{S}$.
More detailed analysis would need to posit the connection between the data $\mathbf{x}$ and the object predictions. We will not go into detail on that subject here, since the particular model is unspecified. However, we may take it as a general property of prediction models that they will tend to have greater difficulty differentiating object types that look similar and will tend to have less difficultly differentiating object types that look dissimilar. Hence, exclusion of an object type from the set $\mathscr{S}$ will tend to increase the probability of prediction of other object types in this set that look similar to this excluded object, in cases where the data is conducive to one of these types.
The above exposition is designed to give some general guidance, stressing the probability constraint in predictions, and the way this impacts on the probability of correct prediction. This leads to the following general principles of a rationally constructed classification model. Ceteris paribus, the following should hold (at least roughly):
If a true object type is excluded from the classification model, this will reduce the probability of correct prediction of that object type to zero, but it will tend to increase the probability of correct prediction for other object types (particularly object types that look like this excluded type);
If a true object type is added to the classification model, this will allow the model to have a non-zero probability of correct prediction of that object type, but it will tend to decrease the probability of correct prediction for other object types (particularly object types that look like the added type);
If a false object type is excluded from the classification model, this will tend to increase the probability of correct prediction for all true object types (particularly object types that look like this excluded type); and
If a false object type is added to the classification model, this will tend to decrease the probability of correct prediction for all true object types (particularly object types that look like the added type).
These general principles may have some pathological exceptions in particular models, in cases where there is complex multi-collinearity between images. However, they should hold as general rules that will emerge in well-behaved models under broad conditions. | Do more object classes increase or decrease the accuracy of object detection | Specific classification behaviour will depend on the particular model form underlying a classification method. The exact response of a model to additional object classes can be derived mathematically | Do more object classes increase or decrease the accuracy of object detection
Specific classification behaviour will depend on the particular model form underlying a classification method. The exact response of a model to additional object classes can be derived mathematically in particular cases, though this may be complicated. Since you have not given details of a particular method, I will assume that you are more interested in the general response of classification models to adding or removing object classes. To answer this, I will provide an intuitive explanation of what you should expect in a rational model of this kind of situation. To the extent that the model departs from this intuitive outcome, under broad conditions, I regard that as a deficiency. Hence, I regard the following responses as a desideratum for an object prediction system.
Prediction in a model with arbitrary object classes: To help facilitate analysis of this problem, suppose you have $N$ images of street-signs (or anything else) that are each as single one of $m$ types. Without loss of generality, let $\theta_1, ..., \theta_N \in \mathscr{M} \equiv \{ 1, 2, ..., m \}$ be the true types of the objects that you are trying to classify, with $\mathscr{M}$ being the true object types. Suppose you impose a detection system that classifies each image into types in the finite set $\mathscr{S} \subset \mathbb{N}$, where we note that $\mathscr{S}$ can include labels that are in $\mathscr{M}$, but it can also include values that are not in this set (i.e., it is possible that your detection system may be trying to find object types that aren't there).
A detection system of this kind looks at image data from each of the images, and uses this data to classify each image into an estimated type, based on the allowable types in the model. In general terms, this can be described by the following components:
$$\begin{matrix}
\text{Data} & & & & & \text{Model Types} & & & & & \text{Estimates} \\
x_1, ..., x_N & & & & & \mathscr{S} & & & & & \hat{\theta}_1, ..., \hat{\theta}_N \in \mathscr{S}
\end{matrix}$$
The probability of correct classification of image $i$ for a model with types $\mathscr{S}$ is:
$$p_i(\mathscr{S}) \equiv \mathbb{P}(\hat{\theta}_i = \theta_i | \mathbf{x}, \mathscr{S}) = \sum_{s \in \mathscr{M} \ \cap \ \mathscr{S}} \mathbb{P}(\hat{\theta}_i = s | \mathbf{x}, \mathscr{S}) \mathbb{I}(\theta_i = s ).$$
The elements of the latter summation are subject to the probability constraint:
$$\sum_{s \in \mathscr{M} \ \cap \ \mathscr{S}} \mathbb{P}(\hat{\theta}_i = s | \mathbf{x}, \mathscr{S}) = 1.$$
Now, clearly if $\theta_i \notin\mathscr{S}$ then we have $p_i(\mathscr{S}) = 0$, since the true object type is not included in the model. Hence, if there are elements of $\mathscr{M}$ that are not in $\mathscr{S}$, this will lead to inability to correctly identify these missing element types. On the other hand, if we exclude an element from the set $\mathscr{S}$ then, ceteris paribus, this will increase the probability of prediction of the remaining object types, since the probabilities of predictions must sum to one. Hence, exclusion of an object type will tend to raise the probabilities of prediction for other object types, which raises the probability of correct prediction for true object types that are in $\mathscr{S}$.
More detailed analysis would need to posit the connection between the data $\mathbf{x}$ and the object predictions. We will not go into detail on that subject here, since the particular model is unspecified. However, we may take it as a general property of prediction models that they will tend to have greater difficulty differentiating object types that look similar and will tend to have less difficultly differentiating object types that look dissimilar. Hence, exclusion of an object type from the set $\mathscr{S}$ will tend to increase the probability of prediction of other object types in this set that look similar to this excluded object, in cases where the data is conducive to one of these types.
The above exposition is designed to give some general guidance, stressing the probability constraint in predictions, and the way this impacts on the probability of correct prediction. This leads to the following general principles of a rationally constructed classification model. Ceteris paribus, the following should hold (at least roughly):
If a true object type is excluded from the classification model, this will reduce the probability of correct prediction of that object type to zero, but it will tend to increase the probability of correct prediction for other object types (particularly object types that look like this excluded type);
If a true object type is added to the classification model, this will allow the model to have a non-zero probability of correct prediction of that object type, but it will tend to decrease the probability of correct prediction for other object types (particularly object types that look like the added type);
If a false object type is excluded from the classification model, this will tend to increase the probability of correct prediction for all true object types (particularly object types that look like this excluded type); and
If a false object type is added to the classification model, this will tend to decrease the probability of correct prediction for all true object types (particularly object types that look like the added type).
These general principles may have some pathological exceptions in particular models, in cases where there is complex multi-collinearity between images. However, they should hold as general rules that will emerge in well-behaved models under broad conditions. | Do more object classes increase or decrease the accuracy of object detection
Specific classification behaviour will depend on the particular model form underlying a classification method. The exact response of a model to additional object classes can be derived mathematically |
19,082 | Do more object classes increase or decrease the accuracy of object detection | Here is a detailed theoretical analysis on this topic. https://arxiv.org/pdf/1506.01567.pdf.
I think that depends on the specific problem and model. The mathematical propositions of the answer above can only be said about general statistical models. In an image data, we are looking at very high dimensions, and mathematics at that level (the extreme non-linearity of deep models also add) will be very complicated.
What we can think intuitively (using a discriminant function approach), is that the more the classes are (Given inter-class variation is enough) the better model will be able to draw the discriminant function between classes. So, if the discriminant function is more detailed, the generalization capability of model will be greater when predicting an unseen image/example.
Think of it as parting between data clusters in a very high dimension. If you can part away the clusters more precisely, you would more likely to classify an incoming unseen example/image.
BTW, do inform us about the experiment, and did it increase or not. TIA. | Do more object classes increase or decrease the accuracy of object detection | Here is a detailed theoretical analysis on this topic. https://arxiv.org/pdf/1506.01567.pdf.
I think that depends on the specific problem and model. The mathematical propositions of the answer above | Do more object classes increase or decrease the accuracy of object detection
Here is a detailed theoretical analysis on this topic. https://arxiv.org/pdf/1506.01567.pdf.
I think that depends on the specific problem and model. The mathematical propositions of the answer above can only be said about general statistical models. In an image data, we are looking at very high dimensions, and mathematics at that level (the extreme non-linearity of deep models also add) will be very complicated.
What we can think intuitively (using a discriminant function approach), is that the more the classes are (Given inter-class variation is enough) the better model will be able to draw the discriminant function between classes. So, if the discriminant function is more detailed, the generalization capability of model will be greater when predicting an unseen image/example.
Think of it as parting between data clusters in a very high dimension. If you can part away the clusters more precisely, you would more likely to classify an incoming unseen example/image.
BTW, do inform us about the experiment, and did it increase or not. TIA. | Do more object classes increase or decrease the accuracy of object detection
Here is a detailed theoretical analysis on this topic. https://arxiv.org/pdf/1506.01567.pdf.
I think that depends on the specific problem and model. The mathematical propositions of the answer above |
19,083 | Log marginal likelihood for Gaussian Process | The more general formulation for the log marginal likelihood (not marginal log likelihood, as you originally wrote - I edited it in your post) of a GP is
$$\log p(y|X) = -\frac{1}{2}(y - m(X))^T(K+\sigma^2_n I)^{-1}(y - m(X)) - \frac{1}{2}\log|K+\sigma^2_n I|-\frac{n}{2}\log2\pi$$
where $m(x): \mathbb{R}^d \rightarrow \mathbb{R}$ for a given point $x$ is a mean function of a GP; and the notation $m(X)$ represents a vector function obtained by applying the mean function to every point in $X$.
The GP in GPML (Eq. 2.30) is a zero-mean GP.
In the Matlab version, $H \beta$ stands for a mean function expressed as a linear combination of basis functions $H = H(x)$, it is not the prediction of the GP.
The GP mean prediction will revert to the mean function very far away from points in the training set $X$ (very far in terms of length scale of the kernel), but it is going to be generally different otherwise. | Log marginal likelihood for Gaussian Process | The more general formulation for the log marginal likelihood (not marginal log likelihood, as you originally wrote - I edited it in your post) of a GP is
$$\log p(y|X) = -\frac{1}{2}(y - m(X))^T(K+\s | Log marginal likelihood for Gaussian Process
The more general formulation for the log marginal likelihood (not marginal log likelihood, as you originally wrote - I edited it in your post) of a GP is
$$\log p(y|X) = -\frac{1}{2}(y - m(X))^T(K+\sigma^2_n I)^{-1}(y - m(X)) - \frac{1}{2}\log|K+\sigma^2_n I|-\frac{n}{2}\log2\pi$$
where $m(x): \mathbb{R}^d \rightarrow \mathbb{R}$ for a given point $x$ is a mean function of a GP; and the notation $m(X)$ represents a vector function obtained by applying the mean function to every point in $X$.
The GP in GPML (Eq. 2.30) is a zero-mean GP.
In the Matlab version, $H \beta$ stands for a mean function expressed as a linear combination of basis functions $H = H(x)$, it is not the prediction of the GP.
The GP mean prediction will revert to the mean function very far away from points in the training set $X$ (very far in terms of length scale of the kernel), but it is going to be generally different otherwise. | Log marginal likelihood for Gaussian Process
The more general formulation for the log marginal likelihood (not marginal log likelihood, as you originally wrote - I edited it in your post) of a GP is
$$\log p(y|X) = -\frac{1}{2}(y - m(X))^T(K+\s |
19,084 | Better performance using Random Forest one-Vs-All than Random Forest multiclass? | I had exactly the same question as you, and was a bit sad to find out no answers were posted on your topic...
That said, I found this paper : One-Vs-All Binarization Technique in the
Context of Random Forest (https://www.elen.ucl.ac.be/Proceedings/esann/esannpdf/es2015-5.pdf) published in 2015.
The authors are showing better classification performances with one-versus-rest Random Forest classifiers compared to standard multiclass Random Forest ones.
The authors are not giving many clues on why it works so well, except that the trees generated in the one-versus-rest context are simpler.
I am wondering if you found some answers yourself since you posted your question? | Better performance using Random Forest one-Vs-All than Random Forest multiclass? | I had exactly the same question as you, and was a bit sad to find out no answers were posted on your topic...
That said, I found this paper : One-Vs-All Binarization Technique in the
Context of Random | Better performance using Random Forest one-Vs-All than Random Forest multiclass?
I had exactly the same question as you, and was a bit sad to find out no answers were posted on your topic...
That said, I found this paper : One-Vs-All Binarization Technique in the
Context of Random Forest (https://www.elen.ucl.ac.be/Proceedings/esann/esannpdf/es2015-5.pdf) published in 2015.
The authors are showing better classification performances with one-versus-rest Random Forest classifiers compared to standard multiclass Random Forest ones.
The authors are not giving many clues on why it works so well, except that the trees generated in the one-versus-rest context are simpler.
I am wondering if you found some answers yourself since you posted your question? | Better performance using Random Forest one-Vs-All than Random Forest multiclass?
I had exactly the same question as you, and was a bit sad to find out no answers were posted on your topic...
That said, I found this paper : One-Vs-All Binarization Technique in the
Context of Random |
19,085 | Better performance using Random Forest one-Vs-All than Random Forest multiclass? | At the end of the day, the model class that you choose defines the shape of your decision boundary -- if you use RandomForests as a multiclass or as a one-vs-all multiclass classifier the boundaries will be equally constrained, with the only difference being the data you use to fit your models. Depending on how well your models fit your data, and how susceptible your model is to data imbalance issues, I don't really see an a priori reason that multiclass should be better than one-vs-all. They just give you different things -- one gives you a decision for every pair of classes, at the cost of more models to train, and one gives you the class decision right away. It is entirely plausible to me, especially considering that RandomForests don't solve a convex loss function, that you would get the results you did.
If you're specifically interested in finding which features are relevant for your classifier, I'd suggest a logistic regression with an L1 loss penalty, since the sparsity would give you a small subset of features which are predictive for each pair of classes that you have. | Better performance using Random Forest one-Vs-All than Random Forest multiclass? | At the end of the day, the model class that you choose defines the shape of your decision boundary -- if you use RandomForests as a multiclass or as a one-vs-all multiclass classifier the boundaries w | Better performance using Random Forest one-Vs-All than Random Forest multiclass?
At the end of the day, the model class that you choose defines the shape of your decision boundary -- if you use RandomForests as a multiclass or as a one-vs-all multiclass classifier the boundaries will be equally constrained, with the only difference being the data you use to fit your models. Depending on how well your models fit your data, and how susceptible your model is to data imbalance issues, I don't really see an a priori reason that multiclass should be better than one-vs-all. They just give you different things -- one gives you a decision for every pair of classes, at the cost of more models to train, and one gives you the class decision right away. It is entirely plausible to me, especially considering that RandomForests don't solve a convex loss function, that you would get the results you did.
If you're specifically interested in finding which features are relevant for your classifier, I'd suggest a logistic regression with an L1 loss penalty, since the sparsity would give you a small subset of features which are predictive for each pair of classes that you have. | Better performance using Random Forest one-Vs-All than Random Forest multiclass?
At the end of the day, the model class that you choose defines the shape of your decision boundary -- if you use RandomForests as a multiclass or as a one-vs-all multiclass classifier the boundaries w |
19,086 | What does a wedge-like shape of the PCA plot indicate? | Assuming the variables are positive or non-negative the edges of the edge are are just points beyond which the data would become 0 or negative respectively. As such real-life data tend to be right skewed, we see greater density of points at the low end of their distribution and hence greater density at the "point" of the wedge.
More generally, PCA is simply a rotation of the data and constraints on those data will generally be visible in the principal components in the same manner as shown in the question.
Here is an example using several log-normally distributed variables:
library("vegan")
set.seed(1)
df <- data.frame(matrix(rlnorm(5*10000), ncol = 5))
plot(rda(df), display = "sites")
Depending on the rotation implied by the first two PCs, you might see the wedge or you might see a somewhat different version, show here in 3d using (ordirgl() in place of plot())
Here, in 3d we see multiple spikes protruding from the centre mass.
For Gaussian random variables ($X_i \sim \mathcal(N)(\mu = 0, \sigma = 1)$) where each has the same mean and variance we see a sphere of points
set.seed(1)
df2 <- data.frame(matrix(rnorm(5*10000), ncol = 5))
plot(rda(df2), display = "sites")
And for uniform positive random variables we see a cube
set.seed(1)
df3 <- data.frame(matrix(runif(3*10000), ncol = 3))
plot(rda(df3), display = "sites")
Note that here, for illustration I show the uniform using just 3 random variables hence the points describe a cube in 3d. With higher dimensions/more variables we can't represent the 5d hypercube perfectly in 3d and hence the distinct "cube" shape gets distorted somewhat. Similar issues effect the other examples shown, but it's still easy to see the constraints in those examples.
For your data, a log transformation of the variables prior to PCA would pull in the tails and stretch out the clumped data, just as you might use such a transformation in a linear regression.
Other shapes can crop up in PCA plots; one such shape is an artefact of the metric representation preserved in the PCA and is known as the horseshoe. For data with a long or dominant gradient (samples arranged along a single dimension with variables increasing from 0 to a maximum and then decreasing again to 0 along portions of the data are well known to generate such artefacts. Consider
ll <- data.frame(Species1 = c(1,2,4,7,8,7,4,2,1,rep(0,10)),
Species2 = c(rep(0, 5),1,2,4,7,8,7,4,2,1, rep(0, 5)),
Species3 = c(rep(0, 10),1,2,4,7,8,7,4,2,1))
rownames(ll) <- paste0("site", seq_len(NROW(ll)))
matplot(ll, type = "o", col = 1:3, pch = 21:23, bg = 1:3,
ylab = "Abundance", xlab = "Sites")
which produces an extreme horseshoe, where points at the ends of the axes bend back into the middle. | What does a wedge-like shape of the PCA plot indicate? | Assuming the variables are positive or non-negative the edges of the edge are are just points beyond which the data would become 0 or negative respectively. As such real-life data tend to be right sk | What does a wedge-like shape of the PCA plot indicate?
Assuming the variables are positive or non-negative the edges of the edge are are just points beyond which the data would become 0 or negative respectively. As such real-life data tend to be right skewed, we see greater density of points at the low end of their distribution and hence greater density at the "point" of the wedge.
More generally, PCA is simply a rotation of the data and constraints on those data will generally be visible in the principal components in the same manner as shown in the question.
Here is an example using several log-normally distributed variables:
library("vegan")
set.seed(1)
df <- data.frame(matrix(rlnorm(5*10000), ncol = 5))
plot(rda(df), display = "sites")
Depending on the rotation implied by the first two PCs, you might see the wedge or you might see a somewhat different version, show here in 3d using (ordirgl() in place of plot())
Here, in 3d we see multiple spikes protruding from the centre mass.
For Gaussian random variables ($X_i \sim \mathcal(N)(\mu = 0, \sigma = 1)$) where each has the same mean and variance we see a sphere of points
set.seed(1)
df2 <- data.frame(matrix(rnorm(5*10000), ncol = 5))
plot(rda(df2), display = "sites")
And for uniform positive random variables we see a cube
set.seed(1)
df3 <- data.frame(matrix(runif(3*10000), ncol = 3))
plot(rda(df3), display = "sites")
Note that here, for illustration I show the uniform using just 3 random variables hence the points describe a cube in 3d. With higher dimensions/more variables we can't represent the 5d hypercube perfectly in 3d and hence the distinct "cube" shape gets distorted somewhat. Similar issues effect the other examples shown, but it's still easy to see the constraints in those examples.
For your data, a log transformation of the variables prior to PCA would pull in the tails and stretch out the clumped data, just as you might use such a transformation in a linear regression.
Other shapes can crop up in PCA plots; one such shape is an artefact of the metric representation preserved in the PCA and is known as the horseshoe. For data with a long or dominant gradient (samples arranged along a single dimension with variables increasing from 0 to a maximum and then decreasing again to 0 along portions of the data are well known to generate such artefacts. Consider
ll <- data.frame(Species1 = c(1,2,4,7,8,7,4,2,1,rep(0,10)),
Species2 = c(rep(0, 5),1,2,4,7,8,7,4,2,1, rep(0, 5)),
Species3 = c(rep(0, 10),1,2,4,7,8,7,4,2,1))
rownames(ll) <- paste0("site", seq_len(NROW(ll)))
matplot(ll, type = "o", col = 1:3, pch = 21:23, bg = 1:3,
ylab = "Abundance", xlab = "Sites")
which produces an extreme horseshoe, where points at the ends of the axes bend back into the middle. | What does a wedge-like shape of the PCA plot indicate?
Assuming the variables are positive or non-negative the edges of the edge are are just points beyond which the data would become 0 or negative respectively. As such real-life data tend to be right sk |
19,087 | Encoding Date/Time (cyclic data) for Neural Networks | I was looking for an answer to a similar problem and stumbled on this thread. The sinusoidal encoding idea is explored in this blog post:
Encoding cyclical continuous features - 24-hour time
Ian's answer fully addressed my needs, so I thought about posting it here for future memory. | Encoding Date/Time (cyclic data) for Neural Networks | I was looking for an answer to a similar problem and stumbled on this thread. The sinusoidal encoding idea is explored in this blog post:
Encoding cyclical continuous features - 24-hour time
Ian's ans | Encoding Date/Time (cyclic data) for Neural Networks
I was looking for an answer to a similar problem and stumbled on this thread. The sinusoidal encoding idea is explored in this blog post:
Encoding cyclical continuous features - 24-hour time
Ian's answer fully addressed my needs, so I thought about posting it here for future memory. | Encoding Date/Time (cyclic data) for Neural Networks
I was looking for an answer to a similar problem and stumbled on this thread. The sinusoidal encoding idea is explored in this blog post:
Encoding cyclical continuous features - 24-hour time
Ian's ans |
19,088 | Encoding Date/Time (cyclic data) for Neural Networks | You could try representing time as a big matrix, i.e. a 365 by 24, to represent the days of the year and hours of the day, and then "unroll" this into a 1 by 8760 vector. The time would then correspond to the position within this vector and the value at this position is the value at that time. | Encoding Date/Time (cyclic data) for Neural Networks | You could try representing time as a big matrix, i.e. a 365 by 24, to represent the days of the year and hours of the day, and then "unroll" this into a 1 by 8760 vector. The time would then correspon | Encoding Date/Time (cyclic data) for Neural Networks
You could try representing time as a big matrix, i.e. a 365 by 24, to represent the days of the year and hours of the day, and then "unroll" this into a 1 by 8760 vector. The time would then correspond to the position within this vector and the value at this position is the value at that time. | Encoding Date/Time (cyclic data) for Neural Networks
You could try representing time as a big matrix, i.e. a 365 by 24, to represent the days of the year and hours of the day, and then "unroll" this into a 1 by 8760 vector. The time would then correspon |
19,089 | Encoding Date/Time (cyclic data) for Neural Networks | I would suggest creating multiple input features from the time series using relationships you know (or believe) to exist already in the data. For example, you state that the target output will vary:
between mornings and evenings, and differs between weekdays, and between summer and winter,...
So why not create a set of features that describes each of these 'cycles'. This may help to tease out both micro and macro variations rather than a single feature that describes all.
For example...
If you have trend whereby something of interest occurs around midday each day, then create a feature from $1..24$ that describes the hours in the day. Now the network will learn to trigger at around 12. Compare this to the case where you have this same data encoded as hours in a week $1..168$. Now the network has to try an learn to trigger on $12,36,60...$ which is significantly more complex. | Encoding Date/Time (cyclic data) for Neural Networks | I would suggest creating multiple input features from the time series using relationships you know (or believe) to exist already in the data. For example, you state that the target output will vary:
| Encoding Date/Time (cyclic data) for Neural Networks
I would suggest creating multiple input features from the time series using relationships you know (or believe) to exist already in the data. For example, you state that the target output will vary:
between mornings and evenings, and differs between weekdays, and between summer and winter,...
So why not create a set of features that describes each of these 'cycles'. This may help to tease out both micro and macro variations rather than a single feature that describes all.
For example...
If you have trend whereby something of interest occurs around midday each day, then create a feature from $1..24$ that describes the hours in the day. Now the network will learn to trigger at around 12. Compare this to the case where you have this same data encoded as hours in a week $1..168$. Now the network has to try an learn to trigger on $12,36,60...$ which is significantly more complex. | Encoding Date/Time (cyclic data) for Neural Networks
I would suggest creating multiple input features from the time series using relationships you know (or believe) to exist already in the data. For example, you state that the target output will vary:
|
19,090 | Can neural network (e.g., convolutional neural network) have negative weights? | Rectified Linear Units (ReLUs) only make the output of the neurons to be non-negative. The parameters of the network, however, can, and will, become positive or negative depending on the training data.
Here are two reasons I can think of right now that justifies (intuitively) why some parameters would become negative:
the regularization of the parameters (a.k.a. the weight decay); the variation in the parameter values makes prediction possible, and if the parameters are centered around zero (i.e. their mean is close to zero), then their $\ell 2$ norm (which is a standard regularizer) is low.
although the gradients of the output of a layer with respect to the layer parameters depend on the input to the layer (which are always positive assuming that the previous layer passes its outputs through a ReLU), however, the gradient of the error (which comes from the layers closer to the final output layers) may be positive or negative, making it possible for SGD to make some of the parameter values negative after taking the next gradient step. More specifically, let $I$, $O$, and $w$ denote the input, output, and parameters of a layer in a neural network. Also, let $E$ be the final error of the network induced by some training sample. The gradient of the error with respect to $w$ is computed as $\frac{\partial E}{\partial w} = \left( \sum_{k=1}^K\frac{\partial E}{\partial O_k} \right) \cdot \frac{\partial O_k}{\partial w}$; note that $O_k = O, \forall k$ (see picture below): | Can neural network (e.g., convolutional neural network) have negative weights? | Rectified Linear Units (ReLUs) only make the output of the neurons to be non-negative. The parameters of the network, however, can, and will, become positive or negative depending on the training data | Can neural network (e.g., convolutional neural network) have negative weights?
Rectified Linear Units (ReLUs) only make the output of the neurons to be non-negative. The parameters of the network, however, can, and will, become positive or negative depending on the training data.
Here are two reasons I can think of right now that justifies (intuitively) why some parameters would become negative:
the regularization of the parameters (a.k.a. the weight decay); the variation in the parameter values makes prediction possible, and if the parameters are centered around zero (i.e. their mean is close to zero), then their $\ell 2$ norm (which is a standard regularizer) is low.
although the gradients of the output of a layer with respect to the layer parameters depend on the input to the layer (which are always positive assuming that the previous layer passes its outputs through a ReLU), however, the gradient of the error (which comes from the layers closer to the final output layers) may be positive or negative, making it possible for SGD to make some of the parameter values negative after taking the next gradient step. More specifically, let $I$, $O$, and $w$ denote the input, output, and parameters of a layer in a neural network. Also, let $E$ be the final error of the network induced by some training sample. The gradient of the error with respect to $w$ is computed as $\frac{\partial E}{\partial w} = \left( \sum_{k=1}^K\frac{\partial E}{\partial O_k} \right) \cdot \frac{\partial O_k}{\partial w}$; note that $O_k = O, \forall k$ (see picture below): | Can neural network (e.g., convolutional neural network) have negative weights?
Rectified Linear Units (ReLUs) only make the output of the neurons to be non-negative. The parameters of the network, however, can, and will, become positive or negative depending on the training data |
19,091 | Can neural network (e.g., convolutional neural network) have negative weights? | Imagine that you have optimal weights which are all non-negative.
Now invert some input variable $x'_i = -x_i$. The optimal network for this setup is with the weights of the $\{x'_i,y\}$ edges inverted, so the new weights are non-positive. | Can neural network (e.g., convolutional neural network) have negative weights? | Imagine that you have optimal weights which are all non-negative.
Now invert some input variable $x'_i = -x_i$. The optimal network for this setup is with the weights of the $\{x'_i,y\}$ edges inverte | Can neural network (e.g., convolutional neural network) have negative weights?
Imagine that you have optimal weights which are all non-negative.
Now invert some input variable $x'_i = -x_i$. The optimal network for this setup is with the weights of the $\{x'_i,y\}$ edges inverted, so the new weights are non-positive. | Can neural network (e.g., convolutional neural network) have negative weights?
Imagine that you have optimal weights which are all non-negative.
Now invert some input variable $x'_i = -x_i$. The optimal network for this setup is with the weights of the $\{x'_i,y\}$ edges inverte |
19,092 | Can neural network (e.g., convolutional neural network) have negative weights? | Unless you use another activation function for instance Leaky ReLU. Rectified weights of layers after the first one are non-negative regardless how many epochs in training. | Can neural network (e.g., convolutional neural network) have negative weights? | Unless you use another activation function for instance Leaky ReLU. Rectified weights of layers after the first one are non-negative regardless how many epochs in training. | Can neural network (e.g., convolutional neural network) have negative weights?
Unless you use another activation function for instance Leaky ReLU. Rectified weights of layers after the first one are non-negative regardless how many epochs in training. | Can neural network (e.g., convolutional neural network) have negative weights?
Unless you use another activation function for instance Leaky ReLU. Rectified weights of layers after the first one are non-negative regardless how many epochs in training. |
19,093 | Calculating risk ratio using odds ratio from logistic regression coefficient | Zhang 1998 originally presented a method for calculating CIs for risk ratios suggesting you could use the lower and upper bounds of the CI for the odds ratio.
This method does not work, it is biased and generally produces anticonservative (too tight) estimates of the risk ratio 95% CI. This is because of the correlation between the intercept term and the slope term as you correctly allude to. If the odds ratio tends towards its lower value in the CI, the intercept term increases to account for a higher overall prevalence in those with a 0 exposure level and conversely for a higher value in the CI. Each of these respectively lead to lower and higher bounds for the CI.
To answer your question outright, you need a knowledge of the baseline prevalence of the outcome to obtain correct confidence intervals. Data from case-control studies would rely on other data to inform this.
Alternately, you can use the delta method if you have the full covariance structure for the parameter estimates. An equivalent parametrization for the OR to RR transformation (having binary exposure and a single predictor) is:
$$RR = \frac{1 + \exp(-\beta_0)}{1+\exp(-\beta_0-\beta_1)}$$
And using multivariate delta method, and the central limit theorem which states that $\sqrt{n} \left( [\hat{\beta}_0, \hat{\beta}_1] - [\beta_0, \beta_1]\right) \rightarrow_D \mathcal{N} \left(0, \mathcal{I}^{-1}(\beta)\right)$, you can obtain the variance of the approximate normal distribution of the $RR$.
Note, notationally this only works for binary exposure and univariate logistic regression. There are some simple R tricks that make use of the delta method and marginal standardization for continuous covariates and other adjustment variables. But for brevity I'll not discuss that here.
However, there are several ways to compute relative risks and its standard error directly from models in R. Two examples of this below:
x <- sample(0:1, 100, replace=T)
y <- rbinom(100, 1, x*.2+.2)
glm(y ~ x, family=binomial(link=log))
library(survival)
coxph(Surv(time=rep(1,100), event=y) ~ x)
http://research.labiomed.org/Biostat/Education/Case%20Studies%202005/Session4/ZhangYu.pdf | Calculating risk ratio using odds ratio from logistic regression coefficient | Zhang 1998 originally presented a method for calculating CIs for risk ratios suggesting you could use the lower and upper bounds of the CI for the odds ratio.
This method does not work, it is biased | Calculating risk ratio using odds ratio from logistic regression coefficient
Zhang 1998 originally presented a method for calculating CIs for risk ratios suggesting you could use the lower and upper bounds of the CI for the odds ratio.
This method does not work, it is biased and generally produces anticonservative (too tight) estimates of the risk ratio 95% CI. This is because of the correlation between the intercept term and the slope term as you correctly allude to. If the odds ratio tends towards its lower value in the CI, the intercept term increases to account for a higher overall prevalence in those with a 0 exposure level and conversely for a higher value in the CI. Each of these respectively lead to lower and higher bounds for the CI.
To answer your question outright, you need a knowledge of the baseline prevalence of the outcome to obtain correct confidence intervals. Data from case-control studies would rely on other data to inform this.
Alternately, you can use the delta method if you have the full covariance structure for the parameter estimates. An equivalent parametrization for the OR to RR transformation (having binary exposure and a single predictor) is:
$$RR = \frac{1 + \exp(-\beta_0)}{1+\exp(-\beta_0-\beta_1)}$$
And using multivariate delta method, and the central limit theorem which states that $\sqrt{n} \left( [\hat{\beta}_0, \hat{\beta}_1] - [\beta_0, \beta_1]\right) \rightarrow_D \mathcal{N} \left(0, \mathcal{I}^{-1}(\beta)\right)$, you can obtain the variance of the approximate normal distribution of the $RR$.
Note, notationally this only works for binary exposure and univariate logistic regression. There are some simple R tricks that make use of the delta method and marginal standardization for continuous covariates and other adjustment variables. But for brevity I'll not discuss that here.
However, there are several ways to compute relative risks and its standard error directly from models in R. Two examples of this below:
x <- sample(0:1, 100, replace=T)
y <- rbinom(100, 1, x*.2+.2)
glm(y ~ x, family=binomial(link=log))
library(survival)
coxph(Surv(time=rep(1,100), event=y) ~ x)
http://research.labiomed.org/Biostat/Education/Case%20Studies%202005/Session4/ZhangYu.pdf | Calculating risk ratio using odds ratio from logistic regression coefficient
Zhang 1998 originally presented a method for calculating CIs for risk ratios suggesting you could use the lower and upper bounds of the CI for the odds ratio.
This method does not work, it is biased |
19,094 | Calculating risk ratio using odds ratio from logistic regression coefficient | Table 2 in the paper by "Sensitivity Analysis in Observational Research: Introducing the E-Value" by Tyler J. VanderWeele and Peng Ding summarises how to approximate risk ratio from odds ratio.
Also, from what I understand, odds in logistic regression based on case-control data cannot be used to calculate probability, therefore, cannot be directly used to calculate risk. | Calculating risk ratio using odds ratio from logistic regression coefficient | Table 2 in the paper by "Sensitivity Analysis in Observational Research: Introducing the E-Value" by Tyler J. VanderWeele and Peng Ding summarises how to approximate risk ratio from odds ratio.
Also, | Calculating risk ratio using odds ratio from logistic regression coefficient
Table 2 in the paper by "Sensitivity Analysis in Observational Research: Introducing the E-Value" by Tyler J. VanderWeele and Peng Ding summarises how to approximate risk ratio from odds ratio.
Also, from what I understand, odds in logistic regression based on case-control data cannot be used to calculate probability, therefore, cannot be directly used to calculate risk. | Calculating risk ratio using odds ratio from logistic regression coefficient
Table 2 in the paper by "Sensitivity Analysis in Observational Research: Introducing the E-Value" by Tyler J. VanderWeele and Peng Ding summarises how to approximate risk ratio from odds ratio.
Also, |
19,095 | How do I train HMM's for classification? | The approach you describe for using HMMs for classification is really only applicable to settings where you have independent sequences you want to classify. For example, if I was classifying the sentiment of sentences as positive or negative, I could build an HMM for each as you've described. See the related answer I gave here. Notice how this rests on the assumption I can break sequences up into the meaningful chunks to be classified before I compare posteriors. This doesn't seem to be the case for you problem since you effectively have one large length $T$ time series. Here's what I would try.
You mentioned over at reddit that you were hesitant to assign a single state for each class. Have you tried this? It may not work as poorly as you think. The estimation problem is also significantly easier in this case. Estimating the transition probabilities is easy, you just count essentially. Furthermore you can just fit the emission probabilities for each state based on you're observed data and corresponding class, ignoring the temporal aspects.
If you are convinced this is a bad idea, or find it performs poorly but still want to stick with generative models, you could use something like a Hierarchical HMM. For example, you could let the states in the top-level represent the classes and then allow the lower level HMMs to model the temporal variation within classes. You could also use one big HMM to achieve something similar. If you have $K$ classes, allocate $N$ states for each class (so $N \times K$ states altogether) of the form $s_{ki}$, $k = 1, \ldots, K$, $i=1,\ldots N$. During training you would need to force the HMM to only assign positive probability to transitioning to a state at time $t$ where $k$ matches the label at time $t$. I might have worded this a little awkwardly so I hope it is clear what I mean. Obviously you can generalize this to having different numbers of states per class. There are probably other types of Dynamic Bayesian Networks you could use as well. Kevin Murphy's thesis is an excellent reference. He also discusses converting HHMMs to HMMs.
Lastly, you could switch to a discriminative model like a Conditional Random Field. A discriminative model will allow you to easily incorporate more complex features and more directly addresses the problem at hand (estimating conditional densities). This is probably what I'd try first. | How do I train HMM's for classification? | The approach you describe for using HMMs for classification is really only applicable to settings where you have independent sequences you want to classify. For example, if I was classifying the senti | How do I train HMM's for classification?
The approach you describe for using HMMs for classification is really only applicable to settings where you have independent sequences you want to classify. For example, if I was classifying the sentiment of sentences as positive or negative, I could build an HMM for each as you've described. See the related answer I gave here. Notice how this rests on the assumption I can break sequences up into the meaningful chunks to be classified before I compare posteriors. This doesn't seem to be the case for you problem since you effectively have one large length $T$ time series. Here's what I would try.
You mentioned over at reddit that you were hesitant to assign a single state for each class. Have you tried this? It may not work as poorly as you think. The estimation problem is also significantly easier in this case. Estimating the transition probabilities is easy, you just count essentially. Furthermore you can just fit the emission probabilities for each state based on you're observed data and corresponding class, ignoring the temporal aspects.
If you are convinced this is a bad idea, or find it performs poorly but still want to stick with generative models, you could use something like a Hierarchical HMM. For example, you could let the states in the top-level represent the classes and then allow the lower level HMMs to model the temporal variation within classes. You could also use one big HMM to achieve something similar. If you have $K$ classes, allocate $N$ states for each class (so $N \times K$ states altogether) of the form $s_{ki}$, $k = 1, \ldots, K$, $i=1,\ldots N$. During training you would need to force the HMM to only assign positive probability to transitioning to a state at time $t$ where $k$ matches the label at time $t$. I might have worded this a little awkwardly so I hope it is clear what I mean. Obviously you can generalize this to having different numbers of states per class. There are probably other types of Dynamic Bayesian Networks you could use as well. Kevin Murphy's thesis is an excellent reference. He also discusses converting HHMMs to HMMs.
Lastly, you could switch to a discriminative model like a Conditional Random Field. A discriminative model will allow you to easily incorporate more complex features and more directly addresses the problem at hand (estimating conditional densities). This is probably what I'd try first. | How do I train HMM's for classification?
The approach you describe for using HMMs for classification is really only applicable to settings where you have independent sequences you want to classify. For example, if I was classifying the senti |
19,096 | Difference-in-Differences Estimator for Logistic Regressions | Linear DiD Methods
You could stick with the linear probability model which you can easily estimate via least squares. Running a simple linear regression for your difference in differences analysis has several nice properties:
the DiD coefficient is readily interpretable (which is not necessarily true for interaction terms in nonlinear models - see Ai and Norton, 2003); non-linear methods can nonetheless identify the incremental effect of the DiD coefficient (see Puhani, 2012)
there are several options available for you to correct for serial correlation of the errors; Bertrand et al. (2004) discuss why this is important and offer several options on how to do it (I listed the available methods in an earlier answer)
the linear probability model is much faster which is particularly true if you have a large data set
Drawbacks of the linear probability model are that it is heteroscedastic by construction though this isn't much of an issue given that this is easily adjusted for. For instance, the block bootstrap adjusts for both hetereoscedasticity and autocorrelation as suggested in Bertrand et al. (2004). If you are interested in prediction, the predicted probabilities can lie outside the (0,1) range but as far as I read your question you want to know the treatment effect from the DiD estimation.
So if none of these problems are real issues for you, the linear probability model is an easy and quick solution for your estimation problem.
Non-Linear DiD Methods
There exist alternative models for non-linear DiD but none of them are straightforward. Blundell and Dias (2009) describe the popular index model under the assumption of linearity in the index. They note though that even with a very simple non-linear specification this type of DiD regression is difficult to implement. Another option is Athey and Imbens (2006) who develop a non-linear DiD estimator which allows for binary outcomes. Again the implementation is everything but easy, though for completeness I mention it here.
Intuition for Interaction Terms in Non-Linear Models
Karaca-Mandic et al. (2012) provide a discussion of the changing interpretation of interaction terms when moving from linear to non-linear models. They provide the mathematical background and support the reader's understanding with graphs and applied examples using publicly available Stata data sets. Thanks to Dimitry V. Masterov for pointing out this useful reference. | Difference-in-Differences Estimator for Logistic Regressions | Linear DiD Methods
You could stick with the linear probability model which you can easily estimate via least squares. Running a simple linear regression for your difference in differences analysis has | Difference-in-Differences Estimator for Logistic Regressions
Linear DiD Methods
You could stick with the linear probability model which you can easily estimate via least squares. Running a simple linear regression for your difference in differences analysis has several nice properties:
the DiD coefficient is readily interpretable (which is not necessarily true for interaction terms in nonlinear models - see Ai and Norton, 2003); non-linear methods can nonetheless identify the incremental effect of the DiD coefficient (see Puhani, 2012)
there are several options available for you to correct for serial correlation of the errors; Bertrand et al. (2004) discuss why this is important and offer several options on how to do it (I listed the available methods in an earlier answer)
the linear probability model is much faster which is particularly true if you have a large data set
Drawbacks of the linear probability model are that it is heteroscedastic by construction though this isn't much of an issue given that this is easily adjusted for. For instance, the block bootstrap adjusts for both hetereoscedasticity and autocorrelation as suggested in Bertrand et al. (2004). If you are interested in prediction, the predicted probabilities can lie outside the (0,1) range but as far as I read your question you want to know the treatment effect from the DiD estimation.
So if none of these problems are real issues for you, the linear probability model is an easy and quick solution for your estimation problem.
Non-Linear DiD Methods
There exist alternative models for non-linear DiD but none of them are straightforward. Blundell and Dias (2009) describe the popular index model under the assumption of linearity in the index. They note though that even with a very simple non-linear specification this type of DiD regression is difficult to implement. Another option is Athey and Imbens (2006) who develop a non-linear DiD estimator which allows for binary outcomes. Again the implementation is everything but easy, though for completeness I mention it here.
Intuition for Interaction Terms in Non-Linear Models
Karaca-Mandic et al. (2012) provide a discussion of the changing interpretation of interaction terms when moving from linear to non-linear models. They provide the mathematical background and support the reader's understanding with graphs and applied examples using publicly available Stata data sets. Thanks to Dimitry V. Masterov for pointing out this useful reference. | Difference-in-Differences Estimator for Logistic Regressions
Linear DiD Methods
You could stick with the linear probability model which you can easily estimate via least squares. Running a simple linear regression for your difference in differences analysis has |
19,097 | Difference-in-Differences Estimator for Logistic Regressions | It sounds like your concern is that of model misspecification. You're interested in determining if the intervention lead to an incremental improvement in the risk of outcome comparing treated to control over time. It sounds like, in particular, you are worried that the log-linear term for the relationship between odds of outcome comparing groups differing by 1 unit in time may not be adequate.
There are two solutions to this, but firstly note: "all models are wrong, some models are useful" - George Box. We ask: what's the risk of getting the time effect wrong? (say it's quadratic) Well, if both groups are measured consistently across time, there's actually no difference. This is the value of balanced design. Adjusting for time improves precision when there is imbalance and the specified model is correct. If you are willing to assume that the specified time effect is "close to correct" (maybe there is a weakly non-linear trend), then using robust standard errors ensures that the inference is correct on the actual intervention effect. The interpretation of the parameter is a "time averaged" effect as a consequence of that.
Another solution is to use a more granular effect of time. Rather than assuming a linear increase, you can test nested models with categorical effects of time. Assume, for instance, there are four time points: two pre-intervention, and two post-intervention. The categorical model would then be:
$$\mbox{logit} (Y | X, T) = \alpha + \beta_1 X + \gamma_1 T_2 + \gamma_2 T_3 + \gamma_3 T_4$$
against the full model
$$\mbox{logit} (Y | X, T) = \alpha + \beta_1 X + \gamma_1 T_2 + \gamma_2 T_3 + \gamma_3 T_4 + \eta X T_4 $$
And the simultaneous test of all post-by-treatment parameters (one $\eta$ for each extra unit time after treatment... accounting for Hawthorne effect with $\beta_1$) will account for a categorical effect-by-time interaction. | Difference-in-Differences Estimator for Logistic Regressions | It sounds like your concern is that of model misspecification. You're interested in determining if the intervention lead to an incremental improvement in the risk of outcome comparing treated to contr | Difference-in-Differences Estimator for Logistic Regressions
It sounds like your concern is that of model misspecification. You're interested in determining if the intervention lead to an incremental improvement in the risk of outcome comparing treated to control over time. It sounds like, in particular, you are worried that the log-linear term for the relationship between odds of outcome comparing groups differing by 1 unit in time may not be adequate.
There are two solutions to this, but firstly note: "all models are wrong, some models are useful" - George Box. We ask: what's the risk of getting the time effect wrong? (say it's quadratic) Well, if both groups are measured consistently across time, there's actually no difference. This is the value of balanced design. Adjusting for time improves precision when there is imbalance and the specified model is correct. If you are willing to assume that the specified time effect is "close to correct" (maybe there is a weakly non-linear trend), then using robust standard errors ensures that the inference is correct on the actual intervention effect. The interpretation of the parameter is a "time averaged" effect as a consequence of that.
Another solution is to use a more granular effect of time. Rather than assuming a linear increase, you can test nested models with categorical effects of time. Assume, for instance, there are four time points: two pre-intervention, and two post-intervention. The categorical model would then be:
$$\mbox{logit} (Y | X, T) = \alpha + \beta_1 X + \gamma_1 T_2 + \gamma_2 T_3 + \gamma_3 T_4$$
against the full model
$$\mbox{logit} (Y | X, T) = \alpha + \beta_1 X + \gamma_1 T_2 + \gamma_2 T_3 + \gamma_3 T_4 + \eta X T_4 $$
And the simultaneous test of all post-by-treatment parameters (one $\eta$ for each extra unit time after treatment... accounting for Hawthorne effect with $\beta_1$) will account for a categorical effect-by-time interaction. | Difference-in-Differences Estimator for Logistic Regressions
It sounds like your concern is that of model misspecification. You're interested in determining if the intervention lead to an incremental improvement in the risk of outcome comparing treated to contr |
19,098 | Understanding the p-value in Spearman's rank correlation | Your understanding of the p-value is correct (well technically it is the probability of seeing the observed correlation or stronger) if no correlation exists.
What is a strong or weak correlation is depends on the context, it is often good to plot your data, or generate random data with a given correlation and plot that to get a feel for the strength of the correlation.
The p-value is determined by the observed correlation and the sample size, so with a large enough sample size a very weak correlation can be significant, meaning that what you saw is likely real and not due to chance, it just may not be very interesting. On the other hand with small sample sizes you can get a very strong correlation that is not statistically significant meaning that chance and no relationship is a plausible explanation (think about 2 points, the correlation will almost always be 1 or -1 even when there is no relationship, so that size can easily be attributed to chance). | Understanding the p-value in Spearman's rank correlation | Your understanding of the p-value is correct (well technically it is the probability of seeing the observed correlation or stronger) if no correlation exists.
What is a strong or weak correlation is d | Understanding the p-value in Spearman's rank correlation
Your understanding of the p-value is correct (well technically it is the probability of seeing the observed correlation or stronger) if no correlation exists.
What is a strong or weak correlation is depends on the context, it is often good to plot your data, or generate random data with a given correlation and plot that to get a feel for the strength of the correlation.
The p-value is determined by the observed correlation and the sample size, so with a large enough sample size a very weak correlation can be significant, meaning that what you saw is likely real and not due to chance, it just may not be very interesting. On the other hand with small sample sizes you can get a very strong correlation that is not statistically significant meaning that chance and no relationship is a plausible explanation (think about 2 points, the correlation will almost always be 1 or -1 even when there is no relationship, so that size can easily be attributed to chance). | Understanding the p-value in Spearman's rank correlation
Your understanding of the p-value is correct (well technically it is the probability of seeing the observed correlation or stronger) if no correlation exists.
What is a strong or weak correlation is d |
19,099 | Gaussian processes benefits | Let's recall some formulas about the Gaussian process regression. Suppose that we have a sample $D = (X,\mathbf{y}) = \{(\mathbf{x}_i, y_i)\}_{i = 1}^N$. For this sample loglikelihood has the form:
$$
L = -\frac12 \left( \log |K| + \mathbf{y}^T K^{-1} \mathbf{y}\right),
$$
where $K = \{k(\mathbf{x}_i, \mathbf{x}_j)\}_{i, j = 1}^N$ is the sample covariance matrix.
There $k(\mathbf{x}_i, \mathbf{x}_j)$ is a covariance function with parameters we tune using the loglikelihood maximization. The prediction (posterior mean) for a new point $\mathbf{x}$ has the form:
$$
\hat{y}(\mathbf{x}) = \mathbf{k} K^{-1} \mathbf{y},
$$
there $\mathbf{k} = \{k(\mathbf{x}, \mathbf{x}_i)\}_{i = 1}^N$ is a vector of covariances between new point and sample points.
Now note that Gaussian processes regression can model exact linear models. Suppose that covariance function has the form $k(\mathbf{x}_i, \mathbf{x}_j) = \mathbf{x}_i^T \mathbf{x}_j$. In this case prediction has the form:
$$
\hat{y}(\mathbf{x}) = \mathbf{x}^T X^T (X X^T)^{-1} \mathbf{y} = \mathbf{x}^T (X^T X)^{-1} X^T \mathbf{y}.
$$
The identity is true in case $(X X^T)^{-1}$ is nonsingular which is not the case, but this is not a problem in case we use covariance matrix regularization. So, the rightest hand side is the exact formula for linear regression, and we can do linear regression with Gaussian processes using proper covariance function.
Now let's consider a Gaussian processes regression with another covariance function (for example, squared exponential covariance function of the form $\exp \left( -(\mathbf{x}_i - \mathbf{x}_j)^T A^{-1} (\mathbf{x}_i - \mathbf{x}_j) \right)$, there $A$ is a matrix of hyperparameters we tune). Obviously, in this case posterior mean is not a linear function (see image).
.
So, the benefit is that we can model nonlinear functions using a proper covariance function (we can select a state-of-the-art one, in most cases squared exponential covariance function is a rather good choice). The source of nonlinearity is not the trend component you mentioned, but the covariance function. | Gaussian processes benefits | Let's recall some formulas about the Gaussian process regression. Suppose that we have a sample $D = (X,\mathbf{y}) = \{(\mathbf{x}_i, y_i)\}_{i = 1}^N$. For this sample loglikelihood has the form:
$$ | Gaussian processes benefits
Let's recall some formulas about the Gaussian process regression. Suppose that we have a sample $D = (X,\mathbf{y}) = \{(\mathbf{x}_i, y_i)\}_{i = 1}^N$. For this sample loglikelihood has the form:
$$
L = -\frac12 \left( \log |K| + \mathbf{y}^T K^{-1} \mathbf{y}\right),
$$
where $K = \{k(\mathbf{x}_i, \mathbf{x}_j)\}_{i, j = 1}^N$ is the sample covariance matrix.
There $k(\mathbf{x}_i, \mathbf{x}_j)$ is a covariance function with parameters we tune using the loglikelihood maximization. The prediction (posterior mean) for a new point $\mathbf{x}$ has the form:
$$
\hat{y}(\mathbf{x}) = \mathbf{k} K^{-1} \mathbf{y},
$$
there $\mathbf{k} = \{k(\mathbf{x}, \mathbf{x}_i)\}_{i = 1}^N$ is a vector of covariances between new point and sample points.
Now note that Gaussian processes regression can model exact linear models. Suppose that covariance function has the form $k(\mathbf{x}_i, \mathbf{x}_j) = \mathbf{x}_i^T \mathbf{x}_j$. In this case prediction has the form:
$$
\hat{y}(\mathbf{x}) = \mathbf{x}^T X^T (X X^T)^{-1} \mathbf{y} = \mathbf{x}^T (X^T X)^{-1} X^T \mathbf{y}.
$$
The identity is true in case $(X X^T)^{-1}$ is nonsingular which is not the case, but this is not a problem in case we use covariance matrix regularization. So, the rightest hand side is the exact formula for linear regression, and we can do linear regression with Gaussian processes using proper covariance function.
Now let's consider a Gaussian processes regression with another covariance function (for example, squared exponential covariance function of the form $\exp \left( -(\mathbf{x}_i - \mathbf{x}_j)^T A^{-1} (\mathbf{x}_i - \mathbf{x}_j) \right)$, there $A$ is a matrix of hyperparameters we tune). Obviously, in this case posterior mean is not a linear function (see image).
.
So, the benefit is that we can model nonlinear functions using a proper covariance function (we can select a state-of-the-art one, in most cases squared exponential covariance function is a rather good choice). The source of nonlinearity is not the trend component you mentioned, but the covariance function. | Gaussian processes benefits
Let's recall some formulas about the Gaussian process regression. Suppose that we have a sample $D = (X,\mathbf{y}) = \{(\mathbf{x}_i, y_i)\}_{i = 1}^N$. For this sample loglikelihood has the form:
$$ |
19,100 | Gaussian processes benefits | For me the biggest advantage of Gaussian Processes is the inherent ability to model the uncertainty of the model. This is incredibly useful because, given the expected value of a function and the corresponding variance I can define a metric (i.e. an Aquisition function) that can tell me e.g. what's the point $x$ that, I should evaluate my underlying function $f$ at, that will result in the highest (in expectation) value of $f(x)$. This forms the basis of Bayesian Optimization.
You probably know the exploration vs. exploitation trade-off. We want to find a $max$ of some function $f$ (which is often expensive to evaluate) and so we need to be frugal about which $x$ we select to evaluate $f$. We will probably want to look at places near the points where we know that the function has a high value (exploitation) or at the points where we have no idea about the function's value (exploration). Gaussian Processes give us the necessary information to make a decision concerning the next evaluation: mean value $\mu$ and covariance matrix $\Sigma$ (uncertainty), allowing for e.g. optimizing expensive black-box functions. | Gaussian processes benefits | For me the biggest advantage of Gaussian Processes is the inherent ability to model the uncertainty of the model. This is incredibly useful because, given the expected value of a function and the corr | Gaussian processes benefits
For me the biggest advantage of Gaussian Processes is the inherent ability to model the uncertainty of the model. This is incredibly useful because, given the expected value of a function and the corresponding variance I can define a metric (i.e. an Aquisition function) that can tell me e.g. what's the point $x$ that, I should evaluate my underlying function $f$ at, that will result in the highest (in expectation) value of $f(x)$. This forms the basis of Bayesian Optimization.
You probably know the exploration vs. exploitation trade-off. We want to find a $max$ of some function $f$ (which is often expensive to evaluate) and so we need to be frugal about which $x$ we select to evaluate $f$. We will probably want to look at places near the points where we know that the function has a high value (exploitation) or at the points where we have no idea about the function's value (exploration). Gaussian Processes give us the necessary information to make a decision concerning the next evaluation: mean value $\mu$ and covariance matrix $\Sigma$ (uncertainty), allowing for e.g. optimizing expensive black-box functions. | Gaussian processes benefits
For me the biggest advantage of Gaussian Processes is the inherent ability to model the uncertainty of the model. This is incredibly useful because, given the expected value of a function and the corr |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.