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
10,601
Is there a "hello, world" for statistical graphics?
Not sure if it exactly qualifies as a hello world, but in R there are also demos built into many packages. e.g. library(graphics) demo(graphics) will step the user through some basic graphics available in the package. Just mouse click over each image to step through basic graphics illustrations. With just two lines, the user is introduced into some of the inspiring capabilities of R graphics for statistics. Corresponding code to generate the graphics is displayed in the R console.
Is there a "hello, world" for statistical graphics?
Not sure if it exactly qualifies as a hello world, but in R there are also demos built into many packages. e.g. library(graphics) demo(graphics) will step the user through some basic graphics availab
Is there a "hello, world" for statistical graphics? Not sure if it exactly qualifies as a hello world, but in R there are also demos built into many packages. e.g. library(graphics) demo(graphics) will step the user through some basic graphics available in the package. Just mouse click over each image to step through basic graphics illustrations. With just two lines, the user is introduced into some of the inspiring capabilities of R graphics for statistics. Corresponding code to generate the graphics is displayed in the R console.
Is there a "hello, world" for statistical graphics? Not sure if it exactly qualifies as a hello world, but in R there are also demos built into many packages. e.g. library(graphics) demo(graphics) will step the user through some basic graphics availab
10,602
Is there a "hello, world" for statistical graphics?
I'd say there were two "Hello World" type programs for data visualization: Print("Hello World"): Something like the histogram of a normally distributed variable, or perhaps a simple X,Y scatterplot. For something slightly more complex, like the section where one takes the principles of Hello World and starts playing with user input, escape characters and the like, I'd say it would be playing around with the Iris data set.
Is there a "hello, world" for statistical graphics?
I'd say there were two "Hello World" type programs for data visualization: Print("Hello World"): Something like the histogram of a normally distributed variable, or perhaps a simple X,Y scatterplot. F
Is there a "hello, world" for statistical graphics? I'd say there were two "Hello World" type programs for data visualization: Print("Hello World"): Something like the histogram of a normally distributed variable, or perhaps a simple X,Y scatterplot. For something slightly more complex, like the section where one takes the principles of Hello World and starts playing with user input, escape characters and the like, I'd say it would be playing around with the Iris data set.
Is there a "hello, world" for statistical graphics? I'd say there were two "Hello World" type programs for data visualization: Print("Hello World"): Something like the histogram of a normally distributed variable, or perhaps a simple X,Y scatterplot. F
10,603
Sanity check: how low can a p-value go?
P-values on standard computers (using IEEE double precision floats) can get as low as approximately $10^{-303}$. These can be legitimately correct calculations when effect sizes are large and/or standard errors are low. Your value, if computed with a T or normal distribution, corresponds to an effect size of about 31 standard errors. Remembering that standard errors usually scale with the reciprocal square root of $n$, that reflects a difference of less than 0.09 standard deviations (assuming all samples are independent). In most applications, there would be nothing suspicious or unusual about such a difference. Interpreting such p-values is another matter. Viewing a number as small as $10^{-207}$ or even $10^{-10}$ as a probability is exceeding the bounds of reason, given all the ways in which reality is likely to deviate from the probability model that underpins this p-value calculation. A good choice is to report the p-value as being less than the smallest threshold you feel the model can reasonably support: often between $0.01$ and $0.0001$.
Sanity check: how low can a p-value go?
P-values on standard computers (using IEEE double precision floats) can get as low as approximately $10^{-303}$. These can be legitimately correct calculations when effect sizes are large and/or stan
Sanity check: how low can a p-value go? P-values on standard computers (using IEEE double precision floats) can get as low as approximately $10^{-303}$. These can be legitimately correct calculations when effect sizes are large and/or standard errors are low. Your value, if computed with a T or normal distribution, corresponds to an effect size of about 31 standard errors. Remembering that standard errors usually scale with the reciprocal square root of $n$, that reflects a difference of less than 0.09 standard deviations (assuming all samples are independent). In most applications, there would be nothing suspicious or unusual about such a difference. Interpreting such p-values is another matter. Viewing a number as small as $10^{-207}$ or even $10^{-10}$ as a probability is exceeding the bounds of reason, given all the ways in which reality is likely to deviate from the probability model that underpins this p-value calculation. A good choice is to report the p-value as being less than the smallest threshold you feel the model can reasonably support: often between $0.01$ and $0.0001$.
Sanity check: how low can a p-value go? P-values on standard computers (using IEEE double precision floats) can get as low as approximately $10^{-303}$. These can be legitimately correct calculations when effect sizes are large and/or stan
10,604
Sanity check: how low can a p-value go?
There is nothing suspicious -- extremely low p-values like yours are pretty common when sample sizes are large (as yours is for comparing medians). As whuber mentioned, normally such p-values are reported as being less than some threshold (e.g. <0.001). One thing to be careful about is that p-values only tells you whether the difference in median is is statistically significant. Whether the difference is significant enough in magnitude is something you will have to decide: e.g. for large sample sets, extremely small differences in means/medians can be statistically significant, but it might not mean very much.
Sanity check: how low can a p-value go?
There is nothing suspicious -- extremely low p-values like yours are pretty common when sample sizes are large (as yours is for comparing medians). As whuber mentioned, normally such p-values are repo
Sanity check: how low can a p-value go? There is nothing suspicious -- extremely low p-values like yours are pretty common when sample sizes are large (as yours is for comparing medians). As whuber mentioned, normally such p-values are reported as being less than some threshold (e.g. <0.001). One thing to be careful about is that p-values only tells you whether the difference in median is is statistically significant. Whether the difference is significant enough in magnitude is something you will have to decide: e.g. for large sample sets, extremely small differences in means/medians can be statistically significant, but it might not mean very much.
Sanity check: how low can a p-value go? There is nothing suspicious -- extremely low p-values like yours are pretty common when sample sizes are large (as yours is for comparing medians). As whuber mentioned, normally such p-values are repo
10,605
Sanity check: how low can a p-value go?
A p-value can achieve a value of 0. Suppose I am testing the composite hypothesis about the value of a range of a uniform 0, $\theta$ random variable. If I set $\mathcal{H}_0: \theta = 1$ and sample a value of $X=1.1$, you see it's impossible to observe such a value or higher under the null hypothesis. The p-value is 0.
Sanity check: how low can a p-value go?
A p-value can achieve a value of 0. Suppose I am testing the composite hypothesis about the value of a range of a uniform 0, $\theta$ random variable. If I set $\mathcal{H}_0: \theta = 1$ and sample a
Sanity check: how low can a p-value go? A p-value can achieve a value of 0. Suppose I am testing the composite hypothesis about the value of a range of a uniform 0, $\theta$ random variable. If I set $\mathcal{H}_0: \theta = 1$ and sample a value of $X=1.1$, you see it's impossible to observe such a value or higher under the null hypothesis. The p-value is 0.
Sanity check: how low can a p-value go? A p-value can achieve a value of 0. Suppose I am testing the composite hypothesis about the value of a range of a uniform 0, $\theta$ random variable. If I set $\mathcal{H}_0: \theta = 1$ and sample a
10,606
Is it a good idea to use CNN to classify 1D signal?
I guess that by 1D signal you mean time-series data, where you assume temporal dependence between the values. In such cases convolutional neural networks (CNN) are one of the possible approaches. The most popular neural network approach to such data is to use recurrent neural networks (RNN), but you can alternatively use CNNs, or hybrid approach (quasi-recurrent neural networks, QRNN) as discussed by Bradbury et al (2016), and also illustrated on their figure below. There also other approaches, like using attention alone, as in Transformer network described by Vaswani et al (‎2017), where the information about time is passed via Fourier series features. With RNN, you would use a cell that takes as input previous hidden state and current input value, to return output and another hidden state, so the information flows via the hidden states. With CNN, you would use sliding window of some width, that would look of certain (learned) patterns in the data, and stack such windows on top of each other, so that higher-level windows would look for patterns within the lower-level patterns. Using such sliding windows may be helpful for finding things such as repeating patterns within the data (e.g. seasonal patterns). QRNN layers mix both approaches. In fact, one of the advantages of CNN and QRNN architectures is that they are faster then RNN.
Is it a good idea to use CNN to classify 1D signal?
I guess that by 1D signal you mean time-series data, where you assume temporal dependence between the values. In such cases convolutional neural networks (CNN) are one of the possible approaches. The
Is it a good idea to use CNN to classify 1D signal? I guess that by 1D signal you mean time-series data, where you assume temporal dependence between the values. In such cases convolutional neural networks (CNN) are one of the possible approaches. The most popular neural network approach to such data is to use recurrent neural networks (RNN), but you can alternatively use CNNs, or hybrid approach (quasi-recurrent neural networks, QRNN) as discussed by Bradbury et al (2016), and also illustrated on their figure below. There also other approaches, like using attention alone, as in Transformer network described by Vaswani et al (‎2017), where the information about time is passed via Fourier series features. With RNN, you would use a cell that takes as input previous hidden state and current input value, to return output and another hidden state, so the information flows via the hidden states. With CNN, you would use sliding window of some width, that would look of certain (learned) patterns in the data, and stack such windows on top of each other, so that higher-level windows would look for patterns within the lower-level patterns. Using such sliding windows may be helpful for finding things such as repeating patterns within the data (e.g. seasonal patterns). QRNN layers mix both approaches. In fact, one of the advantages of CNN and QRNN architectures is that they are faster then RNN.
Is it a good idea to use CNN to classify 1D signal? I guess that by 1D signal you mean time-series data, where you assume temporal dependence between the values. In such cases convolutional neural networks (CNN) are one of the possible approaches. The
10,607
Is it a good idea to use CNN to classify 1D signal?
You can certainly use a CNN to classify a 1D signal. Since you are interested in sleep stage classification see this paper. Its a deep neural network called the DeepSleepNet, and uses a combination of 1D convolutional and LSTM layers to classify EEG signals into sleep stages. Here is the architecture: There are two parts to the network: Representational learning layers: This consists of two convolutional networks in parallel. The main difference between the two networks is the kernel size and max-pooling window size. The left one uses kernel size = $F_s/2$ (where $F_s$ is the sampling rate of the signal) whereas the one the right uses kernel size = $F_s \times 4$. The intuition behind this is that one network tries to learn "fine" (or high frequency) features, and the other tries to learn "coarse" (or low frequency) features. Sequential learning layers: The embeddings (or learnt features) from the convolutional layers are concatenated and fed into the LSTM layers to learn temporal dependencies between the embeddings. At the end there is a 5-way softmax layer to classify the time series into one-of-five classes corresponding to sleep stages.
Is it a good idea to use CNN to classify 1D signal?
You can certainly use a CNN to classify a 1D signal. Since you are interested in sleep stage classification see this paper. Its a deep neural network called the DeepSleepNet, and uses a combination of
Is it a good idea to use CNN to classify 1D signal? You can certainly use a CNN to classify a 1D signal. Since you are interested in sleep stage classification see this paper. Its a deep neural network called the DeepSleepNet, and uses a combination of 1D convolutional and LSTM layers to classify EEG signals into sleep stages. Here is the architecture: There are two parts to the network: Representational learning layers: This consists of two convolutional networks in parallel. The main difference between the two networks is the kernel size and max-pooling window size. The left one uses kernel size = $F_s/2$ (where $F_s$ is the sampling rate of the signal) whereas the one the right uses kernel size = $F_s \times 4$. The intuition behind this is that one network tries to learn "fine" (or high frequency) features, and the other tries to learn "coarse" (or low frequency) features. Sequential learning layers: The embeddings (or learnt features) from the convolutional layers are concatenated and fed into the LSTM layers to learn temporal dependencies between the embeddings. At the end there is a 5-way softmax layer to classify the time series into one-of-five classes corresponding to sleep stages.
Is it a good idea to use CNN to classify 1D signal? You can certainly use a CNN to classify a 1D signal. Since you are interested in sleep stage classification see this paper. Its a deep neural network called the DeepSleepNet, and uses a combination of
10,608
Is it a good idea to use CNN to classify 1D signal?
FWIW, I'll recommend checking out the Temporal Convolutional Network from this paper (I am not the author). They have a neat idea for using CNN for time-series data, is sensitive to time order and can model arbitrarily long sequences (but doesn't have a memory).
Is it a good idea to use CNN to classify 1D signal?
FWIW, I'll recommend checking out the Temporal Convolutional Network from this paper (I am not the author). They have a neat idea for using CNN for time-series data, is sensitive to time order and can
Is it a good idea to use CNN to classify 1D signal? FWIW, I'll recommend checking out the Temporal Convolutional Network from this paper (I am not the author). They have a neat idea for using CNN for time-series data, is sensitive to time order and can model arbitrarily long sequences (but doesn't have a memory).
Is it a good idea to use CNN to classify 1D signal? FWIW, I'll recommend checking out the Temporal Convolutional Network from this paper (I am not the author). They have a neat idea for using CNN for time-series data, is sensitive to time order and can
10,609
Is it a good idea to use CNN to classify 1D signal?
I want to emphasis the use of a stacked hybrid approach (CNN + RNN) for processing long sequences: As you may know, 1D CNNs are not sensitive to the order of timesteps (not further than a local scale); of course, by stacking lots of convolution and pooling layers on top of each other, the final layers are able to observe longer sub-sequences of the original input. However, that might not be an effective approach to model long-term dependencies. Although, CNNs are very fast compared to RNNs. On the other hand, RNNs are sensitive to the order of timesteps and therefore can model the temporal dependencies very well. However, they are known to be weak at modeling very long-term dependencies, where a timestep may have a temporal dependency with the timesteps very far back in the input. Further, they are very slow when the number of timesteps is high. So, an effective approach might be to combine CNNs and RNNs in this way: first we use convolution and pooling layers to reduce the dimensionality of the input. This would give us a rather compressed representation of the original input with higher-level features. Then we can feed this shorter 1D sequence to the RNNs for further processing. So we are taking advantage of the speed of the CNNs as well as the representational capabilities of RNNs at the same time. Although, like any other method, you should experiment with this on your specific use case and dataset to find out whether it's effective or not. Here is a rough illustration of this method: -------------------------- - - - long 1D sequence - - - -------------------------- | | v ========================== = = = Conv + Pooling layers = = = ========================== | | v --------------------------- - - - Shorter representations - - (higher-level - - CNN features) - - - --------------------------- | | v =========================== = = = (stack of) RNN layers = = = =========================== | | v =============================== = = = classifier, regressor, etc. = = = ===============================
Is it a good idea to use CNN to classify 1D signal?
I want to emphasis the use of a stacked hybrid approach (CNN + RNN) for processing long sequences: As you may know, 1D CNNs are not sensitive to the order of timesteps (not further than a local scale
Is it a good idea to use CNN to classify 1D signal? I want to emphasis the use of a stacked hybrid approach (CNN + RNN) for processing long sequences: As you may know, 1D CNNs are not sensitive to the order of timesteps (not further than a local scale); of course, by stacking lots of convolution and pooling layers on top of each other, the final layers are able to observe longer sub-sequences of the original input. However, that might not be an effective approach to model long-term dependencies. Although, CNNs are very fast compared to RNNs. On the other hand, RNNs are sensitive to the order of timesteps and therefore can model the temporal dependencies very well. However, they are known to be weak at modeling very long-term dependencies, where a timestep may have a temporal dependency with the timesteps very far back in the input. Further, they are very slow when the number of timesteps is high. So, an effective approach might be to combine CNNs and RNNs in this way: first we use convolution and pooling layers to reduce the dimensionality of the input. This would give us a rather compressed representation of the original input with higher-level features. Then we can feed this shorter 1D sequence to the RNNs for further processing. So we are taking advantage of the speed of the CNNs as well as the representational capabilities of RNNs at the same time. Although, like any other method, you should experiment with this on your specific use case and dataset to find out whether it's effective or not. Here is a rough illustration of this method: -------------------------- - - - long 1D sequence - - - -------------------------- | | v ========================== = = = Conv + Pooling layers = = = ========================== | | v --------------------------- - - - Shorter representations - - (higher-level - - CNN features) - - - --------------------------- | | v =========================== = = = (stack of) RNN layers = = = =========================== | | v =============================== = = = classifier, regressor, etc. = = = ===============================
Is it a good idea to use CNN to classify 1D signal? I want to emphasis the use of a stacked hybrid approach (CNN + RNN) for processing long sequences: As you may know, 1D CNNs are not sensitive to the order of timesteps (not further than a local scale
10,610
How to explain dropout regularization in simple terms?
The abstract of the dropout article seems perfectly serviceable. Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, Ruslan Salakhutdinov, "Dropout: A Simple Way to Prevent Neural Networks from Overfitting", Journal of Machine Learning Research, 2014. Deep neural nets with a large number of parameters are very powerful machine learning systems. However, overfitting is a serious problem in such networks. Large networks are also slow to use, making it difficult to deal with overfitting by combining the predictions of many different large neural nets at test time. Dropout is a technique for addressing this problem. The key idea is to randomly drop units (along with their connections) from the neural network during training. This prevents units from co-adapting too much. During training, dropout samples from an exponential number of different “thinned” networks. At test time, it is easy to approximate the effect of averaging the predictions of all these thinned networks by simply using a single unthinned network that has smaller weights. This significantly reduces overfitting and gives major improvements over other regularization methods. We show that dropout improves the performance of neural networks on supervised learning tasks in vision, speech recognition, document classification and computational biology, obtaining state-of-the-art results on many benchmark data sets. If you read the paper, you'll find a description of what co-adapting behavior means in the context of drop-out. In a standard neural network, the derivative received by each parameter tells it how it should change so the final loss function is reduced, given what all other units are doing. Therefore, units may change in a way that they fix up the mistakes of the other units. This may lead to complex co-adaptations. This in turn leads to overfitting because these co-adaptations do not generalize to unseen data. We hypothesize that for each hidden unit, dropout prevents co-adaptation by making the presence of other hidden units unreliable. Therefore, a hidden unit cannot rely on other specific units to correct its mistakes. It must perform well in a wide variety of different contexts provided by the other hidden units. To observe this effect directly, we look at the first level features learned by neural networks trained on visual tasks with and without dropout.
How to explain dropout regularization in simple terms?
The abstract of the dropout article seems perfectly serviceable. Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, Ruslan Salakhutdinov, "Dropout: A Simple Way to Prevent Neural Net
How to explain dropout regularization in simple terms? The abstract of the dropout article seems perfectly serviceable. Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, Ruslan Salakhutdinov, "Dropout: A Simple Way to Prevent Neural Networks from Overfitting", Journal of Machine Learning Research, 2014. Deep neural nets with a large number of parameters are very powerful machine learning systems. However, overfitting is a serious problem in such networks. Large networks are also slow to use, making it difficult to deal with overfitting by combining the predictions of many different large neural nets at test time. Dropout is a technique for addressing this problem. The key idea is to randomly drop units (along with their connections) from the neural network during training. This prevents units from co-adapting too much. During training, dropout samples from an exponential number of different “thinned” networks. At test time, it is easy to approximate the effect of averaging the predictions of all these thinned networks by simply using a single unthinned network that has smaller weights. This significantly reduces overfitting and gives major improvements over other regularization methods. We show that dropout improves the performance of neural networks on supervised learning tasks in vision, speech recognition, document classification and computational biology, obtaining state-of-the-art results on many benchmark data sets. If you read the paper, you'll find a description of what co-adapting behavior means in the context of drop-out. In a standard neural network, the derivative received by each parameter tells it how it should change so the final loss function is reduced, given what all other units are doing. Therefore, units may change in a way that they fix up the mistakes of the other units. This may lead to complex co-adaptations. This in turn leads to overfitting because these co-adaptations do not generalize to unseen data. We hypothesize that for each hidden unit, dropout prevents co-adaptation by making the presence of other hidden units unreliable. Therefore, a hidden unit cannot rely on other specific units to correct its mistakes. It must perform well in a wide variety of different contexts provided by the other hidden units. To observe this effect directly, we look at the first level features learned by neural networks trained on visual tasks with and without dropout.
How to explain dropout regularization in simple terms? The abstract of the dropout article seems perfectly serviceable. Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, Ruslan Salakhutdinov, "Dropout: A Simple Way to Prevent Neural Net
10,611
How to explain dropout regularization in simple terms?
This answer is a follow-up to Sycorax' great answer, for readers who would like to see how dropout is implemented. When applying dropout in artificial neural networks, one needs to compensate for the fact that at training time a portion of the neurons were deactivated. To do so, there exist two common strategies: Inverting the dropout during the training phase: Scaling the activation at test time: The /p is moved from the training to the predicting code, where it becomes *p: These three slides came from lecture 6 from Standford CS231n: Convolutional Neural Networks for Visual Recognition.
How to explain dropout regularization in simple terms?
This answer is a follow-up to Sycorax' great answer, for readers who would like to see how dropout is implemented. When applying dropout in artificial neural networks, one needs to compensate for the
How to explain dropout regularization in simple terms? This answer is a follow-up to Sycorax' great answer, for readers who would like to see how dropout is implemented. When applying dropout in artificial neural networks, one needs to compensate for the fact that at training time a portion of the neurons were deactivated. To do so, there exist two common strategies: Inverting the dropout during the training phase: Scaling the activation at test time: The /p is moved from the training to the predicting code, where it becomes *p: These three slides came from lecture 6 from Standford CS231n: Convolutional Neural Networks for Visual Recognition.
How to explain dropout regularization in simple terms? This answer is a follow-up to Sycorax' great answer, for readers who would like to see how dropout is implemented. When applying dropout in artificial neural networks, one needs to compensate for the
10,612
How to explain dropout regularization in simple terms?
Dropout momentarily (in a batch of input data) switches off some neurons in a layer so that they do not contribute any information or learn any information during those updates, and the onus falls on other active neurons to learn harder and reduce the error. If I have to explain drop-out to a 6-year-old, this is how: Imagine a scenario, in a classroom, a teacher asks some questions but always same two kids are answering, immediately. Now, the teacher asks them to stay quiet for some time and let other pupils participate. This way other students get to learn better. Maybe they answer wrong, but the teacher can correct them(weight updates). This way the whole class(layer) learn about a topic better.
How to explain dropout regularization in simple terms?
Dropout momentarily (in a batch of input data) switches off some neurons in a layer so that they do not contribute any information or learn any information during those updates, and the onus falls on
How to explain dropout regularization in simple terms? Dropout momentarily (in a batch of input data) switches off some neurons in a layer so that they do not contribute any information or learn any information during those updates, and the onus falls on other active neurons to learn harder and reduce the error. If I have to explain drop-out to a 6-year-old, this is how: Imagine a scenario, in a classroom, a teacher asks some questions but always same two kids are answering, immediately. Now, the teacher asks them to stay quiet for some time and let other pupils participate. This way other students get to learn better. Maybe they answer wrong, but the teacher can correct them(weight updates). This way the whole class(layer) learn about a topic better.
How to explain dropout regularization in simple terms? Dropout momentarily (in a batch of input data) switches off some neurons in a layer so that they do not contribute any information or learn any information during those updates, and the onus falls on
10,613
How to explain dropout regularization in simple terms?
You can look at drop-out as a prior probability on whether a feature (or latent feature in some intermediate layer) does not matter - i.e. a spike (point mass at zero = feature does not matter) and slab (flat = non-reglarized prior across the whole parameter space) prior. Importantly, this allows you to not just regularize model fitting, but also to obtain uncertainty about inference. This is discussed in the dissertation and papers (also this) of Yarin Gal.
How to explain dropout regularization in simple terms?
You can look at drop-out as a prior probability on whether a feature (or latent feature in some intermediate layer) does not matter - i.e. a spike (point mass at zero = feature does not matter) and sl
How to explain dropout regularization in simple terms? You can look at drop-out as a prior probability on whether a feature (or latent feature in some intermediate layer) does not matter - i.e. a spike (point mass at zero = feature does not matter) and slab (flat = non-reglarized prior across the whole parameter space) prior. Importantly, this allows you to not just regularize model fitting, but also to obtain uncertainty about inference. This is discussed in the dissertation and papers (also this) of Yarin Gal.
How to explain dropout regularization in simple terms? You can look at drop-out as a prior probability on whether a feature (or latent feature in some intermediate layer) does not matter - i.e. a spike (point mass at zero = feature does not matter) and sl
10,614
Why do we say the outcome variable "is regressed on" the predictor(s)?
I do not know what the etymology of "is regressed on" is but here is the interpretation that I have in mind when I am saying or hearing this expression. Consider the following figure from The Elements of Statistical Learning by Hastie et al.: In its core, linear regression amounts to orthogonal projection of $\mathbf y$ on (onto) $\mathbf X$, where $\mathbf y$ is the $n$-dimensional vector of observations of the dependent variable and $\mathbf X$ is the subspace spanned by the predictor vectors. This is a very useful interpretation of linear regression. Since $y$ is being projected on $X$, that is what I think when I hear that $y$ is "regressed on" $X$. From this point of view, it would make less sense to say that $X$ is regressed on $y$ or that $y$ is regressed "against" or "with" $X$. Ideally I'm hoping that a proper explanation of why this terminology exists will help students remember it, and stop them from saying it the wrong way around. As I said, I doubt that this is an explanation of why this terminology exists (perhaps only of why it persists?), but I am sure it can help students remember it.
Why do we say the outcome variable "is regressed on" the predictor(s)?
I do not know what the etymology of "is regressed on" is but here is the interpretation that I have in mind when I am saying or hearing this expression. Consider the following figure from The Elements
Why do we say the outcome variable "is regressed on" the predictor(s)? I do not know what the etymology of "is regressed on" is but here is the interpretation that I have in mind when I am saying or hearing this expression. Consider the following figure from The Elements of Statistical Learning by Hastie et al.: In its core, linear regression amounts to orthogonal projection of $\mathbf y$ on (onto) $\mathbf X$, where $\mathbf y$ is the $n$-dimensional vector of observations of the dependent variable and $\mathbf X$ is the subspace spanned by the predictor vectors. This is a very useful interpretation of linear regression. Since $y$ is being projected on $X$, that is what I think when I hear that $y$ is "regressed on" $X$. From this point of view, it would make less sense to say that $X$ is regressed on $y$ or that $y$ is regressed "against" or "with" $X$. Ideally I'm hoping that a proper explanation of why this terminology exists will help students remember it, and stop them from saying it the wrong way around. As I said, I doubt that this is an explanation of why this terminology exists (perhaps only of why it persists?), but I am sure it can help students remember it.
Why do we say the outcome variable "is regressed on" the predictor(s)? I do not know what the etymology of "is regressed on" is but here is the interpretation that I have in mind when I am saying or hearing this expression. Consider the following figure from The Elements
10,615
Why do we say the outcome variable "is regressed on" the predictor(s)?
I've often used and heard this way of speaking. I'd guess that the sequence mentioning the outcome or response before the predictors follows from conventions in writing, using words or using notation or mixing the two, all the way up to $Y = X\beta$ setting aside the equally interesting (or uninteresting!) question of what we call different kinds of variables. But it seems equally valid mathematically and statistically to mention the predictors first, just as many mathematicians write mappings or functions with arguments first. What often perhaps drives the sequence we use in statistical discussions is that scientifically or practically we usually have a clear idea of what we are trying to predict -- it is mortality, or income, or wheat yield, or votes in an election, or whatever -- while the pool of potential or actual predictors may not be so clear. Even if it is clear, it makes sense to mention the important things first. What are you trying to do? Predict whatever. How are you going to do it? Use some or all of these variables. I don't have a story for "on" rather than any other word that would fit. I don't hear "regressed against" or "regressed with". There may be no logic here, just memes passed on along in textbooks, teaching and discussions. In general, watch out. Consider a related issue, the meaning of "versus". I was brought up to say "plot $y$ [vertical axis variable] against (or versus) $x$ [horizontal axis variable]" and the reverse sounds singularly odd to me. Nevertheless people with considerable experience and expertise have it the other way round. Sometimes, this kind of difference might be traced to charismatic and idiosyncratic teachers who you have imitated ever since you sat at their feet.
Why do we say the outcome variable "is regressed on" the predictor(s)?
I've often used and heard this way of speaking. I'd guess that the sequence mentioning the outcome or response before the predictors follows from conventions in writing, using words or using notation
Why do we say the outcome variable "is regressed on" the predictor(s)? I've often used and heard this way of speaking. I'd guess that the sequence mentioning the outcome or response before the predictors follows from conventions in writing, using words or using notation or mixing the two, all the way up to $Y = X\beta$ setting aside the equally interesting (or uninteresting!) question of what we call different kinds of variables. But it seems equally valid mathematically and statistically to mention the predictors first, just as many mathematicians write mappings or functions with arguments first. What often perhaps drives the sequence we use in statistical discussions is that scientifically or practically we usually have a clear idea of what we are trying to predict -- it is mortality, or income, or wheat yield, or votes in an election, or whatever -- while the pool of potential or actual predictors may not be so clear. Even if it is clear, it makes sense to mention the important things first. What are you trying to do? Predict whatever. How are you going to do it? Use some or all of these variables. I don't have a story for "on" rather than any other word that would fit. I don't hear "regressed against" or "regressed with". There may be no logic here, just memes passed on along in textbooks, teaching and discussions. In general, watch out. Consider a related issue, the meaning of "versus". I was brought up to say "plot $y$ [vertical axis variable] against (or versus) $x$ [horizontal axis variable]" and the reverse sounds singularly odd to me. Nevertheless people with considerable experience and expertise have it the other way round. Sometimes, this kind of difference might be traced to charismatic and idiosyncratic teachers who you have imitated ever since you sat at their feet.
Why do we say the outcome variable "is regressed on" the predictor(s)? I've often used and heard this way of speaking. I'd guess that the sequence mentioning the outcome or response before the predictors follows from conventions in writing, using words or using notation
10,616
Why do we say the outcome variable "is regressed on" the predictor(s)?
1) The term regression comes from the fact that in the usual simple linear regression model: $y = \alpha + \beta x + \epsilon$ that unless the outcome, $y$, and predictor, $x$, variables are perfectly correlated, the fitted values, $\hat{y}$, are closer to the mean of the outcome, $\bar{y}$, (after standardization) than the predictor variable, $x$, is to its mean, $\bar{x}$ (after standardization). Thus the outcome exhibits regression toward the mean. $|\hat{y} - \bar{y}| / s_y < |x - \bar{x}| / s_x $ For example if we use the BOD data frame built into R then: fm <- lm(demand ~ Time, BOD) with(BOD, all( abs(fitted(fm) - mean(demand)) / sd(demand) < abs(scale(Time)))) ## [1] TRUE For a a proof see: https://en.wikipedia.org/wiki/Regression_toward_the_mean 2) The term on comes from the fact that the fitted values are the projection of the outcome variable onto the subspace spanned by the predictor variables (including the intercept) as further explained in many sources such as http://people.eecs.ku.edu/~jhuan/EECS940_S12/slides/linearRegression.pdf . Note Regarding the comment below, what the commenter is stating is what the answer already states above in formula form except that the answer states it correctly. In fact, due to the equality: $(\hat{y} - \bar{y}) = \hat{\beta} (x - \bar{x}) $ the dependent variable is not necessarily on average closer to its mean than the predictor is to its mean unless $| \beta | < 1$ . What is true is that the dependent variable is on average fewer standard deviations from its mean than the predictor is to its as stated in the formula in the answer. Using Galton's data to which the comment refers (which is available in the UsingR package in R) we run the regression and in fact the slope is 0.646 so the average child was closer to its mean than its parent was to its mean but that is not the general case. library(UsingR) fm2 <- lm(child ~ parent, galton) coef(fm2)[[2]] # slope ## [1] 0.646 The BOD example in (1) above is one where the dependent variable is not closer to its mean unless one measures closeness in standard deviations as the slope > 1. coef(fm)[[2]] # slope ## [1] 1.7214 with(BOD, all( abs(fitted(fm) - mean(demand)) < abs(Time - mean(Time)))) ## [1] FALSE
Why do we say the outcome variable "is regressed on" the predictor(s)?
1) The term regression comes from the fact that in the usual simple linear regression model: $y = \alpha + \beta x + \epsilon$ that unless the outcome, $y$, and predictor, $x$, variables are perfectly
Why do we say the outcome variable "is regressed on" the predictor(s)? 1) The term regression comes from the fact that in the usual simple linear regression model: $y = \alpha + \beta x + \epsilon$ that unless the outcome, $y$, and predictor, $x$, variables are perfectly correlated, the fitted values, $\hat{y}$, are closer to the mean of the outcome, $\bar{y}$, (after standardization) than the predictor variable, $x$, is to its mean, $\bar{x}$ (after standardization). Thus the outcome exhibits regression toward the mean. $|\hat{y} - \bar{y}| / s_y < |x - \bar{x}| / s_x $ For example if we use the BOD data frame built into R then: fm <- lm(demand ~ Time, BOD) with(BOD, all( abs(fitted(fm) - mean(demand)) / sd(demand) < abs(scale(Time)))) ## [1] TRUE For a a proof see: https://en.wikipedia.org/wiki/Regression_toward_the_mean 2) The term on comes from the fact that the fitted values are the projection of the outcome variable onto the subspace spanned by the predictor variables (including the intercept) as further explained in many sources such as http://people.eecs.ku.edu/~jhuan/EECS940_S12/slides/linearRegression.pdf . Note Regarding the comment below, what the commenter is stating is what the answer already states above in formula form except that the answer states it correctly. In fact, due to the equality: $(\hat{y} - \bar{y}) = \hat{\beta} (x - \bar{x}) $ the dependent variable is not necessarily on average closer to its mean than the predictor is to its mean unless $| \beta | < 1$ . What is true is that the dependent variable is on average fewer standard deviations from its mean than the predictor is to its as stated in the formula in the answer. Using Galton's data to which the comment refers (which is available in the UsingR package in R) we run the regression and in fact the slope is 0.646 so the average child was closer to its mean than its parent was to its mean but that is not the general case. library(UsingR) fm2 <- lm(child ~ parent, galton) coef(fm2)[[2]] # slope ## [1] 0.646 The BOD example in (1) above is one where the dependent variable is not closer to its mean unless one measures closeness in standard deviations as the slope > 1. coef(fm)[[2]] # slope ## [1] 1.7214 with(BOD, all( abs(fitted(fm) - mean(demand)) < abs(Time - mean(Time)))) ## [1] FALSE
Why do we say the outcome variable "is regressed on" the predictor(s)? 1) The term regression comes from the fact that in the usual simple linear regression model: $y = \alpha + \beta x + \epsilon$ that unless the outcome, $y$, and predictor, $x$, variables are perfectly
10,617
Why do we say the outcome variable "is regressed on" the predictor(s)?
As the target predicted outcome y depends on the predictor x, you can say that "is regressed on" means "is dependent on". The word "regressed" is used instead of "dependent" because we want to emphasise that we are using a regression technique to represent this dependency between x and y. So, this sentence "y is regressed on x" is the short format of: Every predicted y shall "be dependent on" a value of x through a regression technique.
Why do we say the outcome variable "is regressed on" the predictor(s)?
As the target predicted outcome y depends on the predictor x, you can say that "is regressed on" means "is dependent on". The word "regressed" is used instead of "dependent" because we want to emphasi
Why do we say the outcome variable "is regressed on" the predictor(s)? As the target predicted outcome y depends on the predictor x, you can say that "is regressed on" means "is dependent on". The word "regressed" is used instead of "dependent" because we want to emphasise that we are using a regression technique to represent this dependency between x and y. So, this sentence "y is regressed on x" is the short format of: Every predicted y shall "be dependent on" a value of x through a regression technique.
Why do we say the outcome variable "is regressed on" the predictor(s)? As the target predicted outcome y depends on the predictor x, you can say that "is regressed on" means "is dependent on". The word "regressed" is used instead of "dependent" because we want to emphasi
10,618
Why do we say the outcome variable "is regressed on" the predictor(s)?
Personally, when it comes to explaining terminology, I find the definition of the term itself always helps, especially when explaining to students. The actual definition of the word regress is: "return to a former or less developed state". So one way to explain I guess would be the following: "Thinking of the outcome as the fully developed state, we try to explain the outcome by using less developed states, i.e. the independent variables. Thus the outcome is regressed on the predictors." Hope that helps.
Why do we say the outcome variable "is regressed on" the predictor(s)?
Personally, when it comes to explaining terminology, I find the definition of the term itself always helps, especially when explaining to students. The actual definition of the word regress is: "retur
Why do we say the outcome variable "is regressed on" the predictor(s)? Personally, when it comes to explaining terminology, I find the definition of the term itself always helps, especially when explaining to students. The actual definition of the word regress is: "return to a former or less developed state". So one way to explain I guess would be the following: "Thinking of the outcome as the fully developed state, we try to explain the outcome by using less developed states, i.e. the independent variables. Thus the outcome is regressed on the predictors." Hope that helps.
Why do we say the outcome variable "is regressed on" the predictor(s)? Personally, when it comes to explaining terminology, I find the definition of the term itself always helps, especially when explaining to students. The actual definition of the word regress is: "retur
10,619
R-squared in quantile regression
Koenker and Machado$^{[1]}$ describe $R^1$, a local measure of goodness of fit at the particular ($\tau$) quantile. Let $V(\tau) = \min_{b}\sum \rho_\tau(y_i-x_i'b)$ Let $\hat{\beta}(\tau)$ and $\tilde{\beta}(\tau)$ be the coefficient estimates for the full model, and a restricted model, and let $\hat{V}$ and $\tilde{V}$ be the corresponding $V$ terms. They define the goodness of fit criterion $R^1(\tau) = 1-\frac{\hat{V}}{\tilde{V} }$. Koenker gives code for $V$ here, rho <- function(u,tau=.5)u*(tau - (u < 0)) V <- sum(rho(f$resid, f$tau)) So if we compute $V$ for a model with an intercept-only ($\tilde{V}$ - or V0 in the code snippet below) and then an unrestricted model ($\hat{V}$), we can calculate an R1 <- 1-Vhat/V0 that's - at least notionally - somewhat like the usual $R^2$. Edit: In your case, of course, the second argument, which would be put in where f$tau is in the call in the second line of code, will be whichever value of tau you used. The value in the first line merely sets the default. 'Explaining variance about the mean' is really not what you're doing with quantile regression, so you shouldn't expect to have a really equivalent measure. I don't think the concept of $R^2$ translates well to quantile regression. You can define various more-or-less analogous quantities, as here, but no matter what you choose, you won't have most of the properties real $R^2$ has in OLS regression. You need to be clear about what properties you need and what you don't -- in some cases it may be possible to have a measure that does what you want. -- $[1]$ Koenker, R and Machado, J (1999), Goodness of Fit and Related Inference Processes for Quantile Regression, Journal of the American Statistical Association, 94:448, 1296-1310
R-squared in quantile regression
Koenker and Machado$^{[1]}$ describe $R^1$, a local measure of goodness of fit at the particular ($\tau$) quantile. Let $V(\tau) = \min_{b}\sum \rho_\tau(y_i-x_i'b)$ Let $\hat{\beta}(\tau)$ and $\tild
R-squared in quantile regression Koenker and Machado$^{[1]}$ describe $R^1$, a local measure of goodness of fit at the particular ($\tau$) quantile. Let $V(\tau) = \min_{b}\sum \rho_\tau(y_i-x_i'b)$ Let $\hat{\beta}(\tau)$ and $\tilde{\beta}(\tau)$ be the coefficient estimates for the full model, and a restricted model, and let $\hat{V}$ and $\tilde{V}$ be the corresponding $V$ terms. They define the goodness of fit criterion $R^1(\tau) = 1-\frac{\hat{V}}{\tilde{V} }$. Koenker gives code for $V$ here, rho <- function(u,tau=.5)u*(tau - (u < 0)) V <- sum(rho(f$resid, f$tau)) So if we compute $V$ for a model with an intercept-only ($\tilde{V}$ - or V0 in the code snippet below) and then an unrestricted model ($\hat{V}$), we can calculate an R1 <- 1-Vhat/V0 that's - at least notionally - somewhat like the usual $R^2$. Edit: In your case, of course, the second argument, which would be put in where f$tau is in the call in the second line of code, will be whichever value of tau you used. The value in the first line merely sets the default. 'Explaining variance about the mean' is really not what you're doing with quantile regression, so you shouldn't expect to have a really equivalent measure. I don't think the concept of $R^2$ translates well to quantile regression. You can define various more-or-less analogous quantities, as here, but no matter what you choose, you won't have most of the properties real $R^2$ has in OLS regression. You need to be clear about what properties you need and what you don't -- in some cases it may be possible to have a measure that does what you want. -- $[1]$ Koenker, R and Machado, J (1999), Goodness of Fit and Related Inference Processes for Quantile Regression, Journal of the American Statistical Association, 94:448, 1296-1310
R-squared in quantile regression Koenker and Machado$^{[1]}$ describe $R^1$, a local measure of goodness of fit at the particular ($\tau$) quantile. Let $V(\tau) = \min_{b}\sum \rho_\tau(y_i-x_i'b)$ Let $\hat{\beta}(\tau)$ and $\tild
10,620
R-squared in quantile regression
The pseudo-$R^2$ measure suggested by Koenker and Machado (1999) in JASA measures goodness of fit by comparing the sum of weighted deviations for the model of interest with the same sum from a model in which only the intercept appears. It is calculated as $$R_1(\tau) = 1 - \frac{\sum_{y_i \ge \hat y_i} \tau \cdot \vert y_i-\hat y_i \vert +\sum_{y_i<\hat y_i} (1-\tau) \cdot \vert y_i-\hat y_i \vert}{\sum_{y_i \ge \bar y} \tau \cdot \vert y_i-\bar y \vert +\sum_{y_i<\bar y_i} (1-\tau) \cdot \vert y_i-\bar y \vert},$$ where $\hat y_i =\alpha_{\tau}+\beta_{\tau}x$ is the fitted $\tau$th quantile for observation $i$, and $\bar y=\beta_{\tau}$ is the fitted value from the intercept-only model. $R_1(\tau)$ should lie in $[0,1]$, where 1 would correspond to a perfect fit since the numerator which consists of the weighted sum of deviations would be zero. It a local measure of fit for QRM since it depends on $\tau$, unlike the global $R^2$ from OLS. That is arguably the source of the warnings about using it: if you model fits in the tail, there's not guarantee that it fits well anywhere else. This approach could also be used to compare nested models. Here's an example in R: library(quantreg) data(engel) fit0 <- rq(foodexp~1,tau=0.9,data=engel) fit1 <- rq(foodexp~income,tau=0.9,data=engel) rho <- function(u,tau=.5)u*(tau - (u < 0)) R1 <- 1 - fit1$rho/fit0$rho This could probably be accomplished more elegantly.
R-squared in quantile regression
The pseudo-$R^2$ measure suggested by Koenker and Machado (1999) in JASA measures goodness of fit by comparing the sum of weighted deviations for the model of interest with the same sum from a model i
R-squared in quantile regression The pseudo-$R^2$ measure suggested by Koenker and Machado (1999) in JASA measures goodness of fit by comparing the sum of weighted deviations for the model of interest with the same sum from a model in which only the intercept appears. It is calculated as $$R_1(\tau) = 1 - \frac{\sum_{y_i \ge \hat y_i} \tau \cdot \vert y_i-\hat y_i \vert +\sum_{y_i<\hat y_i} (1-\tau) \cdot \vert y_i-\hat y_i \vert}{\sum_{y_i \ge \bar y} \tau \cdot \vert y_i-\bar y \vert +\sum_{y_i<\bar y_i} (1-\tau) \cdot \vert y_i-\bar y \vert},$$ where $\hat y_i =\alpha_{\tau}+\beta_{\tau}x$ is the fitted $\tau$th quantile for observation $i$, and $\bar y=\beta_{\tau}$ is the fitted value from the intercept-only model. $R_1(\tau)$ should lie in $[0,1]$, where 1 would correspond to a perfect fit since the numerator which consists of the weighted sum of deviations would be zero. It a local measure of fit for QRM since it depends on $\tau$, unlike the global $R^2$ from OLS. That is arguably the source of the warnings about using it: if you model fits in the tail, there's not guarantee that it fits well anywhere else. This approach could also be used to compare nested models. Here's an example in R: library(quantreg) data(engel) fit0 <- rq(foodexp~1,tau=0.9,data=engel) fit1 <- rq(foodexp~income,tau=0.9,data=engel) rho <- function(u,tau=.5)u*(tau - (u < 0)) R1 <- 1 - fit1$rho/fit0$rho This could probably be accomplished more elegantly.
R-squared in quantile regression The pseudo-$R^2$ measure suggested by Koenker and Machado (1999) in JASA measures goodness of fit by comparing the sum of weighted deviations for the model of interest with the same sum from a model i
10,621
What is the difference between bagging and random forest if only one explanatory variable is used?
The fundamental difference is that in Random forests, only a subset of features are selected at random out of the total and the best split feature from the subset is used to split each node in a tree, unlike in bagging where all features are considered for splitting a node.
What is the difference between bagging and random forest if only one explanatory variable is used?
The fundamental difference is that in Random forests, only a subset of features are selected at random out of the total and the best split feature from the subset is used to split each node in a tree,
What is the difference between bagging and random forest if only one explanatory variable is used? The fundamental difference is that in Random forests, only a subset of features are selected at random out of the total and the best split feature from the subset is used to split each node in a tree, unlike in bagging where all features are considered for splitting a node.
What is the difference between bagging and random forest if only one explanatory variable is used? The fundamental difference is that in Random forests, only a subset of features are selected at random out of the total and the best split feature from the subset is used to split each node in a tree,
10,622
What is the difference between bagging and random forest if only one explanatory variable is used?
I would like to provide clarification, there is a disctinction between bagging and bagged trees. Bagging (bootstrap + aggregating) is using an ensemble of models where: each model uses a bootstrapped data set (bootstrap part of bagging) models' predictions are aggregated (aggregation part of bagging) This means that in bagging, you can use any model of your choice, not only trees. Further, bagged trees are bagged ensembles where each model is a tree. So, in a sense, each bagged tree is a bagged ensemble, but not each bagged ensemble is a bagged tree. Given this clarification, I think that user3303020's answer provides a good explanation.
What is the difference between bagging and random forest if only one explanatory variable is used?
I would like to provide clarification, there is a disctinction between bagging and bagged trees. Bagging (bootstrap + aggregating) is using an ensemble of models where: each model uses a bootstrapped
What is the difference between bagging and random forest if only one explanatory variable is used? I would like to provide clarification, there is a disctinction between bagging and bagged trees. Bagging (bootstrap + aggregating) is using an ensemble of models where: each model uses a bootstrapped data set (bootstrap part of bagging) models' predictions are aggregated (aggregation part of bagging) This means that in bagging, you can use any model of your choice, not only trees. Further, bagged trees are bagged ensembles where each model is a tree. So, in a sense, each bagged tree is a bagged ensemble, but not each bagged ensemble is a bagged tree. Given this clarification, I think that user3303020's answer provides a good explanation.
What is the difference between bagging and random forest if only one explanatory variable is used? I would like to provide clarification, there is a disctinction between bagging and bagged trees. Bagging (bootstrap + aggregating) is using an ensemble of models where: each model uses a bootstrapped
10,623
What is the difference between bagging and random forest if only one explanatory variable is used?
Bagging in general is an acronym like work that is a portmanteau of Bootstrap and aggregation. In general if you take a bunch of bootstrapped samples of your original dataset, fit models $M_1, M_2, \dots, M_b$ and then average all $b$ model predictions this is bootstrap aggregation i.e. Bagging. This is done as a step within the Random forest model algorithm. Random forest creates bootstrap samples and across observations and for each fitted decision tree a random subsample of the covariates/features/columns are used in the fitting process. The selection of each covariate is done with uniform probability in the original bootstrap paper. So if you had 100 covariates you would select a subset of these features each have selection probability 0.01. If you only had 1 covariate/feature you would select that feature with probability 1. How many of the covariates/features you sample out of all covariates in the data set is a tuning parameter of the algorithm. Thus this algorithm will not generally perform well in high-dimensional data.
What is the difference between bagging and random forest if only one explanatory variable is used?
Bagging in general is an acronym like work that is a portmanteau of Bootstrap and aggregation. In general if you take a bunch of bootstrapped samples of your original dataset, fit models $M_1, M_2, \d
What is the difference between bagging and random forest if only one explanatory variable is used? Bagging in general is an acronym like work that is a portmanteau of Bootstrap and aggregation. In general if you take a bunch of bootstrapped samples of your original dataset, fit models $M_1, M_2, \dots, M_b$ and then average all $b$ model predictions this is bootstrap aggregation i.e. Bagging. This is done as a step within the Random forest model algorithm. Random forest creates bootstrap samples and across observations and for each fitted decision tree a random subsample of the covariates/features/columns are used in the fitting process. The selection of each covariate is done with uniform probability in the original bootstrap paper. So if you had 100 covariates you would select a subset of these features each have selection probability 0.01. If you only had 1 covariate/feature you would select that feature with probability 1. How many of the covariates/features you sample out of all covariates in the data set is a tuning parameter of the algorithm. Thus this algorithm will not generally perform well in high-dimensional data.
What is the difference between bagging and random forest if only one explanatory variable is used? Bagging in general is an acronym like work that is a portmanteau of Bootstrap and aggregation. In general if you take a bunch of bootstrapped samples of your original dataset, fit models $M_1, M_2, \d
10,624
Comparing and contrasting, p-values, significance levels and type I error
The question looks simple, but your reflection around it shows that it is not that simple. Actually, p-values are a relatively late addition to the theory of statistics. Computing a p-value without a computer is very tedious; this is why the only way to perform a statistical test until recently was to use tables of statistical tests, as I explain in this blog post. Because those tables were computed for fixed $\alpha$ levels (typically 0.05, 0.01 and 0.001) you could only perform a test with those levels. Computers made those tables useless, but the logic of testing is still the same. You should: Formulate a null hypothesis. Formulate an alternative hypothesis. Decide a maximum type I error (the probability of falsely rejecting the null hypothesis) error you are ready to accept. Design a rejection region. The probability that the test statistic falls in the rejection region given that the null hypothesis is your level $\alpha$. As @MånsT explains, this should be no smaller than your acceptable type I error, and in many cases use asymptotic approximations. Carry out the random experiment, compute the test statistic and see whether it falls in the rejection region. In theory, there is a strict equivalence between the events "the statistic falls in the rejection region" and "the p-value is less than $\alpha$", which is why it is felt that you can report the p-value instead. In practice, it allows you to skip step 3. and evaluate the type I error after the test is done. To come back to your post, the statement of the null hypothesis is incorrect. The null hypothesis is that the probability of flipping a head is $1/2$ (the null hypothesis cannot pertain to the results of the random experiment). If you repeat the experiment again and again with a threshold p-value of 0.05, yes, you should have approximately 5% rejection. And if you set a p-value cut-off of 0.06, you should end up with roughly 6% rejection. More generally, for continuous tests, by definition of the p-value $p$ $$ Prob(p < x) = x, \, (0 < x < 1), $$ which is only approximately true for discrete tests. Here is some R code that I hope can clarify this a bit. The binomial test is relatively slow, so I do only 10,000 random experiments in which I flip 1000 coins. I perform a binomial test and collect the 10,000 p-values. set.seed(123) # Generate 10,000 random experiments of each 1000 coin flipping rexperiments <- rbinom(n=10000, size=1000, prob=0.5) all_p_values <- rep(NA, 10000) for (i in 1:10000) { all_p_values[i] <- binom.test(rexperiments[i], 1000)$p.value } # Plot the cumulative density of p-values. plot(ecdf(all_p_values)) # How many are less than 0.05? mean(all_p_values < 0.05) # [1] 0.0425 # How many are less than 0.06? mean(all_p_values < 0.06) # 0.0491 You can see that the proportions are not exact, because the sample size is not infinite and the test is discrete, but there is still an increase of roughly 1% between the two.
Comparing and contrasting, p-values, significance levels and type I error
The question looks simple, but your reflection around it shows that it is not that simple. Actually, p-values are a relatively late addition to the theory of statistics. Computing a p-value without a
Comparing and contrasting, p-values, significance levels and type I error The question looks simple, but your reflection around it shows that it is not that simple. Actually, p-values are a relatively late addition to the theory of statistics. Computing a p-value without a computer is very tedious; this is why the only way to perform a statistical test until recently was to use tables of statistical tests, as I explain in this blog post. Because those tables were computed for fixed $\alpha$ levels (typically 0.05, 0.01 and 0.001) you could only perform a test with those levels. Computers made those tables useless, but the logic of testing is still the same. You should: Formulate a null hypothesis. Formulate an alternative hypothesis. Decide a maximum type I error (the probability of falsely rejecting the null hypothesis) error you are ready to accept. Design a rejection region. The probability that the test statistic falls in the rejection region given that the null hypothesis is your level $\alpha$. As @MånsT explains, this should be no smaller than your acceptable type I error, and in many cases use asymptotic approximations. Carry out the random experiment, compute the test statistic and see whether it falls in the rejection region. In theory, there is a strict equivalence between the events "the statistic falls in the rejection region" and "the p-value is less than $\alpha$", which is why it is felt that you can report the p-value instead. In practice, it allows you to skip step 3. and evaluate the type I error after the test is done. To come back to your post, the statement of the null hypothesis is incorrect. The null hypothesis is that the probability of flipping a head is $1/2$ (the null hypothesis cannot pertain to the results of the random experiment). If you repeat the experiment again and again with a threshold p-value of 0.05, yes, you should have approximately 5% rejection. And if you set a p-value cut-off of 0.06, you should end up with roughly 6% rejection. More generally, for continuous tests, by definition of the p-value $p$ $$ Prob(p < x) = x, \, (0 < x < 1), $$ which is only approximately true for discrete tests. Here is some R code that I hope can clarify this a bit. The binomial test is relatively slow, so I do only 10,000 random experiments in which I flip 1000 coins. I perform a binomial test and collect the 10,000 p-values. set.seed(123) # Generate 10,000 random experiments of each 1000 coin flipping rexperiments <- rbinom(n=10000, size=1000, prob=0.5) all_p_values <- rep(NA, 10000) for (i in 1:10000) { all_p_values[i] <- binom.test(rexperiments[i], 1000)$p.value } # Plot the cumulative density of p-values. plot(ecdf(all_p_values)) # How many are less than 0.05? mean(all_p_values < 0.05) # [1] 0.0425 # How many are less than 0.06? mean(all_p_values < 0.06) # 0.0491 You can see that the proportions are not exact, because the sample size is not infinite and the test is discrete, but there is still an increase of roughly 1% between the two.
Comparing and contrasting, p-values, significance levels and type I error The question looks simple, but your reflection around it shows that it is not that simple. Actually, p-values are a relatively late addition to the theory of statistics. Computing a p-value without a
10,625
Comparing and contrasting, p-values, significance levels and type I error
You are getting good answers here from @MansT & @gui11aume (+1 to each). Let me see if I can get more explicitly at something in both of their answers. When working with discrete data, there are only certain p-values possible, and the problem is worse with fewer possibilities / smaller data sets. For example, imagine flipping a coin $n$ times. The probability of getting a particular number of heads, $k$, is: $$ p(k)=\frac{n!}{k!(n-k)!}p^k(1-p)^{n-k} $$ Let's say a researcher want's to test a given coin (which actually is fair) for fairness by flipping it 10 times and recording the number of heads. That is, the null hypothesis is true here. Our researcher sets $\alpha=.05$, by convention and because that's what's necessary for acceptance by the larger community. Now, ignoring the conventional alpha for a moment, let's consider the 2-tailed p-values (type I error rates) that are possible in this situation: number of heads: 0 1 2 3 4 5 6 7 8 9 10 individual probability: .001 .010 .044 .117 .205 .246 .205 .117 .044 .010 .001 type I error rate: .002 .021 .109 .344 .754 1 .754 .344 .109 .021 .002 What this demonstrates is that using $\alpha=.05$ will lead to a long-run 2-tailed type I error rate of $.021$. So this is clearly a case where $\alpha\ne\text{type I error}$, however, if $\alpha$ were set to one of the above values (instead of $.05$) then the significance level would equal the type I error rate. Despite that problem, the p-value does equal the type I error rate in this case. Note that there is no issue here with a mismatch between a discrete inferential statistic and a continuous reference distribution, because I used the exact binomial probabilities. Note further that situations like this have prompted the development of the mid p-value to help minimize the discrepancy between the p-value and the significance level. There can be cases where the calculated p-value does not equal the long-run type I error rate, in addition to the fact that the type I error rate doesn't necessarily equal the significance level. Consider a 2x2 contingency table with these observed counts: col1 col2 row1 2 4 row2 4 2 Now, how should I calculate the p-value for the independence of the rows and columns? There are many options (which I discuss here). I will start by calculating the $\chi^2$ statistic and comparing it to it's reference distribution; that yields $\chi^2_{1}=1.3, p=.248$. The $\chi^2$ reference distribution is continuous, though, and so only an approximation to how this particular (discrete) $\chi^2$ statistic will behave. We can use Fisher's exact test to determine the true type I error rate; then I get $p=.5671$. When the p-value is calculated this way, it does equal the type I error rate, although we still have the question of whether one of the possible p-values is exactly 5%. Let me admit that I cheated a little, if I had used Yates's correction for continuity, I would have gotten a better approximation of the true type I error rate, but it still wouldn't have been quite right ($.5637\ne .5671$). Thus, the issues here are that, with discrete data: your preferred significance level may not be one of the possible type I error rates, & using (conventional) approximations to continuous statistics will yield inaccurate calculated p-values. These problems are exacerbated the smaller your $N$. So far as I know, these problems don't exist with continuous data. (Although the question doesn't ask about solutions to these problems) there are there are things that mitigate these issues: larger $N$ means more possible values, making things more continuous-ish, there are often corrections (such as Yates's correction for continuity) that will bring calculated values closer to correct values, exact tests (if tractable, i.e., if $N$ is small enough) will yield correct p-values the mid p-value offers the possibility of getting your type I error rate closer to your chosen confidence level, you can explicitly use one of the type I error rates that exist (or note what it would be).
Comparing and contrasting, p-values, significance levels and type I error
You are getting good answers here from @MansT & @gui11aume (+1 to each). Let me see if I can get more explicitly at something in both of their answers. When working with discrete data, there are onl
Comparing and contrasting, p-values, significance levels and type I error You are getting good answers here from @MansT & @gui11aume (+1 to each). Let me see if I can get more explicitly at something in both of their answers. When working with discrete data, there are only certain p-values possible, and the problem is worse with fewer possibilities / smaller data sets. For example, imagine flipping a coin $n$ times. The probability of getting a particular number of heads, $k$, is: $$ p(k)=\frac{n!}{k!(n-k)!}p^k(1-p)^{n-k} $$ Let's say a researcher want's to test a given coin (which actually is fair) for fairness by flipping it 10 times and recording the number of heads. That is, the null hypothesis is true here. Our researcher sets $\alpha=.05$, by convention and because that's what's necessary for acceptance by the larger community. Now, ignoring the conventional alpha for a moment, let's consider the 2-tailed p-values (type I error rates) that are possible in this situation: number of heads: 0 1 2 3 4 5 6 7 8 9 10 individual probability: .001 .010 .044 .117 .205 .246 .205 .117 .044 .010 .001 type I error rate: .002 .021 .109 .344 .754 1 .754 .344 .109 .021 .002 What this demonstrates is that using $\alpha=.05$ will lead to a long-run 2-tailed type I error rate of $.021$. So this is clearly a case where $\alpha\ne\text{type I error}$, however, if $\alpha$ were set to one of the above values (instead of $.05$) then the significance level would equal the type I error rate. Despite that problem, the p-value does equal the type I error rate in this case. Note that there is no issue here with a mismatch between a discrete inferential statistic and a continuous reference distribution, because I used the exact binomial probabilities. Note further that situations like this have prompted the development of the mid p-value to help minimize the discrepancy between the p-value and the significance level. There can be cases where the calculated p-value does not equal the long-run type I error rate, in addition to the fact that the type I error rate doesn't necessarily equal the significance level. Consider a 2x2 contingency table with these observed counts: col1 col2 row1 2 4 row2 4 2 Now, how should I calculate the p-value for the independence of the rows and columns? There are many options (which I discuss here). I will start by calculating the $\chi^2$ statistic and comparing it to it's reference distribution; that yields $\chi^2_{1}=1.3, p=.248$. The $\chi^2$ reference distribution is continuous, though, and so only an approximation to how this particular (discrete) $\chi^2$ statistic will behave. We can use Fisher's exact test to determine the true type I error rate; then I get $p=.5671$. When the p-value is calculated this way, it does equal the type I error rate, although we still have the question of whether one of the possible p-values is exactly 5%. Let me admit that I cheated a little, if I had used Yates's correction for continuity, I would have gotten a better approximation of the true type I error rate, but it still wouldn't have been quite right ($.5637\ne .5671$). Thus, the issues here are that, with discrete data: your preferred significance level may not be one of the possible type I error rates, & using (conventional) approximations to continuous statistics will yield inaccurate calculated p-values. These problems are exacerbated the smaller your $N$. So far as I know, these problems don't exist with continuous data. (Although the question doesn't ask about solutions to these problems) there are there are things that mitigate these issues: larger $N$ means more possible values, making things more continuous-ish, there are often corrections (such as Yates's correction for continuity) that will bring calculated values closer to correct values, exact tests (if tractable, i.e., if $N$ is small enough) will yield correct p-values the mid p-value offers the possibility of getting your type I error rate closer to your chosen confidence level, you can explicitly use one of the type I error rates that exist (or note what it would be).
Comparing and contrasting, p-values, significance levels and type I error You are getting good answers here from @MansT & @gui11aume (+1 to each). Let me see if I can get more explicitly at something in both of their answers. When working with discrete data, there are onl
10,626
Comparing and contrasting, p-values, significance levels and type I error
The concepts are indeed intimately linked to each other. The significance level is the probability of a type I error, or rather, the presumed probability of such an event. ${\rm P}({\rm type~I~error})= \alpha$ can generally only be obtained when working with continuous distributions, so in classic test theory a test is said to have significance level $\alpha$ if ${\rm P}({\rm type~I~error})\leq \alpha$, meaning that the probability of a type I error is bounded by $\alpha$. However, tests that use approximations of one kind or another actually tend to have ${\rm P}({\rm type~I~error})\approx \alpha$, in which case the probability of a type I error can be larger than the nominal $\alpha$. The p-value is the lowest significance level at which the null hypothesis would be rejected. Thus it tells us "how significant" the result is.
Comparing and contrasting, p-values, significance levels and type I error
The concepts are indeed intimately linked to each other. The significance level is the probability of a type I error, or rather, the presumed probability of such an event. ${\rm P}({\rm type~I~error}
Comparing and contrasting, p-values, significance levels and type I error The concepts are indeed intimately linked to each other. The significance level is the probability of a type I error, or rather, the presumed probability of such an event. ${\rm P}({\rm type~I~error})= \alpha$ can generally only be obtained when working with continuous distributions, so in classic test theory a test is said to have significance level $\alpha$ if ${\rm P}({\rm type~I~error})\leq \alpha$, meaning that the probability of a type I error is bounded by $\alpha$. However, tests that use approximations of one kind or another actually tend to have ${\rm P}({\rm type~I~error})\approx \alpha$, in which case the probability of a type I error can be larger than the nominal $\alpha$. The p-value is the lowest significance level at which the null hypothesis would be rejected. Thus it tells us "how significant" the result is.
Comparing and contrasting, p-values, significance levels and type I error The concepts are indeed intimately linked to each other. The significance level is the probability of a type I error, or rather, the presumed probability of such an event. ${\rm P}({\rm type~I~error}
10,627
Comparing and contrasting, p-values, significance levels and type I error
Summary. Significance level is the approximately same as the probability of getting a Type I errors for discrete distributions. We will show below with basic probability and empirical validation. -- And they're probably exactly the same for continuous distribution, although I didn't do careful math proof for it. Theory Definitions H0 = Null hypothesis $\alpha$ = significance level. Warning: I'll use 'a' below as well. P-value (of a sample) = P(observe sample and its extremer versions | H0) The claim to verify is: P(Type I error if we use $\alpha$ as p-value threshold) = $\alpha$. Let's see if that is true. Derivation P(Type I error) = P(reject H0 | H0) = P(p-value < a| H0) Let's consider this final term. p-value | H0 is a random variable (let's call it X) whose... events are samples from H0. Let the sample be called $s$. value is P(s or its extremer versions | H0) (the definition of p-value), and... the associated probability of this event is P(s | H0) (the probability that you get this p-value associated with a sample is the probability that you get this sample) Let's go back to the derivation. P(Type I error) = P(reject H0 | H0) = P(p-value < a| H0) = P(X < a) = Sum_{s such that P(s or its extremer versions | H0) < a} P(s | H0) # Let's also focus on a binomial random variable B for H0. = Sum_{s such that P(B >= s) < a} P(B = s) = P(B >= s') where s' = the smallest s such that P(B >= s) < a = the s that makes P(B >= s) as close as possible to a ~ a Hooray! We showed that P(Type I error) ~ a, and it's an underestimate for a discrete distribution. Empirical validation Let's test it against @gui11aume's setup! We will do it in python, but with n = 100,000 instead. import numpy as np import scipy.stats as stats np.random.seed(100) n = 100000 rexperiments = np.random.binomial(1000, 0.5, n) all_p_values = np.empty(n) for i in range(n): all_p_values[i] = stats.binom_test(rexperiments[i], 1000, 0.5) print("Mean of all_p_values less than 0.05:", np.mean(all_p_values < 0.05)) # 0.04588 print("Mean of all_p_values less than 0.06:", np.mean(all_p_values < 0.06)) # 0.05321 $\alpha = 0.05$. s' = the smallest s such that P(B >= s) < a. S' = 527 according to wolframalpha. P(Type I error) = P(B >= 527) = ~0.047, v.s. the empirical 0.04588 $\alpha = 0.06$. P(Type I error) = P(B >= 526) ~ 0.053 v.s. the empirical 0.05321 Close enough!
Comparing and contrasting, p-values, significance levels and type I error
Summary. Significance level is the approximately same as the probability of getting a Type I errors for discrete distributions. We will show below with basic probability and empirical validation. -- A
Comparing and contrasting, p-values, significance levels and type I error Summary. Significance level is the approximately same as the probability of getting a Type I errors for discrete distributions. We will show below with basic probability and empirical validation. -- And they're probably exactly the same for continuous distribution, although I didn't do careful math proof for it. Theory Definitions H0 = Null hypothesis $\alpha$ = significance level. Warning: I'll use 'a' below as well. P-value (of a sample) = P(observe sample and its extremer versions | H0) The claim to verify is: P(Type I error if we use $\alpha$ as p-value threshold) = $\alpha$. Let's see if that is true. Derivation P(Type I error) = P(reject H0 | H0) = P(p-value < a| H0) Let's consider this final term. p-value | H0 is a random variable (let's call it X) whose... events are samples from H0. Let the sample be called $s$. value is P(s or its extremer versions | H0) (the definition of p-value), and... the associated probability of this event is P(s | H0) (the probability that you get this p-value associated with a sample is the probability that you get this sample) Let's go back to the derivation. P(Type I error) = P(reject H0 | H0) = P(p-value < a| H0) = P(X < a) = Sum_{s such that P(s or its extremer versions | H0) < a} P(s | H0) # Let's also focus on a binomial random variable B for H0. = Sum_{s such that P(B >= s) < a} P(B = s) = P(B >= s') where s' = the smallest s such that P(B >= s) < a = the s that makes P(B >= s) as close as possible to a ~ a Hooray! We showed that P(Type I error) ~ a, and it's an underestimate for a discrete distribution. Empirical validation Let's test it against @gui11aume's setup! We will do it in python, but with n = 100,000 instead. import numpy as np import scipy.stats as stats np.random.seed(100) n = 100000 rexperiments = np.random.binomial(1000, 0.5, n) all_p_values = np.empty(n) for i in range(n): all_p_values[i] = stats.binom_test(rexperiments[i], 1000, 0.5) print("Mean of all_p_values less than 0.05:", np.mean(all_p_values < 0.05)) # 0.04588 print("Mean of all_p_values less than 0.06:", np.mean(all_p_values < 0.06)) # 0.05321 $\alpha = 0.05$. s' = the smallest s such that P(B >= s) < a. S' = 527 according to wolframalpha. P(Type I error) = P(B >= 527) = ~0.047, v.s. the empirical 0.04588 $\alpha = 0.06$. P(Type I error) = P(B >= 526) ~ 0.053 v.s. the empirical 0.05321 Close enough!
Comparing and contrasting, p-values, significance levels and type I error Summary. Significance level is the approximately same as the probability of getting a Type I errors for discrete distributions. We will show below with basic probability and empirical validation. -- A
10,628
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
Asymptotic unbiasedness $\impliedby$ consistency + bounded variance Consider an estimator $\hat{\theta}_n$ for a parameter $\theta$. Asymptotic unbiasedness means that the bias of the estimator goes to zero as $n \rightarrow \infty$, which means that the expected value of the estimator converges to the true value of the parameter. Consistency is a stronger condition than this; it requires the estimator (not just its expected value) to converge to the true value of the parameter (with convergence interpreted in various ways). Since there is generally some non-zero variance in the estimator, it will not generally be equal to (or converge to) its expected value. Assuming the variance of the estimator is bounded, consistency ensures asymptotic unbiasedness (proof), but asymptotic unbiasedness is not enough to get consistency. To put it another way, under some mild conditions, asymptotic unbiasedness is a necessary but not sufficient condition for consistency. Asymptotic unbiasedness + vanishing variance $\implies$ consistency If you have an asymptotically unbiased estimator, and its variance converges to zero, this is sufficient to give weak consistency. (This follows from Markov's inequality, which ensures that convergence in mean-square implies convergence in probability). Intuitively, this reflects the fact that a vanishing variance means that the sequence of random variables is converging closer and closer to the expected value, and if the expected value converges to the true parameter (as it does under asymptotic unbiasedness) then the random variable is converging to the true parameter.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
Asymptotic unbiasedness $\impliedby$ consistency + bounded variance Consider an estimator $\hat{\theta}_n$ for a parameter $\theta$. Asymptotic unbiasedness means that the bias of the estimator goes
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] Asymptotic unbiasedness $\impliedby$ consistency + bounded variance Consider an estimator $\hat{\theta}_n$ for a parameter $\theta$. Asymptotic unbiasedness means that the bias of the estimator goes to zero as $n \rightarrow \infty$, which means that the expected value of the estimator converges to the true value of the parameter. Consistency is a stronger condition than this; it requires the estimator (not just its expected value) to converge to the true value of the parameter (with convergence interpreted in various ways). Since there is generally some non-zero variance in the estimator, it will not generally be equal to (or converge to) its expected value. Assuming the variance of the estimator is bounded, consistency ensures asymptotic unbiasedness (proof), but asymptotic unbiasedness is not enough to get consistency. To put it another way, under some mild conditions, asymptotic unbiasedness is a necessary but not sufficient condition for consistency. Asymptotic unbiasedness + vanishing variance $\implies$ consistency If you have an asymptotically unbiased estimator, and its variance converges to zero, this is sufficient to give weak consistency. (This follows from Markov's inequality, which ensures that convergence in mean-square implies convergence in probability). Intuitively, this reflects the fact that a vanishing variance means that the sequence of random variables is converging closer and closer to the expected value, and if the expected value converges to the true parameter (as it does under asymptotic unbiasedness) then the random variable is converging to the true parameter.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] Asymptotic unbiasedness $\impliedby$ consistency + bounded variance Consider an estimator $\hat{\theta}_n$ for a parameter $\theta$. Asymptotic unbiasedness means that the bias of the estimator goes
10,629
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
They are related ideas, but an asymptotically unbiased estimator doesn't have to be consistent. For example, imagine an i.i.d. sample of size $n$ ($X_1, X_2, ..., X_n$) from some distribution with mean $\mu$ and variance $\sigma^2$. As an estimator of $\mu$ consider $T = X_1 + 1/n$. (Edit: Note the $X_1$ there, not $\bar{X}$) The bias is $1/n$ so $T$ is asymptotically unbiased, but it is not consistent.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
They are related ideas, but an asymptotically unbiased estimator doesn't have to be consistent. For example, imagine an i.i.d. sample of size $n$ ($X_1, X_2, ..., X_n$) from some distribution with mea
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] They are related ideas, but an asymptotically unbiased estimator doesn't have to be consistent. For example, imagine an i.i.d. sample of size $n$ ($X_1, X_2, ..., X_n$) from some distribution with mean $\mu$ and variance $\sigma^2$. As an estimator of $\mu$ consider $T = X_1 + 1/n$. (Edit: Note the $X_1$ there, not $\bar{X}$) The bias is $1/n$ so $T$ is asymptotically unbiased, but it is not consistent.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] They are related ideas, but an asymptotically unbiased estimator doesn't have to be consistent. For example, imagine an i.i.d. sample of size $n$ ($X_1, X_2, ..., X_n$) from some distribution with mea
10,630
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
I would like to clarify that consistency in general does not imply asymptotic unbiasedness. Consider an estimator for $0$ taking value $0$ with probability $(n-1)/n$ and value $n$ with probability $1/n$. It is a biased estimator since the expected value is always equal to $1$ and the bias does not disappear even if $n\to\infty$. However, it is a consistent estimator since it converges to $0$ in probability as $n\to\infty$. Asymptotic unbiasedness does not imply consistency either as it is mentioned in other answers. For example, the periodogram is an asymptotically unbiased estimator of the spectral density, but it is not consistent. Roughly speaking, consistency means that for large values of $n$ we are going to be close to the true value of the parameter with a high probability, i.e. estimates are going to be close to the true value of the parameter. Asymptotic unbiasedness means that for large values of $n$ on average we are going to be close to the true value of the parameter, i.e. the average of estimates is going to be close to the true value of the parameter, but not necessarily the estimates themselves.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
I would like to clarify that consistency in general does not imply asymptotic unbiasedness. Consider an estimator for $0$ taking value $0$ with probability $(n-1)/n$ and value $n$ with probability $1/
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] I would like to clarify that consistency in general does not imply asymptotic unbiasedness. Consider an estimator for $0$ taking value $0$ with probability $(n-1)/n$ and value $n$ with probability $1/n$. It is a biased estimator since the expected value is always equal to $1$ and the bias does not disappear even if $n\to\infty$. However, it is a consistent estimator since it converges to $0$ in probability as $n\to\infty$. Asymptotic unbiasedness does not imply consistency either as it is mentioned in other answers. For example, the periodogram is an asymptotically unbiased estimator of the spectral density, but it is not consistent. Roughly speaking, consistency means that for large values of $n$ we are going to be close to the true value of the parameter with a high probability, i.e. estimates are going to be close to the true value of the parameter. Asymptotic unbiasedness means that for large values of $n$ on average we are going to be close to the true value of the parameter, i.e. the average of estimates is going to be close to the true value of the parameter, but not necessarily the estimates themselves.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] I would like to clarify that consistency in general does not imply asymptotic unbiasedness. Consider an estimator for $0$ taking value $0$ with probability $(n-1)/n$ and value $n$ with probability $1/
10,631
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
There are "unbiased but not consistent" estimators as well as "biased but consistent" estimators: https://en.wikipedia.org/wiki/Consistent_estimator#Unbiased_but_not_consistent So, they are not the same thing. Also, there is a long discussion about this topic here: What is the difference between a consistent estimator and an unbiased estimator?
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
There are "unbiased but not consistent" estimators as well as "biased but consistent" estimators: https://en.wikipedia.org/wiki/Consistent_estimator#Unbiased_but_not_consistent So, they are not the sa
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] There are "unbiased but not consistent" estimators as well as "biased but consistent" estimators: https://en.wikipedia.org/wiki/Consistent_estimator#Unbiased_but_not_consistent So, they are not the same thing. Also, there is a long discussion about this topic here: What is the difference between a consistent estimator and an unbiased estimator?
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] There are "unbiased but not consistent" estimators as well as "biased but consistent" estimators: https://en.wikipedia.org/wiki/Consistent_estimator#Unbiased_but_not_consistent So, they are not the sa
10,632
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
If the estimator is bounded then consistency implies asymptotic unbiasness by the dominated convergence theorem.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
If the estimator is bounded then consistency implies asymptotic unbiasness by the dominated convergence theorem.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] If the estimator is bounded then consistency implies asymptotic unbiasness by the dominated convergence theorem.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] If the estimator is bounded then consistency implies asymptotic unbiasness by the dominated convergence theorem.
10,633
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
Asymptotic unbiased: As $n \rightarrow \infty$, bias converges to $0$. Consistent: As $n \rightarrow \infty$, variance of the estimator converges to $0$.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate]
Asymptotic unbiased: As $n \rightarrow \infty$, bias converges to $0$. Consistent: As $n \rightarrow \infty$, variance of the estimator converges to $0$.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] Asymptotic unbiased: As $n \rightarrow \infty$, bias converges to $0$. Consistent: As $n \rightarrow \infty$, variance of the estimator converges to $0$.
Intuitive understanding of the difference between consistent and asymptotically unbiased [duplicate] Asymptotic unbiased: As $n \rightarrow \infty$, bias converges to $0$. Consistent: As $n \rightarrow \infty$, variance of the estimator converges to $0$.
10,634
When to use the Wilcoxon rank-sum test instead of the unpaired t-test?
Yes, there is. For example, any sampling from distributions with infinite variance will wreck the t-test, but not the Wilcoxon. Referring to Nonparametric Statistical Methods (Hollander and Wolfe), I see that the asymptotic relative efficiency (ARE) of the Wilcoxon relative to the t test is 1.0 for the Uniform distribution, 1.097 (i.e., Wilcoxon is better) for the Logistic, 1.5 for the double Exponential (Laplace), and 3.0 for the Exponential. Hodges and Lehmann showed that the minimum ARE of the Wilcoxon relative to any other test is 0.864, so you can never lose more than about 14% efficiency using it relative to anything else. (Of course, this is an asymptotic result.) Consequently, Frank Harrell's use of the Wilcoxon as a default should probably be adopted by almost everyone, including myself. Edit: Responding to the followup question in comments, for those who prefer confidence intervals, the Hodges-Lehmann estimator is the estimator that "corresponds" to the Wilcoxon test, and confidence intervals can be constructed around that.
When to use the Wilcoxon rank-sum test instead of the unpaired t-test?
Yes, there is. For example, any sampling from distributions with infinite variance will wreck the t-test, but not the Wilcoxon. Referring to Nonparametric Statistical Methods (Hollander and Wolfe),
When to use the Wilcoxon rank-sum test instead of the unpaired t-test? Yes, there is. For example, any sampling from distributions with infinite variance will wreck the t-test, but not the Wilcoxon. Referring to Nonparametric Statistical Methods (Hollander and Wolfe), I see that the asymptotic relative efficiency (ARE) of the Wilcoxon relative to the t test is 1.0 for the Uniform distribution, 1.097 (i.e., Wilcoxon is better) for the Logistic, 1.5 for the double Exponential (Laplace), and 3.0 for the Exponential. Hodges and Lehmann showed that the minimum ARE of the Wilcoxon relative to any other test is 0.864, so you can never lose more than about 14% efficiency using it relative to anything else. (Of course, this is an asymptotic result.) Consequently, Frank Harrell's use of the Wilcoxon as a default should probably be adopted by almost everyone, including myself. Edit: Responding to the followup question in comments, for those who prefer confidence intervals, the Hodges-Lehmann estimator is the estimator that "corresponds" to the Wilcoxon test, and confidence intervals can be constructed around that.
When to use the Wilcoxon rank-sum test instead of the unpaired t-test? Yes, there is. For example, any sampling from distributions with infinite variance will wreck the t-test, but not the Wilcoxon. Referring to Nonparametric Statistical Methods (Hollander and Wolfe),
10,635
When to use the Wilcoxon rank-sum test instead of the unpaired t-test?
Let me bring you back to our discussion in comments to this your question. Wilcoxon sum-rank test is equivalent to Mann-Whitney U test (and its direct extension for more-than-two samples is called Kruskal-Wallis test). You can see in Wikipedia as well as in this text that Mann-Whitney (or Kruskal-Wallis) generally compares not means or medians. It compares the overall prevalence of values: which of the samples is "stochastically greater". The test is distribution-free. T-test compares means. It assumes normal distribution. So, the tests engage in different hypotheses. In most cases, we don't plan to compare specifically the means, rather, we want to know which sample is greater by values, and it makes Mann-Whitney the default test for us. On the other hand, when both distributions are symmetric the task of testing whether one sample is "greater" than the other degenerates into the task of comparing the two means, and then, if the distributions are normal with equal variances t-test becomes somewhat more powerful.
When to use the Wilcoxon rank-sum test instead of the unpaired t-test?
Let me bring you back to our discussion in comments to this your question. Wilcoxon sum-rank test is equivalent to Mann-Whitney U test (and its direct extension for more-than-two samples is called Kru
When to use the Wilcoxon rank-sum test instead of the unpaired t-test? Let me bring you back to our discussion in comments to this your question. Wilcoxon sum-rank test is equivalent to Mann-Whitney U test (and its direct extension for more-than-two samples is called Kruskal-Wallis test). You can see in Wikipedia as well as in this text that Mann-Whitney (or Kruskal-Wallis) generally compares not means or medians. It compares the overall prevalence of values: which of the samples is "stochastically greater". The test is distribution-free. T-test compares means. It assumes normal distribution. So, the tests engage in different hypotheses. In most cases, we don't plan to compare specifically the means, rather, we want to know which sample is greater by values, and it makes Mann-Whitney the default test for us. On the other hand, when both distributions are symmetric the task of testing whether one sample is "greater" than the other degenerates into the task of comparing the two means, and then, if the distributions are normal with equal variances t-test becomes somewhat more powerful.
When to use the Wilcoxon rank-sum test instead of the unpaired t-test? Let me bring you back to our discussion in comments to this your question. Wilcoxon sum-rank test is equivalent to Mann-Whitney U test (and its direct extension for more-than-two samples is called Kru
10,636
Clustering quality measure
The choice of metric rather depends on what you consider the purpose of clustering to be. Personally I think clustering ought to be about identifying different groups of observations that were each generated by a different data generating process. So I would test the quality of a clustering by generating data from known data generating processes and then calculate how often patterns are misclassified by the clustering. Of course this involved making assumtions about the distribution of patterns from each generating process, but you can use datasets designed for supervised classification. Others view clustering as attempting to group together points with similar attribute values, in which case measures such as SSE etc are applicable. However I find this definition of clustering rather unsatisfactory, as it only tells you something about the particular sample of data, rather than something generalisable about the underlying distributions. How methods deal with overlapping clusters is a particular problem with this view (for the "data generating process" view it causes no real problem, you just get probabilities of cluster membership).
Clustering quality measure
The choice of metric rather depends on what you consider the purpose of clustering to be. Personally I think clustering ought to be about identifying different groups of observations that were each g
Clustering quality measure The choice of metric rather depends on what you consider the purpose of clustering to be. Personally I think clustering ought to be about identifying different groups of observations that were each generated by a different data generating process. So I would test the quality of a clustering by generating data from known data generating processes and then calculate how often patterns are misclassified by the clustering. Of course this involved making assumtions about the distribution of patterns from each generating process, but you can use datasets designed for supervised classification. Others view clustering as attempting to group together points with similar attribute values, in which case measures such as SSE etc are applicable. However I find this definition of clustering rather unsatisfactory, as it only tells you something about the particular sample of data, rather than something generalisable about the underlying distributions. How methods deal with overlapping clusters is a particular problem with this view (for the "data generating process" view it causes no real problem, you just get probabilities of cluster membership).
Clustering quality measure The choice of metric rather depends on what you consider the purpose of clustering to be. Personally I think clustering ought to be about identifying different groups of observations that were each g
10,637
Clustering quality measure
The Silhouette can be used to evaluate clustering results. It does so by comparing the average distance within a cluster with the average distance to the points in the nearest cluster.
Clustering quality measure
The Silhouette can be used to evaluate clustering results. It does so by comparing the average distance within a cluster with the average distance to the points in the nearest cluster.
Clustering quality measure The Silhouette can be used to evaluate clustering results. It does so by comparing the average distance within a cluster with the average distance to the points in the nearest cluster.
Clustering quality measure The Silhouette can be used to evaluate clustering results. It does so by comparing the average distance within a cluster with the average distance to the points in the nearest cluster.
10,638
Clustering quality measure
Since clustering is unsupervised, it's hard to know a priori what the best clustering is. This is research topic. Gary King, a well-known quantitative social scientist, has a forthcoming article on this topic.
Clustering quality measure
Since clustering is unsupervised, it's hard to know a priori what the best clustering is. This is research topic. Gary King, a well-known quantitative social scientist, has a forthcoming article on th
Clustering quality measure Since clustering is unsupervised, it's hard to know a priori what the best clustering is. This is research topic. Gary King, a well-known quantitative social scientist, has a forthcoming article on this topic.
Clustering quality measure Since clustering is unsupervised, it's hard to know a priori what the best clustering is. This is research topic. Gary King, a well-known quantitative social scientist, has a forthcoming article on th
10,639
Clustering quality measure
Here you have a couple of measures, but there are many more: SSE: sum of the square error from the items of each cluster. Inter cluster distance: sum of the square distance between each cluster centroid. Intra cluster distance for each cluster: sum of the square distance from the items of each cluster to its centroid. Maximum Radius: largest distance from an instance to its cluster centroid. Average Radius: sum of the largest distance from an instance to its cluster centroid divided by the number of clusters.
Clustering quality measure
Here you have a couple of measures, but there are many more: SSE: sum of the square error from the items of each cluster. Inter cluster distance: sum of the square distance between each cluster centro
Clustering quality measure Here you have a couple of measures, but there are many more: SSE: sum of the square error from the items of each cluster. Inter cluster distance: sum of the square distance between each cluster centroid. Intra cluster distance for each cluster: sum of the square distance from the items of each cluster to its centroid. Maximum Radius: largest distance from an instance to its cluster centroid. Average Radius: sum of the largest distance from an instance to its cluster centroid divided by the number of clusters.
Clustering quality measure Here you have a couple of measures, but there are many more: SSE: sum of the square error from the items of each cluster. Inter cluster distance: sum of the square distance between each cluster centro
10,640
Clustering quality measure
As others have pointed out, there are many measures of clustering "quality"; most programs minimize SSE. No single number can tell much about noise in the data, or noise in the method, or flat minima — low points in Saskatchewan. So first try to visualize, get a feel for, a given clustering, before reducing it to "41". Then make 3 runs: do you get SSEs 41, 39, 43 or 41, 28, 107 ? What are the cluster sizes and radii ? (Added:) Take a look at silhouette plots and silhouette scores, e.g. in the book by Izenman, Modern Multivariate Statistical Techniques (2008, 731p, isbn 0387781889).
Clustering quality measure
As others have pointed out, there are many measures of clustering "quality"; most programs minimize SSE. No single number can tell much about noise in the data, or noise in the method, or flat minima
Clustering quality measure As others have pointed out, there are many measures of clustering "quality"; most programs minimize SSE. No single number can tell much about noise in the data, or noise in the method, or flat minima — low points in Saskatchewan. So first try to visualize, get a feel for, a given clustering, before reducing it to "41". Then make 3 runs: do you get SSEs 41, 39, 43 or 41, 28, 107 ? What are the cluster sizes and radii ? (Added:) Take a look at silhouette plots and silhouette scores, e.g. in the book by Izenman, Modern Multivariate Statistical Techniques (2008, 731p, isbn 0387781889).
Clustering quality measure As others have pointed out, there are many measures of clustering "quality"; most programs minimize SSE. No single number can tell much about noise in the data, or noise in the method, or flat minima
10,641
Clustering quality measure
You ran into the Clustering Validation area. My student did validation using techniques described in: A. Banerjee and R. N. Dave. Validating clusters using the hopkins statistic. 2004 IEEE International Conference on Fuzzy Systems IEEE Cat No04CH37542, 1:p. 149–153, 2004. It is based on the principle, that if a cluster is valid then data points are uniformly distributed within a cluster. But before that you should determine if your data has any so called Clustering Tendency i.e. if it is worth clustering and optimum number of clusters: S. Saitta, B. Raphael, and I. F. C. Smith. A comprehensive validity index for clustering. Intell. Data Anal., 12(6):p. 529–548, 2008.
Clustering quality measure
You ran into the Clustering Validation area. My student did validation using techniques described in: A. Banerjee and R. N. Dave. Validating clusters using the hopkins statistic. 2004 IEEE Internation
Clustering quality measure You ran into the Clustering Validation area. My student did validation using techniques described in: A. Banerjee and R. N. Dave. Validating clusters using the hopkins statistic. 2004 IEEE International Conference on Fuzzy Systems IEEE Cat No04CH37542, 1:p. 149–153, 2004. It is based on the principle, that if a cluster is valid then data points are uniformly distributed within a cluster. But before that you should determine if your data has any so called Clustering Tendency i.e. if it is worth clustering and optimum number of clusters: S. Saitta, B. Raphael, and I. F. C. Smith. A comprehensive validity index for clustering. Intell. Data Anal., 12(6):p. 529–548, 2008.
Clustering quality measure You ran into the Clustering Validation area. My student did validation using techniques described in: A. Banerjee and R. N. Dave. Validating clusters using the hopkins statistic. 2004 IEEE Internation
10,642
Clustering quality measure
If the clustering algorithm isn't deterministic, then try to measure "stability" of clusterings - find out how often each two observations belongs to the same cluster. That's generaly interesting method, useful for choosing k in kmeans algorithm.
Clustering quality measure
If the clustering algorithm isn't deterministic, then try to measure "stability" of clusterings - find out how often each two observations belongs to the same cluster. That's generaly interesting met
Clustering quality measure If the clustering algorithm isn't deterministic, then try to measure "stability" of clusterings - find out how often each two observations belongs to the same cluster. That's generaly interesting method, useful for choosing k in kmeans algorithm.
Clustering quality measure If the clustering algorithm isn't deterministic, then try to measure "stability" of clusterings - find out how often each two observations belongs to the same cluster. That's generaly interesting met
10,643
Clustering quality measure
A method such as that used in unsupervised random forest could be used. Random Forest algorithms treat unsupervised classification as a two class problem, were a whole different artificial and random data set is created from the first data set by removing the dependency structure in the data (randomization). You could then create such a artificial and random data set, apply your clustering model and compare you metric of choice (eg. SSE) in your true data and your random data. Mixing in randomization, permutation, bootstrapping,bagging and/or jacknifing could give you a measure similar to a P value by measuring the number of times a given clustering model gives you a smaller value for you true data than your random data using a metric of choice (eg. SSE, or out of bag error prediction). Your metric is thus difference (probability, size difference,...) in any metric of choice between true and random data. Iterating this for many models would allow you to distinguish between models. This can be implemented in R. randomforest is available in R
Clustering quality measure
A method such as that used in unsupervised random forest could be used. Random Forest algorithms treat unsupervised classification as a two class problem, were a whole different artificial and random
Clustering quality measure A method such as that used in unsupervised random forest could be used. Random Forest algorithms treat unsupervised classification as a two class problem, were a whole different artificial and random data set is created from the first data set by removing the dependency structure in the data (randomization). You could then create such a artificial and random data set, apply your clustering model and compare you metric of choice (eg. SSE) in your true data and your random data. Mixing in randomization, permutation, bootstrapping,bagging and/or jacknifing could give you a measure similar to a P value by measuring the number of times a given clustering model gives you a smaller value for you true data than your random data using a metric of choice (eg. SSE, or out of bag error prediction). Your metric is thus difference (probability, size difference,...) in any metric of choice between true and random data. Iterating this for many models would allow you to distinguish between models. This can be implemented in R. randomforest is available in R
Clustering quality measure A method such as that used in unsupervised random forest could be used. Random Forest algorithms treat unsupervised classification as a two class problem, were a whole different artificial and random
10,644
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate]
There are simulations that are not Monte Carlo: Basically, all Monte Carlo methods use the (weak) law of large numbers: The mean converges to its expectation. Then there are Quasi Monte Carlo methods. These are simulated with a compromise of random numbers and equally spaced grids to yield faster convergece. Simulations that are not Monte Carlo are e.g. used in computational fluid dynamics. It is easy to model fluid dynamics on a "micro scale" of single portions of the fluid. These portions have an initial speed, pressure and size and are affected by forces from the neighbouring portions or by solid bodies. Simulations compute the whole behaviour of the fluid by calculating all the portions and their interaction. Doing this efficiently makes this a science. No random numbers are needed there. In meteorology or climate research, things are done similarly. But now, the initial values are not exactly known: You only have the meteorological data at some points where they have been measured. A lot of data has to be guessed. Further, Monte Carlo Simulations are expected to help researchers obtain results close to reality, they are random simulations meant to mimic reality. If your random simulation doesn't have anything to do with reality or predicting some actual event, then it would not be correct to call your random simulation a Monte Carlo Simulation.
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate]
There are simulations that are not Monte Carlo: Basically, all Monte Carlo methods use the (weak) law of large numbers: The mean converges to its expectation. Then there are Quasi Monte Carlo methods
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate] There are simulations that are not Monte Carlo: Basically, all Monte Carlo methods use the (weak) law of large numbers: The mean converges to its expectation. Then there are Quasi Monte Carlo methods. These are simulated with a compromise of random numbers and equally spaced grids to yield faster convergece. Simulations that are not Monte Carlo are e.g. used in computational fluid dynamics. It is easy to model fluid dynamics on a "micro scale" of single portions of the fluid. These portions have an initial speed, pressure and size and are affected by forces from the neighbouring portions or by solid bodies. Simulations compute the whole behaviour of the fluid by calculating all the portions and their interaction. Doing this efficiently makes this a science. No random numbers are needed there. In meteorology or climate research, things are done similarly. But now, the initial values are not exactly known: You only have the meteorological data at some points where they have been measured. A lot of data has to be guessed. Further, Monte Carlo Simulations are expected to help researchers obtain results close to reality, they are random simulations meant to mimic reality. If your random simulation doesn't have anything to do with reality or predicting some actual event, then it would not be correct to call your random simulation a Monte Carlo Simulation.
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate] There are simulations that are not Monte Carlo: Basically, all Monte Carlo methods use the (weak) law of large numbers: The mean converges to its expectation. Then there are Quasi Monte Carlo methods
10,645
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate]
Nicholas Metropolis claimed in 1987 that It was at that time that I suggested an obvious name for the statistical method - a suggestion not unrelated to the fact that Stan[islaw Ulam] had an uncle who would borrow money from relatives because he “just had to go to Monte Carlo.” "Monte Carlo" refers to a casino in Monaco. Of course, as you note, casinos have a connection to random number generation. (And to - potentially ruinous - results from generating many random numbers.) This nomenclature needs to be seen in the context of a group of physicists and mathematicians that amuse themselves playing small-stakes poker. Relatedly, Stanislaw Ulam wrote in his memoirs that Metropolis once described what a triumph it was to win ten dollars from John von Neumann, author of a famous treatise on game theory. He then bought his book for five dollars and pasted the other five inside the cover as a symbol of his victory. This may give you an idea of the intellectual environment that gives birth to technical terms patterned after places of gambling. Edit: you ask is there any reason to call a random simulation a "Monte Carlo" simulation other than sounding sophisticated/clever? I don't see or know of any other reason other than it's the commonly accepted term for a random simulation. This may not be a "technical" reason, but I would say that using an accepted term for a technical issue is quite a sufficient reason to minimize misunderstandings.
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate]
Nicholas Metropolis claimed in 1987 that It was at that time that I suggested an obvious name for the statistical method - a suggestion not unrelated to the fact that Stan[islaw Ul
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate] Nicholas Metropolis claimed in 1987 that It was at that time that I suggested an obvious name for the statistical method - a suggestion not unrelated to the fact that Stan[islaw Ulam] had an uncle who would borrow money from relatives because he “just had to go to Monte Carlo.” "Monte Carlo" refers to a casino in Monaco. Of course, as you note, casinos have a connection to random number generation. (And to - potentially ruinous - results from generating many random numbers.) This nomenclature needs to be seen in the context of a group of physicists and mathematicians that amuse themselves playing small-stakes poker. Relatedly, Stanislaw Ulam wrote in his memoirs that Metropolis once described what a triumph it was to win ten dollars from John von Neumann, author of a famous treatise on game theory. He then bought his book for five dollars and pasted the other five inside the cover as a symbol of his victory. This may give you an idea of the intellectual environment that gives birth to technical terms patterned after places of gambling. Edit: you ask is there any reason to call a random simulation a "Monte Carlo" simulation other than sounding sophisticated/clever? I don't see or know of any other reason other than it's the commonly accepted term for a random simulation. This may not be a "technical" reason, but I would say that using an accepted term for a technical issue is quite a sufficient reason to minimize misunderstandings.
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate] Nicholas Metropolis claimed in 1987 that It was at that time that I suggested an obvious name for the statistical method - a suggestion not unrelated to the fact that Stan[islaw Ul
10,646
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate]
I have sometimes heard of people who distinguish between Monte Carlo algorithms and Las Vegas algorithms. Unlike a Monte Carlo algorithm—which will always terminate, but has a chance of giving wildly inaccurate results—a Las Vegas algorithm has a chance of running for an arbitrarily long time, but will always give accurate results. I suspect that most people don't make the distinction often, since (as you note) most people use "Monte Carlo" and "random" interchangeably. (Wikipedia says that there are also Atlantic City algorithms, but I had never heard of that term until now.)
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate]
I have sometimes heard of people who distinguish between Monte Carlo algorithms and Las Vegas algorithms. Unlike a Monte Carlo algorithm—which will always terminate, but has a chance of giving wildly
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate] I have sometimes heard of people who distinguish between Monte Carlo algorithms and Las Vegas algorithms. Unlike a Monte Carlo algorithm—which will always terminate, but has a chance of giving wildly inaccurate results—a Las Vegas algorithm has a chance of running for an arbitrarily long time, but will always give accurate results. I suspect that most people don't make the distinction often, since (as you note) most people use "Monte Carlo" and "random" interchangeably. (Wikipedia says that there are also Atlantic City algorithms, but I had never heard of that term until now.)
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate] I have sometimes heard of people who distinguish between Monte Carlo algorithms and Las Vegas algorithms. Unlike a Monte Carlo algorithm—which will always terminate, but has a chance of giving wildly
10,647
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate]
You can read about the history of the Monte Carlo name in the other answers and comments. So this answer will provide a complementary perspective. In sophisticated company, it's referred to as stochastic simulation. See for example, the book "Stochastic Simulation: Algorithms and Analysis", Asmussen and Glynn. http://www.springer.com/us/book/9780387306797 . Monte Carlo simulation is a rather down-market term (pardon my snobbery). In my workplace, I usually refer to Monte Carlo simulation, because many people wouldn't have a clue what I was talking about if I said stochastic simulation. I don't usually find myself in upscale company there, ha ha.
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate]
You can read about the history of the Monte Carlo name in the other answers and comments. So this answer will provide a complementary perspective. In sophisticated company, it's referred to as stochas
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate] You can read about the history of the Monte Carlo name in the other answers and comments. So this answer will provide a complementary perspective. In sophisticated company, it's referred to as stochastic simulation. See for example, the book "Stochastic Simulation: Algorithms and Analysis", Asmussen and Glynn. http://www.springer.com/us/book/9780387306797 . Monte Carlo simulation is a rather down-market term (pardon my snobbery). In my workplace, I usually refer to Monte Carlo simulation, because many people wouldn't have a clue what I was talking about if I said stochastic simulation. I don't usually find myself in upscale company there, ha ha.
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate] You can read about the history of the Monte Carlo name in the other answers and comments. So this answer will provide a complementary perspective. In sophisticated company, it's referred to as stochas
10,648
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate]
This is actually a really good question, and it has provoked some fine answers. I'm adding this because I wondered about this too, and believe that Monte Carlo was used and became popular, because the process employed by gambling casinos, and the statistical process of estimation have specific, similar characteristics. The methods employ randomness, but themselves are not random, as scientists typically use the term. (Eg. "I expected to see some evidence of xxxxxx, but the results looks completely random."). Both the Monte Carlo casino operators, and those using statistical techniques are seeking a specific outcome, and they are using similar methods to achieve a desired outcome. Random typically implies no evident pattern or unpredictable. The methods used by gambling casinos are very well thought out. The unpredictability of the specific outcome of specific events is established (else it would not be gambling, would it?), but the nature and distribution of the range of outcomes is fully understood - and this key fact, both in casino gambling, and in the use of statistical estimation techniques - makes all the difference. An example: A Monte Carlo roulette wheel will have 1 to 18 numbers in one colour, and 19 to 36 in another, if I remember correctly, so red or black have equal probability of appearing. You can wager a specific number, or just bet on red or black appearing. The players are playing against each other, for each other's money. How does the casino operator make any money from this? The wheel has a "0" position, and if and when the ball lands there, the casino operator rakes in all the bets - the house wins. Each time the ball lands on the zero, the house wins. So each trial - each spin of the wheel - has a random outcome, but the house has (assuming the wheel is not rigged, say by putting a little magnet under the "0" number), then the house still can expect to - on average - sweep all the bets off the table with a 1/37 (or 0.027027) probability. And if the house wants to improve its outcome? It can add a second number to the wheel - typically "00", or double-zero. Now, the probability that the house will win is almost (but not quite) doubled, to 2/38 (or 0.0526316). That's over 5%, or a serious take. Suppose the average amount of money wagered at the table each night, by the high-rollers, is $ 170,000. With one zero, the house can be expected to make 170000 * 0.027027 = $4594.59, but adding the extra zero, and the expected take for the house is now 170000 * 0.0526316 = $8947.37. See, the amount gambled each night will be random. We won't know what it will be. But assuming the wheel is fair and true (and smart gamblers are always watching to see if a game is "rigged" - just like the house detectives are always watching to see if players are cheating), we can say with close to certainty, that by adding the extra zero to the wheel, the casino can almost double it's take from the roulette game. If the casino operators can add that extra zero to the wheel, and not drive away players, and reduce the nightly amount bet, then they will do it. And just using simple probability, the improvement in the cash-take can be predicted. If the casino operator adds free drinks, to attract more players, then the cost of such extra attractions can be subtracted from the expected improved take. It may well be that adding the extra double-zero to the wheel and adding free alcohol, may improve the bet-flow. As the casino operator, you would run some experiments, and assess the outcomes. And since the operation of the process is filling your pocket with money, you are willing to focus on how it works, with some serious attention to detail. And that, lastly is the key point. Although randomness is employed, the operation of any casino is a very analysis-intensive business, where statistical techniques and an understanding of probability are key to obtaining a successful outcome. Casino operators know the expected outcome on each and every game they offer, and because the randomness is limited to activity within a known distribution of possible results, the expected cash take on each game can be estimated quite accurately. This is how cheaters are caught. One particular game experiences a big divergence from expected outcome, right? As the casino operator, you know something is wrong. Monte Carlo methods, or the techniques of statistical and probabilistic estimation, can be very effective at predicting the outcomes of processes where the distribution of possible results is known. And if either side can obtain an "edge", or shift the distribution of random outcomes in such a way as to alter the long-term expected value of the outcome even slightly, such an "edge" can make a person (or more often, the casino operator), very rich. Monte Carlo methods employ randomness, but the methods - and the outcomes they can provide - are not random at all. The methods themselves can be as well-engineered and finely-tuned as the engines of the Porsche automobiles in the casino parking lots. And that is why the term is used.
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate]
This is actually a really good question, and it has provoked some fine answers. I'm adding this because I wondered about this too, and believe that Monte Carlo was used and became popular, because the
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate] This is actually a really good question, and it has provoked some fine answers. I'm adding this because I wondered about this too, and believe that Monte Carlo was used and became popular, because the process employed by gambling casinos, and the statistical process of estimation have specific, similar characteristics. The methods employ randomness, but themselves are not random, as scientists typically use the term. (Eg. "I expected to see some evidence of xxxxxx, but the results looks completely random."). Both the Monte Carlo casino operators, and those using statistical techniques are seeking a specific outcome, and they are using similar methods to achieve a desired outcome. Random typically implies no evident pattern or unpredictable. The methods used by gambling casinos are very well thought out. The unpredictability of the specific outcome of specific events is established (else it would not be gambling, would it?), but the nature and distribution of the range of outcomes is fully understood - and this key fact, both in casino gambling, and in the use of statistical estimation techniques - makes all the difference. An example: A Monte Carlo roulette wheel will have 1 to 18 numbers in one colour, and 19 to 36 in another, if I remember correctly, so red or black have equal probability of appearing. You can wager a specific number, or just bet on red or black appearing. The players are playing against each other, for each other's money. How does the casino operator make any money from this? The wheel has a "0" position, and if and when the ball lands there, the casino operator rakes in all the bets - the house wins. Each time the ball lands on the zero, the house wins. So each trial - each spin of the wheel - has a random outcome, but the house has (assuming the wheel is not rigged, say by putting a little magnet under the "0" number), then the house still can expect to - on average - sweep all the bets off the table with a 1/37 (or 0.027027) probability. And if the house wants to improve its outcome? It can add a second number to the wheel - typically "00", or double-zero. Now, the probability that the house will win is almost (but not quite) doubled, to 2/38 (or 0.0526316). That's over 5%, or a serious take. Suppose the average amount of money wagered at the table each night, by the high-rollers, is $ 170,000. With one zero, the house can be expected to make 170000 * 0.027027 = $4594.59, but adding the extra zero, and the expected take for the house is now 170000 * 0.0526316 = $8947.37. See, the amount gambled each night will be random. We won't know what it will be. But assuming the wheel is fair and true (and smart gamblers are always watching to see if a game is "rigged" - just like the house detectives are always watching to see if players are cheating), we can say with close to certainty, that by adding the extra zero to the wheel, the casino can almost double it's take from the roulette game. If the casino operators can add that extra zero to the wheel, and not drive away players, and reduce the nightly amount bet, then they will do it. And just using simple probability, the improvement in the cash-take can be predicted. If the casino operator adds free drinks, to attract more players, then the cost of such extra attractions can be subtracted from the expected improved take. It may well be that adding the extra double-zero to the wheel and adding free alcohol, may improve the bet-flow. As the casino operator, you would run some experiments, and assess the outcomes. And since the operation of the process is filling your pocket with money, you are willing to focus on how it works, with some serious attention to detail. And that, lastly is the key point. Although randomness is employed, the operation of any casino is a very analysis-intensive business, where statistical techniques and an understanding of probability are key to obtaining a successful outcome. Casino operators know the expected outcome on each and every game they offer, and because the randomness is limited to activity within a known distribution of possible results, the expected cash take on each game can be estimated quite accurately. This is how cheaters are caught. One particular game experiences a big divergence from expected outcome, right? As the casino operator, you know something is wrong. Monte Carlo methods, or the techniques of statistical and probabilistic estimation, can be very effective at predicting the outcomes of processes where the distribution of possible results is known. And if either side can obtain an "edge", or shift the distribution of random outcomes in such a way as to alter the long-term expected value of the outcome even slightly, such an "edge" can make a person (or more often, the casino operator), very rich. Monte Carlo methods employ randomness, but the methods - and the outcomes they can provide - are not random at all. The methods themselves can be as well-engineered and finely-tuned as the engines of the Porsche automobiles in the casino parking lots. And that is why the term is used.
Why is the term "Monte Carlo simulation" used instead of "Random simulation"? [duplicate] This is actually a really good question, and it has provoked some fine answers. I'm adding this because I wondered about this too, and believe that Monte Carlo was used and became popular, because the
10,649
Do all machine learning algorithms separate data linearly?
The answer is No. user20160 has a perfect answer, I will add 3 examples with visualization to illustrate the idea. Note, these plots may not be helpful for you to see if the "final decision" is in linear form but give you some sense about tree, boosting and KNN. We will start with decision trees. With many splits, it is a non-linear decision boundary. And we cannot think all the previous splits are "feature transformations" and there are a final decision line at the end. Another example is the boosting model, which aggregates many "weak classifiers" and the final decision boundary is not linear. You can think about it is a complicated code/algorithm to make the final prediction. Finally, think about K Nearest Neighbors (KNN). It is also not a linear decision function at the end layer. in addition, there are no "feature transformations" in KNN. Here are three visualizations in 2D space (Tree, Boosting and KNN from top to bottom). The ground truth is 2 spirals represent two classes, and the left subplot is the predictions from the model and the right subplot is the decision boundaries from the model. EDIT: @ssdecontrol's answer in this post gives another perspective. It depends on how we define the "transformation". Any function that partitions the data into two pieces can be transformed into a linear model of this form, with an intercept and a single input (an indicator of which "side" of the partition the data point is on). It is important to take note of the difference between a decision function and a decision boundary.
Do all machine learning algorithms separate data linearly?
The answer is No. user20160 has a perfect answer, I will add 3 examples with visualization to illustrate the idea. Note, these plots may not be helpful for you to see if the "final decision" is in lin
Do all machine learning algorithms separate data linearly? The answer is No. user20160 has a perfect answer, I will add 3 examples with visualization to illustrate the idea. Note, these plots may not be helpful for you to see if the "final decision" is in linear form but give you some sense about tree, boosting and KNN. We will start with decision trees. With many splits, it is a non-linear decision boundary. And we cannot think all the previous splits are "feature transformations" and there are a final decision line at the end. Another example is the boosting model, which aggregates many "weak classifiers" and the final decision boundary is not linear. You can think about it is a complicated code/algorithm to make the final prediction. Finally, think about K Nearest Neighbors (KNN). It is also not a linear decision function at the end layer. in addition, there are no "feature transformations" in KNN. Here are three visualizations in 2D space (Tree, Boosting and KNN from top to bottom). The ground truth is 2 spirals represent two classes, and the left subplot is the predictions from the model and the right subplot is the decision boundaries from the model. EDIT: @ssdecontrol's answer in this post gives another perspective. It depends on how we define the "transformation". Any function that partitions the data into two pieces can be transformed into a linear model of this form, with an intercept and a single input (an indicator of which "side" of the partition the data point is on). It is important to take note of the difference between a decision function and a decision boundary.
Do all machine learning algorithms separate data linearly? The answer is No. user20160 has a perfect answer, I will add 3 examples with visualization to illustrate the idea. Note, these plots may not be helpful for you to see if the "final decision" is in lin
10,650
Do all machine learning algorithms separate data linearly?
Some algorithms use a hyperplane (i.e. linear function) to separate the data. A prominent example is logistic regression. Others use a hyperplane to separate the data after a nonlinear transformation (e.g. neural networks and support vector machines with nonlinear kernels). In this case, the decision boundary is nonlinear in the original data space, but linear in the feature space into which the data are mapped. In the case of SVMs, the kernel formulation defines this mapping implicitly. Other algorithms use multiple splitting hyperplanes in local regions of data space (e.g. decision trees). In this case, the decision boundary is piecewise linear (but nonlinear overall). However, other algorithms have nonlinear decision boundaries, and are not formulated in terms of hyperplanes. A prominent example is k nearest neighbors classification. Ensemble classifiers (e.g. produced by boosting or bagging other classifiers) are generally nonlinear.
Do all machine learning algorithms separate data linearly?
Some algorithms use a hyperplane (i.e. linear function) to separate the data. A prominent example is logistic regression. Others use a hyperplane to separate the data after a nonlinear transformation
Do all machine learning algorithms separate data linearly? Some algorithms use a hyperplane (i.e. linear function) to separate the data. A prominent example is logistic regression. Others use a hyperplane to separate the data after a nonlinear transformation (e.g. neural networks and support vector machines with nonlinear kernels). In this case, the decision boundary is nonlinear in the original data space, but linear in the feature space into which the data are mapped. In the case of SVMs, the kernel formulation defines this mapping implicitly. Other algorithms use multiple splitting hyperplanes in local regions of data space (e.g. decision trees). In this case, the decision boundary is piecewise linear (but nonlinear overall). However, other algorithms have nonlinear decision boundaries, and are not formulated in terms of hyperplanes. A prominent example is k nearest neighbors classification. Ensemble classifiers (e.g. produced by boosting or bagging other classifiers) are generally nonlinear.
Do all machine learning algorithms separate data linearly? Some algorithms use a hyperplane (i.e. linear function) to separate the data. A prominent example is logistic regression. Others use a hyperplane to separate the data after a nonlinear transformation
10,651
How is interpolation related to the concept of regression?
The main difference between interpolation and regression, is the definition of the problem they solve. Given $n$ data points, when you interpolate, you look for a function that is of some predefined form that has the values in that points exactly as specified. That means given pairs $(x_i, y_i)$ you look for $F$ of some predefined form that satisfies $F(x_i) = y_i$. I think most commonly $F$ is chosen to be polynomial, spline (low degree polynomials on intervals between given points). When you do regression, you look for a function that minimizes some cost, usually sum of squares of errors. You don't require the function to have the exact values at given points, you just want a good aproximation. In general, your found function $F$ might not satisfy $F(x_i) = y_i$ for any data point, but the cost function, i.e $\sum_{i=1}^n (F(x_i) - y_i)^2$ will be the smallest possible of all the functions of given form. A good example for why you might want to only aproximate instead of interpolate are prices on stock market. You can take prices in some $k$ recent units of time, and try to interpolate them to get some prediction of the price in the next unit of time. This is rather a bad idea, because there is no reason to think that the relations between the prices can be exactly expressed by a polynomial. But linear regression might do the trick, since the prices might have some "slope" and a linear function might be a good aproximation, at least locally (hint: it's not that easy, but regression is definately a better idea than interpolation in this case).
How is interpolation related to the concept of regression?
The main difference between interpolation and regression, is the definition of the problem they solve. Given $n$ data points, when you interpolate, you look for a function that is of some predefined f
How is interpolation related to the concept of regression? The main difference between interpolation and regression, is the definition of the problem they solve. Given $n$ data points, when you interpolate, you look for a function that is of some predefined form that has the values in that points exactly as specified. That means given pairs $(x_i, y_i)$ you look for $F$ of some predefined form that satisfies $F(x_i) = y_i$. I think most commonly $F$ is chosen to be polynomial, spline (low degree polynomials on intervals between given points). When you do regression, you look for a function that minimizes some cost, usually sum of squares of errors. You don't require the function to have the exact values at given points, you just want a good aproximation. In general, your found function $F$ might not satisfy $F(x_i) = y_i$ for any data point, but the cost function, i.e $\sum_{i=1}^n (F(x_i) - y_i)^2$ will be the smallest possible of all the functions of given form. A good example for why you might want to only aproximate instead of interpolate are prices on stock market. You can take prices in some $k$ recent units of time, and try to interpolate them to get some prediction of the price in the next unit of time. This is rather a bad idea, because there is no reason to think that the relations between the prices can be exactly expressed by a polynomial. But linear regression might do the trick, since the prices might have some "slope" and a linear function might be a good aproximation, at least locally (hint: it's not that easy, but regression is definately a better idea than interpolation in this case).
How is interpolation related to the concept of regression? The main difference between interpolation and regression, is the definition of the problem they solve. Given $n$ data points, when you interpolate, you look for a function that is of some predefined f
10,652
How is interpolation related to the concept of regression?
The two previous answers have explained the relationship between linear interpolation and linear regression (or even general interpolation and polynomial regression). But an important connection is that once you fit a regression model you can use it to interpolate between the given data points.
How is interpolation related to the concept of regression?
The two previous answers have explained the relationship between linear interpolation and linear regression (or even general interpolation and polynomial regression). But an important connection is t
How is interpolation related to the concept of regression? The two previous answers have explained the relationship between linear interpolation and linear regression (or even general interpolation and polynomial regression). But an important connection is that once you fit a regression model you can use it to interpolate between the given data points.
How is interpolation related to the concept of regression? The two previous answers have explained the relationship between linear interpolation and linear regression (or even general interpolation and polynomial regression). But an important connection is t
10,653
How is interpolation related to the concept of regression?
Hopefully this will come rather quickly with a simple example and visualization. Suppose you have the following data: X Y 1 6 10 15 20 25 30 35 40 45 50 55 We may use regression to model Y as a response to X. Using R: lm(y ~ x) The results are an intercept of 5, and a coefficent for x of 1. Which means an arbitrary Y can be calculated for a given X as X + 5. As a picture, you can see this this way: Notice how if you went to the X axis, anywhere along it, and drew a line up to the fitted line, and then drew a line over to the Y axis, you can get a value, whether or not I provided a value point for Y. Regression is smoothing over areas with no data by estimating the underlying relationship.
How is interpolation related to the concept of regression?
Hopefully this will come rather quickly with a simple example and visualization. Suppose you have the following data: X Y 1 6 10 15 20 25 30 35 40 45 50 55 We may use regression to model Y as a res
How is interpolation related to the concept of regression? Hopefully this will come rather quickly with a simple example and visualization. Suppose you have the following data: X Y 1 6 10 15 20 25 30 35 40 45 50 55 We may use regression to model Y as a response to X. Using R: lm(y ~ x) The results are an intercept of 5, and a coefficent for x of 1. Which means an arbitrary Y can be calculated for a given X as X + 5. As a picture, you can see this this way: Notice how if you went to the X axis, anywhere along it, and drew a line up to the fitted line, and then drew a line over to the Y axis, you can get a value, whether or not I provided a value point for Y. Regression is smoothing over areas with no data by estimating the underlying relationship.
How is interpolation related to the concept of regression? Hopefully this will come rather quickly with a simple example and visualization. Suppose you have the following data: X Y 1 6 10 15 20 25 30 35 40 45 50 55 We may use regression to model Y as a res
10,654
How is interpolation related to the concept of regression?
Regression is the process of finding the line of best fit[1]. Interpolation is the process of using the line of best fit to estimate the value of one variable from the value of another, provided that the value you are using is within the range of your data. If it's outside the range, then you would be using Extrapolation[1]. [1] http://mathhelpforum.com/advanced-applied-math/182558-interpolation-vs-regression.html
How is interpolation related to the concept of regression?
Regression is the process of finding the line of best fit[1]. Interpolation is the process of using the line of best fit to estimate the value of one variable from the value of another, provided that
How is interpolation related to the concept of regression? Regression is the process of finding the line of best fit[1]. Interpolation is the process of using the line of best fit to estimate the value of one variable from the value of another, provided that the value you are using is within the range of your data. If it's outside the range, then you would be using Extrapolation[1]. [1] http://mathhelpforum.com/advanced-applied-math/182558-interpolation-vs-regression.html
How is interpolation related to the concept of regression? Regression is the process of finding the line of best fit[1]. Interpolation is the process of using the line of best fit to estimate the value of one variable from the value of another, provided that
10,655
How is interpolation related to the concept of regression?
the basic difference b/w Interpolation and regression is as follows: Interpolation:suppose there are n points (eg:10 data points),in interpolation we will fit the curve passing through all the data points (i.e here 10 data points) with a degree of the polynomial (no.of data points -1; i.e here it is 9).where as in regression not all the data points only a set of them needed for curve fitting. generally the order of the Interpolation & regression will be (1,2 or 3) if the order is more than 3 ,more oscillations will be seen in the curve.
How is interpolation related to the concept of regression?
the basic difference b/w Interpolation and regression is as follows: Interpolation:suppose there are n points (eg:10 data points),in interpolation we will fit the curve passing through all the data po
How is interpolation related to the concept of regression? the basic difference b/w Interpolation and regression is as follows: Interpolation:suppose there are n points (eg:10 data points),in interpolation we will fit the curve passing through all the data points (i.e here 10 data points) with a degree of the polynomial (no.of data points -1; i.e here it is 9).where as in regression not all the data points only a set of them needed for curve fitting. generally the order of the Interpolation & regression will be (1,2 or 3) if the order is more than 3 ,more oscillations will be seen in the curve.
How is interpolation related to the concept of regression? the basic difference b/w Interpolation and regression is as follows: Interpolation:suppose there are n points (eg:10 data points),in interpolation we will fit the curve passing through all the data po
10,656
How is interpolation related to the concept of regression?
With interpolation or spline fitting what we get is a numeric data (interpolated bet ween each pair of original data) of larger size, which when plotted generates the effect of a smooth curve. In actuality, between each pair of original data a different polynomial is fitted, therefore the entire curve after interpolation is a piece-wise continuous curve, where each piece is formed of a different polynomial. If one is looking for parametric representation of the original numeric data, regression must be done. You can also try to fit a high degree polynomial to the spline. In any case, the representation is going to be an approximation. You can also check how accurate the approximation is.
How is interpolation related to the concept of regression?
With interpolation or spline fitting what we get is a numeric data (interpolated bet ween each pair of original data) of larger size, which when plotted generates the effect of a smooth curve. In actu
How is interpolation related to the concept of regression? With interpolation or spline fitting what we get is a numeric data (interpolated bet ween each pair of original data) of larger size, which when plotted generates the effect of a smooth curve. In actuality, between each pair of original data a different polynomial is fitted, therefore the entire curve after interpolation is a piece-wise continuous curve, where each piece is formed of a different polynomial. If one is looking for parametric representation of the original numeric data, regression must be done. You can also try to fit a high degree polynomial to the spline. In any case, the representation is going to be an approximation. You can also check how accurate the approximation is.
How is interpolation related to the concept of regression? With interpolation or spline fitting what we get is a numeric data (interpolated bet ween each pair of original data) of larger size, which when plotted generates the effect of a smooth curve. In actu
10,657
How is interpolation related to the concept of regression?
Both regression and interpolation are used to predict values of a variable(Y) for a given value of another variable(X). In Regression we can predict any value of the dependent variable(Y) for a given value of the independent variable(X) Even if it is outside the range of tabulated values.But in case of Interpolation we can only predict the values of dependent variable(Y) for a value of independent variable(X) which is within the range of given values of X.
How is interpolation related to the concept of regression?
Both regression and interpolation are used to predict values of a variable(Y) for a given value of another variable(X). In Regression we can predict any value of the dependent variable(Y) for a given
How is interpolation related to the concept of regression? Both regression and interpolation are used to predict values of a variable(Y) for a given value of another variable(X). In Regression we can predict any value of the dependent variable(Y) for a given value of the independent variable(X) Even if it is outside the range of tabulated values.But in case of Interpolation we can only predict the values of dependent variable(Y) for a value of independent variable(X) which is within the range of given values of X.
How is interpolation related to the concept of regression? Both regression and interpolation are used to predict values of a variable(Y) for a given value of another variable(X). In Regression we can predict any value of the dependent variable(Y) for a given
10,658
How is interpolation related to the concept of regression?
Interpolation is the process of fitting a number of points between x=a and x=b exactly to an interpolating polynomial. Interpolation can be used to find the approximate value (or the missing value) of y in the domain x=[a,b] with better accuracy than regression technique. On the other hand, regression is a process of fitting a number of points to a curve that passing through or near the points with minimal squared error. Regression will not approximate the value of y in the domain x=[a,b] as accurate as interpolation however regression provides better predictions than interpolation for the values of y in the domain between x=(-infinity, a) and x=(b, +infinity). In summary, interpolation provide better accuracy in the value of y within the domain of a known x range while regression provides better predictions of y in the domain below and beyond the known range of x.
How is interpolation related to the concept of regression?
Interpolation is the process of fitting a number of points between x=a and x=b exactly to an interpolating polynomial. Interpolation can be used to find the approximate value (or the missing value) of
How is interpolation related to the concept of regression? Interpolation is the process of fitting a number of points between x=a and x=b exactly to an interpolating polynomial. Interpolation can be used to find the approximate value (or the missing value) of y in the domain x=[a,b] with better accuracy than regression technique. On the other hand, regression is a process of fitting a number of points to a curve that passing through or near the points with minimal squared error. Regression will not approximate the value of y in the domain x=[a,b] as accurate as interpolation however regression provides better predictions than interpolation for the values of y in the domain between x=(-infinity, a) and x=(b, +infinity). In summary, interpolation provide better accuracy in the value of y within the domain of a known x range while regression provides better predictions of y in the domain below and beyond the known range of x.
How is interpolation related to the concept of regression? Interpolation is the process of fitting a number of points between x=a and x=b exactly to an interpolating polynomial. Interpolation can be used to find the approximate value (or the missing value) of
10,659
How is interpolation related to the concept of regression?
Compared to interpolation, regression takes the uncertainty of measurements into consideration. The pairs of observed values may be noisy.
How is interpolation related to the concept of regression?
Compared to interpolation, regression takes the uncertainty of measurements into consideration. The pairs of observed values may be noisy.
How is interpolation related to the concept of regression? Compared to interpolation, regression takes the uncertainty of measurements into consideration. The pairs of observed values may be noisy.
How is interpolation related to the concept of regression? Compared to interpolation, regression takes the uncertainty of measurements into consideration. The pairs of observed values may be noisy.
10,660
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources?
Bishop is a great book. I hope these suggestions help with your study: The author himself has posted some slides for Chapters 1, 2, 3 & 8, as well as many solutions. A reading group at INRIA have posted their own slides covering every chapter. João Pedro Neto has posted some notes and workings in R here. (Scroll down to where it says "Bishop's Pattern Recognition and ML") Many introductory machine learning courses use Bishop as their textbook. Googling gives a few different ones; have a look and see which topics and focus you prefer.
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources?
Bishop is a great book. I hope these suggestions help with your study: The author himself has posted some slides for Chapters 1, 2, 3 & 8, as well as many solutions. A reading group at INRIA have pos
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources? Bishop is a great book. I hope these suggestions help with your study: The author himself has posted some slides for Chapters 1, 2, 3 & 8, as well as many solutions. A reading group at INRIA have posted their own slides covering every chapter. João Pedro Neto has posted some notes and workings in R here. (Scroll down to where it says "Bishop's Pattern Recognition and ML") Many introductory machine learning courses use Bishop as their textbook. Googling gives a few different ones; have a look and see which topics and focus you prefer.
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources? Bishop is a great book. I hope these suggestions help with your study: The author himself has posted some slides for Chapters 1, 2, 3 & 8, as well as many solutions. A reading group at INRIA have pos
10,661
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources?
I would recommend these resources to you: Tom Mitchell: Carnegie Mellon University (Only for Supervised Learning and follows Bishop) Pattern Recognition: Indian Institute of Science (I personally like this course as I have attended it, but this course requires you to know probability theory.) Both the courses are maths oriented, for a lighter course on machine learning would be "Machine Learning" by Udacity
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources?
I would recommend these resources to you: Tom Mitchell: Carnegie Mellon University (Only for Supervised Learning and follows Bishop) Pattern Recognition: Indian Institute of Science (I personally lik
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources? I would recommend these resources to you: Tom Mitchell: Carnegie Mellon University (Only for Supervised Learning and follows Bishop) Pattern Recognition: Indian Institute of Science (I personally like this course as I have attended it, but this course requires you to know probability theory.) Both the courses are maths oriented, for a lighter course on machine learning would be "Machine Learning" by Udacity
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources? I would recommend these resources to you: Tom Mitchell: Carnegie Mellon University (Only for Supervised Learning and follows Bishop) Pattern Recognition: Indian Institute of Science (I personally lik
10,662
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources?
https://www.cs.toronto.edu/~rsalakhu/STA4273_2015/ This course closely follows part of Bishop's. It has lecture videos with it.
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources?
https://www.cs.toronto.edu/~rsalakhu/STA4273_2015/ This course closely follows part of Bishop's. It has lecture videos with it.
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources? https://www.cs.toronto.edu/~rsalakhu/STA4273_2015/ This course closely follows part of Bishop's. It has lecture videos with it.
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources? https://www.cs.toronto.edu/~rsalakhu/STA4273_2015/ This course closely follows part of Bishop's. It has lecture videos with it.
10,663
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources?
jupyter notebooks with python implementations and scikit-learn usage at PRML
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources?
jupyter notebooks with python implementations and scikit-learn usage at PRML
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources? jupyter notebooks with python implementations and scikit-learn usage at PRML
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources? jupyter notebooks with python implementations and scikit-learn usage at PRML
10,664
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources?
I think an often overlooked book is Information Theory, Inference, and Learning Algorithms by David MacKay. It follows the general framework of PRML, since the authors seem to have a similar (at least in my view) perspective. Depending on your background -- whether or not you enjoy concepts like information theory/coding/KL-divergence -- you may find this book extremely eye-opening.
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources?
I think an often overlooked book is Information Theory, Inference, and Learning Algorithms by David MacKay. It follows the general framework of PRML, since the authors seem to have a similar (at least
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources? I think an often overlooked book is Information Theory, Inference, and Learning Algorithms by David MacKay. It follows the general framework of PRML, since the authors seem to have a similar (at least in my view) perspective. Depending on your background -- whether or not you enjoy concepts like information theory/coding/KL-divergence -- you may find this book extremely eye-opening.
I am learning from Pattern Recognition and Machine Learning, Chris Bishop any good resources? I think an often overlooked book is Information Theory, Inference, and Learning Algorithms by David MacKay. It follows the general framework of PRML, since the authors seem to have a similar (at least
10,665
Not normalizing data before PCA gives better explained variance ratio
Depends on the goal of your analysis. Some common practices, some of which are mentioned in whuber's link: Standardizing is usually done when the variables on which the PCA is performed are not measured on the same scale. Note that standardizing implies assigning equal importance to all variables. If they are not measured on the same scale and you choose to work on the non standardized variables, it is often the case that each PC is dominated by a single variable and you just get a sort of ordering of the variables by their variance. (One of the loadings of each (early) component will be close to +1 or -1.) The two methods often lead to different results, as you have experienced. Intuitive example: Suppose you have two variables: the height of a tree and the girth of the same tree. We will convert the volume to a factor: a tree will be high in volume if its volume is bigger than 20 cubic feet, and low in volume otherwise. We will use the trees dataset which comes preloaded in R. >data(trees) >tree.girth<-trees[,1] >tree.height<-trees[,2] >tree.vol<-as.factor(ifelse(trees[,3]>20,"high","low")) Now suppose that the height was actually measured in miles instead of feet. >tree.height<-tree.height/5280 >tree<-cbind(tree.height,tree.girth) > >#do the PCA >tree.pca<-princomp(tree) >summary(tree.pca) Importance of components: Comp.1 Comp.2 Standard deviation 3.0871086 1.014551e-03 Proportion of Variance 0.9999999 1.080050e-07 Cumulative Proportion 0.9999999 1.000000e+00 The first component explains almost 100% of the variability in the data. The loadings: > loadings(tree.pca) Loadings: Comp.1 Comp.2 tree.height -1 tree.girth 1 Graphical assessment: >biplot(tree.pca,xlabs=tree.vol,col=c("grey","red")) We see that trees high in volume tend to have a high tree girth, but the three height doesn't give any information on tree volume. This is likely wrong and the consequence of the two different unit measures. We could use the same units, or we could standardize the variables. I expect both will lead to a more balanced picture of the variability. Of course in this case one can argue that the variables should have the same unit but not be standardized, which may be a valid argument, were it not that we are measuring two different things. (When we would be measuring the weight of the tree and the girth of the tree, the scale on which both should be measured is no longer very clear. In this case we have a clear argument to work on the standardized variables.) >tree.height<-tree.height*5280 >tree<-cbind(tree.height,tree.girth) > >#do the PCA >tree.pca<-princomp(tree) > summary(tree.pca) Importance of components: Comp.1 Comp.2 Standard deviation 6.5088696 2.5407042 Proportion of Variance 0.8677775 0.1322225 Cumulative Proportion 0.8677775 1.0000000 > loadings(tree.pca) Loadings: Comp.1 Comp.2 tree.height -0.956 0.293 tree.girth -0.293 -0.956 >biplot(tree.pca,xlabs=tree.vol,col=c("grey","red")) We now see that trees which are tall and have a big girth, are high in volume (bottom left corner), compared to low girth and low height for low volume trees (upper right corner). This intuitively makes sense.
Not normalizing data before PCA gives better explained variance ratio
Depends on the goal of your analysis. Some common practices, some of which are mentioned in whuber's link: Standardizing is usually done when the variables on which the PCA is performed are not measu
Not normalizing data before PCA gives better explained variance ratio Depends on the goal of your analysis. Some common practices, some of which are mentioned in whuber's link: Standardizing is usually done when the variables on which the PCA is performed are not measured on the same scale. Note that standardizing implies assigning equal importance to all variables. If they are not measured on the same scale and you choose to work on the non standardized variables, it is often the case that each PC is dominated by a single variable and you just get a sort of ordering of the variables by their variance. (One of the loadings of each (early) component will be close to +1 or -1.) The two methods often lead to different results, as you have experienced. Intuitive example: Suppose you have two variables: the height of a tree and the girth of the same tree. We will convert the volume to a factor: a tree will be high in volume if its volume is bigger than 20 cubic feet, and low in volume otherwise. We will use the trees dataset which comes preloaded in R. >data(trees) >tree.girth<-trees[,1] >tree.height<-trees[,2] >tree.vol<-as.factor(ifelse(trees[,3]>20,"high","low")) Now suppose that the height was actually measured in miles instead of feet. >tree.height<-tree.height/5280 >tree<-cbind(tree.height,tree.girth) > >#do the PCA >tree.pca<-princomp(tree) >summary(tree.pca) Importance of components: Comp.1 Comp.2 Standard deviation 3.0871086 1.014551e-03 Proportion of Variance 0.9999999 1.080050e-07 Cumulative Proportion 0.9999999 1.000000e+00 The first component explains almost 100% of the variability in the data. The loadings: > loadings(tree.pca) Loadings: Comp.1 Comp.2 tree.height -1 tree.girth 1 Graphical assessment: >biplot(tree.pca,xlabs=tree.vol,col=c("grey","red")) We see that trees high in volume tend to have a high tree girth, but the three height doesn't give any information on tree volume. This is likely wrong and the consequence of the two different unit measures. We could use the same units, or we could standardize the variables. I expect both will lead to a more balanced picture of the variability. Of course in this case one can argue that the variables should have the same unit but not be standardized, which may be a valid argument, were it not that we are measuring two different things. (When we would be measuring the weight of the tree and the girth of the tree, the scale on which both should be measured is no longer very clear. In this case we have a clear argument to work on the standardized variables.) >tree.height<-tree.height*5280 >tree<-cbind(tree.height,tree.girth) > >#do the PCA >tree.pca<-princomp(tree) > summary(tree.pca) Importance of components: Comp.1 Comp.2 Standard deviation 6.5088696 2.5407042 Proportion of Variance 0.8677775 0.1322225 Cumulative Proportion 0.8677775 1.0000000 > loadings(tree.pca) Loadings: Comp.1 Comp.2 tree.height -0.956 0.293 tree.girth -0.293 -0.956 >biplot(tree.pca,xlabs=tree.vol,col=c("grey","red")) We now see that trees which are tall and have a big girth, are high in volume (bottom left corner), compared to low girth and low height for low volume trees (upper right corner). This intuitively makes sense.
Not normalizing data before PCA gives better explained variance ratio Depends on the goal of your analysis. Some common practices, some of which are mentioned in whuber's link: Standardizing is usually done when the variables on which the PCA is performed are not measu
10,666
Algorithms for Time Series Anomaly Detection
Twitter algorithm is based on Rosner, B., (May 1983), "Percentage Points for a Generalized ESD Many-Outlier Procedure" , Technometrics, 25(2), pp. 165-172 I'm sure there have been many techniques and advances since 1983!. I have tested on my internal data, and Twitter's anomaly detection does not identify obvious outliers. I would use other approaches as well to test for outliers in time series. The best that I have come across is Tsay's outlier detection procedure which is implemented in SAS/SPSS/Autobox and SCA software. All of which are commercial systems. There is also tsoutliers package which is great but needs specification of arima model in order to work efficiently. I have had issues with its default auto.arima with regards to optimization and model selection. Tsay's article is a seminal work in outlier detection in time series. Leading journal in forecasting research International Journal of Forecasting mentioned that Tsay's article is one of the most cited work and most influential papers in an article linked above (also see below). Diffusion of this important work and other outlier detection algorithms in forecasting software(especially in open source software) is a rarity.
Algorithms for Time Series Anomaly Detection
Twitter algorithm is based on Rosner, B., (May 1983), "Percentage Points for a Generalized ESD Many-Outlier Procedure" , Technometrics, 25(2), pp. 165-172 I'm sure there have been many techniques
Algorithms for Time Series Anomaly Detection Twitter algorithm is based on Rosner, B., (May 1983), "Percentage Points for a Generalized ESD Many-Outlier Procedure" , Technometrics, 25(2), pp. 165-172 I'm sure there have been many techniques and advances since 1983!. I have tested on my internal data, and Twitter's anomaly detection does not identify obvious outliers. I would use other approaches as well to test for outliers in time series. The best that I have come across is Tsay's outlier detection procedure which is implemented in SAS/SPSS/Autobox and SCA software. All of which are commercial systems. There is also tsoutliers package which is great but needs specification of arima model in order to work efficiently. I have had issues with its default auto.arima with regards to optimization and model selection. Tsay's article is a seminal work in outlier detection in time series. Leading journal in forecasting research International Journal of Forecasting mentioned that Tsay's article is one of the most cited work and most influential papers in an article linked above (also see below). Diffusion of this important work and other outlier detection algorithms in forecasting software(especially in open source software) is a rarity.
Algorithms for Time Series Anomaly Detection Twitter algorithm is based on Rosner, B., (May 1983), "Percentage Points for a Generalized ESD Many-Outlier Procedure" , Technometrics, 25(2), pp. 165-172 I'm sure there have been many techniques
10,667
Algorithms for Time Series Anomaly Detection
Here are the options for Anomaly Detection in R as of 2017. Twitter's AnomalyDetection Package Works by using Seasonal Hybrid ESD (S-H-ESD); Builds upon the Generalized ESD test for detecting anomalies; Can detect both local and global anomalies; Employing time series decomposition and robust statistical metrics (e.g. median together with ESD) Employs piecewise approximation for long time series; Also has method for when time stamps are not available; Can specify direction of anomalies, window of interest, toggle the piecewise approximation, and has visuals support. anomalyDetection Package (different from Twitter's) various approaches including Mahalanobis distance, factor analysis, Horn's parallel analysis, block inspection, principle components analysis ; Has method for dealing with the results. tsoutliers package Detects outliers in time series following the Chen and Liu procedure (https://www.jstor.org/stable/2290724?seq=1#page_scan_tab_contents); Outliers are obtained based on 'less-contaminated' estimates of model parameters, estimated outlier effects using multiple linear regression, and estimates the model parameters and effects jointly. Considers innovational outliers, additive outliers, level shifts, temporary changes and seasonal level shifts. anomalous-acm Works by computing a vector of features on each time series (e.g. include lag correlation, strength of seasonality, spectral entropy) then applying robust principal component decomposition on the features, and finally applying various bivariate outlier detection methods to the first two principal components; Enables the most unusual series, based on their feature vectors, to be identified; Package contains both real and synthetic datasets from Yahoo. rainbow package Uses bagplots and boxplots; Identifies outliers with lowest depth or density. kmodR package Uses an implementation of k-means proposed by Chawla and Gionis in 2013 (http://epubs.siam.org/doi/pdf/10.1137/1.9781611972832.21); Useful for creating (potentially) tighter clusters than standard k-means and simultaneously finding outliers inexpensively in multidimensional space. washeR method Uses a new non-parametric methodology (https://rivista-statistica.unibo.it/article/viewFile/3617/2968) The CRAN Task view for Robust Statistical Methods A variety of approaches for using robust statistical methods to detect outliers. EDIT 2018 anomalize: Tidy Anomaly Detection
Algorithms for Time Series Anomaly Detection
Here are the options for Anomaly Detection in R as of 2017. Twitter's AnomalyDetection Package Works by using Seasonal Hybrid ESD (S-H-ESD); Builds upon the Generalized ESD test for detecting anomali
Algorithms for Time Series Anomaly Detection Here are the options for Anomaly Detection in R as of 2017. Twitter's AnomalyDetection Package Works by using Seasonal Hybrid ESD (S-H-ESD); Builds upon the Generalized ESD test for detecting anomalies; Can detect both local and global anomalies; Employing time series decomposition and robust statistical metrics (e.g. median together with ESD) Employs piecewise approximation for long time series; Also has method for when time stamps are not available; Can specify direction of anomalies, window of interest, toggle the piecewise approximation, and has visuals support. anomalyDetection Package (different from Twitter's) various approaches including Mahalanobis distance, factor analysis, Horn's parallel analysis, block inspection, principle components analysis ; Has method for dealing with the results. tsoutliers package Detects outliers in time series following the Chen and Liu procedure (https://www.jstor.org/stable/2290724?seq=1#page_scan_tab_contents); Outliers are obtained based on 'less-contaminated' estimates of model parameters, estimated outlier effects using multiple linear regression, and estimates the model parameters and effects jointly. Considers innovational outliers, additive outliers, level shifts, temporary changes and seasonal level shifts. anomalous-acm Works by computing a vector of features on each time series (e.g. include lag correlation, strength of seasonality, spectral entropy) then applying robust principal component decomposition on the features, and finally applying various bivariate outlier detection methods to the first two principal components; Enables the most unusual series, based on their feature vectors, to be identified; Package contains both real and synthetic datasets from Yahoo. rainbow package Uses bagplots and boxplots; Identifies outliers with lowest depth or density. kmodR package Uses an implementation of k-means proposed by Chawla and Gionis in 2013 (http://epubs.siam.org/doi/pdf/10.1137/1.9781611972832.21); Useful for creating (potentially) tighter clusters than standard k-means and simultaneously finding outliers inexpensively in multidimensional space. washeR method Uses a new non-parametric methodology (https://rivista-statistica.unibo.it/article/viewFile/3617/2968) The CRAN Task view for Robust Statistical Methods A variety of approaches for using robust statistical methods to detect outliers. EDIT 2018 anomalize: Tidy Anomaly Detection
Algorithms for Time Series Anomaly Detection Here are the options for Anomaly Detection in R as of 2017. Twitter's AnomalyDetection Package Works by using Seasonal Hybrid ESD (S-H-ESD); Builds upon the Generalized ESD test for detecting anomali
10,668
Algorithms for Time Series Anomaly Detection
I've come across a few sources that may help you but they won't be as easy/convenient as running an R script over your data: Numenta have a open-sourced their NuPIC platform that is used for many things including anomaly detection. Netflix's Atlas Project will soon release an open-source outlier/anomaly detection tool. Prelert have an anomaly detection engine that comes as a server-side application. Their trial offers limited usage which may satisfy your needs.
Algorithms for Time Series Anomaly Detection
I've come across a few sources that may help you but they won't be as easy/convenient as running an R script over your data: Numenta have a open-sourced their NuPIC platform that is used for many thi
Algorithms for Time Series Anomaly Detection I've come across a few sources that may help you but they won't be as easy/convenient as running an R script over your data: Numenta have a open-sourced their NuPIC platform that is used for many things including anomaly detection. Netflix's Atlas Project will soon release an open-source outlier/anomaly detection tool. Prelert have an anomaly detection engine that comes as a server-side application. Their trial offers limited usage which may satisfy your needs.
Algorithms for Time Series Anomaly Detection I've come across a few sources that may help you but they won't be as easy/convenient as running an R script over your data: Numenta have a open-sourced their NuPIC platform that is used for many thi
10,669
Algorithms for Time Series Anomaly Detection
Autobox(my company) provides outlier detection. Twitter's algorithm gets the big outliers, but misses the smaller ones compared to Autobox. It takes a long time to run, but the results are better for finding the smaller outliers and also changes in the seasonality which are also outliers. Below is the model finding 79 outliers using the first 8,560 observations of 14,398 original observations. The standard version max's out at 10,000 observations, but it could be modified for more, but there is no real reason to have that much data anyway when you want to identify and respond to outliers. We were influenced by the work done by Tsay on outliers, level shifts, and variance change and Chow's work on parameter changes along with our own work on detecting changes in seasonality, If you download the 30 day trial and load in the Twitter example data and specify the frequency to be 60 and save 3 trigger files in the installation folder (noparcon.afs, novarcon.afs, notrend.afs) and create a file called stepupde.afs with 100.
Algorithms for Time Series Anomaly Detection
Autobox(my company) provides outlier detection. Twitter's algorithm gets the big outliers, but misses the smaller ones compared to Autobox. It takes a long time to run, but the results are better for
Algorithms for Time Series Anomaly Detection Autobox(my company) provides outlier detection. Twitter's algorithm gets the big outliers, but misses the smaller ones compared to Autobox. It takes a long time to run, but the results are better for finding the smaller outliers and also changes in the seasonality which are also outliers. Below is the model finding 79 outliers using the first 8,560 observations of 14,398 original observations. The standard version max's out at 10,000 observations, but it could be modified for more, but there is no real reason to have that much data anyway when you want to identify and respond to outliers. We were influenced by the work done by Tsay on outliers, level shifts, and variance change and Chow's work on parameter changes along with our own work on detecting changes in seasonality, If you download the 30 day trial and load in the Twitter example data and specify the frequency to be 60 and save 3 trigger files in the installation folder (noparcon.afs, novarcon.afs, notrend.afs) and create a file called stepupde.afs with 100.
Algorithms for Time Series Anomaly Detection Autobox(my company) provides outlier detection. Twitter's algorithm gets the big outliers, but misses the smaller ones compared to Autobox. It takes a long time to run, but the results are better for
10,670
Algorithms for Time Series Anomaly Detection
In Python, the Anomaly Detection Toolkit (ADTK) provides really a nice interface and suit of functions. This talk from 2019 provides a walkthrough of the features, but essentially the same material can be found in the examples in the docs. The package provides 13 built-in methods for detection ranging from the very simple, e.g. thresholds, to the complex e.g. PCA residuals or changes in variability: There are also nice plotting abilities and functions to deal with typical things like seasonality.
Algorithms for Time Series Anomaly Detection
In Python, the Anomaly Detection Toolkit (ADTK) provides really a nice interface and suit of functions. This talk from 2019 provides a walkthrough of the features, but essentially the same material ca
Algorithms for Time Series Anomaly Detection In Python, the Anomaly Detection Toolkit (ADTK) provides really a nice interface and suit of functions. This talk from 2019 provides a walkthrough of the features, but essentially the same material can be found in the examples in the docs. The package provides 13 built-in methods for detection ranging from the very simple, e.g. thresholds, to the complex e.g. PCA residuals or changes in variability: There are also nice plotting abilities and functions to deal with typical things like seasonality.
Algorithms for Time Series Anomaly Detection In Python, the Anomaly Detection Toolkit (ADTK) provides really a nice interface and suit of functions. This talk from 2019 provides a walkthrough of the features, but essentially the same material ca
10,671
How to whiten the data using principal component analysis?
First, you get the mean zero by subtracting the mean $\boldsymbol \mu = \frac{1}{N}\sum \mathbf{x}$. Second, you get the covariances zero by doing PCA. If $\boldsymbol \Sigma$ is the covariance matrix of your data, then PCA amounts to performing an eigendecomposition $\boldsymbol \Sigma = \mathbf{U} \boldsymbol \Lambda \mathbf{U}^\top$, where $\mathbf{U}$ is an orthogonal rotation matrix composed of eigenvectors of $\boldsymbol \Sigma$, and $\boldsymbol \Lambda$ is a diagonal matrix with eigenvalues on the diagonal. Matrix $\mathbf{U}^\top$ gives a rotation needed to de-correlate the data (i.e. maps the original features to principal components). Third, after the rotation each component will have variance given by a corresponding eigenvalue. So to make variances equal to $1$, you need to divide by the square root of $\boldsymbol \Lambda$. All together, the whitening transformation is $\mathbf{x} \mapsto \boldsymbol \Lambda^{-1/2} \mathbf{U}^\top (\mathbf{x} - \boldsymbol \mu)$. You can open the brackets to get the form you are looking for. Update. See also this later thread for more details: What is the difference between ZCA whitening and PCA whitening?
How to whiten the data using principal component analysis?
First, you get the mean zero by subtracting the mean $\boldsymbol \mu = \frac{1}{N}\sum \mathbf{x}$. Second, you get the covariances zero by doing PCA. If $\boldsymbol \Sigma$ is the covariance matrix
How to whiten the data using principal component analysis? First, you get the mean zero by subtracting the mean $\boldsymbol \mu = \frac{1}{N}\sum \mathbf{x}$. Second, you get the covariances zero by doing PCA. If $\boldsymbol \Sigma$ is the covariance matrix of your data, then PCA amounts to performing an eigendecomposition $\boldsymbol \Sigma = \mathbf{U} \boldsymbol \Lambda \mathbf{U}^\top$, where $\mathbf{U}$ is an orthogonal rotation matrix composed of eigenvectors of $\boldsymbol \Sigma$, and $\boldsymbol \Lambda$ is a diagonal matrix with eigenvalues on the diagonal. Matrix $\mathbf{U}^\top$ gives a rotation needed to de-correlate the data (i.e. maps the original features to principal components). Third, after the rotation each component will have variance given by a corresponding eigenvalue. So to make variances equal to $1$, you need to divide by the square root of $\boldsymbol \Lambda$. All together, the whitening transformation is $\mathbf{x} \mapsto \boldsymbol \Lambda^{-1/2} \mathbf{U}^\top (\mathbf{x} - \boldsymbol \mu)$. You can open the brackets to get the form you are looking for. Update. See also this later thread for more details: What is the difference between ZCA whitening and PCA whitening?
How to whiten the data using principal component analysis? First, you get the mean zero by subtracting the mean $\boldsymbol \mu = \frac{1}{N}\sum \mathbf{x}$. Second, you get the covariances zero by doing PCA. If $\boldsymbol \Sigma$ is the covariance matrix
10,672
What to learn after Casella & Berger?
I do not think I will be able to give regular time investment to continue learning data analysis I don't think Casella & Berger is a place to learn data much in the way of data analysis. It's a place to learn some of the tools of statistical theory. My experience so far telling me to be a statistican one needs to bear with a lot of tedious computation involving various distributions(Weibull, Cauchy, t, F...). I've spent a lot of time as a statistician doing data analysis. It rarely (almost never) involves me doing tedious calculation. It sometimes involves a little simple algebra, but the common problems are usually solved and I don't need to expend any effort on replicating that each time. The computer does all the tedious calculation. If I am in a situation where I'm not prepared to assume a reasonably standard case (e.g. not prepared to use a GLM), I generally don't have enough information to assume any other distribution either, so the question of the calculations in LRT is usually moot (I can do them when I need to, they just either tend to be already solved or come up so rarely that it's an interesting diversion). I tend to do a lot of simulation; I also frequently try to use resampling in some form either alongside or in place of parametric assumptions. Will I need to spend 20hr+ per week on it like I used to be? It depends on what you want to be able to do and how soon you want to get good at it. Data analysis is a skill, and it takes practice and a large base of knowledge. You'll have some of the knowledge you need already. If you want to be a good practitioner at a wide variety of things, it will take a lot of time - but to my mind it's a lot more fun than the algebra and such of doing Casella and Berger exercises. Some of the skills I built up on say regression problems are helpful with time series, say -- but a lot of new skills are needed. So learning to interpret residual plots and QQ plots is handy, but they don't tell me how much I need to worry about a little bump in a PACF plot and don't give me tools like the use of one-step-ahead prediction errors. So for example, I don't need to expend effort figuring out how to do reasonably ML for typical gamma or weibull models, because they're standard enough to be solved problems that have already been largely put into a convenient form. If you come to do research, you'll need a lot more of the skills you pick up in places like Casella & Berger (but even with those kind of skills, you should also read more than one book). Some suggested things: You should definitely build up some regression skills, even if you do nothing else. There are a number of quite good books, but perhaps Draper & Smith Applied Regression Analysis plus Fox and Weisberg An R Companion to Applied Regression; I'd also suggest you consider following with Harrell's Regression Modelling Strategies (You could substitute any number of good books for Draper and Smith - find one or two that suit you.) The second book has a number of online additional chapters that are very much worth reading (and its own R-package) -- A good second serving would be Venables & Ripley's Modern Applied Statistics with S. That's some grounding in a fairly broad swathe of ideas. It may turn out that you need some more basic material in some topics (I don't know your background). Then you'd need to start thinking about what areas of statistics you want/need -- Bayesian stats, time series, multivariate analysis, etc etc
What to learn after Casella & Berger?
I do not think I will be able to give regular time investment to continue learning data analysis I don't think Casella & Berger is a place to learn data much in the way of data analysis. It's a place
What to learn after Casella & Berger? I do not think I will be able to give regular time investment to continue learning data analysis I don't think Casella & Berger is a place to learn data much in the way of data analysis. It's a place to learn some of the tools of statistical theory. My experience so far telling me to be a statistican one needs to bear with a lot of tedious computation involving various distributions(Weibull, Cauchy, t, F...). I've spent a lot of time as a statistician doing data analysis. It rarely (almost never) involves me doing tedious calculation. It sometimes involves a little simple algebra, but the common problems are usually solved and I don't need to expend any effort on replicating that each time. The computer does all the tedious calculation. If I am in a situation where I'm not prepared to assume a reasonably standard case (e.g. not prepared to use a GLM), I generally don't have enough information to assume any other distribution either, so the question of the calculations in LRT is usually moot (I can do them when I need to, they just either tend to be already solved or come up so rarely that it's an interesting diversion). I tend to do a lot of simulation; I also frequently try to use resampling in some form either alongside or in place of parametric assumptions. Will I need to spend 20hr+ per week on it like I used to be? It depends on what you want to be able to do and how soon you want to get good at it. Data analysis is a skill, and it takes practice and a large base of knowledge. You'll have some of the knowledge you need already. If you want to be a good practitioner at a wide variety of things, it will take a lot of time - but to my mind it's a lot more fun than the algebra and such of doing Casella and Berger exercises. Some of the skills I built up on say regression problems are helpful with time series, say -- but a lot of new skills are needed. So learning to interpret residual plots and QQ plots is handy, but they don't tell me how much I need to worry about a little bump in a PACF plot and don't give me tools like the use of one-step-ahead prediction errors. So for example, I don't need to expend effort figuring out how to do reasonably ML for typical gamma or weibull models, because they're standard enough to be solved problems that have already been largely put into a convenient form. If you come to do research, you'll need a lot more of the skills you pick up in places like Casella & Berger (but even with those kind of skills, you should also read more than one book). Some suggested things: You should definitely build up some regression skills, even if you do nothing else. There are a number of quite good books, but perhaps Draper & Smith Applied Regression Analysis plus Fox and Weisberg An R Companion to Applied Regression; I'd also suggest you consider following with Harrell's Regression Modelling Strategies (You could substitute any number of good books for Draper and Smith - find one or two that suit you.) The second book has a number of online additional chapters that are very much worth reading (and its own R-package) -- A good second serving would be Venables & Ripley's Modern Applied Statistics with S. That's some grounding in a fairly broad swathe of ideas. It may turn out that you need some more basic material in some topics (I don't know your background). Then you'd need to start thinking about what areas of statistics you want/need -- Bayesian stats, time series, multivariate analysis, etc etc
What to learn after Casella & Berger? I do not think I will be able to give regular time investment to continue learning data analysis I don't think Casella & Berger is a place to learn data much in the way of data analysis. It's a place
10,673
What to learn after Casella & Berger?
My advice, coming from the opposite perspective (Stats PhD student) is to work through a regression textbook. This seems a natural starting point for someone with a solid theoretical background without any applied experience. I know many graduate students from outside our department start in a regression course. A good one is Sanford Weisberg's Applied Linear Regression. I believe it's on its fourth version. You could probably find relatively cheap older versions. http://users.stat.umn.edu/~sandy/alr4ed/ One nice thing about this textbook, particularly given your relative inexperience with R, is the R primer available via the above link. It provides sufficient instruction to recreate everything done in the book. This way, you can actually learn regression (in addition to some basics of GLM), without your lack of R programming holding you back (and you'll probably pick up many of the R basics along the way). If you want a comprehensive introduction to R, you may be better served going through Fox and Weisberg's An R Companion to Applied Regression, but it sounds like you would rather learn statistics than programming (if those two things can be thought of separately). As far as your time commitment concern, I really don't think you would find this textbook or material overly difficult. Unlike Casella-Berger, there won't be much in the way of proofs or derivations. It's generally pretty straightforward. As an aside, there seem to be solutions floating around online (or were at some point), so you could attempt problems, check solutions, and kind of speed work your way through the book.
What to learn after Casella & Berger?
My advice, coming from the opposite perspective (Stats PhD student) is to work through a regression textbook. This seems a natural starting point for someone with a solid theoretical background withou
What to learn after Casella & Berger? My advice, coming from the opposite perspective (Stats PhD student) is to work through a regression textbook. This seems a natural starting point for someone with a solid theoretical background without any applied experience. I know many graduate students from outside our department start in a regression course. A good one is Sanford Weisberg's Applied Linear Regression. I believe it's on its fourth version. You could probably find relatively cheap older versions. http://users.stat.umn.edu/~sandy/alr4ed/ One nice thing about this textbook, particularly given your relative inexperience with R, is the R primer available via the above link. It provides sufficient instruction to recreate everything done in the book. This way, you can actually learn regression (in addition to some basics of GLM), without your lack of R programming holding you back (and you'll probably pick up many of the R basics along the way). If you want a comprehensive introduction to R, you may be better served going through Fox and Weisberg's An R Companion to Applied Regression, but it sounds like you would rather learn statistics than programming (if those two things can be thought of separately). As far as your time commitment concern, I really don't think you would find this textbook or material overly difficult. Unlike Casella-Berger, there won't be much in the way of proofs or derivations. It's generally pretty straightforward. As an aside, there seem to be solutions floating around online (or were at some point), so you could attempt problems, check solutions, and kind of speed work your way through the book.
What to learn after Casella & Berger? My advice, coming from the opposite perspective (Stats PhD student) is to work through a regression textbook. This seems a natural starting point for someone with a solid theoretical background withou
10,674
What to learn after Casella & Berger?
I'm trying in a roundabout way to be more of a statistician myself, but I'm primarily a psychologist who happens to have some quantitative and methodological interests. To do psychometric work properly, I've been studying advanced (for a psychologist) methods that I wouldn't dream of calculating manually (much less would I know how). I've been surprised at how accessible and convenient these methods have become through all the dedicated efforts of R package programmers over the past decade. I've been doing real-life analysis with new methods that I've learned to use in much less than 20 hours per method...I might spend that much time on a new method by the time I'm ready to publish a result using it, but there's certainly no need to make a part-time job of studying just to make progress like I have. Do what you can as you find the time for it; it's not an all-or-nothing pursuit if you don't need it to be. I certainly haven't focused exclusively on any topic, let alone families of distributions; I doubt that any honest-to-goodness statistician would study so narrowly either. I've dabbled in theoretical distributions for maybe an hour per day on a few occasions over the past week; that's been plenty to prove useful in real data applications. As far as I can tell, the idea isn't so much to classify distributions strictly; it's to recognize distribution shapes that resemble theories and use them to help decide the appropriate analyses and understand basic dynamics. I've shared similar thoughts on my most recent answer to "Is it better to select distributions based on theory, fit or something else?" You haven't said what analysis you want to perform in what I assume was your hypothetical worst- case scenario, but there are ways to study the sensitivity of any analysis to sampling error. If the CLT doesn't apply, there are still several statistical questions you can ask if you know how. Nonparametric methods generally make very limited assumptions about distributions, so prior knowledge of the shape of a population's distribution isn't necessarily a major problem. Knowledge in general doesn't really evaporate all that quickly or completely, but if you don't use it, you will find it harder to recall freely. You will retain a recognition advantage much longer, which could still come in handy if you ever need to study topics you've studied several years before...but if you want to remain fluent in what you've learned, keep on using it, and keep on learning! R is definitely a good place to invest any spare study time you have. It should help with your pure math too: see another of my recent answers to "Best open source data visualization software to use with PowerPoint."
What to learn after Casella & Berger?
I'm trying in a roundabout way to be more of a statistician myself, but I'm primarily a psychologist who happens to have some quantitative and methodological interests. To do psychometric work properl
What to learn after Casella & Berger? I'm trying in a roundabout way to be more of a statistician myself, but I'm primarily a psychologist who happens to have some quantitative and methodological interests. To do psychometric work properly, I've been studying advanced (for a psychologist) methods that I wouldn't dream of calculating manually (much less would I know how). I've been surprised at how accessible and convenient these methods have become through all the dedicated efforts of R package programmers over the past decade. I've been doing real-life analysis with new methods that I've learned to use in much less than 20 hours per method...I might spend that much time on a new method by the time I'm ready to publish a result using it, but there's certainly no need to make a part-time job of studying just to make progress like I have. Do what you can as you find the time for it; it's not an all-or-nothing pursuit if you don't need it to be. I certainly haven't focused exclusively on any topic, let alone families of distributions; I doubt that any honest-to-goodness statistician would study so narrowly either. I've dabbled in theoretical distributions for maybe an hour per day on a few occasions over the past week; that's been plenty to prove useful in real data applications. As far as I can tell, the idea isn't so much to classify distributions strictly; it's to recognize distribution shapes that resemble theories and use them to help decide the appropriate analyses and understand basic dynamics. I've shared similar thoughts on my most recent answer to "Is it better to select distributions based on theory, fit or something else?" You haven't said what analysis you want to perform in what I assume was your hypothetical worst- case scenario, but there are ways to study the sensitivity of any analysis to sampling error. If the CLT doesn't apply, there are still several statistical questions you can ask if you know how. Nonparametric methods generally make very limited assumptions about distributions, so prior knowledge of the shape of a population's distribution isn't necessarily a major problem. Knowledge in general doesn't really evaporate all that quickly or completely, but if you don't use it, you will find it harder to recall freely. You will retain a recognition advantage much longer, which could still come in handy if you ever need to study topics you've studied several years before...but if you want to remain fluent in what you've learned, keep on using it, and keep on learning! R is definitely a good place to invest any spare study time you have. It should help with your pure math too: see another of my recent answers to "Best open source data visualization software to use with PowerPoint."
What to learn after Casella & Berger? I'm trying in a roundabout way to be more of a statistician myself, but I'm primarily a psychologist who happens to have some quantitative and methodological interests. To do psychometric work properl
10,675
What to learn after Casella & Berger?
I stumbled upon this one in 2019. My two cents. I'm a statistics professor with an inclination to do data analysis of various kinds (that's why I chose statistics!). To pick up some practical knowledge, I recommend James, Witten, Hastie and Tibshirani "An Introduction to Statistical Learning". They even have a MOOC based on that. The book uses a lot of "real data" examples and is also R-based.
What to learn after Casella & Berger?
I stumbled upon this one in 2019. My two cents. I'm a statistics professor with an inclination to do data analysis of various kinds (that's why I chose statistics!). To pick up some practical knowled
What to learn after Casella & Berger? I stumbled upon this one in 2019. My two cents. I'm a statistics professor with an inclination to do data analysis of various kinds (that's why I chose statistics!). To pick up some practical knowledge, I recommend James, Witten, Hastie and Tibshirani "An Introduction to Statistical Learning". They even have a MOOC based on that. The book uses a lot of "real data" examples and is also R-based.
What to learn after Casella & Berger? I stumbled upon this one in 2019. My two cents. I'm a statistics professor with an inclination to do data analysis of various kinds (that's why I chose statistics!). To pick up some practical knowled
10,676
What to learn after Casella & Berger?
Answering for others who come to this question later… real life data analysis Learn databases (SQL), dplyr/pandas, unix tools (sed, grep), scraping, scripting, data cleaning, and software testing. The various specialised distributions have little value in industry. An applied regression book like Angrist & Pischke, Faraway, or Weisberg, will be a more practical kind of theory. most of the time we do not know what the distribution is for real life data, so what is the purpose for us to focus exclusively on various families of distributions Hence the interest in nonparametric statistics. But at the same time nonparametric with no assumptions is too loose. To answer your question, the specialised families can be thought of as answers to simple questions that you might, maybe come across. For example I think of a Gaussian as a "smooth" point-estimate. Poisson answers another simple question. When people build mathematical models these special can be useful fulcrum points. (But academics do often take the quest for the master distribution the wrong way.) OP: Hope you had fun with your PhD research!
What to learn after Casella & Berger?
Answering for others who come to this question later… real life data analysis Learn databases (SQL), dplyr/pandas, unix tools (sed, grep), scraping, scripting, data cleaning, and software testing.
What to learn after Casella & Berger? Answering for others who come to this question later… real life data analysis Learn databases (SQL), dplyr/pandas, unix tools (sed, grep), scraping, scripting, data cleaning, and software testing. The various specialised distributions have little value in industry. An applied regression book like Angrist & Pischke, Faraway, or Weisberg, will be a more practical kind of theory. most of the time we do not know what the distribution is for real life data, so what is the purpose for us to focus exclusively on various families of distributions Hence the interest in nonparametric statistics. But at the same time nonparametric with no assumptions is too loose. To answer your question, the specialised families can be thought of as answers to simple questions that you might, maybe come across. For example I think of a Gaussian as a "smooth" point-estimate. Poisson answers another simple question. When people build mathematical models these special can be useful fulcrum points. (But academics do often take the quest for the master distribution the wrong way.) OP: Hope you had fun with your PhD research!
What to learn after Casella & Berger? Answering for others who come to this question later… real life data analysis Learn databases (SQL), dplyr/pandas, unix tools (sed, grep), scraping, scripting, data cleaning, and software testing.
10,677
Why using Newton's method for logistic regression optimization is called iterative re-weighted least squares?
Summary: GLMs are fit via Fisher scoring which, as Dimitriy V. Masterov notes, is Newton-Raphson with the expected Hessian instead (i.e. we use an estimate of the Fisher information instead of the observed information). If we are using the canonical link function it turns out that the observed Hessian equals the expected Hessian so NR and Fisher scoring are the same in that case. Either way, we'll see that Fisher scoring is actually fitting a weighted least squares linear model, and the coefficient estimates from this converge* on a maximum of the logistic regression likelihood. Aside from reducing fitting a logistic regression to an already solved problem, we also get the benefit of being able to use linear regression diagnostics on the final WLS fit to learn about our logistic regression. I'm going to keep this focused on logistic regression, but for a more general perspective on maximum likelihood in GLMs I recommend section 15.3 of this chapter which goes through this and derives IRLS in a more general setting (I think it's from John Fox's Applied Regression Analysis and Generalized Linear Models). $^*$ see comments at the end The likelihood and score function We will be fitting our GLM by iterating something of the form $$ b^{(m+1)} = b^{(m)} - J^{-1}_{(m)}\nabla \ell(b^{(m)}) $$ where $\ell$ is the log likelihood and $J_{m}$ will be either the observed or expected Hessian of the log likelihood. Our link function is a function $g$ that maps the conditional mean $\mu_i = E(y_i | x_i)$ to our linear predictor, so our model for the mean is $g(\mu_i) = x_i^T\beta$. Let $h$ be the inverse link function mapping the linear predictor to the mean. For a logistic regression we have a Bernoulli likelihood with independent observations so $$ \ell(b; y) = \sum_{i=1}^n y_i\log h(x_i^T b) + (1 - y_i) \log(1 - h(x_i^Tb)). $$ Taking derivatives, $$ \frac{\partial \ell}{\partial b_j} = \sum_{i=1}^n \frac{y_i}{h(x_i^T b)} h'(x_i^T b) x_{ij} - \frac{1 - y_i}{1 - h(x_i^T b)} h'(x_i^T b) x_{ij} $$ $$ = \sum_{i=1}^n x_{ij} h'(x_i^T b) \left(\frac{y_i}{h(x_i^T b)} - \frac{1 - y_i}{1 - h(x_i^T b)} \right) $$ $$ = \sum_i x_{ij} \frac{h'(x_i^T b)}{h(x_i^T b)(1 - h(x_i^T b))}(y_i - h(x_i^T b)). $$ Using the canonical link Now let's suppose we're using the canonical link function $g_c = \text{logit}$. Then $g^{-1}_c(x) := h_c(x) = \frac{1}{1+e^{-x}}$ so $h_c' = h_c \cdot (1-h_c)$ which means this simplifies to $$ \frac{\partial \ell}{\partial b_j} = \sum_i x_{ij} (y_i - h_c(x_i^T b)) $$ so $$ \nabla \ell (b; y) = X^T (y - \hat y). $$ Furthermore, still using $h_c$, $$ \frac{\partial^2 \ell}{\partial b_k \partial b_j} = - \sum_i x_{ij} \frac{\partial}{\partial b_k} h_c(x_i^T b) = - \sum_i x_{ij}x_{ik} \left[h_c(x_i^T b) (1 - h_c(x_i^T b))\right]. $$ Let $$ W = \text{diag}\left(h_c(x_1^T b)(1 - h_c(x_1^T b)), \dots, h_c(x_n^T b)(1 - h_c(x_n^T b))\right) = \text{diag}\left(\hat y_1(1 - \hat y_1), \dots, \hat y_n (1 - \hat y_n)\right). $$ Then we have $$ H = -X^TWX $$ and note how this doesn't have any $y_i$ in it anymore, so $E(H) = H$ (we're viewing this as a function of $b$ so the only random thing is $y$ itself). Thus we've shown that Fisher scoring is equivalent to Newton-Raphson when we use the canonical link in logistic regression. Also by virtue of $\hat y_i \in (0,1)$ $-X^TWX$ will always be strictly negative definite, although numerically if $\hat y_i$ gets too close to $0$ or $1$ then we may have weights round to $0$ which can make $H$ negative semidefinite and therefore computationally singular. Now create the working response $z = W^{-1}(y - \hat y)$ and note that $$ \nabla \ell = X^T(y - \hat y) = X^T W z. $$ All together this means that we can optimize the log likelihood by iterating $$ b^{(m+1)} = b^{(m)} + (X^T W_{(m)} X)^{-1}X^T W_{(m)} z_{(m)} $$ and $(X^T W_{(m)} X)^{-1}X^T W_{(m)} z_{(m)}$ is exactly $\hat \beta$ for a weighted least squares regression of $z_{(m)}$ on $X$. Checking this in R: set.seed(123) p <- 5 n <- 500 x <- matrix(rnorm(n * p), n, p) betas <- runif(p, -2, 2) hc <- function(x) 1 /(1 + exp(-x)) # inverse canonical link p.true <- hc(x %*% betas) y <- rbinom(n, 1, p.true) # fitting with our procedure my_IRLS_canonical <- function(x, y, b.init, hc, tol=1e-8) { change <- Inf b.old <- b.init while(change > tol) { eta <- x %*% b.old # linear predictor y.hat <- hc(eta) h.prime_eta <- y.hat * (1 - y.hat) z <- (y - y.hat) / h.prime_eta b.new <- b.old + lm(z ~ x - 1, weights = h.prime_eta)$coef # WLS regression change <- sqrt(sum((b.new - b.old)^2)) b.old <- b.new } b.new } my_IRLS_canonical(x, y, rep(1,p), hc) # x1 x2 x3 x4 x5 # -1.1149687 2.1897992 1.0271298 0.8702975 -1.2074851 glm(y ~ x - 1, family=binomial())$coef # x1 x2 x3 x4 x5 # -1.1149687 2.1897992 1.0271298 0.8702975 -1.2074851 and they agree. Non-canonical link functions Now if we're not using the canonical link we don't get the simplification of $\frac{h'}{h(1-h)} = 1$ in $\nabla \ell$ so $H$ becomes much more complicated, and we therefore see a noticeable difference by using $E(H)$ in our Fisher scoring. Here's how this will go: we already worked out the general $\nabla \ell$ so the Hessian will be the main difficulty. We need $$ \frac{\partial^2 \ell}{\partial b_k \partial b_j} = \sum_i x_{ij} \frac{\partial}{\partial b_k}h'(x_i^T b) \left(\frac{y_i}{h(x_i^T b)} - \frac{1 - y_i}{1 - h(x_i^T b)} \right) $$ $$ = \sum_i x_{ij}x_{ik} \left[h''(x_i^T b) \left(\frac{y_i}{h(x_i^T b)} - \frac{1 - y_i}{1 - h(x_i^T b)} \right) - h'(x_i^T b)^2\left(\frac{y_i}{h(x_i^T b)^2} + \frac{1-y_i}{(1-h(x_i^T b))^2} \right)\right] $$ Via the linearity of expectation all we need to do to get $E(H)$ is replace each occurrence of $y_i$ with its mean under our model which is $\mu_i=h(x_i^T\beta)$. Each term in the summand will therefore contain a factor of the form $$ h''(x_i^T b) \left(\frac{h(x_i^T \beta)}{h(x_i^T b)} - \frac{1 - h(x_i^T \beta)}{1 - h(x_i^T b)} \right) - h'(x_i^T b)^2\left(\frac{h(x_i^T \beta)}{h(x_i^T b)^2} + \frac{1-h(x_i^T \beta)}{(1-h(x_i^T b))^2} \right). $$ But to actually do our optimization we'll need to estimate each $\beta$, and at step $m$ $b^{(m)}$ is the best guess we have. This means that this will reduce to $$ h''(x_i^T b) \left(\frac{h(x_i^T b)}{h(x_i^T b)} - \frac{1 - h(x_i^T b)}{1 - h(x_i^T b)} \right) - h'(x_i^T b)^2\left(\frac{h(x_i^T b)}{h(x_i^T b)^2} + \frac{1-h(x_i^T b)}{(1-h(x_i^T b))^2} \right) $$ $$ = - h'(x_i^T b)^2\left(\frac{1}{h(x_i^T b)} + \frac{1}{1-h(x_i^T b)} \right) $$ $$ = -\frac{h'(x_i^T b)^2}{h(x_i^T b)(1-h(x_i^T b))}. $$ This means we will use $J$ with $$ J_{jk} = -\sum_i x_{ij}x_{ik} \frac{h'(x_i^T b)^2}{h(x_i^T b)(1-h(x_i^T b))}. $$ Now let $$ W^* = \text{diag}\left(\frac{h'(x_1^T b)^2}{h(x_1^T b)(1-h(x_1^T b))} ,\dots, \frac{h'(x_n^T b)^2}{h(x_n^T b)(1-h(x_n^T b))}\right) $$ and note how under the canonical link $h_c' = h_c \cdot (1-h_c)$ reduces $W^*$ to $W$ from the previous section. This lets us write $$ J = -X^TW^*X $$ except this is now $\hat E(H)$ rather than necessarily being $H$ itself, so this can differ from Newton-Raphson. For all $i$ $W_{ii}^* > 0$ so aside from numerical issues $J$ will be negative definite. We have $$ \frac{\partial \ell}{\partial b_j} = \sum_i x_{ij} \frac{h'(x_i^T b)}{h(x_i^T b)(1 - h(x_i^T b))}(y_i - h(x_i^T b)) $$ so letting our new working response be $z^* = D^{-1}(y-\hat y)$ with $D=\text{diag}\left(h'(x_1^T b), \dots, h'(x_n^T b)\right)$, we have $\nabla \ell = X^TW^*z^*$. All together we are iterating $$ b^{(m+1)} = b^{(m)} + (X^T W_{(m)}^* X)^{-1}X^T W_{(m)}^* z_{(m)}^* $$ so this is still a sequence of WLS regressions except now it's not necessarily Newton-Raphson. I've written it out this way to emphasize the connection to Newton-Raphson, but frequently people will factor the updates so that each new point $b^{(m+1)}$ is itself the WLS solution, rather than a WLS solution added to the current point $b^{(m)}$. If we wanted to do this, we can do the following: $$ b^{(m+1)} = b^{(m)} + (X^T W_{(m)}^* X)^{-1}X^T W_{(m)}^* z_{(m)}^* $$ $$ = (X^T W_{(m)}^* X)^{-1}\left(X^T W_{(m)}^* Xb^{(m)}+ X^TW^*_{(m)}z_{(m)}^* \right) $$ $$ = (X^T W_{(m)}^* X)^{-1}X^TW_{(m)}^*\left(Xb^{(m)}+ z_{(m)}^* \right) $$ so if we're going this way you'll see the working response take the form $\eta^{(m)} + D^{-1}_{(m)}(y - \hat y^{(m)})$, but it's the same thing. Let's confirm that this works by using it to perform a probit regression on the same simulated data as before (and this is not the canonical link, so we need this more general form of IRLS). my_IRLS_general <- function(x, y, b.init, h, h.prime, tol=1e-8) { change <- Inf b.old <- b.init while(change > tol) { eta <- x %*% b.old # linear predictor y.hat <- h(eta) h.prime_eta <- h.prime(eta) w_star <- h.prime_eta^2 / (y.hat * (1 - y.hat)) z_star <- (y - y.hat) / h.prime_eta b.new <- b.old + lm(z_star ~ x - 1, weights = w_star)$coef # WLS change <- sqrt(sum((b.new - b.old)^2)) b.old <- b.new } b.new } # probit inverse link and derivative h_probit <- function(x) pnorm(x, 0, 1) h.prime_probit <- function(x) dnorm(x, 0, 1) my_IRLS_general(x, y, rep(0,p), h_probit, h.prime_probit) # x1 x2 x3 x4 x5 # -0.6456508 1.2520266 0.5820856 0.4982678 -0.6768585 glm(y~x-1, family=binomial(link="probit"))$coef # x1 x2 x3 x4 x5 # -0.6456490 1.2520241 0.5820835 0.4982663 -0.6768581 and again the two agree. Comments on convergence Finally, a few quick comments on convergence (I'll keep this brief as this is getting really long and I'm no expert at optimization). Even though theoretically each $J_{(m)}$ is negative definite, bad initial conditions can still prevent this algorithm from converging. In the probit example above, changing the initial conditions to b.init=rep(1,p) results in this, and that doesn't even look like a suspicious initial condition. If you step through the IRLS procedure with that initialization and these simulated data, by the second time through the loop there are some $\hat y_i$ that round to exactly $1$ and so the weights become undefined. If we're using the canonical link in the algorithm I gave we won't ever be dividing by $\hat y_i (1 - \hat y_i)$ to get undefined weights, but if we've got a situation where some $\hat y_i$ are approaching $0$ or $1$, such as in the case of perfect separation, then we'll still get non-convergence as the gradient dies without us reaching anything.
Why using Newton's method for logistic regression optimization is called iterative re-weighted least
Summary: GLMs are fit via Fisher scoring which, as Dimitriy V. Masterov notes, is Newton-Raphson with the expected Hessian instead (i.e. we use an estimate of the Fisher information instead of the obs
Why using Newton's method for logistic regression optimization is called iterative re-weighted least squares? Summary: GLMs are fit via Fisher scoring which, as Dimitriy V. Masterov notes, is Newton-Raphson with the expected Hessian instead (i.e. we use an estimate of the Fisher information instead of the observed information). If we are using the canonical link function it turns out that the observed Hessian equals the expected Hessian so NR and Fisher scoring are the same in that case. Either way, we'll see that Fisher scoring is actually fitting a weighted least squares linear model, and the coefficient estimates from this converge* on a maximum of the logistic regression likelihood. Aside from reducing fitting a logistic regression to an already solved problem, we also get the benefit of being able to use linear regression diagnostics on the final WLS fit to learn about our logistic regression. I'm going to keep this focused on logistic regression, but for a more general perspective on maximum likelihood in GLMs I recommend section 15.3 of this chapter which goes through this and derives IRLS in a more general setting (I think it's from John Fox's Applied Regression Analysis and Generalized Linear Models). $^*$ see comments at the end The likelihood and score function We will be fitting our GLM by iterating something of the form $$ b^{(m+1)} = b^{(m)} - J^{-1}_{(m)}\nabla \ell(b^{(m)}) $$ where $\ell$ is the log likelihood and $J_{m}$ will be either the observed or expected Hessian of the log likelihood. Our link function is a function $g$ that maps the conditional mean $\mu_i = E(y_i | x_i)$ to our linear predictor, so our model for the mean is $g(\mu_i) = x_i^T\beta$. Let $h$ be the inverse link function mapping the linear predictor to the mean. For a logistic regression we have a Bernoulli likelihood with independent observations so $$ \ell(b; y) = \sum_{i=1}^n y_i\log h(x_i^T b) + (1 - y_i) \log(1 - h(x_i^Tb)). $$ Taking derivatives, $$ \frac{\partial \ell}{\partial b_j} = \sum_{i=1}^n \frac{y_i}{h(x_i^T b)} h'(x_i^T b) x_{ij} - \frac{1 - y_i}{1 - h(x_i^T b)} h'(x_i^T b) x_{ij} $$ $$ = \sum_{i=1}^n x_{ij} h'(x_i^T b) \left(\frac{y_i}{h(x_i^T b)} - \frac{1 - y_i}{1 - h(x_i^T b)} \right) $$ $$ = \sum_i x_{ij} \frac{h'(x_i^T b)}{h(x_i^T b)(1 - h(x_i^T b))}(y_i - h(x_i^T b)). $$ Using the canonical link Now let's suppose we're using the canonical link function $g_c = \text{logit}$. Then $g^{-1}_c(x) := h_c(x) = \frac{1}{1+e^{-x}}$ so $h_c' = h_c \cdot (1-h_c)$ which means this simplifies to $$ \frac{\partial \ell}{\partial b_j} = \sum_i x_{ij} (y_i - h_c(x_i^T b)) $$ so $$ \nabla \ell (b; y) = X^T (y - \hat y). $$ Furthermore, still using $h_c$, $$ \frac{\partial^2 \ell}{\partial b_k \partial b_j} = - \sum_i x_{ij} \frac{\partial}{\partial b_k} h_c(x_i^T b) = - \sum_i x_{ij}x_{ik} \left[h_c(x_i^T b) (1 - h_c(x_i^T b))\right]. $$ Let $$ W = \text{diag}\left(h_c(x_1^T b)(1 - h_c(x_1^T b)), \dots, h_c(x_n^T b)(1 - h_c(x_n^T b))\right) = \text{diag}\left(\hat y_1(1 - \hat y_1), \dots, \hat y_n (1 - \hat y_n)\right). $$ Then we have $$ H = -X^TWX $$ and note how this doesn't have any $y_i$ in it anymore, so $E(H) = H$ (we're viewing this as a function of $b$ so the only random thing is $y$ itself). Thus we've shown that Fisher scoring is equivalent to Newton-Raphson when we use the canonical link in logistic regression. Also by virtue of $\hat y_i \in (0,1)$ $-X^TWX$ will always be strictly negative definite, although numerically if $\hat y_i$ gets too close to $0$ or $1$ then we may have weights round to $0$ which can make $H$ negative semidefinite and therefore computationally singular. Now create the working response $z = W^{-1}(y - \hat y)$ and note that $$ \nabla \ell = X^T(y - \hat y) = X^T W z. $$ All together this means that we can optimize the log likelihood by iterating $$ b^{(m+1)} = b^{(m)} + (X^T W_{(m)} X)^{-1}X^T W_{(m)} z_{(m)} $$ and $(X^T W_{(m)} X)^{-1}X^T W_{(m)} z_{(m)}$ is exactly $\hat \beta$ for a weighted least squares regression of $z_{(m)}$ on $X$. Checking this in R: set.seed(123) p <- 5 n <- 500 x <- matrix(rnorm(n * p), n, p) betas <- runif(p, -2, 2) hc <- function(x) 1 /(1 + exp(-x)) # inverse canonical link p.true <- hc(x %*% betas) y <- rbinom(n, 1, p.true) # fitting with our procedure my_IRLS_canonical <- function(x, y, b.init, hc, tol=1e-8) { change <- Inf b.old <- b.init while(change > tol) { eta <- x %*% b.old # linear predictor y.hat <- hc(eta) h.prime_eta <- y.hat * (1 - y.hat) z <- (y - y.hat) / h.prime_eta b.new <- b.old + lm(z ~ x - 1, weights = h.prime_eta)$coef # WLS regression change <- sqrt(sum((b.new - b.old)^2)) b.old <- b.new } b.new } my_IRLS_canonical(x, y, rep(1,p), hc) # x1 x2 x3 x4 x5 # -1.1149687 2.1897992 1.0271298 0.8702975 -1.2074851 glm(y ~ x - 1, family=binomial())$coef # x1 x2 x3 x4 x5 # -1.1149687 2.1897992 1.0271298 0.8702975 -1.2074851 and they agree. Non-canonical link functions Now if we're not using the canonical link we don't get the simplification of $\frac{h'}{h(1-h)} = 1$ in $\nabla \ell$ so $H$ becomes much more complicated, and we therefore see a noticeable difference by using $E(H)$ in our Fisher scoring. Here's how this will go: we already worked out the general $\nabla \ell$ so the Hessian will be the main difficulty. We need $$ \frac{\partial^2 \ell}{\partial b_k \partial b_j} = \sum_i x_{ij} \frac{\partial}{\partial b_k}h'(x_i^T b) \left(\frac{y_i}{h(x_i^T b)} - \frac{1 - y_i}{1 - h(x_i^T b)} \right) $$ $$ = \sum_i x_{ij}x_{ik} \left[h''(x_i^T b) \left(\frac{y_i}{h(x_i^T b)} - \frac{1 - y_i}{1 - h(x_i^T b)} \right) - h'(x_i^T b)^2\left(\frac{y_i}{h(x_i^T b)^2} + \frac{1-y_i}{(1-h(x_i^T b))^2} \right)\right] $$ Via the linearity of expectation all we need to do to get $E(H)$ is replace each occurrence of $y_i$ with its mean under our model which is $\mu_i=h(x_i^T\beta)$. Each term in the summand will therefore contain a factor of the form $$ h''(x_i^T b) \left(\frac{h(x_i^T \beta)}{h(x_i^T b)} - \frac{1 - h(x_i^T \beta)}{1 - h(x_i^T b)} \right) - h'(x_i^T b)^2\left(\frac{h(x_i^T \beta)}{h(x_i^T b)^2} + \frac{1-h(x_i^T \beta)}{(1-h(x_i^T b))^2} \right). $$ But to actually do our optimization we'll need to estimate each $\beta$, and at step $m$ $b^{(m)}$ is the best guess we have. This means that this will reduce to $$ h''(x_i^T b) \left(\frac{h(x_i^T b)}{h(x_i^T b)} - \frac{1 - h(x_i^T b)}{1 - h(x_i^T b)} \right) - h'(x_i^T b)^2\left(\frac{h(x_i^T b)}{h(x_i^T b)^2} + \frac{1-h(x_i^T b)}{(1-h(x_i^T b))^2} \right) $$ $$ = - h'(x_i^T b)^2\left(\frac{1}{h(x_i^T b)} + \frac{1}{1-h(x_i^T b)} \right) $$ $$ = -\frac{h'(x_i^T b)^2}{h(x_i^T b)(1-h(x_i^T b))}. $$ This means we will use $J$ with $$ J_{jk} = -\sum_i x_{ij}x_{ik} \frac{h'(x_i^T b)^2}{h(x_i^T b)(1-h(x_i^T b))}. $$ Now let $$ W^* = \text{diag}\left(\frac{h'(x_1^T b)^2}{h(x_1^T b)(1-h(x_1^T b))} ,\dots, \frac{h'(x_n^T b)^2}{h(x_n^T b)(1-h(x_n^T b))}\right) $$ and note how under the canonical link $h_c' = h_c \cdot (1-h_c)$ reduces $W^*$ to $W$ from the previous section. This lets us write $$ J = -X^TW^*X $$ except this is now $\hat E(H)$ rather than necessarily being $H$ itself, so this can differ from Newton-Raphson. For all $i$ $W_{ii}^* > 0$ so aside from numerical issues $J$ will be negative definite. We have $$ \frac{\partial \ell}{\partial b_j} = \sum_i x_{ij} \frac{h'(x_i^T b)}{h(x_i^T b)(1 - h(x_i^T b))}(y_i - h(x_i^T b)) $$ so letting our new working response be $z^* = D^{-1}(y-\hat y)$ with $D=\text{diag}\left(h'(x_1^T b), \dots, h'(x_n^T b)\right)$, we have $\nabla \ell = X^TW^*z^*$. All together we are iterating $$ b^{(m+1)} = b^{(m)} + (X^T W_{(m)}^* X)^{-1}X^T W_{(m)}^* z_{(m)}^* $$ so this is still a sequence of WLS regressions except now it's not necessarily Newton-Raphson. I've written it out this way to emphasize the connection to Newton-Raphson, but frequently people will factor the updates so that each new point $b^{(m+1)}$ is itself the WLS solution, rather than a WLS solution added to the current point $b^{(m)}$. If we wanted to do this, we can do the following: $$ b^{(m+1)} = b^{(m)} + (X^T W_{(m)}^* X)^{-1}X^T W_{(m)}^* z_{(m)}^* $$ $$ = (X^T W_{(m)}^* X)^{-1}\left(X^T W_{(m)}^* Xb^{(m)}+ X^TW^*_{(m)}z_{(m)}^* \right) $$ $$ = (X^T W_{(m)}^* X)^{-1}X^TW_{(m)}^*\left(Xb^{(m)}+ z_{(m)}^* \right) $$ so if we're going this way you'll see the working response take the form $\eta^{(m)} + D^{-1}_{(m)}(y - \hat y^{(m)})$, but it's the same thing. Let's confirm that this works by using it to perform a probit regression on the same simulated data as before (and this is not the canonical link, so we need this more general form of IRLS). my_IRLS_general <- function(x, y, b.init, h, h.prime, tol=1e-8) { change <- Inf b.old <- b.init while(change > tol) { eta <- x %*% b.old # linear predictor y.hat <- h(eta) h.prime_eta <- h.prime(eta) w_star <- h.prime_eta^2 / (y.hat * (1 - y.hat)) z_star <- (y - y.hat) / h.prime_eta b.new <- b.old + lm(z_star ~ x - 1, weights = w_star)$coef # WLS change <- sqrt(sum((b.new - b.old)^2)) b.old <- b.new } b.new } # probit inverse link and derivative h_probit <- function(x) pnorm(x, 0, 1) h.prime_probit <- function(x) dnorm(x, 0, 1) my_IRLS_general(x, y, rep(0,p), h_probit, h.prime_probit) # x1 x2 x3 x4 x5 # -0.6456508 1.2520266 0.5820856 0.4982678 -0.6768585 glm(y~x-1, family=binomial(link="probit"))$coef # x1 x2 x3 x4 x5 # -0.6456490 1.2520241 0.5820835 0.4982663 -0.6768581 and again the two agree. Comments on convergence Finally, a few quick comments on convergence (I'll keep this brief as this is getting really long and I'm no expert at optimization). Even though theoretically each $J_{(m)}$ is negative definite, bad initial conditions can still prevent this algorithm from converging. In the probit example above, changing the initial conditions to b.init=rep(1,p) results in this, and that doesn't even look like a suspicious initial condition. If you step through the IRLS procedure with that initialization and these simulated data, by the second time through the loop there are some $\hat y_i$ that round to exactly $1$ and so the weights become undefined. If we're using the canonical link in the algorithm I gave we won't ever be dividing by $\hat y_i (1 - \hat y_i)$ to get undefined weights, but if we've got a situation where some $\hat y_i$ are approaching $0$ or $1$, such as in the case of perfect separation, then we'll still get non-convergence as the gradient dies without us reaching anything.
Why using Newton's method for logistic regression optimization is called iterative re-weighted least Summary: GLMs are fit via Fisher scoring which, as Dimitriy V. Masterov notes, is Newton-Raphson with the expected Hessian instead (i.e. we use an estimate of the Fisher information instead of the obs
10,678
what happens when a model is having more parameters than training samples
When talking about neural networks (nowadays especially deep neural networks), it is nearly always the case that the network has far more parameters than training samples. Theoretically, a simple two-layer neural network with $2n+d$ parameters is capable of perfectly fitting any dataset of $n$ samples of dimension $d$ (Zhang et al., 2017). So to answer your question, having such a large model can lead to overfitting. The awesome thing about deep neural networks is that they work very well despite these potential overfitting problems. Usually it is thanks to various regularization effects implicit to the training/optimization algorithm and the network architecture, and explicitly used regularization methods such as dropout, weight decay and data augmentation. My paper Regularization for Deep Learning: A Taxonomy describes some of these effects in depth. The obvious benefit of having many parameters is that you can represent much more complicated functions than with fewer parameters. The relationships that neural networks model are often very complicated ones and using a small network (adapting the size of the network to the size of the training set, i.e. making your data look big just by using a small model) can lead to the problem when your network is too simple and unable to represent the desired mapping (high bias). On the other hand, if you have many parameters, the network is flexible enough to represent the desired mapping and you can always employ stronger regularization to prevent overfitting. To answer the last part of your question: The number of parameters is fully defined by the number of layers in the network, number of units in every layer, and dimensionality of the input and the output. For more info, see also Relationship between model over fitting and number of parameters.
what happens when a model is having more parameters than training samples
When talking about neural networks (nowadays especially deep neural networks), it is nearly always the case that the network has far more parameters than training samples. Theoretically, a simple two-
what happens when a model is having more parameters than training samples When talking about neural networks (nowadays especially deep neural networks), it is nearly always the case that the network has far more parameters than training samples. Theoretically, a simple two-layer neural network with $2n+d$ parameters is capable of perfectly fitting any dataset of $n$ samples of dimension $d$ (Zhang et al., 2017). So to answer your question, having such a large model can lead to overfitting. The awesome thing about deep neural networks is that they work very well despite these potential overfitting problems. Usually it is thanks to various regularization effects implicit to the training/optimization algorithm and the network architecture, and explicitly used regularization methods such as dropout, weight decay and data augmentation. My paper Regularization for Deep Learning: A Taxonomy describes some of these effects in depth. The obvious benefit of having many parameters is that you can represent much more complicated functions than with fewer parameters. The relationships that neural networks model are often very complicated ones and using a small network (adapting the size of the network to the size of the training set, i.e. making your data look big just by using a small model) can lead to the problem when your network is too simple and unable to represent the desired mapping (high bias). On the other hand, if you have many parameters, the network is flexible enough to represent the desired mapping and you can always employ stronger regularization to prevent overfitting. To answer the last part of your question: The number of parameters is fully defined by the number of layers in the network, number of units in every layer, and dimensionality of the input and the output. For more info, see also Relationship between model over fitting and number of parameters.
what happens when a model is having more parameters than training samples When talking about neural networks (nowadays especially deep neural networks), it is nearly always the case that the network has far more parameters than training samples. Theoretically, a simple two-
10,679
How the embedding layer is trained in Keras Embedding layer
Embedding layers in Keras are trained just like any other layer in your network architecture: they are tuned to minimize the loss function by using the selected optimization method. The major difference with other layers, is that their output is not a mathematical function of the input. Instead the input to the layer is used to index a table with the embedding vectors [1]. However, the underlying automatic differentiation engine has no problem to optimize these vectors to minimize the loss function... So, you cannot say that the Embedding layer in Keras is doing the same as word2vec [2]. Remember that word2vec refers to a very specific network setup which tries to learn an embedding which captures the semantics of words. With Keras's embedding layer, you are just trying to minimize the loss function, so if for instance you are working with a sentiment classification problem, the learned embedding will probably not capture complete word semantics but just their emotional polarity... For example, the following image taken from [3] shows the embedding of three sentences with a Keras Embedding layer trained from scratch as part of a supervised network designed to detect clickbait headlines (left) and pre-trained word2vec embeddings (right). As you can see, word2vec embeddings reflect the semantic similarity between phrases b) and c). Conversely, the embeddings generated by Keras's Embedding layer might be useful for classification, but do not capture the semantical similarity of b) and c). This explains why when you have a limited amount of training samples, it might be a good idea to initialize your Embedding layer with word2vec weights, so at least your model recognizes that "Alps" and "Himalaya" are similar things, even if they don't both occur in sentences of your training dataset. [1] How does Keras 'Embedding' layer work? [2] https://www.tensorflow.org/tutorials/word2vec [3] https://link.springer.com/article/10.1007/s10489-017-1109-7 NOTE: Actually, the image shows the activations of the layer after the Embedding layer, but for the purpose of this example it does not matter... See more details in [3]
How the embedding layer is trained in Keras Embedding layer
Embedding layers in Keras are trained just like any other layer in your network architecture: they are tuned to minimize the loss function by using the selected optimization method. The major differen
How the embedding layer is trained in Keras Embedding layer Embedding layers in Keras are trained just like any other layer in your network architecture: they are tuned to minimize the loss function by using the selected optimization method. The major difference with other layers, is that their output is not a mathematical function of the input. Instead the input to the layer is used to index a table with the embedding vectors [1]. However, the underlying automatic differentiation engine has no problem to optimize these vectors to minimize the loss function... So, you cannot say that the Embedding layer in Keras is doing the same as word2vec [2]. Remember that word2vec refers to a very specific network setup which tries to learn an embedding which captures the semantics of words. With Keras's embedding layer, you are just trying to minimize the loss function, so if for instance you are working with a sentiment classification problem, the learned embedding will probably not capture complete word semantics but just their emotional polarity... For example, the following image taken from [3] shows the embedding of three sentences with a Keras Embedding layer trained from scratch as part of a supervised network designed to detect clickbait headlines (left) and pre-trained word2vec embeddings (right). As you can see, word2vec embeddings reflect the semantic similarity between phrases b) and c). Conversely, the embeddings generated by Keras's Embedding layer might be useful for classification, but do not capture the semantical similarity of b) and c). This explains why when you have a limited amount of training samples, it might be a good idea to initialize your Embedding layer with word2vec weights, so at least your model recognizes that "Alps" and "Himalaya" are similar things, even if they don't both occur in sentences of your training dataset. [1] How does Keras 'Embedding' layer work? [2] https://www.tensorflow.org/tutorials/word2vec [3] https://link.springer.com/article/10.1007/s10489-017-1109-7 NOTE: Actually, the image shows the activations of the layer after the Embedding layer, but for the purpose of this example it does not matter... See more details in [3]
How the embedding layer is trained in Keras Embedding layer Embedding layers in Keras are trained just like any other layer in your network architecture: they are tuned to minimize the loss function by using the selected optimization method. The major differen
10,680
How the embedding layer is trained in Keras Embedding layer
The embedding layer is just a projection from discrete and sparse 1-hot-vector into a continuous and dense latent space. It is a matrix of (n,m) where n is your vocabulary size and n is your desired latent space dimensions. Only in practice, there's no need to actually do the matrix multiplication, and instead you can save on computation by using the index. So in practice, it is a layer that maps positive integers (indices corresponding to words) into dense vectors of fixed size (the embedding vectors). You could train it to create a Word2Vec embedding by using Skip-Gram or CBOW. Or you can train it on your specific problem to get an embedding suited for your specific task at hand. You could also load pre-trained embeddings (like Word2Vec, GloVe etc.) and then continue training on your specific problem ( a form of transfer learning ).
How the embedding layer is trained in Keras Embedding layer
The embedding layer is just a projection from discrete and sparse 1-hot-vector into a continuous and dense latent space. It is a matrix of (n,m) where n is your vocabulary size and n is your desired l
How the embedding layer is trained in Keras Embedding layer The embedding layer is just a projection from discrete and sparse 1-hot-vector into a continuous and dense latent space. It is a matrix of (n,m) where n is your vocabulary size and n is your desired latent space dimensions. Only in practice, there's no need to actually do the matrix multiplication, and instead you can save on computation by using the index. So in practice, it is a layer that maps positive integers (indices corresponding to words) into dense vectors of fixed size (the embedding vectors). You could train it to create a Word2Vec embedding by using Skip-Gram or CBOW. Or you can train it on your specific problem to get an embedding suited for your specific task at hand. You could also load pre-trained embeddings (like Word2Vec, GloVe etc.) and then continue training on your specific problem ( a form of transfer learning ).
How the embedding layer is trained in Keras Embedding layer The embedding layer is just a projection from discrete and sparse 1-hot-vector into a continuous and dense latent space. It is a matrix of (n,m) where n is your vocabulary size and n is your desired l
10,681
What is the difference between pooled cross sectional data and panel data?
When I see panel data, I think longitudinal data, so observations collected on the same individuals at multiple times, on the same topics. Repeated cross sections should be the same topics, but you get different samples of individuals at each observation. I'd welcome other descriptions.
What is the difference between pooled cross sectional data and panel data?
When I see panel data, I think longitudinal data, so observations collected on the same individuals at multiple times, on the same topics. Repeated cross sections should be the same topics, but you ge
What is the difference between pooled cross sectional data and panel data? When I see panel data, I think longitudinal data, so observations collected on the same individuals at multiple times, on the same topics. Repeated cross sections should be the same topics, but you get different samples of individuals at each observation. I'd welcome other descriptions.
What is the difference between pooled cross sectional data and panel data? When I see panel data, I think longitudinal data, so observations collected on the same individuals at multiple times, on the same topics. Repeated cross sections should be the same topics, but you ge
10,682
What is the difference between pooled cross sectional data and panel data?
The answer here is pretty straight forward: Both pooled cross sectional data and pure panel data collect data over time (this can range from 2 time periods to any large number). The key difference between the two is the "units" we follow. I am defining units as households, countries, or whatever we are collecting data on. In pooled cross section, we will take random samples in different time periods, of different units, i.e. each sample we take, will be populated by different individuals. This is often used to see the impact of policy or programmes. For example we will take household income data on households X, Y and Z, in 1990. And then we will take the same income data on households G, F and A in 1995. Although we are interested in the same data, we are taking different samples (using different households) in different time periods. In pure panel data, we are following the same units i.e. the same households or individuals over time. For example we will follow the same set of households X, Y and Z, for each time period we collect data i.e. in 1990 and we will also interview the same households in 1995. Therefore the fundamental difference, is simply the units we observe the data for. Hope this helps.
What is the difference between pooled cross sectional data and panel data?
The answer here is pretty straight forward: Both pooled cross sectional data and pure panel data collect data over time (this can range from 2 time periods to any large number). The key difference bet
What is the difference between pooled cross sectional data and panel data? The answer here is pretty straight forward: Both pooled cross sectional data and pure panel data collect data over time (this can range from 2 time periods to any large number). The key difference between the two is the "units" we follow. I am defining units as households, countries, or whatever we are collecting data on. In pooled cross section, we will take random samples in different time periods, of different units, i.e. each sample we take, will be populated by different individuals. This is often used to see the impact of policy or programmes. For example we will take household income data on households X, Y and Z, in 1990. And then we will take the same income data on households G, F and A in 1995. Although we are interested in the same data, we are taking different samples (using different households) in different time periods. In pure panel data, we are following the same units i.e. the same households or individuals over time. For example we will follow the same set of households X, Y and Z, for each time period we collect data i.e. in 1990 and we will also interview the same households in 1995. Therefore the fundamental difference, is simply the units we observe the data for. Hope this helps.
What is the difference between pooled cross sectional data and panel data? The answer here is pretty straight forward: Both pooled cross sectional data and pure panel data collect data over time (this can range from 2 time periods to any large number). The key difference bet
10,683
What is the difference between pooled cross sectional data and panel data?
Cross-sectional data, or a cross section of a study population, in statistics and econometrics is a type of one- dimensional data set. Cross-sectional data refers to data collected by observing many subjects (such as individuals, firms or countries/regions) at the same point of time, or without regard to differences in time. Analysis of cross-sectional data usually consists of comparing the differences among the subjects. For example, we want to measure current obesity levels in a population. We could draw a sample of 1,000 people randomly from that population (also known as a cross section of that population), measure their weight and height, and calculate what percentage of that sample is categorized as obese. For example, 30% of our sample were categorized as obese. This cross- sectional sample provides us with a snapshot of that population, at that one point in time. Note that we do not know based on one cross-sectional sample if obesity is increasing or decreasing; we can only describe the current proportion. Cross-sectional data differs from time series data also known as longitudinal data, which follows one subject's changes over the course of time. Another variant, panel data (or time- series cross-sectional (TSCS) data), combines both and looks at multiple subjects and how they change over the course of time. Panel analysis uses panel data to examine changes in variables over time and differences in variables between subjects. In a rolling cross-section, both the presence of an individual in the sample and the time at which the individual is included in the sample are determined randomly. For example, a political poll may decide to interview 100,000 individuals. It first selects these individuals randomly from the entire population. It then assigns a random date to each individual. This is the random date on which that individual will be interviewed, and thus included in the survey.
What is the difference between pooled cross sectional data and panel data?
Cross-sectional data, or a cross section of a study population, in statistics and econometrics is a type of one- dimensional data set. Cross-sectional data refers to data collected by observing many s
What is the difference between pooled cross sectional data and panel data? Cross-sectional data, or a cross section of a study population, in statistics and econometrics is a type of one- dimensional data set. Cross-sectional data refers to data collected by observing many subjects (such as individuals, firms or countries/regions) at the same point of time, or without regard to differences in time. Analysis of cross-sectional data usually consists of comparing the differences among the subjects. For example, we want to measure current obesity levels in a population. We could draw a sample of 1,000 people randomly from that population (also known as a cross section of that population), measure their weight and height, and calculate what percentage of that sample is categorized as obese. For example, 30% of our sample were categorized as obese. This cross- sectional sample provides us with a snapshot of that population, at that one point in time. Note that we do not know based on one cross-sectional sample if obesity is increasing or decreasing; we can only describe the current proportion. Cross-sectional data differs from time series data also known as longitudinal data, which follows one subject's changes over the course of time. Another variant, panel data (or time- series cross-sectional (TSCS) data), combines both and looks at multiple subjects and how they change over the course of time. Panel analysis uses panel data to examine changes in variables over time and differences in variables between subjects. In a rolling cross-section, both the presence of an individual in the sample and the time at which the individual is included in the sample are determined randomly. For example, a political poll may decide to interview 100,000 individuals. It first selects these individuals randomly from the entire population. It then assigns a random date to each individual. This is the random date on which that individual will be interviewed, and thus included in the survey.
What is the difference between pooled cross sectional data and panel data? Cross-sectional data, or a cross section of a study population, in statistics and econometrics is a type of one- dimensional data set. Cross-sectional data refers to data collected by observing many s
10,684
What is the difference between pooled cross sectional data and panel data?
Based on the definition of Corey, we have following methodology to estimate the model with the pooled cross-sectional data and panel data. Pooled cross section: one way fixed effects or random effects (only time) or just pooled OLS. Panel data: two (or one) way fixed effects/random effects (either time or individual or both) or pooled OLS.
What is the difference between pooled cross sectional data and panel data?
Based on the definition of Corey, we have following methodology to estimate the model with the pooled cross-sectional data and panel data. Pooled cross section: one way fixed effects or random effect
What is the difference between pooled cross sectional data and panel data? Based on the definition of Corey, we have following methodology to estimate the model with the pooled cross-sectional data and panel data. Pooled cross section: one way fixed effects or random effects (only time) or just pooled OLS. Panel data: two (or one) way fixed effects/random effects (either time or individual or both) or pooled OLS.
What is the difference between pooled cross sectional data and panel data? Based on the definition of Corey, we have following methodology to estimate the model with the pooled cross-sectional data and panel data. Pooled cross section: one way fixed effects or random effect
10,685
What is the difference between pooled cross sectional data and panel data?
This is from "Basic Econometrics" by Gujarati (4th Edition, P28): Panel, Longitudinal, or Micropanel Data This is a special type of pooled data in which the same cross-sectional unit (say, a family or a firm) is surveyed over time. For example, the U.S. Department of Commerce carries out a census of housing at periodic intervals. At each periodic survey the same household (or the people living at the same address) is interviewed to find out if there has been any change in the housing and financial conditions of that household since the last survey. By interviewing the same household periodically, the panel data provides very useful information on the dynamics of household behavior.
What is the difference between pooled cross sectional data and panel data?
This is from "Basic Econometrics" by Gujarati (4th Edition, P28): Panel, Longitudinal, or Micropanel Data This is a special type of pooled data in which the same cross-sectional unit (say, a family or
What is the difference between pooled cross sectional data and panel data? This is from "Basic Econometrics" by Gujarati (4th Edition, P28): Panel, Longitudinal, or Micropanel Data This is a special type of pooled data in which the same cross-sectional unit (say, a family or a firm) is surveyed over time. For example, the U.S. Department of Commerce carries out a census of housing at periodic intervals. At each periodic survey the same household (or the people living at the same address) is interviewed to find out if there has been any change in the housing and financial conditions of that household since the last survey. By interviewing the same household periodically, the panel data provides very useful information on the dynamics of household behavior.
What is the difference between pooled cross sectional data and panel data? This is from "Basic Econometrics" by Gujarati (4th Edition, P28): Panel, Longitudinal, or Micropanel Data This is a special type of pooled data in which the same cross-sectional unit (say, a family or
10,686
What is the difference between pooled cross sectional data and panel data?
Pooled data is also panel data but the inverse is not true.
What is the difference between pooled cross sectional data and panel data?
Pooled data is also panel data but the inverse is not true.
What is the difference between pooled cross sectional data and panel data? Pooled data is also panel data but the inverse is not true.
What is the difference between pooled cross sectional data and panel data? Pooled data is also panel data but the inverse is not true.
10,687
Regression modelling with unequal variance
Pills against the "megaphone effect" include (among others): Use log or square root transform $Y$. This is not exact but sometimes it tames the widening. Use weighted least square regression. In this approach, each observation is given its own variance factor. This answer shows how to use WLSR in R (for instance if the variance of the residuals is proportional to the means, you can provide as weights the inverse of the fitted value in the unweighted model). Use robust regression. The funciton rlm() in the MASS package of R does M-estimation, which is supposed to be robust to inequality of variances. July 2017 edit: It seems that generalized least squares, as suggested in the answer of Greg Snow, is one of the best options.
Regression modelling with unequal variance
Pills against the "megaphone effect" include (among others): Use log or square root transform $Y$. This is not exact but sometimes it tames the widening. Use weighted least square regression. In thi
Regression modelling with unequal variance Pills against the "megaphone effect" include (among others): Use log or square root transform $Y$. This is not exact but sometimes it tames the widening. Use weighted least square regression. In this approach, each observation is given its own variance factor. This answer shows how to use WLSR in R (for instance if the variance of the residuals is proportional to the means, you can provide as weights the inverse of the fitted value in the unweighted model). Use robust regression. The funciton rlm() in the MASS package of R does M-estimation, which is supposed to be robust to inequality of variances. July 2017 edit: It seems that generalized least squares, as suggested in the answer of Greg Snow, is one of the best options.
Regression modelling with unequal variance Pills against the "megaphone effect" include (among others): Use log or square root transform $Y$. This is not exact but sometimes it tames the widening. Use weighted least square regression. In thi
10,688
Regression modelling with unequal variance
The gls function in the nlme package for R can estimate the regression and the relationship with the variance at the same time. See the weights argument and the 2nd example on the help page.
Regression modelling with unequal variance
The gls function in the nlme package for R can estimate the regression and the relationship with the variance at the same time. See the weights argument and the 2nd example on the help page.
Regression modelling with unequal variance The gls function in the nlme package for R can estimate the regression and the relationship with the variance at the same time. See the weights argument and the 2nd example on the help page.
Regression modelling with unequal variance The gls function in the nlme package for R can estimate the regression and the relationship with the variance at the same time. See the weights argument and the 2nd example on the help page.
10,689
Regression modelling with unequal variance
With the gamlss package you can model the error distribution of the response as a linear, a non-linear, or a smooth function of the explanatory variables. This seems to be a quite powerful approach (I learned a lot about all the possibilities that might arise during the model selection process) and everything is nicely explained in several publications (including books) that is referenced at the link above.
Regression modelling with unequal variance
With the gamlss package you can model the error distribution of the response as a linear, a non-linear, or a smooth function of the explanatory variables. This seems to be a quite powerful approach (I
Regression modelling with unequal variance With the gamlss package you can model the error distribution of the response as a linear, a non-linear, or a smooth function of the explanatory variables. This seems to be a quite powerful approach (I learned a lot about all the possibilities that might arise during the model selection process) and everything is nicely explained in several publications (including books) that is referenced at the link above.
Regression modelling with unequal variance With the gamlss package you can model the error distribution of the response as a linear, a non-linear, or a smooth function of the explanatory variables. This seems to be a quite powerful approach (I
10,690
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)?
You are perfectly right, probability is the measure of uncertainty. Coin flip is a nice example, as discussed in another thread. Tossing a coin is a physical, deterministic process. In fact there are people who have learned to flip the coin in such way to get the outcome they want and are machines that produce deterministic, predictable coin flips. Let me, once again, quote E. Borel (after Bruno de Finetti, Probabilism: A Critical Essay on the Theory of Probability and on the Value of Science): "One can bet, in heads or tails, after the coin, already tossed, is in the air, so that its movement is determined. One can also bet after the coin has landed, on the sole condition that one does not see on what side it has landed. Probability does not lie in the fact that the event is undetermined (in the more or less philosophical sense of the term) but only in our inability to predict what possibility will take place, or to know what possibility has taken place." To make things even more complicated, there are Bayesians who interpret probability as degree of belief. In fact, there are many different interpretations of probability. When something is impossible, or very, very unlikely we assign zero probability to it (check here, here and here), when it is certain, the probability is equal to unity. When talking only about impossible and unlikely events, probability reduces to logic. When considering uncertain events, it may be seen as an extension of logic. But probability is not a substitute for "unknown", it is a measure of how much "likely" the unknown is. It may be interpreted in different ways, and so measure slightly different things, but in the end it lets us to quantify the unknown. Probability lets us say much more about the reality, then that something is "unknown", or "uncertain". But it is not only about measuring, probability lets us to make predictions, precisely estimate the expectations and risks, or apply Bayes theorem to combine probabilities, to give only few examples. In fact, as shown by Daniel Kahneman and Amos Tversky, people are poor in reasoning about uncertainties and risks, while using formal, probabilistic reasoning guards us from our biases.
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)?
You are perfectly right, probability is the measure of uncertainty. Coin flip is a nice example, as discussed in another thread. Tossing a coin is a physical, deterministic process. In fact there are
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)? You are perfectly right, probability is the measure of uncertainty. Coin flip is a nice example, as discussed in another thread. Tossing a coin is a physical, deterministic process. In fact there are people who have learned to flip the coin in such way to get the outcome they want and are machines that produce deterministic, predictable coin flips. Let me, once again, quote E. Borel (after Bruno de Finetti, Probabilism: A Critical Essay on the Theory of Probability and on the Value of Science): "One can bet, in heads or tails, after the coin, already tossed, is in the air, so that its movement is determined. One can also bet after the coin has landed, on the sole condition that one does not see on what side it has landed. Probability does not lie in the fact that the event is undetermined (in the more or less philosophical sense of the term) but only in our inability to predict what possibility will take place, or to know what possibility has taken place." To make things even more complicated, there are Bayesians who interpret probability as degree of belief. In fact, there are many different interpretations of probability. When something is impossible, or very, very unlikely we assign zero probability to it (check here, here and here), when it is certain, the probability is equal to unity. When talking only about impossible and unlikely events, probability reduces to logic. When considering uncertain events, it may be seen as an extension of logic. But probability is not a substitute for "unknown", it is a measure of how much "likely" the unknown is. It may be interpreted in different ways, and so measure slightly different things, but in the end it lets us to quantify the unknown. Probability lets us say much more about the reality, then that something is "unknown", or "uncertain". But it is not only about measuring, probability lets us to make predictions, precisely estimate the expectations and risks, or apply Bayes theorem to combine probabilities, to give only few examples. In fact, as shown by Daniel Kahneman and Amos Tversky, people are poor in reasoning about uncertainties and risks, while using formal, probabilistic reasoning guards us from our biases.
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)? You are perfectly right, probability is the measure of uncertainty. Coin flip is a nice example, as discussed in another thread. Tossing a coin is a physical, deterministic process. In fact there are
10,691
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)?
There is a long and deep history of uncertainty and the quantification of uncertainty, with terms like "subjective probability." A key result is Cox's Theorem. He posited three properties of any measure or representation of uncertainty: Divisibility and comparability – The plausibility of a proposition is a real number and is dependent on information we have related to the proposition. Common sense – Plausibilities should vary sensibly with the assessment of plausibilities in the model. Consistency – If the plausibility of a proposition can be derived in many ways, all the results must be equal. These make perfect sense, and capture what we want in any representation of uncertainty. Together with derived results, such as the probability of a proposition $A$ plus the probability of the proposition not $A$ must sum to 1.0 (certainty), and that uncertainty is monotonic (if you have more and more uncertainty, the numerical value describing that certainty must only get smaller), he derived mathematically what any such representation must obey. His result is that they must be expressed in, and use the relations of probability.
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)?
There is a long and deep history of uncertainty and the quantification of uncertainty, with terms like "subjective probability." A key result is Cox's Theorem. He posited three properties of any mea
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)? There is a long and deep history of uncertainty and the quantification of uncertainty, with terms like "subjective probability." A key result is Cox's Theorem. He posited three properties of any measure or representation of uncertainty: Divisibility and comparability – The plausibility of a proposition is a real number and is dependent on information we have related to the proposition. Common sense – Plausibilities should vary sensibly with the assessment of plausibilities in the model. Consistency – If the plausibility of a proposition can be derived in many ways, all the results must be equal. These make perfect sense, and capture what we want in any representation of uncertainty. Together with derived results, such as the probability of a proposition $A$ plus the probability of the proposition not $A$ must sum to 1.0 (certainty), and that uncertainty is monotonic (if you have more and more uncertainty, the numerical value describing that certainty must only get smaller), he derived mathematically what any such representation must obey. His result is that they must be expressed in, and use the relations of probability.
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)? There is a long and deep history of uncertainty and the quantification of uncertainty, with terms like "subjective probability." A key result is Cox's Theorem. He posited three properties of any mea
10,692
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)?
The short answer is yes. The first chapter of this phd thesis has an example with a simulation of flipping a throwing pin. The outcome 'pin-up' or 'pin-down' depends on a number of variables (like rotation speed and size), which we do not usually control in everyday life. So in the simulation the system is deterministic: given the input variables the outcome can be computed. But when flipping a pin on your table, you don't know the exact values so you can only estimate the probability of the pin landing 'pin-up' or 'pin-down'. As a final remark we simply note that most, if not all real-world systems can be described (at least in principle) in terms of a dynamical system, and that our interpretation of ‘random’ as arising from uncertain, incomplete knowledge about the state of a system applies even down to the quantum level.
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)?
The short answer is yes. The first chapter of this phd thesis has an example with a simulation of flipping a throwing pin. The outcome 'pin-up' or 'pin-down' depends on a number of variables (like rot
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)? The short answer is yes. The first chapter of this phd thesis has an example with a simulation of flipping a throwing pin. The outcome 'pin-up' or 'pin-down' depends on a number of variables (like rotation speed and size), which we do not usually control in everyday life. So in the simulation the system is deterministic: given the input variables the outcome can be computed. But when flipping a pin on your table, you don't know the exact values so you can only estimate the probability of the pin landing 'pin-up' or 'pin-down'. As a final remark we simply note that most, if not all real-world systems can be described (at least in principle) in terms of a dynamical system, and that our interpretation of ‘random’ as arising from uncertain, incomplete knowledge about the state of a system applies even down to the quantum level.
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)? The short answer is yes. The first chapter of this phd thesis has an example with a simulation of flipping a throwing pin. The outcome 'pin-up' or 'pin-down' depends on a number of variables (like rot
10,693
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)?
Talking quantum physics might nevertheless help to appreciate certain issues and paradoxes. Take for example lemur’s comment: ..., but these hurt my philosophical feelings: QM is Nature’s way of having to avoid dealing with an infinite number of bits But there is a paradox here, since it seems that Nature still requires an infinite number of bits, just to write down the exact probability of an event. The same issue happens for everyday probabilities: The weather forecast may predict the probability of precipitation for the following day in a certain area during a certain time span to be 30%. But how accurate is this probability? Does it mean that the actual probability is between 25% and 35%? Does it even make sense to talk about the accuracy of a probability? The probability for a certain number in Roulette is 1/37, but can one also say something about the accuracy of that probability? Here one can at least test the hypothesis about a given accuracy of the probability by performing a sufficient number of repeated experiments. Even if not meant that way, Pascal's Wager presents a similar type of paradox. It describes an experiment which can not be repeated, and then assumes that one could assign a probability like 0.000001 or 1e-3000 to a certain outcome, without questioning whether such an accurate probability even makes sense in this context. A paper by Ole Peters and Murray Gell-Mann (the famous physicists) triggered those thoughts...
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)?
Talking quantum physics might nevertheless help to appreciate certain issues and paradoxes. Take for example lemur’s comment: ..., but these hurt my philosophical feelings: QM is Nature’s way of havi
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)? Talking quantum physics might nevertheless help to appreciate certain issues and paradoxes. Take for example lemur’s comment: ..., but these hurt my philosophical feelings: QM is Nature’s way of having to avoid dealing with an infinite number of bits But there is a paradox here, since it seems that Nature still requires an infinite number of bits, just to write down the exact probability of an event. The same issue happens for everyday probabilities: The weather forecast may predict the probability of precipitation for the following day in a certain area during a certain time span to be 30%. But how accurate is this probability? Does it mean that the actual probability is between 25% and 35%? Does it even make sense to talk about the accuracy of a probability? The probability for a certain number in Roulette is 1/37, but can one also say something about the accuracy of that probability? Here one can at least test the hypothesis about a given accuracy of the probability by performing a sufficient number of repeated experiments. Even if not meant that way, Pascal's Wager presents a similar type of paradox. It describes an experiment which can not be repeated, and then assumes that one could assign a probability like 0.000001 or 1e-3000 to a certain outcome, without questioning whether such an accurate probability even makes sense in this context. A paper by Ole Peters and Murray Gell-Mann (the famous physicists) triggered those thoughts...
Is everyday probability just a way of dealing with the unknown (not talking quantum physics here)? Talking quantum physics might nevertheless help to appreciate certain issues and paradoxes. Take for example lemur’s comment: ..., but these hurt my philosophical feelings: QM is Nature’s way of havi
10,694
What intuitively is "bias"?
Bias is the difference between the expected value of an estimator and the true value being estimated. For example the sample mean for a simple random sample (SRS) is an unbiased estimator of the population mean because if you take all the possible SRS's find their means, and take the mean of those means then you will get the population mean (for finite populations this is just algebra to show this). But if we use a sampling mechanism that is somehow related to the value then the mean can become biased, think of a random digit dialing sample asking a question about income. If there is positive correlation between number of phone numbers someone has and their income (poor people only have a few phone numbers that they can be reached at while richer people have more) then the sample will be more likely to include more people with higher incomes and therefore the mean income in the sample will tend to be higher than the population income. The are also some estimators that are naturally biased. The trimmed mean will be biased for a skewed population/distribution. The standard variance is unbiased for SRS's if either the population mean is used with denominator $n$ or the sample mean is used with denominator $n-1$. Here is a simple example using R, we generate a bunch of samples from a normal with mean 0 and standard deviation 1, then compute the average mean, variance, and standard deviation from the samples. Notice how close the mean and variance averages are to the true values (sampling error means they won't be exact), now compare the mean sd, it is a biased estimator (though not hugely biased). > tmp.data <- matrix( rnorm(10*1000000), ncol=10 ) > mean( apply(tmp.data, 1, mean) ) [1] 0.0001561002 > mean( apply(tmp.data, 1, var) ) [1] 1.000109 > mean( apply(tmp.data, 1, sd) ) [1] 0.9727121 In regression we can get biased estimators of slopes by doing stepwise regression. A variable is more likely to be kept in a stepwise regression if the estimated slope is further from 0 and more likely to be dropped if it is closer to 0, so this is biased sampling and the slopes in the final model will tend to be further from 0 than the true slope. Techniques like the lasso and ridge regression bias slopes towards 0 to counter the selection bias away from 0.
What intuitively is "bias"?
Bias is the difference between the expected value of an estimator and the true value being estimated. For example the sample mean for a simple random sample (SRS) is an unbiased estimator of the popu
What intuitively is "bias"? Bias is the difference between the expected value of an estimator and the true value being estimated. For example the sample mean for a simple random sample (SRS) is an unbiased estimator of the population mean because if you take all the possible SRS's find their means, and take the mean of those means then you will get the population mean (for finite populations this is just algebra to show this). But if we use a sampling mechanism that is somehow related to the value then the mean can become biased, think of a random digit dialing sample asking a question about income. If there is positive correlation between number of phone numbers someone has and their income (poor people only have a few phone numbers that they can be reached at while richer people have more) then the sample will be more likely to include more people with higher incomes and therefore the mean income in the sample will tend to be higher than the population income. The are also some estimators that are naturally biased. The trimmed mean will be biased for a skewed population/distribution. The standard variance is unbiased for SRS's if either the population mean is used with denominator $n$ or the sample mean is used with denominator $n-1$. Here is a simple example using R, we generate a bunch of samples from a normal with mean 0 and standard deviation 1, then compute the average mean, variance, and standard deviation from the samples. Notice how close the mean and variance averages are to the true values (sampling error means they won't be exact), now compare the mean sd, it is a biased estimator (though not hugely biased). > tmp.data <- matrix( rnorm(10*1000000), ncol=10 ) > mean( apply(tmp.data, 1, mean) ) [1] 0.0001561002 > mean( apply(tmp.data, 1, var) ) [1] 1.000109 > mean( apply(tmp.data, 1, sd) ) [1] 0.9727121 In regression we can get biased estimators of slopes by doing stepwise regression. A variable is more likely to be kept in a stepwise regression if the estimated slope is further from 0 and more likely to be dropped if it is closer to 0, so this is biased sampling and the slopes in the final model will tend to be further from 0 than the true slope. Techniques like the lasso and ridge regression bias slopes towards 0 to counter the selection bias away from 0.
What intuitively is "bias"? Bias is the difference between the expected value of an estimator and the true value being estimated. For example the sample mean for a simple random sample (SRS) is an unbiased estimator of the popu
10,695
What intuitively is "bias"?
Bias means that the expected value of the estimator is not equal to the population parameter. Intuitively in a regression analysis, this would mean that the estimate of one of the parameters is too high or too low. However, ordinary least squares regression estimates are BLUE, which stands for best linear unbiased estimators. In other forms of regression, the parameter estimates may be biased. This can be a good idea, because there is often a tradeoff between bias and variance. For example, ridge regression is sometimes used to reduce the variance of estimates when there is collinearity. A simple example may illustrate this better, although not in the regression context. Suppose you weigh 150 pounds (verified on a balance scale that has you in one basket and a pile of weights in the other basket). Now, you have two bathroom scales. You weigh yourself 5 times on each. Scale 1 gives weights of 152, 151, 151.5, 150.5 and 152. Scale 2 gives weights of 145, 155, 154, 146 and 150. Scale 1 is biased, but has lower variance; the average of the weights is not your true weight. Scale 2 is unbiased (the average is 150), but has much higher variance. Which scale is "better"? It depends on what you want the scale to do.
What intuitively is "bias"?
Bias means that the expected value of the estimator is not equal to the population parameter. Intuitively in a regression analysis, this would mean that the estimate of one of the parameters is too hi
What intuitively is "bias"? Bias means that the expected value of the estimator is not equal to the population parameter. Intuitively in a regression analysis, this would mean that the estimate of one of the parameters is too high or too low. However, ordinary least squares regression estimates are BLUE, which stands for best linear unbiased estimators. In other forms of regression, the parameter estimates may be biased. This can be a good idea, because there is often a tradeoff between bias and variance. For example, ridge regression is sometimes used to reduce the variance of estimates when there is collinearity. A simple example may illustrate this better, although not in the regression context. Suppose you weigh 150 pounds (verified on a balance scale that has you in one basket and a pile of weights in the other basket). Now, you have two bathroom scales. You weigh yourself 5 times on each. Scale 1 gives weights of 152, 151, 151.5, 150.5 and 152. Scale 2 gives weights of 145, 155, 154, 146 and 150. Scale 1 is biased, but has lower variance; the average of the weights is not your true weight. Scale 2 is unbiased (the average is 150), but has much higher variance. Which scale is "better"? It depends on what you want the scale to do.
What intuitively is "bias"? Bias means that the expected value of the estimator is not equal to the population parameter. Intuitively in a regression analysis, this would mean that the estimate of one of the parameters is too hi
10,696
What intuitively is "bias"?
In Linear regression analysis, bias refer to the error that is introduced by approximating a real-life problem, which may be complicated, by a much simpler model. In simple terms, you assume a simple linear model such as y*=(a*)x+b* where as in real life the business problem could be y = ax^3 + bx^2+c. It can be said that the expected test MSE(Mean squared error) from a regression problem can be decomposed as below. E(y0 - f*(x0))^2 = Var(f*(x0)) + [Bias(f*(x0))]^2 + Var(e) f* -> functional form assumed for linear regression model y0 -> original response value recorded in test data x0 -> orginal predictor value recorded in test data e -> irreducible error So, the goal is selecting a best method in arriving a model that achieves low variance and low bias. Note: An Introduction to Statistical Learning by Trevor Hastie & Robert Tibshirani has a good insights on this topic
What intuitively is "bias"?
In Linear regression analysis, bias refer to the error that is introduced by approximating a real-life problem, which may be complicated, by a much simpler model. In simple terms, you assume a simple
What intuitively is "bias"? In Linear regression analysis, bias refer to the error that is introduced by approximating a real-life problem, which may be complicated, by a much simpler model. In simple terms, you assume a simple linear model such as y*=(a*)x+b* where as in real life the business problem could be y = ax^3 + bx^2+c. It can be said that the expected test MSE(Mean squared error) from a regression problem can be decomposed as below. E(y0 - f*(x0))^2 = Var(f*(x0)) + [Bias(f*(x0))]^2 + Var(e) f* -> functional form assumed for linear regression model y0 -> original response value recorded in test data x0 -> orginal predictor value recorded in test data e -> irreducible error So, the goal is selecting a best method in arriving a model that achieves low variance and low bias. Note: An Introduction to Statistical Learning by Trevor Hastie & Robert Tibshirani has a good insights on this topic
What intuitively is "bias"? In Linear regression analysis, bias refer to the error that is introduced by approximating a real-life problem, which may be complicated, by a much simpler model. In simple terms, you assume a simple
10,697
Why Lasso or ElasticNet perform better than Ridge when the features are correlated
Suppose you have two highly correlated predictor variables $x,z$, and suppose both are centered and scaled (to mean zero, variance one). Then the ridge penalty on the parameter vector is $\beta_1^2 + \beta_2^2$ while the lasso penalty term is $ \mid \beta_1 \mid + \mid \beta_2 \mid$. Now, since the model is supposed highly colinear, so that $x$ and $z$ more or less can substitute each other in predicting $Y$, so many linear combination of $x, z$ where we simply substitute in part $x$ for $z$, will work very similarly as predictors, for example $0.2 x + 0.8 z, 0.3 x + 0.7 z$ or $0.5 x + 0.5 z$ will be about equally good as predictors. Now look at these three examples, the lasso penalty in all three cases are equal, it is 1, while the ridge penalty differ, it is respectively 0.68, 0.58, 0.5, so the ridge penalty will prefer equal weighting of colinear variables while lasso penalty will not be able to choose. This is one reason ridge (or more generally, elastic net, which is a linear combination of lasso and ridge penalties) will work better with colinear predictors: When the data give little reason to choose between different linear combinations of colinear predictors, lasso will just "wander" while ridge tends to choose equal weighting. That last might be a better guess for use with future data! And, if that is so with present data, could show up in cross validation as better results with ridge. We can view this in a Bayesian way: Ridge and lasso implies different prior information, and the prior information implied by ridge tend to be more reasonable in such situations. (This explanation here I learned , more or less, from the book: "Statistical Learning with Sparsity The Lasso and Generalizations" by Trevor Hastie, Robert Tibshirani and Martin Wainwright, but at this moment I was not able to find a direct quote). But the OP seems to have a different problem: However, my results show that the mean absolute error of Lasso or Elastic is around 0.61 whereas this score is 0.97 for the ridge regression Now, lasso is also effectively doing variable selection, it can set some coefficients exactly to zero. Ridge cannot do that (except with probability zero.) So it might be that with the OP data, among the colinear variables, some are effective and others don't act at all (and the degree of colinearity sufficiently low that this can be detected.) See When should I use lasso vs ridge? where this is discussed. A detailed analysis would need more information than is given in the question.
Why Lasso or ElasticNet perform better than Ridge when the features are correlated
Suppose you have two highly correlated predictor variables $x,z$, and suppose both are centered and scaled (to mean zero, variance one). Then the ridge penalty on the parameter vector is $\beta_1^2 +
Why Lasso or ElasticNet perform better than Ridge when the features are correlated Suppose you have two highly correlated predictor variables $x,z$, and suppose both are centered and scaled (to mean zero, variance one). Then the ridge penalty on the parameter vector is $\beta_1^2 + \beta_2^2$ while the lasso penalty term is $ \mid \beta_1 \mid + \mid \beta_2 \mid$. Now, since the model is supposed highly colinear, so that $x$ and $z$ more or less can substitute each other in predicting $Y$, so many linear combination of $x, z$ where we simply substitute in part $x$ for $z$, will work very similarly as predictors, for example $0.2 x + 0.8 z, 0.3 x + 0.7 z$ or $0.5 x + 0.5 z$ will be about equally good as predictors. Now look at these three examples, the lasso penalty in all three cases are equal, it is 1, while the ridge penalty differ, it is respectively 0.68, 0.58, 0.5, so the ridge penalty will prefer equal weighting of colinear variables while lasso penalty will not be able to choose. This is one reason ridge (or more generally, elastic net, which is a linear combination of lasso and ridge penalties) will work better with colinear predictors: When the data give little reason to choose between different linear combinations of colinear predictors, lasso will just "wander" while ridge tends to choose equal weighting. That last might be a better guess for use with future data! And, if that is so with present data, could show up in cross validation as better results with ridge. We can view this in a Bayesian way: Ridge and lasso implies different prior information, and the prior information implied by ridge tend to be more reasonable in such situations. (This explanation here I learned , more or less, from the book: "Statistical Learning with Sparsity The Lasso and Generalizations" by Trevor Hastie, Robert Tibshirani and Martin Wainwright, but at this moment I was not able to find a direct quote). But the OP seems to have a different problem: However, my results show that the mean absolute error of Lasso or Elastic is around 0.61 whereas this score is 0.97 for the ridge regression Now, lasso is also effectively doing variable selection, it can set some coefficients exactly to zero. Ridge cannot do that (except with probability zero.) So it might be that with the OP data, among the colinear variables, some are effective and others don't act at all (and the degree of colinearity sufficiently low that this can be detected.) See When should I use lasso vs ridge? where this is discussed. A detailed analysis would need more information than is given in the question.
Why Lasso or ElasticNet perform better than Ridge when the features are correlated Suppose you have two highly correlated predictor variables $x,z$, and suppose both are centered and scaled (to mean zero, variance one). Then the ridge penalty on the parameter vector is $\beta_1^2 +
10,698
Why Lasso or ElasticNet perform better than Ridge when the features are correlated
most important difference between lasso and ridge is that lasso naturally makes a selection, expecially where covariates are very correlated. it's impossible to be really sure without seeing the fitted coefficients, but it's easy to think that among those correlated features, many were simply useless.
Why Lasso or ElasticNet perform better than Ridge when the features are correlated
most important difference between lasso and ridge is that lasso naturally makes a selection, expecially where covariates are very correlated. it's impossible to be really sure without seeing the fitte
Why Lasso or ElasticNet perform better than Ridge when the features are correlated most important difference between lasso and ridge is that lasso naturally makes a selection, expecially where covariates are very correlated. it's impossible to be really sure without seeing the fitted coefficients, but it's easy to think that among those correlated features, many were simply useless.
Why Lasso or ElasticNet perform better than Ridge when the features are correlated most important difference between lasso and ridge is that lasso naturally makes a selection, expecially where covariates are very correlated. it's impossible to be really sure without seeing the fitte
10,699
Intuition (geometric or other) of $Var(X) = E[X^2] - (E[X])^2$
Expanding on @whuber's point in the comments, if $Y$ and $Z$ are orthogonal, you have the Pythagorean Theorem: $$ \|Y\|^2 + \|Z\|^2 = \|Y + Z\|^2 $$ Observe that $\langle Y, Z \rangle \equiv \mathrm{E}[YZ]$ is a valid inner product and that $\|Y\| = \sqrt{\mathrm{E}[Y^2]}$ is the norm induced by that inner product. Let $X$ be some random variable. Let $Y = \mathrm{E}[X]$, Let $Z = X - \mathrm{E}[X]$. If $Y$ and $Z$ are orthogonal: \begin{align*} & \|Y\|^2 + \|Z\|^2 = \|Y + Z\|^2 \\ \Leftrightarrow \quad&\mathrm{E}[\mathrm{E}[X]^2] + \mathrm{E}[(X - \mathrm{E}[X])^2] = \mathrm{E}[X^2] \\ \Leftrightarrow \quad & \mathrm{E[X]}^2 + \mathrm{Var}[X]= \mathrm{E}[X^2] \end{align*} And it's easy to show that $Y = \mathrm{E}[X]$ and $Z = X - \mathrm{E}[X]$ are orthogonal under this inner product: $$\langle Y, Z \rangle = \mathrm{E}[\mathrm{E}[X]\left(X - \mathrm{E}[X] \right)] = \mathrm{E}[X]^2 - \mathrm{E}[X]^2 = 0$$ One of the legs of the triangle is $X - \mathrm{E}[X]$, the other leg is $\mathrm{E}[X]$, and the hypotenuse is $X$. And the Pythagorean theorem can be applied because a demeaned random variable is orthogonal to its mean. Technical remark: $Y$ in this example really should be the vector $Y = \mathrm{E}[X] \mathbf{1}$, that is, the scalar $\mathrm{E}[X]$ times the constant vector $\mathbf{1}$ (e.g. $\mathbf{1} = [1, 1, 1, \ldots, 1]'$ in the discrete, finite outcome case). $Y$ is the vector projection of $X$ onto the constant vector $\mathbf{1}$. Simple Example Consider the case where $X$ is a Bernoulli random variable where $p = .2$. We have: $$ X = \begin{bmatrix} 1 \\ 0 \end{bmatrix} \quad P = \begin{bmatrix} .2 \\ .8 \end{bmatrix} \quad \mathrm{E}[X] = \sum_i P_iX_i = .2 $$ $$ Y = \mathrm{E}[X]\mathbf{1} = \begin{bmatrix} .2 \\ .2 \end{bmatrix} \quad Z = X - \mathrm{E}[X] = \begin{bmatrix} .8 \\ -.2 \end{bmatrix} $$ And the picture is: The squared magnitude of the red vector is the variance of $X$, the squared magnitude of the blue vector is $\mathrm{E}[X]^2$, and the squared magnitude of the yellow vector is $\mathrm{E}[X^2]$. REMEMBER though that these magnitudes, the orthogonality etc... aren't with respect to the usual dot product $\sum_i Y_iZ_i$ but the inner product $\sum_i P_iY_iZ_i$. The magnitude of the yellow vector isn't 1, it is .2. The red vector $Y = \mathrm{E}[X]$ and the blue vector $Z = X - \mathrm{E}[X]$ are perpendicular under the inner product $\sum_i P_i Y_i Z_i$ but they aren't perpendicular in the intro, high school geometry sense. Remember we're not using the usual dot product $\sum_i Y_i Z_i$ as the inner product!
Intuition (geometric or other) of $Var(X) = E[X^2] - (E[X])^2$
Expanding on @whuber's point in the comments, if $Y$ and $Z$ are orthogonal, you have the Pythagorean Theorem: $$ \|Y\|^2 + \|Z\|^2 = \|Y + Z\|^2 $$ Observe that $\langle Y, Z \rangle \equiv \mathrm{E
Intuition (geometric or other) of $Var(X) = E[X^2] - (E[X])^2$ Expanding on @whuber's point in the comments, if $Y$ and $Z$ are orthogonal, you have the Pythagorean Theorem: $$ \|Y\|^2 + \|Z\|^2 = \|Y + Z\|^2 $$ Observe that $\langle Y, Z \rangle \equiv \mathrm{E}[YZ]$ is a valid inner product and that $\|Y\| = \sqrt{\mathrm{E}[Y^2]}$ is the norm induced by that inner product. Let $X$ be some random variable. Let $Y = \mathrm{E}[X]$, Let $Z = X - \mathrm{E}[X]$. If $Y$ and $Z$ are orthogonal: \begin{align*} & \|Y\|^2 + \|Z\|^2 = \|Y + Z\|^2 \\ \Leftrightarrow \quad&\mathrm{E}[\mathrm{E}[X]^2] + \mathrm{E}[(X - \mathrm{E}[X])^2] = \mathrm{E}[X^2] \\ \Leftrightarrow \quad & \mathrm{E[X]}^2 + \mathrm{Var}[X]= \mathrm{E}[X^2] \end{align*} And it's easy to show that $Y = \mathrm{E}[X]$ and $Z = X - \mathrm{E}[X]$ are orthogonal under this inner product: $$\langle Y, Z \rangle = \mathrm{E}[\mathrm{E}[X]\left(X - \mathrm{E}[X] \right)] = \mathrm{E}[X]^2 - \mathrm{E}[X]^2 = 0$$ One of the legs of the triangle is $X - \mathrm{E}[X]$, the other leg is $\mathrm{E}[X]$, and the hypotenuse is $X$. And the Pythagorean theorem can be applied because a demeaned random variable is orthogonal to its mean. Technical remark: $Y$ in this example really should be the vector $Y = \mathrm{E}[X] \mathbf{1}$, that is, the scalar $\mathrm{E}[X]$ times the constant vector $\mathbf{1}$ (e.g. $\mathbf{1} = [1, 1, 1, \ldots, 1]'$ in the discrete, finite outcome case). $Y$ is the vector projection of $X$ onto the constant vector $\mathbf{1}$. Simple Example Consider the case where $X$ is a Bernoulli random variable where $p = .2$. We have: $$ X = \begin{bmatrix} 1 \\ 0 \end{bmatrix} \quad P = \begin{bmatrix} .2 \\ .8 \end{bmatrix} \quad \mathrm{E}[X] = \sum_i P_iX_i = .2 $$ $$ Y = \mathrm{E}[X]\mathbf{1} = \begin{bmatrix} .2 \\ .2 \end{bmatrix} \quad Z = X - \mathrm{E}[X] = \begin{bmatrix} .8 \\ -.2 \end{bmatrix} $$ And the picture is: The squared magnitude of the red vector is the variance of $X$, the squared magnitude of the blue vector is $\mathrm{E}[X]^2$, and the squared magnitude of the yellow vector is $\mathrm{E}[X^2]$. REMEMBER though that these magnitudes, the orthogonality etc... aren't with respect to the usual dot product $\sum_i Y_iZ_i$ but the inner product $\sum_i P_iY_iZ_i$. The magnitude of the yellow vector isn't 1, it is .2. The red vector $Y = \mathrm{E}[X]$ and the blue vector $Z = X - \mathrm{E}[X]$ are perpendicular under the inner product $\sum_i P_i Y_i Z_i$ but they aren't perpendicular in the intro, high school geometry sense. Remember we're not using the usual dot product $\sum_i Y_i Z_i$ as the inner product!
Intuition (geometric or other) of $Var(X) = E[X^2] - (E[X])^2$ Expanding on @whuber's point in the comments, if $Y$ and $Z$ are orthogonal, you have the Pythagorean Theorem: $$ \|Y\|^2 + \|Z\|^2 = \|Y + Z\|^2 $$ Observe that $\langle Y, Z \rangle \equiv \mathrm{E
10,700
Intuition (geometric or other) of $Var(X) = E[X^2] - (E[X])^2$
I will go for a purely geometric approach for a very specific scenario. Let us consider a discrete valued random variable $X$ taking values $\{x_1,x_2\}$ with probabilities $(p_1,p_2)$. We will further assume that this random variable can be represented in $\mathbb{R}^2$ as a vector, $\mathbf{X} = \left(x_1\sqrt{p_1},x_2\sqrt{p_2} \right)$. Notice that the length-square of $\mathbf{X}$ is $x_1^2p_1+x_2^2p_2$ which is equal to $E[X^2]$. Thus, $\left\| \mathbf{X} \right\| = \sqrt{E[X^2]}$. Since $p_1+p_2=1$, the tip of vector $\mathbf{X}$ actually traces an ellipse. This becomes easier to see if one reparametrizes $p_1$ and $p_2$ as $\cos^2(\theta)$ and $\sin^2(\theta)$. Hence, we have $\sqrt{p_1} =\cos(\theta)$ and $\sqrt{p_2} = \sin(\theta)$. One way of drawing ellipses is via a mechanism called Trammel of Archimedes. As described in wiki: It consists of two shuttles which are confined ("trammelled") to perpendicular channels or rails, and a rod which is attached to the shuttles by pivots at fixed positions along the rod. As the shuttles move back and forth, each along its channel, the end of the rod moves in an elliptical path. This principle is illustrated in the figure below. Now let us geometrically analyze one instance of this trammel when the vertical shuttle is at $A$ and the horizontal shuttle is at $B$ forming an angle of $\theta$. Due to construction, $\left|BX\right| = x_2$ and $\left| AB \right| = x_1-x_2$, $\forall \theta$ (here $x_1\geq x_2$ is assumed wlog). Let us draw a line from origin, $OC$, that is perpendicular to the rod. One can show that $\left| OC \right|=(x_1-x_2) \sin(\theta) \cos(\theta)$. For this specific random variable \begin{eqnarray} Var(X) &=& (x_1^2p_1 +x_2^2p_2) - (x_1p_1+x_2p_2)^2 \\ &=& x_1^2p_1 +x_2^2p_2 - x_1^2p_1^2 - x_2^2p_2^2 - 2x_1x_2p_1p_2 \\ &=& x_1^2(p_1-p_1^2) + x_2^2(p_2-p_2^2) - 2x_1x_2p_1p_2 \\ &=& p_1p_2(x_1^2- 2x_1x_2 + x_2^2) \\ &=& \left[(x_1-x_2)\sqrt{p_1}\sqrt{p_2}\right]^2 = \left|OC \right|^2 \end{eqnarray} Therefore, the perpendicular distance $\left|OC \right|$ from the origin to the rod is actually equal to the standard deviation, $\sigma$. If we compute the length of segment from $C$ to $X$: \begin{eqnarray} \left|CX\right| &=& x_2 + (x_1-x_2)\cos^2(\theta) \\ &=& x_1\cos^2(\theta) +x_2\sin^2(\theta) \\ &=& x_1p_1 + x_2p_2 = E[X] \end{eqnarray} Applying the Pythagorean Theorem in the triangle OCX, we end up with \begin{equation} E[X^2] = Var(X) + E[X]^2. \end{equation} To summarize, for a trammel that describes all possible discrete valued random variables taking values $\{x_1,x_2\}$, $\sqrt{E[X^2]}$ is the distance from the origin to the tip of the mechanism and the standard deviation $\sigma$ is the perpendicular distance to the rod. Note: Notice that when $\theta$ is $0$ or $\pi/2$, $X$ is completely deterministic. When $\theta$ is $\pi/4$ we end up with maximum variance.
Intuition (geometric or other) of $Var(X) = E[X^2] - (E[X])^2$
I will go for a purely geometric approach for a very specific scenario. Let us consider a discrete valued random variable $X$ taking values $\{x_1,x_2\}$ with probabilities $(p_1,p_2)$. We will furthe
Intuition (geometric or other) of $Var(X) = E[X^2] - (E[X])^2$ I will go for a purely geometric approach for a very specific scenario. Let us consider a discrete valued random variable $X$ taking values $\{x_1,x_2\}$ with probabilities $(p_1,p_2)$. We will further assume that this random variable can be represented in $\mathbb{R}^2$ as a vector, $\mathbf{X} = \left(x_1\sqrt{p_1},x_2\sqrt{p_2} \right)$. Notice that the length-square of $\mathbf{X}$ is $x_1^2p_1+x_2^2p_2$ which is equal to $E[X^2]$. Thus, $\left\| \mathbf{X} \right\| = \sqrt{E[X^2]}$. Since $p_1+p_2=1$, the tip of vector $\mathbf{X}$ actually traces an ellipse. This becomes easier to see if one reparametrizes $p_1$ and $p_2$ as $\cos^2(\theta)$ and $\sin^2(\theta)$. Hence, we have $\sqrt{p_1} =\cos(\theta)$ and $\sqrt{p_2} = \sin(\theta)$. One way of drawing ellipses is via a mechanism called Trammel of Archimedes. As described in wiki: It consists of two shuttles which are confined ("trammelled") to perpendicular channels or rails, and a rod which is attached to the shuttles by pivots at fixed positions along the rod. As the shuttles move back and forth, each along its channel, the end of the rod moves in an elliptical path. This principle is illustrated in the figure below. Now let us geometrically analyze one instance of this trammel when the vertical shuttle is at $A$ and the horizontal shuttle is at $B$ forming an angle of $\theta$. Due to construction, $\left|BX\right| = x_2$ and $\left| AB \right| = x_1-x_2$, $\forall \theta$ (here $x_1\geq x_2$ is assumed wlog). Let us draw a line from origin, $OC$, that is perpendicular to the rod. One can show that $\left| OC \right|=(x_1-x_2) \sin(\theta) \cos(\theta)$. For this specific random variable \begin{eqnarray} Var(X) &=& (x_1^2p_1 +x_2^2p_2) - (x_1p_1+x_2p_2)^2 \\ &=& x_1^2p_1 +x_2^2p_2 - x_1^2p_1^2 - x_2^2p_2^2 - 2x_1x_2p_1p_2 \\ &=& x_1^2(p_1-p_1^2) + x_2^2(p_2-p_2^2) - 2x_1x_2p_1p_2 \\ &=& p_1p_2(x_1^2- 2x_1x_2 + x_2^2) \\ &=& \left[(x_1-x_2)\sqrt{p_1}\sqrt{p_2}\right]^2 = \left|OC \right|^2 \end{eqnarray} Therefore, the perpendicular distance $\left|OC \right|$ from the origin to the rod is actually equal to the standard deviation, $\sigma$. If we compute the length of segment from $C$ to $X$: \begin{eqnarray} \left|CX\right| &=& x_2 + (x_1-x_2)\cos^2(\theta) \\ &=& x_1\cos^2(\theta) +x_2\sin^2(\theta) \\ &=& x_1p_1 + x_2p_2 = E[X] \end{eqnarray} Applying the Pythagorean Theorem in the triangle OCX, we end up with \begin{equation} E[X^2] = Var(X) + E[X]^2. \end{equation} To summarize, for a trammel that describes all possible discrete valued random variables taking values $\{x_1,x_2\}$, $\sqrt{E[X^2]}$ is the distance from the origin to the tip of the mechanism and the standard deviation $\sigma$ is the perpendicular distance to the rod. Note: Notice that when $\theta$ is $0$ or $\pi/2$, $X$ is completely deterministic. When $\theta$ is $\pi/4$ we end up with maximum variance.
Intuition (geometric or other) of $Var(X) = E[X^2] - (E[X])^2$ I will go for a purely geometric approach for a very specific scenario. Let us consider a discrete valued random variable $X$ taking values $\{x_1,x_2\}$ with probabilities $(p_1,p_2)$. We will furthe