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
41,501
What would the distribution of time spent per day on a given site look like?
This type of question raises a lot of issues that would be worth talking about. I can only speak for myself, but I would want to make the following points. The most basic properties you would expect for this distribution is that it would be continuous and have non-negative support. You could quibble with the first of these properties if you were to measure time in discrete increments (e.g., measurement goes down to seconds), but even in that case, it would be best to think of the actual time spent on the site as continuous, but then it is discretised by the measuring instrument. Given that you have a large number of users operating separately from each other, with immense variation in the length of activities on the sites (e.g., different video lengths on YouTube), it would be reasonable to think that the distribution would have a smooth density and would be quasi-concave (i.e., unimodal). Since we are looking at the amount of time spent on the site per day the distribution would also be truncated at one day (i.e., this is the upper bound on the outcome). The time spent on the site can be framed as a "truncated survival process" and so it would be reasonable to consider standard distributions in survival analysis as starting points for speculation. One could reasonably speculate on the distribution by thinking about the likely shape of the "hazard function" for the process. Most likely, the hazard function would start off low and then get larger over time (i.e., the user is more likely to leave the longer they have been on the site). It is generally bad practice to assume away nasty empirical realities, such as a person being away-from-keyboard or opening and then quickly closing the site. There is no particular reason that either of these realities would cause problems in speculating on the distribution. I see no reason to remove them from consideration. Now, if one agrees with the above ideas, some reasonable speculations for the shape of the distribution would be the truncated gamma distribution or the truncated Weibull distribution. The latter has a imple hazard function that can be set to be exponentially increasing. Finally, it is important to note that these are just speculations. Ultimately, if we want to know the distribution of the time on these sites per day, we need to obtain data on that outcome and let the data "speak for itself". It may be that standard parametric distributions do not fit this data particularly well, in which case we might fall back on non-parametric analysis.
What would the distribution of time spent per day on a given site look like?
This type of question raises a lot of issues that would be worth talking about. I can only speak for myself, but I would want to make the following points. The most basic properties you would expect
What would the distribution of time spent per day on a given site look like? This type of question raises a lot of issues that would be worth talking about. I can only speak for myself, but I would want to make the following points. The most basic properties you would expect for this distribution is that it would be continuous and have non-negative support. You could quibble with the first of these properties if you were to measure time in discrete increments (e.g., measurement goes down to seconds), but even in that case, it would be best to think of the actual time spent on the site as continuous, but then it is discretised by the measuring instrument. Given that you have a large number of users operating separately from each other, with immense variation in the length of activities on the sites (e.g., different video lengths on YouTube), it would be reasonable to think that the distribution would have a smooth density and would be quasi-concave (i.e., unimodal). Since we are looking at the amount of time spent on the site per day the distribution would also be truncated at one day (i.e., this is the upper bound on the outcome). The time spent on the site can be framed as a "truncated survival process" and so it would be reasonable to consider standard distributions in survival analysis as starting points for speculation. One could reasonably speculate on the distribution by thinking about the likely shape of the "hazard function" for the process. Most likely, the hazard function would start off low and then get larger over time (i.e., the user is more likely to leave the longer they have been on the site). It is generally bad practice to assume away nasty empirical realities, such as a person being away-from-keyboard or opening and then quickly closing the site. There is no particular reason that either of these realities would cause problems in speculating on the distribution. I see no reason to remove them from consideration. Now, if one agrees with the above ideas, some reasonable speculations for the shape of the distribution would be the truncated gamma distribution or the truncated Weibull distribution. The latter has a imple hazard function that can be set to be exponentially increasing. Finally, it is important to note that these are just speculations. Ultimately, if we want to know the distribution of the time on these sites per day, we need to obtain data on that outcome and let the data "speak for itself". It may be that standard parametric distributions do not fit this data particularly well, in which case we might fall back on non-parametric analysis.
What would the distribution of time spent per day on a given site look like? This type of question raises a lot of issues that would be worth talking about. I can only speak for myself, but I would want to make the following points. The most basic properties you would expect
41,502
Compare two Weibull distributions
My question is, what is the null hypothesis in this likelihood ratio test? Under the null for that particular test as described, all the parameters are the same (which is why you were fitting a single Weibull to all the data under that case) -- under the shape-scale parameterization $$f(x;\lambda,\theta) =\frac{\theta}{\lambda}\left(\frac{x}{\lambda}\right)^{\theta-1}e^{-(x/\lambda)^{\theta}} \: \mathbb{I}_{x\geq0}\,,\quad \theta,\lambda>0$$ the null would be that both the shape and scale parameters ($\theta$ and $\lambda$ respectively) are the same, which you might write as: $$H_0: \theta_1=\theta_2\, , \: \lambda_1=\lambda_2$$ It's your null and alternative hypotheses that determine the likelihood ratio test that you do, not the other way around. If that's not the null you wanted to test you have to set the test up differently. The test takes the ratio of likelihoods under the null and alternative (and asymptotically, minus twice its log will be chi-squared distributed under fairly broad conditions). I get a P-value=0.4258827 and I don't know whether this means that the 2 Weibull distributions come from the same distribution or not. Note that you don't state a significance level anywhere. You shouldn't even do the calculations for a test until you have picked one, and until you're clear what your rejection rule will be. (If you're asking here how to interpret a p-value or what a p-value greater than your significance level - assuming it is - means, we have many discussions on that topic which can be searched for. There's little value in repeating what's been said very well on the basic mechanics of how hypothesis tests work. Start with Wikipedia on statistical hypothesis testing under "An alternative process", and there's some discussion here and here for example. Since explanations of what to do are easy to find I assume your actual issue is somewhat different.) If you understand that you don't reject (presuming your significance level is lower than your p-value here), but are asking about how to interpret the non-rejection, note that failure to reject the null does not mean that the two distributions are the same (as your question suggests). It means there's no clear indication that they're different above what you'd be able to explain as due to random variation. Which is to say that the data are reasonably consistent with them having come from the same Weibull. This is not at all the same as being able to assert that they actually do. It may in that situation be reasonable to act as if they're all drawn from the same distribution, but we don't know it to be so.
Compare two Weibull distributions
My question is, what is the null hypothesis in this likelihood ratio test? Under the null for that particular test as described, all the parameters are the same (which is why you were fitting a sing
Compare two Weibull distributions My question is, what is the null hypothesis in this likelihood ratio test? Under the null for that particular test as described, all the parameters are the same (which is why you were fitting a single Weibull to all the data under that case) -- under the shape-scale parameterization $$f(x;\lambda,\theta) =\frac{\theta}{\lambda}\left(\frac{x}{\lambda}\right)^{\theta-1}e^{-(x/\lambda)^{\theta}} \: \mathbb{I}_{x\geq0}\,,\quad \theta,\lambda>0$$ the null would be that both the shape and scale parameters ($\theta$ and $\lambda$ respectively) are the same, which you might write as: $$H_0: \theta_1=\theta_2\, , \: \lambda_1=\lambda_2$$ It's your null and alternative hypotheses that determine the likelihood ratio test that you do, not the other way around. If that's not the null you wanted to test you have to set the test up differently. The test takes the ratio of likelihoods under the null and alternative (and asymptotically, minus twice its log will be chi-squared distributed under fairly broad conditions). I get a P-value=0.4258827 and I don't know whether this means that the 2 Weibull distributions come from the same distribution or not. Note that you don't state a significance level anywhere. You shouldn't even do the calculations for a test until you have picked one, and until you're clear what your rejection rule will be. (If you're asking here how to interpret a p-value or what a p-value greater than your significance level - assuming it is - means, we have many discussions on that topic which can be searched for. There's little value in repeating what's been said very well on the basic mechanics of how hypothesis tests work. Start with Wikipedia on statistical hypothesis testing under "An alternative process", and there's some discussion here and here for example. Since explanations of what to do are easy to find I assume your actual issue is somewhat different.) If you understand that you don't reject (presuming your significance level is lower than your p-value here), but are asking about how to interpret the non-rejection, note that failure to reject the null does not mean that the two distributions are the same (as your question suggests). It means there's no clear indication that they're different above what you'd be able to explain as due to random variation. Which is to say that the data are reasonably consistent with them having come from the same Weibull. This is not at all the same as being able to assert that they actually do. It may in that situation be reasonable to act as if they're all drawn from the same distribution, but we don't know it to be so.
Compare two Weibull distributions My question is, what is the null hypothesis in this likelihood ratio test? Under the null for that particular test as described, all the parameters are the same (which is why you were fitting a sing
41,503
What problem does Residual Nets solve that batch normalization does not solve?
"Skip connections eliminate singularities" by A. Emin Orhan, Xaq Pitkow offers an explanation: residual connections ameliorate singularities in neural networks. Skip connections made the training of very deep networks possible and have become an indispensable component in a variety of neural architectures. A completely satisfactory explanation for their success remains elusive. Here, we present a novel explanation for the benefits of skip connections in training very deep networks. The difficulty of training deep networks is partly due to the singularities caused by the non-identifiability of the model. Several such singularities have been identified in previous works: (i) overlap singularities caused by the permutation symmetry of nodes in a given layer, (ii) elimination singularities corresponding to the elimination, i.e. consistent deactivation, of nodes, (iii) singularities generated by the linear dependence of the nodes. These singularities cause degenerate manifolds in the loss landscape that slow down learning. We argue that skip connections eliminate these singularities by breaking the permutation symmetry of nodes, by reducing the possibility of node elimination and by making the nodes less linearly dependent. Moreover, for typical initializations, skip connections move the network away from the “ghosts” of these singularities and sculpt the landscape around them to alleviate the learning slow-down. These hypotheses are supported by evidence from simplified models, as well as from experiments with deep networks trained on real-world datasets. I'm not aware of a layer or batch normalization strategy that can accomplish this.
What problem does Residual Nets solve that batch normalization does not solve?
"Skip connections eliminate singularities" by A. Emin Orhan, Xaq Pitkow offers an explanation: residual connections ameliorate singularities in neural networks. Skip connections made the training of
What problem does Residual Nets solve that batch normalization does not solve? "Skip connections eliminate singularities" by A. Emin Orhan, Xaq Pitkow offers an explanation: residual connections ameliorate singularities in neural networks. Skip connections made the training of very deep networks possible and have become an indispensable component in a variety of neural architectures. A completely satisfactory explanation for their success remains elusive. Here, we present a novel explanation for the benefits of skip connections in training very deep networks. The difficulty of training deep networks is partly due to the singularities caused by the non-identifiability of the model. Several such singularities have been identified in previous works: (i) overlap singularities caused by the permutation symmetry of nodes in a given layer, (ii) elimination singularities corresponding to the elimination, i.e. consistent deactivation, of nodes, (iii) singularities generated by the linear dependence of the nodes. These singularities cause degenerate manifolds in the loss landscape that slow down learning. We argue that skip connections eliminate these singularities by breaking the permutation symmetry of nodes, by reducing the possibility of node elimination and by making the nodes less linearly dependent. Moreover, for typical initializations, skip connections move the network away from the “ghosts” of these singularities and sculpt the landscape around them to alleviate the learning slow-down. These hypotheses are supported by evidence from simplified models, as well as from experiments with deep networks trained on real-world datasets. I'm not aware of a layer or batch normalization strategy that can accomplish this.
What problem does Residual Nets solve that batch normalization does not solve? "Skip connections eliminate singularities" by A. Emin Orhan, Xaq Pitkow offers an explanation: residual connections ameliorate singularities in neural networks. Skip connections made the training of
41,504
What problem does Residual Nets solve that batch normalization does not solve?
Batch normalization mitigates issues such as: how can you use a large learning rate without 'breaking' the network, eg accidentally kill all ReLUs, push the preceeding layer so far in one direction, that their output is always negative, and thus no gradients flow avoid having to shift all weights in one direction by a constant amounts, or multiply by a constant magnitude, when you can simply learn two single scalars to handle this However, vanishing gradients are typically considered to be caused in a large part by the passage through non-linear 'activation' functions, such as sigmoid or tanh. Using ReLU mitigates this issue to a large extend, a large part of the reason for the widespread usage of ReLU, but doesn't solve vanishing gradients entirely. Using residual nets gives a 'bus' that all gradients can flow down, directly, albeit modified somewhat by the attached residual blocks. I put a diagram of how I see a residual net working in another answer, to a similar-ish question, at Gradient backpropagation through ResNet skip connections
What problem does Residual Nets solve that batch normalization does not solve?
Batch normalization mitigates issues such as: how can you use a large learning rate without 'breaking' the network, eg accidentally kill all ReLUs, push the preceeding layer so far in one direction,
What problem does Residual Nets solve that batch normalization does not solve? Batch normalization mitigates issues such as: how can you use a large learning rate without 'breaking' the network, eg accidentally kill all ReLUs, push the preceeding layer so far in one direction, that their output is always negative, and thus no gradients flow avoid having to shift all weights in one direction by a constant amounts, or multiply by a constant magnitude, when you can simply learn two single scalars to handle this However, vanishing gradients are typically considered to be caused in a large part by the passage through non-linear 'activation' functions, such as sigmoid or tanh. Using ReLU mitigates this issue to a large extend, a large part of the reason for the widespread usage of ReLU, but doesn't solve vanishing gradients entirely. Using residual nets gives a 'bus' that all gradients can flow down, directly, albeit modified somewhat by the attached residual blocks. I put a diagram of how I see a residual net working in another answer, to a similar-ish question, at Gradient backpropagation through ResNet skip connections
What problem does Residual Nets solve that batch normalization does not solve? Batch normalization mitigates issues such as: how can you use a large learning rate without 'breaking' the network, eg accidentally kill all ReLUs, push the preceeding layer so far in one direction,
41,505
What problem does Residual Nets solve that batch normalization does not solve?
I think the main reason in that deep networks forget the input data from some time thus their behavior depends from previous layers. And it the same as a broken phone. Resid connections adding some hopping over few layers, which gives better understanding what happening.
What problem does Residual Nets solve that batch normalization does not solve?
I think the main reason in that deep networks forget the input data from some time thus their behavior depends from previous layers. And it the same as a broken phone. Resid connections adding some ho
What problem does Residual Nets solve that batch normalization does not solve? I think the main reason in that deep networks forget the input data from some time thus their behavior depends from previous layers. And it the same as a broken phone. Resid connections adding some hopping over few layers, which gives better understanding what happening.
What problem does Residual Nets solve that batch normalization does not solve? I think the main reason in that deep networks forget the input data from some time thus their behavior depends from previous layers. And it the same as a broken phone. Resid connections adding some ho
41,506
Uniqueness for OLS linear regression
I'm going to transpose your notation so that it is consistent with how these things are usually written. You have a predictor matrix $X \in \mathbb R^{n \times p}$ (with the first column taken to be all $1$s) and a random response $Y \in \mathbb R^n$. We are going to fit the model $E(Y|X) = X\beta$. Your case corresponds to $p=2$. In general you know that $$\hat \beta = \textrm{argmin}_{b \in \mathbb R^p} ||Y - Xb||^2.$$ If $X$ is full rank then this problem is strictly convex and therefore the argminimum is unique. Now suppose that $X$ is not full rank. Then the problem no longer is strictly convex and there are infinitely many solutions. In your case, this would be the case where $x_1 = \dots x_n = c$ for some constant $c \in \mathbb R$. Note that $X$ is full rank $\iff$ $X^TX$ is invertible. We could also use a more direct linear algebra argument rather than a convexity argument. We know that a solution $\hat \beta$ to $\min ||Y - Xb||^2$ is a solution to the normal equations $$ X^TY = X^TX \hat \beta. $$ Suppose $\hat \beta$ and $\tilde \beta$ both satisfy the normal equations so that $$ (X^TX)\hat\beta = (X^TX)\tilde\beta $$ If $X$ is full rank, or equivalently $X^TX$ is invertible, then $X^TX\hat\beta = X^TX\tilde\beta \implies \hat\beta = \tilde\beta$. In terms of linear transformations, $X^TX$ being invertible means it's a bijection (and therefore 1-1) so this is just saying $f(a) = f(b) \implies a = b$ for a bijection $f$. Now if $X^TX$ is singular then its null space $N(X^TX)$ is at least 1-dimensional so let $v \neq 0 \in N(X^TX)$. This tells us that $$ X^TX\hat\beta = X^TX(\hat \beta + v) $$ so it is not necessarily the case that two solutions to the normal equations are equal.
Uniqueness for OLS linear regression
I'm going to transpose your notation so that it is consistent with how these things are usually written. You have a predictor matrix $X \in \mathbb R^{n \times p}$ (with the first column taken to be a
Uniqueness for OLS linear regression I'm going to transpose your notation so that it is consistent with how these things are usually written. You have a predictor matrix $X \in \mathbb R^{n \times p}$ (with the first column taken to be all $1$s) and a random response $Y \in \mathbb R^n$. We are going to fit the model $E(Y|X) = X\beta$. Your case corresponds to $p=2$. In general you know that $$\hat \beta = \textrm{argmin}_{b \in \mathbb R^p} ||Y - Xb||^2.$$ If $X$ is full rank then this problem is strictly convex and therefore the argminimum is unique. Now suppose that $X$ is not full rank. Then the problem no longer is strictly convex and there are infinitely many solutions. In your case, this would be the case where $x_1 = \dots x_n = c$ for some constant $c \in \mathbb R$. Note that $X$ is full rank $\iff$ $X^TX$ is invertible. We could also use a more direct linear algebra argument rather than a convexity argument. We know that a solution $\hat \beta$ to $\min ||Y - Xb||^2$ is a solution to the normal equations $$ X^TY = X^TX \hat \beta. $$ Suppose $\hat \beta$ and $\tilde \beta$ both satisfy the normal equations so that $$ (X^TX)\hat\beta = (X^TX)\tilde\beta $$ If $X$ is full rank, or equivalently $X^TX$ is invertible, then $X^TX\hat\beta = X^TX\tilde\beta \implies \hat\beta = \tilde\beta$. In terms of linear transformations, $X^TX$ being invertible means it's a bijection (and therefore 1-1) so this is just saying $f(a) = f(b) \implies a = b$ for a bijection $f$. Now if $X^TX$ is singular then its null space $N(X^TX)$ is at least 1-dimensional so let $v \neq 0 \in N(X^TX)$. This tells us that $$ X^TX\hat\beta = X^TX(\hat \beta + v) $$ so it is not necessarily the case that two solutions to the normal equations are equal.
Uniqueness for OLS linear regression I'm going to transpose your notation so that it is consistent with how these things are usually written. You have a predictor matrix $X \in \mathbb R^{n \times p}$ (with the first column taken to be a
41,507
Neural network regression with confidence interval implemented with Keras
You would have to output vectors of means and standard deviations rather than discrete values to achieve that. One solution to get those vectors would be variational inference - generate those, sample w/reparametrization, then optimize so the results of the sampling match the original values like in normal regression (i.e. MSE/MAPE/MAE/whatever loss) and regularize the means and stddev to 0/1 respectively. Essentially the same process as a vanilla Variational Autoencoder, except you're not bound by the Autoencoder architecture, and you want the means/stddevs as the outputs of the trained network rather than the sampled values.
Neural network regression with confidence interval implemented with Keras
You would have to output vectors of means and standard deviations rather than discrete values to achieve that. One solution to get those vectors would be variational inference - generate those, sample
Neural network regression with confidence interval implemented with Keras You would have to output vectors of means and standard deviations rather than discrete values to achieve that. One solution to get those vectors would be variational inference - generate those, sample w/reparametrization, then optimize so the results of the sampling match the original values like in normal regression (i.e. MSE/MAPE/MAE/whatever loss) and regularize the means and stddev to 0/1 respectively. Essentially the same process as a vanilla Variational Autoencoder, except you're not bound by the Autoencoder architecture, and you want the means/stddevs as the outputs of the trained network rather than the sampled values.
Neural network regression with confidence interval implemented with Keras You would have to output vectors of means and standard deviations rather than discrete values to achieve that. One solution to get those vectors would be variational inference - generate those, sample
41,508
Neural network regression with confidence interval implemented with Keras
Thanks to @jkm I was quite fascinated by the idea of implementing confidence intervals for regression in Keras. Personally, I hope it would boost my model network's performance as I have multiple supervised DL models on different datasets that are being fed into a single Reinforcement Learning Algorithm. Hence, the RL 'parent' would be able to know how confident the individual model is at a given time. I went with a different approach to implementing a custom loss function (as I need the two neuron outputs without any Keras magic of printing hidden layer outputs...). If at the end of the model you have a Dense(2) layer, then you have an output of size [batch_size, 2]. The problem is that tf.random.normal needs two separate tensors for the mean and std. So you need to transpose the output. The Loss Function with MSE: class RegressionDistLoss(tf.keras.losses.Loss): def __init__(self): super(RegressionDistLoss, self).__init__() self.mse = tf.keras.losses.MeanSquaredError() def call(self, y_true, y_pred): x = tf.transpose(y_pred) x = tf.random.normal([y_pred.shape[0]], x[0], x[1]) # print(x) # tf.Tensor([-0.2107901 3.8580756 1.8032494], shape=(3,), dtype=float32) return self.mse(y_true, x) Val. Experiment: y_true = tf.constant([0, 4, 2], dtype='float32') y_pred = tf.constant([[0, 1], [3.5, .5], [2.2, .7]], dtype='float32') x = RegressionDistLoss()(y_true, y_pred) print(x) # <tf.Tensor: shape=(), dtype=float32, numpy=0.0344286>
Neural network regression with confidence interval implemented with Keras
Thanks to @jkm I was quite fascinated by the idea of implementing confidence intervals for regression in Keras. Personally, I hope it would boost my model network's performance as I have multiple supe
Neural network regression with confidence interval implemented with Keras Thanks to @jkm I was quite fascinated by the idea of implementing confidence intervals for regression in Keras. Personally, I hope it would boost my model network's performance as I have multiple supervised DL models on different datasets that are being fed into a single Reinforcement Learning Algorithm. Hence, the RL 'parent' would be able to know how confident the individual model is at a given time. I went with a different approach to implementing a custom loss function (as I need the two neuron outputs without any Keras magic of printing hidden layer outputs...). If at the end of the model you have a Dense(2) layer, then you have an output of size [batch_size, 2]. The problem is that tf.random.normal needs two separate tensors for the mean and std. So you need to transpose the output. The Loss Function with MSE: class RegressionDistLoss(tf.keras.losses.Loss): def __init__(self): super(RegressionDistLoss, self).__init__() self.mse = tf.keras.losses.MeanSquaredError() def call(self, y_true, y_pred): x = tf.transpose(y_pred) x = tf.random.normal([y_pred.shape[0]], x[0], x[1]) # print(x) # tf.Tensor([-0.2107901 3.8580756 1.8032494], shape=(3,), dtype=float32) return self.mse(y_true, x) Val. Experiment: y_true = tf.constant([0, 4, 2], dtype='float32') y_pred = tf.constant([[0, 1], [3.5, .5], [2.2, .7]], dtype='float32') x = RegressionDistLoss()(y_true, y_pred) print(x) # <tf.Tensor: shape=(), dtype=float32, numpy=0.0344286>
Neural network regression with confidence interval implemented with Keras Thanks to @jkm I was quite fascinated by the idea of implementing confidence intervals for regression in Keras. Personally, I hope it would boost my model network's performance as I have multiple supe
41,509
Proving Bernoulli is the limit of Beta
The analysis can be a little messy, especially if carried out with full and elementary rigor, but the idea is simple and easily grasped. Focus on small regions very close to $0$ and $1$. As $\alpha$ and $\beta$ approach $0$, almost all the probability of a Beta$(\alpha,\beta)$ distribution becomes located within these regions. By shrinking the sizes of the regions, we see that the limiting distribution if one exists can only be a Bernoulli distribution. We can create a limiting distribution only by making the ratio $\alpha:\beta$ approach a constant, exactly as described in the question. The nice thing about this analysis is that looking at relative areas obviates any need to consider the behavior of the normalizing constant, a Beta function $B(\alpha,\beta)$. This is a considerable simplification. (Its avoidance of the Beta function is similar in spirit to my analysis of Beta distribution quantiles at Do two quantiles of a beta distribution determine its parameters?) A further feature of this analysis is approximating the incomplete Beta function by simple integrals of the form $\int t^c\mathrm{d}t$ for constants $c\gt -1$. This reduces everything to the most elementary operations of Calculus and algebraic inequalities. The Beta PDF is proportional to $$f(x)=x^{\alpha-1}(1-x)^{\beta-1}.$$ Consider small $\epsilon\gt 0$ and examine the contributions to the area under $f$ within the three intervals $(0,\epsilon]$, $(\epsilon, 1-\epsilon)$, and $[1-\epsilon, 1)$ as $\alpha$ and $\beta$ grow small (but remain positive). Eventually both $\alpha$ and $\beta$ will both be less than $1$: $f$ will therefore have poles at both $0$ and $1$, looking like this: The graph of $f$ is the upper blue line. Compared to it are the graphs of $x^{\alpha-1}$ (red curve, with a pole only at $0$) and $(1-x)^{\beta-1}$ (gold curve, with a pole only at $1$). What happens to the three areas under $f$, relative to each other, in the limit? As a matter of notation, write $$F(x) = \int_0^x f(t)\mathrm{d}t = \int_0^x t^{\alpha-1}(1-t)^{\beta-1}\mathrm{d}t$$for the area under the graph of $f$ between $0$ and $x$. I am asking about the relative sizes of $F(\epsilon)$, $F(1-\epsilon)-F(\epsilon)$, and $F(1)-F(1-\epsilon)$. Let's estimate these areas one at a time, always assuming $0 \lt \alpha \lt 1$ and $0\lt \beta \lt 1,$ $0\lt x \lt 1,$ and $0\lt \epsilon \lt 1/2$. Under these assumptions $$x^{\alpha-1} \gt 1;\quad(1-x)^{\beta-1}\gt 1,$$ $x\to x^{\alpha-1}$ (red) is a decreasing function in $x,$ and $x\to (1-x)^{\beta-1}$ (gold) is an increasing function. On the left, it looks like the blue and red curves draw close. Indeed, for $0\lt x \lt \epsilon$, the foregoing inequalities yield the bounds $$x^{\alpha-1} \lt x^{\alpha-1}(1-x)^{\beta-1} \lt x^{\alpha-1}(1-\epsilon)^{\beta-1}.$$Integrating each between $0$ and $\epsilon$ is simple and squeezes $F(\epsilon)$ between two close bounds, $$\frac{\epsilon^\alpha}{\alpha} \lt F(\epsilon) \lt (1-\epsilon)^{\beta-1} \frac{\epsilon^\alpha}{\alpha}.\tag{1}$$ The same analysis applies to the right hand side, yielding a similar result. Because $f$ is concave, on the middle interval $[\epsilon, 1-\epsilon]$ it attains its extreme values at the endpoints. Consequently the area is less than that of the trapezoid spanned by those points: $$\eqalign{ F(1-\epsilon) - F(\epsilon) &\lt \frac{1}{2}\left(f(\epsilon) + f(1-\epsilon)\right)(1-\epsilon - \epsilon)\\ &= \frac{1-2\epsilon}{2}\left(\epsilon^{\alpha-1}(1-\epsilon)^{\beta-1} + (1-\epsilon)^{\alpha-1}\epsilon^{\beta-1}\right)).\tag{2} }$$ Although this threatens to get messy, let's temporarily fix $\epsilon$ and consider what happens to the ratio $(F(1-\epsilon)-F(\epsilon)):F(\epsilon)$ as $\alpha$ and $\beta$ approach $0$. In expressions $(1)$ and $(2)$, both $(1-\epsilon)^{\alpha-1}$ and $(1-\epsilon)^{\beta-1}$ will approach $(1-\epsilon)^0=1$. Thus, the only terms that matter in the limit are $$\frac{F(1-\epsilon)-F(\epsilon)}{F(\epsilon)} \approx \frac{(\epsilon^{\alpha-1} + \epsilon^{\beta-1})/2}{\epsilon^\alpha / \alpha} = \frac{\alpha}{2\epsilon} + \frac{\alpha}{2\epsilon^{\alpha-\beta}} \approx \frac{\alpha}{\epsilon}\tag{3}$$ because $\alpha-\beta \approx 0$. Consequently, since $\alpha\to 0$, eventually the middle area is inconsequential compared to the left area. The same argument shows that eventually the middle area is close to $\beta/\epsilon$ times the right area, which also becomes inconsequential. This shows that $(*)$ No matter what $0\lt \epsilon\lt 1/2$ may be, if we take both $\alpha$ and $\beta$ to be sufficiently small, then essentially all the area under $f$ is concentrated within the left interval $(0,\epsilon)$ and the right interval $(1-\epsilon, 1)$. The rest is easy: the mean will be very close to the area near the right pole (proof: underestimate it by replacing $xf(x)$ by $0f(x)$ in the integrals over the left and middle intervals and by $(1-\epsilon)f(x)$ in the right interval, then overestimate it by replacing $xf(x)$ by $\epsilon f(x)$ at the left, $(1-\epsilon)f(x)$ in the middle, and $f(x)$ at the right. Both expressions closely approximate $F(1)-F(1-\epsilon)$.) But, by $(3),$ the relative areas are approximately $$\frac{F(1)-F(1-\epsilon)}{F(\epsilon)} \approx \frac{\epsilon/\beta}{\epsilon/\alpha} = \frac{\alpha}{\beta}.$$ By keeping the mean constant, this ratio remains constant, allowing us to add one more observation to $(*)$: $(**)$ If we let $\alpha\to 0$ and $\beta\to 0$ in such a way that $\alpha/\beta$ approaches a limiting constant $\lambda$, then eventually the ratio of the area at the right to the area at the left will be arbitrarily close to $\lambda$, too. Now contemplate $\epsilon$ shrinking to zero. The result is that the limiting distribution exists and it must have all its probability concentrated around the values $0$ and $1$: this is the class of Bernoulli distributions. $(**)$ pins down which one: since the Bernoulli$(p)$ distribution, whose mean is $p,$ assigns probability $p$ to $1$ and probability $1-p$ to $0$, the ratio $p/(1-p)$ must be the limiting ratio $\lambda.$ In the terminology of the question, $$\lambda = \alpha / \left(\frac{1-\mu}{\mu}\alpha\right) = \frac{\mu}{1-\mu} = \frac{p}{1-p},$$ as claimed.
Proving Bernoulli is the limit of Beta
The analysis can be a little messy, especially if carried out with full and elementary rigor, but the idea is simple and easily grasped. Focus on small regions very close to $0$ and $1$. As $\alpha$
Proving Bernoulli is the limit of Beta The analysis can be a little messy, especially if carried out with full and elementary rigor, but the idea is simple and easily grasped. Focus on small regions very close to $0$ and $1$. As $\alpha$ and $\beta$ approach $0$, almost all the probability of a Beta$(\alpha,\beta)$ distribution becomes located within these regions. By shrinking the sizes of the regions, we see that the limiting distribution if one exists can only be a Bernoulli distribution. We can create a limiting distribution only by making the ratio $\alpha:\beta$ approach a constant, exactly as described in the question. The nice thing about this analysis is that looking at relative areas obviates any need to consider the behavior of the normalizing constant, a Beta function $B(\alpha,\beta)$. This is a considerable simplification. (Its avoidance of the Beta function is similar in spirit to my analysis of Beta distribution quantiles at Do two quantiles of a beta distribution determine its parameters?) A further feature of this analysis is approximating the incomplete Beta function by simple integrals of the form $\int t^c\mathrm{d}t$ for constants $c\gt -1$. This reduces everything to the most elementary operations of Calculus and algebraic inequalities. The Beta PDF is proportional to $$f(x)=x^{\alpha-1}(1-x)^{\beta-1}.$$ Consider small $\epsilon\gt 0$ and examine the contributions to the area under $f$ within the three intervals $(0,\epsilon]$, $(\epsilon, 1-\epsilon)$, and $[1-\epsilon, 1)$ as $\alpha$ and $\beta$ grow small (but remain positive). Eventually both $\alpha$ and $\beta$ will both be less than $1$: $f$ will therefore have poles at both $0$ and $1$, looking like this: The graph of $f$ is the upper blue line. Compared to it are the graphs of $x^{\alpha-1}$ (red curve, with a pole only at $0$) and $(1-x)^{\beta-1}$ (gold curve, with a pole only at $1$). What happens to the three areas under $f$, relative to each other, in the limit? As a matter of notation, write $$F(x) = \int_0^x f(t)\mathrm{d}t = \int_0^x t^{\alpha-1}(1-t)^{\beta-1}\mathrm{d}t$$for the area under the graph of $f$ between $0$ and $x$. I am asking about the relative sizes of $F(\epsilon)$, $F(1-\epsilon)-F(\epsilon)$, and $F(1)-F(1-\epsilon)$. Let's estimate these areas one at a time, always assuming $0 \lt \alpha \lt 1$ and $0\lt \beta \lt 1,$ $0\lt x \lt 1,$ and $0\lt \epsilon \lt 1/2$. Under these assumptions $$x^{\alpha-1} \gt 1;\quad(1-x)^{\beta-1}\gt 1,$$ $x\to x^{\alpha-1}$ (red) is a decreasing function in $x,$ and $x\to (1-x)^{\beta-1}$ (gold) is an increasing function. On the left, it looks like the blue and red curves draw close. Indeed, for $0\lt x \lt \epsilon$, the foregoing inequalities yield the bounds $$x^{\alpha-1} \lt x^{\alpha-1}(1-x)^{\beta-1} \lt x^{\alpha-1}(1-\epsilon)^{\beta-1}.$$Integrating each between $0$ and $\epsilon$ is simple and squeezes $F(\epsilon)$ between two close bounds, $$\frac{\epsilon^\alpha}{\alpha} \lt F(\epsilon) \lt (1-\epsilon)^{\beta-1} \frac{\epsilon^\alpha}{\alpha}.\tag{1}$$ The same analysis applies to the right hand side, yielding a similar result. Because $f$ is concave, on the middle interval $[\epsilon, 1-\epsilon]$ it attains its extreme values at the endpoints. Consequently the area is less than that of the trapezoid spanned by those points: $$\eqalign{ F(1-\epsilon) - F(\epsilon) &\lt \frac{1}{2}\left(f(\epsilon) + f(1-\epsilon)\right)(1-\epsilon - \epsilon)\\ &= \frac{1-2\epsilon}{2}\left(\epsilon^{\alpha-1}(1-\epsilon)^{\beta-1} + (1-\epsilon)^{\alpha-1}\epsilon^{\beta-1}\right)).\tag{2} }$$ Although this threatens to get messy, let's temporarily fix $\epsilon$ and consider what happens to the ratio $(F(1-\epsilon)-F(\epsilon)):F(\epsilon)$ as $\alpha$ and $\beta$ approach $0$. In expressions $(1)$ and $(2)$, both $(1-\epsilon)^{\alpha-1}$ and $(1-\epsilon)^{\beta-1}$ will approach $(1-\epsilon)^0=1$. Thus, the only terms that matter in the limit are $$\frac{F(1-\epsilon)-F(\epsilon)}{F(\epsilon)} \approx \frac{(\epsilon^{\alpha-1} + \epsilon^{\beta-1})/2}{\epsilon^\alpha / \alpha} = \frac{\alpha}{2\epsilon} + \frac{\alpha}{2\epsilon^{\alpha-\beta}} \approx \frac{\alpha}{\epsilon}\tag{3}$$ because $\alpha-\beta \approx 0$. Consequently, since $\alpha\to 0$, eventually the middle area is inconsequential compared to the left area. The same argument shows that eventually the middle area is close to $\beta/\epsilon$ times the right area, which also becomes inconsequential. This shows that $(*)$ No matter what $0\lt \epsilon\lt 1/2$ may be, if we take both $\alpha$ and $\beta$ to be sufficiently small, then essentially all the area under $f$ is concentrated within the left interval $(0,\epsilon)$ and the right interval $(1-\epsilon, 1)$. The rest is easy: the mean will be very close to the area near the right pole (proof: underestimate it by replacing $xf(x)$ by $0f(x)$ in the integrals over the left and middle intervals and by $(1-\epsilon)f(x)$ in the right interval, then overestimate it by replacing $xf(x)$ by $\epsilon f(x)$ at the left, $(1-\epsilon)f(x)$ in the middle, and $f(x)$ at the right. Both expressions closely approximate $F(1)-F(1-\epsilon)$.) But, by $(3),$ the relative areas are approximately $$\frac{F(1)-F(1-\epsilon)}{F(\epsilon)} \approx \frac{\epsilon/\beta}{\epsilon/\alpha} = \frac{\alpha}{\beta}.$$ By keeping the mean constant, this ratio remains constant, allowing us to add one more observation to $(*)$: $(**)$ If we let $\alpha\to 0$ and $\beta\to 0$ in such a way that $\alpha/\beta$ approaches a limiting constant $\lambda$, then eventually the ratio of the area at the right to the area at the left will be arbitrarily close to $\lambda$, too. Now contemplate $\epsilon$ shrinking to zero. The result is that the limiting distribution exists and it must have all its probability concentrated around the values $0$ and $1$: this is the class of Bernoulli distributions. $(**)$ pins down which one: since the Bernoulli$(p)$ distribution, whose mean is $p,$ assigns probability $p$ to $1$ and probability $1-p$ to $0$, the ratio $p/(1-p)$ must be the limiting ratio $\lambda.$ In the terminology of the question, $$\lambda = \alpha / \left(\frac{1-\mu}{\mu}\alpha\right) = \frac{\mu}{1-\mu} = \frac{p}{1-p},$$ as claimed.
Proving Bernoulli is the limit of Beta The analysis can be a little messy, especially if carried out with full and elementary rigor, but the idea is simple and easily grasped. Focus on small regions very close to $0$ and $1$. As $\alpha$
41,510
What's the point in neural networks for multivariate regression?
Here's a cartoon representation of the models. Model A uses a single network to predict both outputs. Model B uses separate networks to predict both outputs. Because the input to both networks is the same, we can re-frame this as the equivalent model C. In this case, the input is passed to to hidden/output layers that are simply concatenated copies of those in model B. The hidden layer weights would have a block diagonal structure, such that weights between units in the left and right halves are zero. Presumably the output units are linear (because this is a regression problem) and the hidden units are nonlinear (otherwise why bother with a neural net). We can think of a network as mapping the input nonlinearly into a feature space. The images of the inputs in feature space are given by the activations of the last hidden layer. The output layer then performs linear regression in feature space. Training the network amounts to jointly learning the regression weights and feature space mapping. Training model A would mean learning a single feature space mapping. Another way to say this is that we want to find a single representation of the input that's good for predicting both outputs. With model B, we'd find a separate representation for each output. By the equivalence to model C, this can also be seen as finding a single, higher dimensional representation. Models B/C are much bigger networks than model A and have many more parameters. Consequently, they should be much more flexible. This could be good or bad depending on the situation. A bigger network can learn more complicated functions, given enough data. Given insufficient data, it can be more prone to overfit. Consider what would happen if we scaled this to 100 outputs instead of 2.
What's the point in neural networks for multivariate regression?
Here's a cartoon representation of the models. Model A uses a single network to predict both outputs. Model B uses separate networks to predict both outputs. Because the input to both networks is the
What's the point in neural networks for multivariate regression? Here's a cartoon representation of the models. Model A uses a single network to predict both outputs. Model B uses separate networks to predict both outputs. Because the input to both networks is the same, we can re-frame this as the equivalent model C. In this case, the input is passed to to hidden/output layers that are simply concatenated copies of those in model B. The hidden layer weights would have a block diagonal structure, such that weights between units in the left and right halves are zero. Presumably the output units are linear (because this is a regression problem) and the hidden units are nonlinear (otherwise why bother with a neural net). We can think of a network as mapping the input nonlinearly into a feature space. The images of the inputs in feature space are given by the activations of the last hidden layer. The output layer then performs linear regression in feature space. Training the network amounts to jointly learning the regression weights and feature space mapping. Training model A would mean learning a single feature space mapping. Another way to say this is that we want to find a single representation of the input that's good for predicting both outputs. With model B, we'd find a separate representation for each output. By the equivalence to model C, this can also be seen as finding a single, higher dimensional representation. Models B/C are much bigger networks than model A and have many more parameters. Consequently, they should be much more flexible. This could be good or bad depending on the situation. A bigger network can learn more complicated functions, given enough data. Given insufficient data, it can be more prone to overfit. Consider what would happen if we scaled this to 100 outputs instead of 2.
What's the point in neural networks for multivariate regression? Here's a cartoon representation of the models. Model A uses a single network to predict both outputs. Model B uses separate networks to predict both outputs. Because the input to both networks is the
41,511
Moments of kernel density estimates
Moments are reasonably straightforward via the law of total expectation and the law of total variance: Law of total expectation $${\displaystyle \operatorname {E} (Y)=\operatorname {E} (\operatorname {E} (Y\mid X)),}$$ Here the $X$ is the original variable and $Y|X$ can be thought of as the kernel. The unconditional distribution is the resulting KDE. We have $E(Y|X) = X$, and so $E(Y) = E(X) = \mu_F$. Law of total variance $${\displaystyle \operatorname {Var} (Y)=\operatorname {E} [\operatorname {Var} (Y|X)]+\operatorname {Var} (\operatorname {E} [Y|X]).}$$ $\text{Var}(Y|X)$ is the variance of the kernel at $X$, which is constant, so $E(Var(Y|X))=\sigma^2_K = h^2$. The second term reduces to $\text{Var}(X)=\sigma^2_F$ So $\text{Var}(Y) = \sigma^2_F + h^2$. In summary, the expectation is unaffected by a zero-mean kernel, but the variance is (unsurprisingly) increased by the variance of the kernel.
Moments of kernel density estimates
Moments are reasonably straightforward via the law of total expectation and the law of total variance: Law of total expectation $${\displaystyle \operatorname {E} (Y)=\operatorname {E} (\operatorname
Moments of kernel density estimates Moments are reasonably straightforward via the law of total expectation and the law of total variance: Law of total expectation $${\displaystyle \operatorname {E} (Y)=\operatorname {E} (\operatorname {E} (Y\mid X)),}$$ Here the $X$ is the original variable and $Y|X$ can be thought of as the kernel. The unconditional distribution is the resulting KDE. We have $E(Y|X) = X$, and so $E(Y) = E(X) = \mu_F$. Law of total variance $${\displaystyle \operatorname {Var} (Y)=\operatorname {E} [\operatorname {Var} (Y|X)]+\operatorname {Var} (\operatorname {E} [Y|X]).}$$ $\text{Var}(Y|X)$ is the variance of the kernel at $X$, which is constant, so $E(Var(Y|X))=\sigma^2_K = h^2$. The second term reduces to $\text{Var}(X)=\sigma^2_F$ So $\text{Var}(Y) = \sigma^2_F + h^2$. In summary, the expectation is unaffected by a zero-mean kernel, but the variance is (unsurprisingly) increased by the variance of the kernel.
Moments of kernel density estimates Moments are reasonably straightforward via the law of total expectation and the law of total variance: Law of total expectation $${\displaystyle \operatorname {E} (Y)=\operatorname {E} (\operatorname
41,512
Hessian matrix for maximum likelihood
You have to remember that since $\pmb{\beta} \in \Re^{n \times 1}$ is a vector, partial derivatives you described are vectors, and matrices. Especially the hessian $$H(\pmb{\beta}, \sigma^2) = \begin{pmatrix} \frac{\partial}{\partial \boldsymbol{\beta}^{T}}[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta}}] & \frac{\partial}{\partial \sigma^{2}}[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta}}]\\ \frac{\partial}{\partial \boldsymbol{\beta}^{T}}[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \sigma^{2}}] & \frac{\partial}{\partial \boldsymbol{\sigma}^{2}}[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \sigma^{2}}] \\ \end{pmatrix} \in \Re^{(n+1) \times (n+1)}$$ and since $\pmb{\beta}$ is a column vector, we have $$ \frac{\partial}{\partial \boldsymbol{\beta}^{T}}\Big[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta}}\Big] \in \Re^{n \times n} \text{, is a matrix}$$ $$\frac{\partial}{\partial \sigma^{2}}\Big[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta}}\Big] \in \Re^{n \times 1} \text{, is a column vector}$$ $$\frac{\partial}{\partial \boldsymbol{\beta}^{T}}\Big[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \sigma^{2}}\Big] \in \Re^{1 \times n} \text{, is a row vector}$$ So we simply take partial derivates w.r.t $\pmb{\beta}$ or $\pmb{\beta^T}$ so that they "fit" in a matrix. To visualize it better $$\frac{\partial}{\partial \boldsymbol{\beta}^{T}}\Big[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta}}\Big] = \frac{\partial}{\partial \boldsymbol{\beta}^{T}} \begin{pmatrix} \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_1}} \\ \vdots \\ \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_n}} \end{pmatrix} = \begin{pmatrix} \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_1}\partial \boldsymbol{\beta_1}}& \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_1}\partial \boldsymbol{\beta_2}}& \dots & \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_1}\partial \boldsymbol{\beta_n}} \\ \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_2}\partial \boldsymbol{\beta_1}} & \ddots & & \vdots \\ \vdots& \\ \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_n}\partial \boldsymbol{\beta_1}} & \dots & & \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_n}\partial \boldsymbol{\beta_n}} \end{pmatrix}$$
Hessian matrix for maximum likelihood
You have to remember that since $\pmb{\beta} \in \Re^{n \times 1}$ is a vector, partial derivatives you described are vectors, and matrices. Especially the hessian $$H(\pmb{\beta}, \sigma^2) = \begin
Hessian matrix for maximum likelihood You have to remember that since $\pmb{\beta} \in \Re^{n \times 1}$ is a vector, partial derivatives you described are vectors, and matrices. Especially the hessian $$H(\pmb{\beta}, \sigma^2) = \begin{pmatrix} \frac{\partial}{\partial \boldsymbol{\beta}^{T}}[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta}}] & \frac{\partial}{\partial \sigma^{2}}[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta}}]\\ \frac{\partial}{\partial \boldsymbol{\beta}^{T}}[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \sigma^{2}}] & \frac{\partial}{\partial \boldsymbol{\sigma}^{2}}[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \sigma^{2}}] \\ \end{pmatrix} \in \Re^{(n+1) \times (n+1)}$$ and since $\pmb{\beta}$ is a column vector, we have $$ \frac{\partial}{\partial \boldsymbol{\beta}^{T}}\Big[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta}}\Big] \in \Re^{n \times n} \text{, is a matrix}$$ $$\frac{\partial}{\partial \sigma^{2}}\Big[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta}}\Big] \in \Re^{n \times 1} \text{, is a column vector}$$ $$\frac{\partial}{\partial \boldsymbol{\beta}^{T}}\Big[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \sigma^{2}}\Big] \in \Re^{1 \times n} \text{, is a row vector}$$ So we simply take partial derivates w.r.t $\pmb{\beta}$ or $\pmb{\beta^T}$ so that they "fit" in a matrix. To visualize it better $$\frac{\partial}{\partial \boldsymbol{\beta}^{T}}\Big[\frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta}}\Big] = \frac{\partial}{\partial \boldsymbol{\beta}^{T}} \begin{pmatrix} \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_1}} \\ \vdots \\ \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_n}} \end{pmatrix} = \begin{pmatrix} \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_1}\partial \boldsymbol{\beta_1}}& \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_1}\partial \boldsymbol{\beta_2}}& \dots & \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_1}\partial \boldsymbol{\beta_n}} \\ \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_2}\partial \boldsymbol{\beta_1}} & \ddots & & \vdots \\ \vdots& \\ \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_n}\partial \boldsymbol{\beta_1}} & \dots & & \frac{\partial l(\boldsymbol{\beta},\sigma^{2};\mathbf{y})}{\partial \boldsymbol{\beta_n}\partial \boldsymbol{\beta_n}} \end{pmatrix}$$
Hessian matrix for maximum likelihood You have to remember that since $\pmb{\beta} \in \Re^{n \times 1}$ is a vector, partial derivatives you described are vectors, and matrices. Especially the hessian $$H(\pmb{\beta}, \sigma^2) = \begin
41,513
Variance of the sum of random vectors
You are asking for $\text{Var}(\sum_i X_i)$ when $\sum_i X_i$ is a vector of multiple elements, though I think what you're asking for is the covariance matrix (the generalization of variance to a vector). You can solve this in a similar way to the univariate case. Suppose we have two variables, $x, y \in \mathbb{R}^1$, each with $n$ observations. We want to calculate $$ \text{Cov}(\sum_ix_i, \sum_j y_j). $$ Once you do that, then you can simply generalize to $x \in \mathbb{R}^d$ by generating the covariance matrix with each pairing of dimension using the same formula as above, for $x$ and $y$. So, $$ \begin{split} \text{Cov}(\sum_ix_i, \sum_j y_j) &= \left\langle \left( \sum_i x_i - \langle \sum_i x_i \rangle \right) \left( \sum_j y_j - \langle \sum_j y_j \rangle \right) \right\rangle \\ &= \sum_{i,j} \left\langle \langle x_i y_j \rangle + \langle x_i \rangle \langle y_j \rangle - x_i \langle y_j \rangle - \langle x_i \rangle y_j \right\rangle \\ &= \sum_{i,j} \left( \langle x_i y_j \rangle - \langle x_i \rangle \langle y_j \rangle\right) \\ &= \sum_{i,j} \text{Cov}(x_i,y_j), \end{split} $$ where the sum is over all $n^2$ pairings of $i,j$. In the second line, I used the fact that $\langle \sum_i x_i \rangle = \sum_i \langle x_i \rangle$, which is true even if the terms are not independent. To see this, express the expectation as an integral over the $n$-dimensional space of observations, with a joint distribution $p(x)$. Lack of independence means you can't split $p(x)$ into a product of individual distributions, but you can still pull the sum out of the integral, and the expectation of each term is simply taken with respect to the whole set of observations. This is certainly symmetric because the indices that run over $x$ and $y$ are symmetric. It also reduces to the univariate case ($y=x$) because you can split the sum into the diagonal elements (the $\text{Var}$ terms) and twice the upper triangle elements (the $\text{Cov}$ terms for $i<j$, which is equivalent to the lower triangle terms). In the general case, however, you don't get to simply take the upper right triangle indices and double them, because $x_i y_j \ne x_j y_i$, so you have to sum over all pairings. Thus, in general, $$ \text{Cov}\left(\sum_i X_i^{(k)}, \sum_j X_j^{(m)} \right) = \sum_{i,j} \text{Cov} \left( X_i^{(k)}, X_j^{(m)} \right). $$
Variance of the sum of random vectors
You are asking for $\text{Var}(\sum_i X_i)$ when $\sum_i X_i$ is a vector of multiple elements, though I think what you're asking for is the covariance matrix (the generalization of variance to a vect
Variance of the sum of random vectors You are asking for $\text{Var}(\sum_i X_i)$ when $\sum_i X_i$ is a vector of multiple elements, though I think what you're asking for is the covariance matrix (the generalization of variance to a vector). You can solve this in a similar way to the univariate case. Suppose we have two variables, $x, y \in \mathbb{R}^1$, each with $n$ observations. We want to calculate $$ \text{Cov}(\sum_ix_i, \sum_j y_j). $$ Once you do that, then you can simply generalize to $x \in \mathbb{R}^d$ by generating the covariance matrix with each pairing of dimension using the same formula as above, for $x$ and $y$. So, $$ \begin{split} \text{Cov}(\sum_ix_i, \sum_j y_j) &= \left\langle \left( \sum_i x_i - \langle \sum_i x_i \rangle \right) \left( \sum_j y_j - \langle \sum_j y_j \rangle \right) \right\rangle \\ &= \sum_{i,j} \left\langle \langle x_i y_j \rangle + \langle x_i \rangle \langle y_j \rangle - x_i \langle y_j \rangle - \langle x_i \rangle y_j \right\rangle \\ &= \sum_{i,j} \left( \langle x_i y_j \rangle - \langle x_i \rangle \langle y_j \rangle\right) \\ &= \sum_{i,j} \text{Cov}(x_i,y_j), \end{split} $$ where the sum is over all $n^2$ pairings of $i,j$. In the second line, I used the fact that $\langle \sum_i x_i \rangle = \sum_i \langle x_i \rangle$, which is true even if the terms are not independent. To see this, express the expectation as an integral over the $n$-dimensional space of observations, with a joint distribution $p(x)$. Lack of independence means you can't split $p(x)$ into a product of individual distributions, but you can still pull the sum out of the integral, and the expectation of each term is simply taken with respect to the whole set of observations. This is certainly symmetric because the indices that run over $x$ and $y$ are symmetric. It also reduces to the univariate case ($y=x$) because you can split the sum into the diagonal elements (the $\text{Var}$ terms) and twice the upper triangle elements (the $\text{Cov}$ terms for $i<j$, which is equivalent to the lower triangle terms). In the general case, however, you don't get to simply take the upper right triangle indices and double them, because $x_i y_j \ne x_j y_i$, so you have to sum over all pairings. Thus, in general, $$ \text{Cov}\left(\sum_i X_i^{(k)}, \sum_j X_j^{(m)} \right) = \sum_{i,j} \text{Cov} \left( X_i^{(k)}, X_j^{(m)} \right). $$
Variance of the sum of random vectors You are asking for $\text{Var}(\sum_i X_i)$ when $\sum_i X_i$ is a vector of multiple elements, though I think what you're asking for is the covariance matrix (the generalization of variance to a vect
41,514
Variance of the sum of random vectors
Define $\mathrm{cov}(X_i, X_j) = EX_iX_j^T - EX_iEX_j^T$, which obviously reduces to the usual definition when $X_i$ is one-dimensional. Then the variance-covariance matrix of $X_i$ is $\mathrm{var}(X_i)=\mathrm{cov}(X_i, X_i)$. Thus, \begin{align*} \mathrm{var}\left(\sum_{i}X_i\right) &= E\left(\sum_i X_i \right)\left(\sum_i X_i \right)^T - E\left(\sum_i X_i \right) E\left(\sum_i X_i \right)^T \\ &= \sum_{i}\sum_j E X_iX_j^T - \sum_i\sum_jEX_iEX_j^T \\ &= \sum_i \sum _j \mathrm{cov}(X_i, X_j) \\ &= n \mathrm{var}(X_i) + \sum_{i< j}\mathrm{cov}(X_i, X_j) + \sum_{i> j}\mathrm{cov}(X_i, X_j), \end{align*} which reduces to your Equation $(1)$ if and only if $\sum_{i<j}\mathrm{cov}(X_i, X_j) = \sum_{i > j}cov(X_i, X_j)$, which is obviously true when $d = 1$ since, then, $\mathrm{cov}(X_i, X_j) = \mathrm{cov}(X_j, X_i)$. It need not be true when $d > 1$. Consider $n = d = 2$ and suppose $X_1 = (\xi_1, \xi_2)^T$, $X_2 = (\xi_3, \xi_4)^T$, where $\xi = (\xi_1, \dots, \xi_4)^T$ has variance-covariance matrix $\Sigma$. Then $$\mathrm{cov}(X_1, X_2) = \begin{bmatrix} \Sigma_{13} & \Sigma_{14} \\ \Sigma_{23} & \Sigma_{24} \end{bmatrix}, \quad \mathrm{cov}(X_2, X_1) = \begin{bmatrix} \Sigma_{31} & \Sigma_{32} \\ \Sigma_{41} & \Sigma_{42} \end{bmatrix},$$ which are not the same unless $\Sigma_{23} = \Sigma_{41}$.
Variance of the sum of random vectors
Define $\mathrm{cov}(X_i, X_j) = EX_iX_j^T - EX_iEX_j^T$, which obviously reduces to the usual definition when $X_i$ is one-dimensional. Then the variance-covariance matrix of $X_i$ is $\mathrm{var}(X
Variance of the sum of random vectors Define $\mathrm{cov}(X_i, X_j) = EX_iX_j^T - EX_iEX_j^T$, which obviously reduces to the usual definition when $X_i$ is one-dimensional. Then the variance-covariance matrix of $X_i$ is $\mathrm{var}(X_i)=\mathrm{cov}(X_i, X_i)$. Thus, \begin{align*} \mathrm{var}\left(\sum_{i}X_i\right) &= E\left(\sum_i X_i \right)\left(\sum_i X_i \right)^T - E\left(\sum_i X_i \right) E\left(\sum_i X_i \right)^T \\ &= \sum_{i}\sum_j E X_iX_j^T - \sum_i\sum_jEX_iEX_j^T \\ &= \sum_i \sum _j \mathrm{cov}(X_i, X_j) \\ &= n \mathrm{var}(X_i) + \sum_{i< j}\mathrm{cov}(X_i, X_j) + \sum_{i> j}\mathrm{cov}(X_i, X_j), \end{align*} which reduces to your Equation $(1)$ if and only if $\sum_{i<j}\mathrm{cov}(X_i, X_j) = \sum_{i > j}cov(X_i, X_j)$, which is obviously true when $d = 1$ since, then, $\mathrm{cov}(X_i, X_j) = \mathrm{cov}(X_j, X_i)$. It need not be true when $d > 1$. Consider $n = d = 2$ and suppose $X_1 = (\xi_1, \xi_2)^T$, $X_2 = (\xi_3, \xi_4)^T$, where $\xi = (\xi_1, \dots, \xi_4)^T$ has variance-covariance matrix $\Sigma$. Then $$\mathrm{cov}(X_1, X_2) = \begin{bmatrix} \Sigma_{13} & \Sigma_{14} \\ \Sigma_{23} & \Sigma_{24} \end{bmatrix}, \quad \mathrm{cov}(X_2, X_1) = \begin{bmatrix} \Sigma_{31} & \Sigma_{32} \\ \Sigma_{41} & \Sigma_{42} \end{bmatrix},$$ which are not the same unless $\Sigma_{23} = \Sigma_{41}$.
Variance of the sum of random vectors Define $\mathrm{cov}(X_i, X_j) = EX_iX_j^T - EX_iEX_j^T$, which obviously reduces to the usual definition when $X_i$ is one-dimensional. Then the variance-covariance matrix of $X_i$ is $\mathrm{var}(X
41,515
What is the distribution of the (arbitrarily) weighted Maximum Likelihood Estimator?
In general, your question has no answer. There are a couple of reasons. 1) Suppose that all $w_i = 1$. Even in that case, the distribution of MLE estimate depends on the distribution of data, i.e. on the function $l(\theta;x,y)$. For instance, it is possible to prove that in the exponential family of distributions, combined with a few more restrictions, the MLE estimate is asymptotically Normal. However, once $l(\theta;x,y)$ is outside the exponential family, anything can happen. 2) Even if $l(\theta;x,y)$ is in the exponential family, the presence of weights (especially if they are dependent on x and Y) is very likely to make the asymptotic distribution results invalid.
What is the distribution of the (arbitrarily) weighted Maximum Likelihood Estimator?
In general, your question has no answer. There are a couple of reasons. 1) Suppose that all $w_i = 1$. Even in that case, the distribution of MLE estimate depends on the distribution of data, i.e. on
What is the distribution of the (arbitrarily) weighted Maximum Likelihood Estimator? In general, your question has no answer. There are a couple of reasons. 1) Suppose that all $w_i = 1$. Even in that case, the distribution of MLE estimate depends on the distribution of data, i.e. on the function $l(\theta;x,y)$. For instance, it is possible to prove that in the exponential family of distributions, combined with a few more restrictions, the MLE estimate is asymptotically Normal. However, once $l(\theta;x,y)$ is outside the exponential family, anything can happen. 2) Even if $l(\theta;x,y)$ is in the exponential family, the presence of weights (especially if they are dependent on x and Y) is very likely to make the asymptotic distribution results invalid.
What is the distribution of the (arbitrarily) weighted Maximum Likelihood Estimator? In general, your question has no answer. There are a couple of reasons. 1) Suppose that all $w_i = 1$. Even in that case, the distribution of MLE estimate depends on the distribution of data, i.e. on
41,516
What is the distribution of the (arbitrarily) weighted Maximum Likelihood Estimator?
In general the answer of Nik Tuzov is correct, but some details are not completely correct. In summary, the distribution of the WMLE is unknown. You can write down the actual equation for the MLE (weights or none) and write the complete derivative to determine the extremal point(s) maximum. Which gives you a computational answer -- but without the specific knowledge of the underlying distribution, you can't perform it. Actually the presence of the weights doesn't change the question much, since you still just have to compute the derivative. The typical usage of LE in applied science is exactly with weights that depend on the Y -- think counting experiments/results distributed as Poissonian with associated uncertainties that act as weights. In the practical application, where the LE is performed numerically, a typical approximation is a parabolical shape around the maximum value. You can interpret this either as "normal distribution" or as the first non-vanishing element of the Taylor expansion. But apart from special cases it's not accurate (and can be determined much better even numerically). So: in simple cases for the underlying distribution you might be able to derive an analytical description for the resulting distribution -- where the series actually converges. Otherwise: no, so in general also: no.
What is the distribution of the (arbitrarily) weighted Maximum Likelihood Estimator?
In general the answer of Nik Tuzov is correct, but some details are not completely correct. In summary, the distribution of the WMLE is unknown. You can write down the actual equation for the MLE (wei
What is the distribution of the (arbitrarily) weighted Maximum Likelihood Estimator? In general the answer of Nik Tuzov is correct, but some details are not completely correct. In summary, the distribution of the WMLE is unknown. You can write down the actual equation for the MLE (weights or none) and write the complete derivative to determine the extremal point(s) maximum. Which gives you a computational answer -- but without the specific knowledge of the underlying distribution, you can't perform it. Actually the presence of the weights doesn't change the question much, since you still just have to compute the derivative. The typical usage of LE in applied science is exactly with weights that depend on the Y -- think counting experiments/results distributed as Poissonian with associated uncertainties that act as weights. In the practical application, where the LE is performed numerically, a typical approximation is a parabolical shape around the maximum value. You can interpret this either as "normal distribution" or as the first non-vanishing element of the Taylor expansion. But apart from special cases it's not accurate (and can be determined much better even numerically). So: in simple cases for the underlying distribution you might be able to derive an analytical description for the resulting distribution -- where the series actually converges. Otherwise: no, so in general also: no.
What is the distribution of the (arbitrarily) weighted Maximum Likelihood Estimator? In general the answer of Nik Tuzov is correct, but some details are not completely correct. In summary, the distribution of the WMLE is unknown. You can write down the actual equation for the MLE (wei
41,517
Most accessible introduction to directional statistics?
Batschelet is a very friendly and rich book but inevitably a little dated. It covers a lot of ground. I find the books first authored by Fisher to have the best overall blend of statistical and scientific thinking. Fisher is best on several modern approaches, including graphics, bootstrapping and modelling. The book by Mardia and Jupp makes stronger assumptions about readers' mathematical knowledge but does include a sprinkling of examples based on real data. All of these books are usefully complementary.
Most accessible introduction to directional statistics?
Batschelet is a very friendly and rich book but inevitably a little dated. It covers a lot of ground. I find the books first authored by Fisher to have the best overall blend of statistical and scien
Most accessible introduction to directional statistics? Batschelet is a very friendly and rich book but inevitably a little dated. It covers a lot of ground. I find the books first authored by Fisher to have the best overall blend of statistical and scientific thinking. Fisher is best on several modern approaches, including graphics, bootstrapping and modelling. The book by Mardia and Jupp makes stronger assumptions about readers' mathematical knowledge but does include a sprinkling of examples based on real data. All of these books are usefully complementary.
Most accessible introduction to directional statistics? Batschelet is a very friendly and rich book but inevitably a little dated. It covers a lot of ground. I find the books first authored by Fisher to have the best overall blend of statistical and scien
41,518
Nested Cross-Validation for Feature Selection and Hyperparameter Optimization
I figured out where my understanding was off, figured I should answer my question in case anyone else stumbles upon it. To start, sklearn makes nested cross-validation deceptively easy. I read their example over and over but never got it until I looked at the extremely helpful pseudocode given in the answer to this question. Briefly, this is what I had to do (which is almost a copy of the example scikit-learn gives): Initialize two cross-validation generators, inner and outer. For this, I used the StratifiedKFold() constructor. Create a RandomizedSearchCV object (so much quicker than the whole grid search—I think one can easily use sklearn objects to calculate the Bayesian Information Criterion and make an even cooler/faster/smarter hyperparameter optimizer, but this is beyond my knowledge, I just heard Andreas Mueller talk about it in some lecture once) giving the inner cross-validator as the cv parameter, and the rest of your stuff, estimators, scoring function, etc. as normal. Fit this to your training set (X) and labels (y). You want to fit this because you'll need an estimator for the next step (i.e., the estimator you get after transforming X and y using estimators in your pipeline + fitting X and y using the final estimator to produce a fitted estimator). Use cross_val_score and give it your newly-fitted RandomizedSearchCV object, X, y, and the outer cross-validator. I assigned the outputs from this into a variable called scores and I returned a tuple consisting of a tuple with the best score and best parameters given by the randomized search (rs._best_params, rs._best_score) and the scores variable. I'm a little fuzzy on what exactly I needed and got a bit lazy, so this might be more information returned than necessary. In code, this is kind of how it looks: def nestedCrossValidation(X, y, pipe, param_dist, scoring, outer, inner): rs = RandomizedSearchCV(pipe, param_dist, verbose=1, scoring=scoring, cv=inner) rs.fit(X, y) scores = cross_val_score(rs, X, y, cv=outer) return ((rs._best_score, rs.best_params), scores) cross_val_score will split into a training/test set and do a randomized search on that training set, which itself splits into a test/training set, generates the scores, then goes back up to cross_val_score to test and move on to the next test/training set. AFTER you do this, you'll get a bunch of cross-validation scores. My original question was: "what do you get/do now?" Nested cross-validation is not for model selection. What I mean by that, is that you're not trying to get parameter values that are good for your final model. That's what the inner RandomizedSearchCV is for. But of course, if you are using something like a RandomForest for feature selection in your pipeline, then you'd expect a different set of parameters each time! So what do you really get that's useful? Nested cross-validation is to give an unbiased estimate as to how good your methodology/series of steps is. What is "good"? Good is defined by the stability of hyperparameters and the cross-validation scores you ultimately get. Say you get numbers like I did: I got cross-validation scores of: [0.57027027, 0.48918919, 0.37297297, 0.74444444, 0.53703704]. So depending on the mood of my method of doing things, I can get an ROC score between 0.37 and 0.74 — obviously this is undesirable. If you were to look at my hyper-parameters, you'd see that the "optimal" hyper-parameters vary wildly. Whereas if I got consistent cross-validation scores that were high, and the optimal hyper-parameters were all in the same ballpark, I can be fairly confident that the way I am choosing to select features and model my data is pretty good. If you have instability—I am not sure what you can do. I'm still new to this—the gurus on this board probably have better advice other than blindly changing your methodology. But if you have stability, what's next? This is another important aspect that I neglected to understand: a really good and predictive and generalizable model created by your training data is NOT the final model. But it's close. The final model uses all of your data, because you're done testing and optimizing and tweaking (yeah, if you'd try and cross-validate a model with data you used to fit it, you'd get a biased result, but why would you cross-validate it at this point? You've already done that, and hopefully a bias issue doesn't exist)—you give it all the data you can so it can make the most informed decisions it can, and the next time you'll see how well your model does, is when it's in the wild, using data that neither you nor the model has ever seen before. I hope this helps someone. For some reason it took me a really long time to wrap my head around this, and here are some other links I used to understand: http://www.pnas.org/content/99/10/6562.full.pdf — A paper that re-examines data and conclusions drawn by other genetics papers that don't use nested cross-validation for feature selection/hyper-parameter selection. It's somewhat comforting to know that even super smart and accomplished people also get swindled by statistics from time to time. http://jmlr.org/papers/volume11/cawley10a/cawley10a.pdf — iirc, I've seen an author to this author answer a ton of questions about this topic on this forum Training with the full dataset after cross-validation? — One of the aforementioned authors answering a similar question in a more colloquial manner. http://scikit-learn.org/stable/auto_examples/model_selection/plot_nested_cross_validation_iris.html — the sklearn example
Nested Cross-Validation for Feature Selection and Hyperparameter Optimization
I figured out where my understanding was off, figured I should answer my question in case anyone else stumbles upon it. To start, sklearn makes nested cross-validation deceptively easy. I read their e
Nested Cross-Validation for Feature Selection and Hyperparameter Optimization I figured out where my understanding was off, figured I should answer my question in case anyone else stumbles upon it. To start, sklearn makes nested cross-validation deceptively easy. I read their example over and over but never got it until I looked at the extremely helpful pseudocode given in the answer to this question. Briefly, this is what I had to do (which is almost a copy of the example scikit-learn gives): Initialize two cross-validation generators, inner and outer. For this, I used the StratifiedKFold() constructor. Create a RandomizedSearchCV object (so much quicker than the whole grid search—I think one can easily use sklearn objects to calculate the Bayesian Information Criterion and make an even cooler/faster/smarter hyperparameter optimizer, but this is beyond my knowledge, I just heard Andreas Mueller talk about it in some lecture once) giving the inner cross-validator as the cv parameter, and the rest of your stuff, estimators, scoring function, etc. as normal. Fit this to your training set (X) and labels (y). You want to fit this because you'll need an estimator for the next step (i.e., the estimator you get after transforming X and y using estimators in your pipeline + fitting X and y using the final estimator to produce a fitted estimator). Use cross_val_score and give it your newly-fitted RandomizedSearchCV object, X, y, and the outer cross-validator. I assigned the outputs from this into a variable called scores and I returned a tuple consisting of a tuple with the best score and best parameters given by the randomized search (rs._best_params, rs._best_score) and the scores variable. I'm a little fuzzy on what exactly I needed and got a bit lazy, so this might be more information returned than necessary. In code, this is kind of how it looks: def nestedCrossValidation(X, y, pipe, param_dist, scoring, outer, inner): rs = RandomizedSearchCV(pipe, param_dist, verbose=1, scoring=scoring, cv=inner) rs.fit(X, y) scores = cross_val_score(rs, X, y, cv=outer) return ((rs._best_score, rs.best_params), scores) cross_val_score will split into a training/test set and do a randomized search on that training set, which itself splits into a test/training set, generates the scores, then goes back up to cross_val_score to test and move on to the next test/training set. AFTER you do this, you'll get a bunch of cross-validation scores. My original question was: "what do you get/do now?" Nested cross-validation is not for model selection. What I mean by that, is that you're not trying to get parameter values that are good for your final model. That's what the inner RandomizedSearchCV is for. But of course, if you are using something like a RandomForest for feature selection in your pipeline, then you'd expect a different set of parameters each time! So what do you really get that's useful? Nested cross-validation is to give an unbiased estimate as to how good your methodology/series of steps is. What is "good"? Good is defined by the stability of hyperparameters and the cross-validation scores you ultimately get. Say you get numbers like I did: I got cross-validation scores of: [0.57027027, 0.48918919, 0.37297297, 0.74444444, 0.53703704]. So depending on the mood of my method of doing things, I can get an ROC score between 0.37 and 0.74 — obviously this is undesirable. If you were to look at my hyper-parameters, you'd see that the "optimal" hyper-parameters vary wildly. Whereas if I got consistent cross-validation scores that were high, and the optimal hyper-parameters were all in the same ballpark, I can be fairly confident that the way I am choosing to select features and model my data is pretty good. If you have instability—I am not sure what you can do. I'm still new to this—the gurus on this board probably have better advice other than blindly changing your methodology. But if you have stability, what's next? This is another important aspect that I neglected to understand: a really good and predictive and generalizable model created by your training data is NOT the final model. But it's close. The final model uses all of your data, because you're done testing and optimizing and tweaking (yeah, if you'd try and cross-validate a model with data you used to fit it, you'd get a biased result, but why would you cross-validate it at this point? You've already done that, and hopefully a bias issue doesn't exist)—you give it all the data you can so it can make the most informed decisions it can, and the next time you'll see how well your model does, is when it's in the wild, using data that neither you nor the model has ever seen before. I hope this helps someone. For some reason it took me a really long time to wrap my head around this, and here are some other links I used to understand: http://www.pnas.org/content/99/10/6562.full.pdf — A paper that re-examines data and conclusions drawn by other genetics papers that don't use nested cross-validation for feature selection/hyper-parameter selection. It's somewhat comforting to know that even super smart and accomplished people also get swindled by statistics from time to time. http://jmlr.org/papers/volume11/cawley10a/cawley10a.pdf — iirc, I've seen an author to this author answer a ton of questions about this topic on this forum Training with the full dataset after cross-validation? — One of the aforementioned authors answering a similar question in a more colloquial manner. http://scikit-learn.org/stable/auto_examples/model_selection/plot_nested_cross_validation_iris.html — the sklearn example
Nested Cross-Validation for Feature Selection and Hyperparameter Optimization I figured out where my understanding was off, figured I should answer my question in case anyone else stumbles upon it. To start, sklearn makes nested cross-validation deceptively easy. I read their e
41,519
Why is boosting less likely to overfit?
The general idea is that each individual tree will over fit some parts of the data, but therefor will under fit other parts of the data. But in boosting, you don't use the individual trees, but rather "average" them all together, so for a particular data point (or group of points) the trees that over fit that point (those points) will be average with the under fitting trees and the combined average should neither over or under fit, but should be about right. As with all models, you should try this out on some simulated data to help yourself understand what is going on. Also, as with all models, you should look at diagnostics and use your knowledge of the science and common sense to make sure that the modeling represents your data reasonably.
Why is boosting less likely to overfit?
The general idea is that each individual tree will over fit some parts of the data, but therefor will under fit other parts of the data. But in boosting, you don't use the individual trees, but rathe
Why is boosting less likely to overfit? The general idea is that each individual tree will over fit some parts of the data, but therefor will under fit other parts of the data. But in boosting, you don't use the individual trees, but rather "average" them all together, so for a particular data point (or group of points) the trees that over fit that point (those points) will be average with the under fitting trees and the combined average should neither over or under fit, but should be about right. As with all models, you should try this out on some simulated data to help yourself understand what is going on. Also, as with all models, you should look at diagnostics and use your knowledge of the science and common sense to make sure that the modeling represents your data reasonably.
Why is boosting less likely to overfit? The general idea is that each individual tree will over fit some parts of the data, but therefor will under fit other parts of the data. But in boosting, you don't use the individual trees, but rathe
41,520
Why is boosting less likely to overfit?
This is one of those things that has been observed for a while but not necessarily theoretically explained. In one of the original random forest papers, Breiman hypothesized that adaboost functions as a kind of random forest in its latter stage as the weights are essentially drawn from a random distribution. His full supposition hasn't been proven but gives reasonable intuition. In modern gradient boosting machines etc it is common to use the learning rate and sub-sampeling of the data features to make the tree growth explicitly randomized. Its also notable that their are relatively few hyper-paramaters to tune and they function pretty directly to combat overfitting. So while it is possible to overfit with a boosted model its also easy to dial back the tree depth, leaf size, learning rate etc and/or add in randomization to combat this.
Why is boosting less likely to overfit?
This is one of those things that has been observed for a while but not necessarily theoretically explained. In one of the original random forest papers, Breiman hypothesized that adaboost functions as
Why is boosting less likely to overfit? This is one of those things that has been observed for a while but not necessarily theoretically explained. In one of the original random forest papers, Breiman hypothesized that adaboost functions as a kind of random forest in its latter stage as the weights are essentially drawn from a random distribution. His full supposition hasn't been proven but gives reasonable intuition. In modern gradient boosting machines etc it is common to use the learning rate and sub-sampeling of the data features to make the tree growth explicitly randomized. Its also notable that their are relatively few hyper-paramaters to tune and they function pretty directly to combat overfitting. So while it is possible to overfit with a boosted model its also easy to dial back the tree depth, leaf size, learning rate etc and/or add in randomization to combat this.
Why is boosting less likely to overfit? This is one of those things that has been observed for a while but not necessarily theoretically explained. In one of the original random forest papers, Breiman hypothesized that adaboost functions as
41,521
Why is boosting less likely to overfit?
This is not a very formal justification, but the discussion in this article provides some interesting perspective on this question. I would recommend reading the article itself (it is fairly short and not too technical), but here is an overview of the basic argument: The way boosting selects trees is algorithmically similar to a technique for computing the "regularization path" of LASSO (i.e. the set of solutions to $\min_\beta ||y - X\beta||_2^2 + \lambda ||\beta||_1$ as $\lambda$ varies), called Least Angle Regression, which was first introduced by many of the same authors here. Moreover, the way boosting works (successively adding more trees from a model with no predictors) can be thought of as tracing out a path from having a lot of regularization (high $\lambda$, so small $||\beta||_1$ with many 0s) to having very little regularization (and therefore larger $||\beta||_1$) with more 0s). In this view then, boosting as an algorithm tends to guarantee that the solutions found are ones that are "sparse", while early stopping can be thought of as a numerically efficient way of doing cross-validation to tune an implicit $L^1$ regularization parameter. The authors then discuss the virtues of $L^1$ regularization using what they call the "bet on sparsity" principle to justify why this algorithmic view of boosting might explain why it seems to work well.
Why is boosting less likely to overfit?
This is not a very formal justification, but the discussion in this article provides some interesting perspective on this question. I would recommend reading the article itself (it is fairly short and
Why is boosting less likely to overfit? This is not a very formal justification, but the discussion in this article provides some interesting perspective on this question. I would recommend reading the article itself (it is fairly short and not too technical), but here is an overview of the basic argument: The way boosting selects trees is algorithmically similar to a technique for computing the "regularization path" of LASSO (i.e. the set of solutions to $\min_\beta ||y - X\beta||_2^2 + \lambda ||\beta||_1$ as $\lambda$ varies), called Least Angle Regression, which was first introduced by many of the same authors here. Moreover, the way boosting works (successively adding more trees from a model with no predictors) can be thought of as tracing out a path from having a lot of regularization (high $\lambda$, so small $||\beta||_1$ with many 0s) to having very little regularization (and therefore larger $||\beta||_1$) with more 0s). In this view then, boosting as an algorithm tends to guarantee that the solutions found are ones that are "sparse", while early stopping can be thought of as a numerically efficient way of doing cross-validation to tune an implicit $L^1$ regularization parameter. The authors then discuss the virtues of $L^1$ regularization using what they call the "bet on sparsity" principle to justify why this algorithmic view of boosting might explain why it seems to work well.
Why is boosting less likely to overfit? This is not a very formal justification, but the discussion in this article provides some interesting perspective on this question. I would recommend reading the article itself (it is fairly short and
41,522
Is Partitioning Around Medoids (PAM) deterministic?
PAM is close to being deterministic, but there may be ties. In particular, PAM does not use a random generator. The heart of PAM is the BUILD phase that tries to smartly choose the initial settings (there exist variations that use a random sample, but IIRC that is not the original PAM algorithm). If I remember correctly, the authors even claimed that you don't really need the iterative refinement (SWAP phase), and it will finish in very few iterations because of the good starting conditions. Nevertheless, if you have, e.g., a symmetric data set, you are likely to have more than one choice as "best medoid" at some point. Because of these "ties", it cannot be fully deterministic (most implementations will be deterministic because they do not randomly break these ties; but if you permute the data and have such ties, you may occasionally see different results). PAM also is not exhaustive search. It is a steepest descent approach, but it will consider nearby solutions only. The hypergraph interpretation in the CLARANS article outlines this. But it easy to see that there are (n choose k) possible medoids, but PAM at any time only considers (n-k)*k alternatives in each SWAP step.
Is Partitioning Around Medoids (PAM) deterministic?
PAM is close to being deterministic, but there may be ties. In particular, PAM does not use a random generator. The heart of PAM is the BUILD phase that tries to smartly choose the initial settings (t
Is Partitioning Around Medoids (PAM) deterministic? PAM is close to being deterministic, but there may be ties. In particular, PAM does not use a random generator. The heart of PAM is the BUILD phase that tries to smartly choose the initial settings (there exist variations that use a random sample, but IIRC that is not the original PAM algorithm). If I remember correctly, the authors even claimed that you don't really need the iterative refinement (SWAP phase), and it will finish in very few iterations because of the good starting conditions. Nevertheless, if you have, e.g., a symmetric data set, you are likely to have more than one choice as "best medoid" at some point. Because of these "ties", it cannot be fully deterministic (most implementations will be deterministic because they do not randomly break these ties; but if you permute the data and have such ties, you may occasionally see different results). PAM also is not exhaustive search. It is a steepest descent approach, but it will consider nearby solutions only. The hypergraph interpretation in the CLARANS article outlines this. But it easy to see that there are (n choose k) possible medoids, but PAM at any time only considers (n-k)*k alternatives in each SWAP step.
Is Partitioning Around Medoids (PAM) deterministic? PAM is close to being deterministic, but there may be ties. In particular, PAM does not use a random generator. The heart of PAM is the BUILD phase that tries to smartly choose the initial settings (t
41,523
Is Partitioning Around Medoids (PAM) deterministic?
Short answer no. It is sensitive to the starting medoids. There could be multiple correct combinations of medoids that minimize the objective function. Some software packages implement a smart building stage where the starting medoids are selected in a deterministic way. If the starting medoids are a deterministic the PAM results will be also. This paper helped me tie it all together Amorim et al. The paper presents a weighted version of PAM.
Is Partitioning Around Medoids (PAM) deterministic?
Short answer no. It is sensitive to the starting medoids. There could be multiple correct combinations of medoids that minimize the objective function. Some software packages implement a smart buildin
Is Partitioning Around Medoids (PAM) deterministic? Short answer no. It is sensitive to the starting medoids. There could be multiple correct combinations of medoids that minimize the objective function. Some software packages implement a smart building stage where the starting medoids are selected in a deterministic way. If the starting medoids are a deterministic the PAM results will be also. This paper helped me tie it all together Amorim et al. The paper presents a weighted version of PAM.
Is Partitioning Around Medoids (PAM) deterministic? Short answer no. It is sensitive to the starting medoids. There could be multiple correct combinations of medoids that minimize the objective function. Some software packages implement a smart buildin
41,524
Comparing Cox proportional hazards models - AIC?
For the Cox proportional hazard model the baselinehazard (i.e. 'intercept') is not estimated and so the likelihood is only a partial one. Even though this is partial, it is possible to compare nested COX models using a likelihood ratio test (LRT) to test for a significant difference in model fit. The Akaike's Information Criterion (AIC) is depended on likelihood as well, but also on the amount of predictors/parameters/degrees of freedom used by the model. It is defined as follows $ AIC = 2k - 2ln(L) $ where k = the amount of df used and L the (partial) likelihood of your model. Lower AICs correspond to a better fit. The AIC often aligns with the LRT, but sometimes result in different conclusions due to the strict correction for every parameter/df added to your model. In your situation however, the models are not nested. To my knowledge no (simple) statistical tests to compare these models on data fit are available (if so, I'd like to learn as well!). The AIC is somewhat of an exception to this, because its correction for the amount of parameters makes unnested models made for the same outcome on the same data, more comparable. So to conclude, no, there is no easy way of comparing the specific AICs using a statistical test. So IMHO the model with the lowest AIC would be best, irregardless of significance tests. As a suggestion for further thought and smarter people: might bootstrapping the data, building the two models in each bootstrap dataset, and then comparing the distributions of AIC be a way to statistically test these two AICs?
Comparing Cox proportional hazards models - AIC?
For the Cox proportional hazard model the baselinehazard (i.e. 'intercept') is not estimated and so the likelihood is only a partial one. Even though this is partial, it is possible to compare nested
Comparing Cox proportional hazards models - AIC? For the Cox proportional hazard model the baselinehazard (i.e. 'intercept') is not estimated and so the likelihood is only a partial one. Even though this is partial, it is possible to compare nested COX models using a likelihood ratio test (LRT) to test for a significant difference in model fit. The Akaike's Information Criterion (AIC) is depended on likelihood as well, but also on the amount of predictors/parameters/degrees of freedom used by the model. It is defined as follows $ AIC = 2k - 2ln(L) $ where k = the amount of df used and L the (partial) likelihood of your model. Lower AICs correspond to a better fit. The AIC often aligns with the LRT, but sometimes result in different conclusions due to the strict correction for every parameter/df added to your model. In your situation however, the models are not nested. To my knowledge no (simple) statistical tests to compare these models on data fit are available (if so, I'd like to learn as well!). The AIC is somewhat of an exception to this, because its correction for the amount of parameters makes unnested models made for the same outcome on the same data, more comparable. So to conclude, no, there is no easy way of comparing the specific AICs using a statistical test. So IMHO the model with the lowest AIC would be best, irregardless of significance tests. As a suggestion for further thought and smarter people: might bootstrapping the data, building the two models in each bootstrap dataset, and then comparing the distributions of AIC be a way to statistically test these two AICs?
Comparing Cox proportional hazards models - AIC? For the Cox proportional hazard model the baselinehazard (i.e. 'intercept') is not estimated and so the likelihood is only a partial one. Even though this is partial, it is possible to compare nested
41,525
Comparing Cox proportional hazards models - AIC?
I think that your problem is one of model selection. If you would consider forward selection, and stop after including one variable, then you would end up with the FLAB model. As compared to the other univariate model, it is more significant and has smaller AIC. From the output, there would be no reason not to select this model. The two AICs tell you that the models are roughly the same in terms of goodness of fit. But you can't rigorously compare the models because they are not nested (like IWS said). I think that you should also fit a model with both FLAB and Freehand. Then you would be able to look at the univariate models nested in the multivariate one, and use likelihood ratio tests or something similar to asses whether a model with FLAB + Freehand is better than a model with FLAB only.
Comparing Cox proportional hazards models - AIC?
I think that your problem is one of model selection. If you would consider forward selection, and stop after including one variable, then you would end up with the FLAB model. As compared to the other
Comparing Cox proportional hazards models - AIC? I think that your problem is one of model selection. If you would consider forward selection, and stop after including one variable, then you would end up with the FLAB model. As compared to the other univariate model, it is more significant and has smaller AIC. From the output, there would be no reason not to select this model. The two AICs tell you that the models are roughly the same in terms of goodness of fit. But you can't rigorously compare the models because they are not nested (like IWS said). I think that you should also fit a model with both FLAB and Freehand. Then you would be able to look at the univariate models nested in the multivariate one, and use likelihood ratio tests or something similar to asses whether a model with FLAB + Freehand is better than a model with FLAB only.
Comparing Cox proportional hazards models - AIC? I think that your problem is one of model selection. If you would consider forward selection, and stop after including one variable, then you would end up with the FLAB model. As compared to the other
41,526
Comparing Cox proportional hazards models - AIC?
With everything else being quite similar, the c-index (Concordance in the model summary) values differ and could therefore be used to compare models. Based on this, the freehand model is better (0.655 vs. 0.609).
Comparing Cox proportional hazards models - AIC?
With everything else being quite similar, the c-index (Concordance in the model summary) values differ and could therefore be used to compare models. Based on this, the freehand model is better (0.655
Comparing Cox proportional hazards models - AIC? With everything else being quite similar, the c-index (Concordance in the model summary) values differ and could therefore be used to compare models. Based on this, the freehand model is better (0.655 vs. 0.609).
Comparing Cox proportional hazards models - AIC? With everything else being quite similar, the c-index (Concordance in the model summary) values differ and could therefore be used to compare models. Based on this, the freehand model is better (0.655
41,527
"Smoothness" of a statistic for bootstrapping?
$\newcommand{\OLS}{\operatorname{OLS}}$This is essentially a question about mathematical, not statistical terminology, as far as I can tell. Anyway the point is that the statistics are not a differentiable function of the sample, or are not $n-$times continuously differentiable function of the sample. In other words there are possibly places where the response of the statistic to changes in the sample is not ideal, or is unappealingly abrupt (hence the terminology 'smooth'), in a way that linear or polynomial functions of the data, for example, could never have. The Wikipedia page about smooth functions is probably unnecessarily technical at points, but hopefully some of the pictures and extended discussion can give you some intuition for what is meant to be evoked by the term 'smoothness'. If a certain function is a "differentiable function of sample moments" then it may be a smooth function of the sample moments, depending on what sense "smooth" is being used in that context. I most often see "smooth" used to mean infinitely many times continuously differentiable (e.g. like polynomials or linear functions or sines and cosines), but sometimes the term can be used in a less strict sense, as the Wikipedia page mentions. In any case you are definitely right that it relates to differentiability -- that is the key idea. Also it's worth noting that there exist functions which are continuous but not "smooth" -- the idea is that while continuity is in general a nice regularity property, in many cases it still allows a lot of undesirable pathological behavior, while such pathological behavior cannot occur for smooth functions, because they are even nicer still than continuous ones. Example: Consider, for example, the LASSO estimator with orthonormal covariates: $$ \hat{\beta}_j = S_{N \lambda}(\hat{\beta}_j^{\OLS}) = \hat{\beta}_j^{\OLS} \max\left\{ 0, 1 - \frac{N \lambda}{\left|\hat{\beta}^{\OLS}_j \right|} \right\}, $$ where $\hat{\beta}^{OLS} = (X^T X)^{-1}X^Ty = X^T y$. First we note that $\hat{\beta}_j^{\OLS}$ is linear in the coordinates of $X$ and $y$ since $\hat{\beta}^{\OLS}$ is linear in $X$ and $y$, so (assuming that $X$ or $y$ represents the sample) all of the $\hat{\beta}_j^{\OLS}$ are completely smooth functions and are not the source of the non-smoothness. Instead, any non-smoothness comes from the maximum function $\max$ found in the definition of $\hat{\beta}_j$, as I will try to convince you below. We use the identity $\max\{x, y \} = \frac{x+y +|x-y|}{2}$ (discussed and proven here) to rewrite the above expression as follows: $$ \begin{array}{rcl} \hat{\beta}_j & = & \displaystyle\frac{\hat{\beta}_j^{\OLS}}{2}\left[ -\left( \frac{N \lambda}{\left|\hat{\beta}_j^{\OLS}\right|} - 1 \right) + \left|\frac{N \lambda}{\left|\hat{\beta}_j^{\OLS}\right|}-1\right| \enspace \right] \\ & = & \begin{cases} 0, & \text{when } \displaystyle\frac{N \lambda}{\left|\hat{\beta}^{\OLS}\right|} \ge 1 \\ \hat{\beta}_j^{\OLS}\left(1 - \displaystyle\frac{N \lambda}{\left|\hat{\beta}_j^{\OLS}\right|} \right), & \text{when } \displaystyle\frac{N \lambda}{\left|\hat{\beta}^{\OLS}\right|} \le 1 \end{cases} \end{array}$$ Written in this form, it is obvious that we have at least two possible sources for non-smooth behavior: (1) when $\hat{\beta}_j^{\OLS}=0$, causing a denominator to vanish, (2) and possible cusps at the point(s) where: $$\frac{N \lambda}{\left| \hat{\beta}^{\OLS}_j \right|} = 1 \iff N\lambda = \left| \hat{\beta}^{\OLS}_j \right|,$$ since of course at these points $\hat{\beta}_j$ is the "gluing together" of two different functions $\left(0\text{ and }\hat{\beta}_j^{\OLS}\left(1 - \frac{N \lambda}{\left|\hat{\beta}_j^{\OLS}\right|} \right) \right)$ which, even though they have the same value at the points where $N\lambda = \left| \hat{\beta}^{\OLS}_j \right| $, may not necessarily "play nicely" together in such a way that the left- and right-hand derivatives agree for all $n$. The most basic example of a function for which this fails to happen is $|x|$ at the value $x=0$: it's first left-hand derivative is $-1$ and it's first right-hand derivative is $1$, so it is not smooth at $x=0$. I suspect that an analogous phenomenon likely happens for the function $\hat{\beta}_j$ at those points where $N \lambda = \left| \hat{\beta}^{\OLS}_j \right|$, causing $\hat{\beta}_j$ to not be a smooth function of its inputs. The function $\hat{\beta}_j$ only needs to be smooth with respect to its input arguments in order to be considered smooth. Presumably its input arguments are the sample itself, or some functions $g$ of the sample. If $\hat{\beta}_j$ is a function of functions $g$ of the sample, then one can by composition $\hat{\beta}_j \circ g$ get a new function $\tilde{\hat{\beta}}_j$ that skips the middleman (i.e. returns the same outputs of interest and is directly a function of the sample). By the chain rule this composed function $\tilde{\hat{\beta}}_j = \hat{\beta}_j \circ g$ is smooth if and only if both functions $\hat{\beta}_j$ and $g$ are smooth.
"Smoothness" of a statistic for bootstrapping?
$\newcommand{\OLS}{\operatorname{OLS}}$This is essentially a question about mathematical, not statistical terminology, as far as I can tell. Anyway the point is that the statistics are not a differen
"Smoothness" of a statistic for bootstrapping? $\newcommand{\OLS}{\operatorname{OLS}}$This is essentially a question about mathematical, not statistical terminology, as far as I can tell. Anyway the point is that the statistics are not a differentiable function of the sample, or are not $n-$times continuously differentiable function of the sample. In other words there are possibly places where the response of the statistic to changes in the sample is not ideal, or is unappealingly abrupt (hence the terminology 'smooth'), in a way that linear or polynomial functions of the data, for example, could never have. The Wikipedia page about smooth functions is probably unnecessarily technical at points, but hopefully some of the pictures and extended discussion can give you some intuition for what is meant to be evoked by the term 'smoothness'. If a certain function is a "differentiable function of sample moments" then it may be a smooth function of the sample moments, depending on what sense "smooth" is being used in that context. I most often see "smooth" used to mean infinitely many times continuously differentiable (e.g. like polynomials or linear functions or sines and cosines), but sometimes the term can be used in a less strict sense, as the Wikipedia page mentions. In any case you are definitely right that it relates to differentiability -- that is the key idea. Also it's worth noting that there exist functions which are continuous but not "smooth" -- the idea is that while continuity is in general a nice regularity property, in many cases it still allows a lot of undesirable pathological behavior, while such pathological behavior cannot occur for smooth functions, because they are even nicer still than continuous ones. Example: Consider, for example, the LASSO estimator with orthonormal covariates: $$ \hat{\beta}_j = S_{N \lambda}(\hat{\beta}_j^{\OLS}) = \hat{\beta}_j^{\OLS} \max\left\{ 0, 1 - \frac{N \lambda}{\left|\hat{\beta}^{\OLS}_j \right|} \right\}, $$ where $\hat{\beta}^{OLS} = (X^T X)^{-1}X^Ty = X^T y$. First we note that $\hat{\beta}_j^{\OLS}$ is linear in the coordinates of $X$ and $y$ since $\hat{\beta}^{\OLS}$ is linear in $X$ and $y$, so (assuming that $X$ or $y$ represents the sample) all of the $\hat{\beta}_j^{\OLS}$ are completely smooth functions and are not the source of the non-smoothness. Instead, any non-smoothness comes from the maximum function $\max$ found in the definition of $\hat{\beta}_j$, as I will try to convince you below. We use the identity $\max\{x, y \} = \frac{x+y +|x-y|}{2}$ (discussed and proven here) to rewrite the above expression as follows: $$ \begin{array}{rcl} \hat{\beta}_j & = & \displaystyle\frac{\hat{\beta}_j^{\OLS}}{2}\left[ -\left( \frac{N \lambda}{\left|\hat{\beta}_j^{\OLS}\right|} - 1 \right) + \left|\frac{N \lambda}{\left|\hat{\beta}_j^{\OLS}\right|}-1\right| \enspace \right] \\ & = & \begin{cases} 0, & \text{when } \displaystyle\frac{N \lambda}{\left|\hat{\beta}^{\OLS}\right|} \ge 1 \\ \hat{\beta}_j^{\OLS}\left(1 - \displaystyle\frac{N \lambda}{\left|\hat{\beta}_j^{\OLS}\right|} \right), & \text{when } \displaystyle\frac{N \lambda}{\left|\hat{\beta}^{\OLS}\right|} \le 1 \end{cases} \end{array}$$ Written in this form, it is obvious that we have at least two possible sources for non-smooth behavior: (1) when $\hat{\beta}_j^{\OLS}=0$, causing a denominator to vanish, (2) and possible cusps at the point(s) where: $$\frac{N \lambda}{\left| \hat{\beta}^{\OLS}_j \right|} = 1 \iff N\lambda = \left| \hat{\beta}^{\OLS}_j \right|,$$ since of course at these points $\hat{\beta}_j$ is the "gluing together" of two different functions $\left(0\text{ and }\hat{\beta}_j^{\OLS}\left(1 - \frac{N \lambda}{\left|\hat{\beta}_j^{\OLS}\right|} \right) \right)$ which, even though they have the same value at the points where $N\lambda = \left| \hat{\beta}^{\OLS}_j \right| $, may not necessarily "play nicely" together in such a way that the left- and right-hand derivatives agree for all $n$. The most basic example of a function for which this fails to happen is $|x|$ at the value $x=0$: it's first left-hand derivative is $-1$ and it's first right-hand derivative is $1$, so it is not smooth at $x=0$. I suspect that an analogous phenomenon likely happens for the function $\hat{\beta}_j$ at those points where $N \lambda = \left| \hat{\beta}^{\OLS}_j \right|$, causing $\hat{\beta}_j$ to not be a smooth function of its inputs. The function $\hat{\beta}_j$ only needs to be smooth with respect to its input arguments in order to be considered smooth. Presumably its input arguments are the sample itself, or some functions $g$ of the sample. If $\hat{\beta}_j$ is a function of functions $g$ of the sample, then one can by composition $\hat{\beta}_j \circ g$ get a new function $\tilde{\hat{\beta}}_j$ that skips the middleman (i.e. returns the same outputs of interest and is directly a function of the sample). By the chain rule this composed function $\tilde{\hat{\beta}}_j = \hat{\beta}_j \circ g$ is smooth if and only if both functions $\hat{\beta}_j$ and $g$ are smooth.
"Smoothness" of a statistic for bootstrapping? $\newcommand{\OLS}{\operatorname{OLS}}$This is essentially a question about mathematical, not statistical terminology, as far as I can tell. Anyway the point is that the statistics are not a differen
41,528
How to use isometric logratio ilr() from a package "compositions"
If your data is compositional, it means that the only relevant information available in your data is the relative information you have between parts. Therefore, you are interested in studying the relations between parts relatively. The log-ratio methodology studies this relative relations using the quotient between parts, to be more precise, using the logarithm between ratios of parts. You can see that all the possible ratios between a $k$-part composition, $(x_1,\dots,x_k)$, are completely caracterized by considering only $k-1$ certain (independant) log-ratios. A common approach is to consider all the ratios against the last component, $(\log\frac{x_1}{x_k}, \dots, \log\frac{x_{k-1}}{x_k}))$, this approach is known as the additive log-ratio transformation (alr). It is possible to interpret the alr tranformation as the coordinates with respect a certain basis. A first problem you have with the alr tranformation is that the basis used to obtain the trnaformed values is not orthogonal but oblique and a second problem is that the simplex does not seems to have an standard basis. Although, you can define orthonormal basis in the simplex and with this basis you can define a transformation. This tranformation is commonly known as ilr transformation (ilr) and the function implemented inside the package compositions is to obtain the ilr coordinates with respect to an orthonormal basis. With your example (I've reduced the number of composition), set.seed(1) # loading library library(compositions) # Generate data dataset <- data.frame( x = runif(5, min = 0.2, max = 0.65), y = runif(5, min = 0.2, max = 0.4), z = runif(5, min = 0.1, max = 0.7)) # Make data compositional dataset.compositional = acomp(dataset) you have that the coordinates of your sample (X <- dataset.compositional/rowSums(dataset.compositional)) # x y z # [1,] 0.3462279 0.4114672 0.2423048 # [2,] 0.3818417 0.4041619 0.2139964 # [3,] 0.3515582 0.2550841 0.3933578 # [4,] 0.4811888 0.2575718 0.2612394 # [5,] 0.2730063 0.1993929 0.5276008 are (dataset.ilr <- ilr(dataset.compositional)) # [,1] [,2] # [1,] 0.12206935 -0.3618850 # [2,] 0.04017035 -0.4959822 # [3,] -0.22682715 0.2226876 # [4,] -0.44191428 -0.2435951 # [5,] -0.22218525 0.6662235 By default, the ilr function uses the basis (in columns) (B <- exp(ilrBase(D=3)) # 1 0.4930687 0.6648138 # 2 2.0281150 0.6648138 # 3 1.0000000 2.2625592 which means that your original sample can be obtained from the orthnormal basis B and the ilr coordinates. X1 = t(apply(dataset.ilr, 1, function(x){ B[,1]^x[1] * B[,2]^x[2] })) X1 / rowSums(X1) # 1 2 3 # [1,] 0.3462279 0.4114672 0.2423048 # [2,] 0.3818417 0.4041619 0.2139964 # [3,] 0.3515582 0.2550841 0.3933578 # [4,] 0.4811888 0.2575718 0.2612394 # [5,] 0.2730063 0.1993929 0.5276008 In this case, taking into an account the basis B, we see that (except for a constant term) the first column of the ilr coordinates is comparing the first component against the second component 1/sqrt(2) * log(X[,2]/X[,1]) # Compare with first column of dataset.ilr # [1] 0.12206935 0.04017035 -0.22682715 -0.44191428 -0.22218525 the second column is comparing (expect for a constant term) the thir component against the other components (in fact, against the geometric mean of first and second component) sqrt(2)/sqrt(3) * log(X[,3] / (X[,1]*X[,2])^(1/2)) # [1] -0.3618850 -0.4959822 0.2226876 -0.2435951 0.6662235 Finally, I think that a good place to find more information about the subject: articles, books, ... is http://www.compositionaldata.com/material.php
How to use isometric logratio ilr() from a package "compositions"
If your data is compositional, it means that the only relevant information available in your data is the relative information you have between parts. Therefore, you are interested in studying the rela
How to use isometric logratio ilr() from a package "compositions" If your data is compositional, it means that the only relevant information available in your data is the relative information you have between parts. Therefore, you are interested in studying the relations between parts relatively. The log-ratio methodology studies this relative relations using the quotient between parts, to be more precise, using the logarithm between ratios of parts. You can see that all the possible ratios between a $k$-part composition, $(x_1,\dots,x_k)$, are completely caracterized by considering only $k-1$ certain (independant) log-ratios. A common approach is to consider all the ratios against the last component, $(\log\frac{x_1}{x_k}, \dots, \log\frac{x_{k-1}}{x_k}))$, this approach is known as the additive log-ratio transformation (alr). It is possible to interpret the alr tranformation as the coordinates with respect a certain basis. A first problem you have with the alr tranformation is that the basis used to obtain the trnaformed values is not orthogonal but oblique and a second problem is that the simplex does not seems to have an standard basis. Although, you can define orthonormal basis in the simplex and with this basis you can define a transformation. This tranformation is commonly known as ilr transformation (ilr) and the function implemented inside the package compositions is to obtain the ilr coordinates with respect to an orthonormal basis. With your example (I've reduced the number of composition), set.seed(1) # loading library library(compositions) # Generate data dataset <- data.frame( x = runif(5, min = 0.2, max = 0.65), y = runif(5, min = 0.2, max = 0.4), z = runif(5, min = 0.1, max = 0.7)) # Make data compositional dataset.compositional = acomp(dataset) you have that the coordinates of your sample (X <- dataset.compositional/rowSums(dataset.compositional)) # x y z # [1,] 0.3462279 0.4114672 0.2423048 # [2,] 0.3818417 0.4041619 0.2139964 # [3,] 0.3515582 0.2550841 0.3933578 # [4,] 0.4811888 0.2575718 0.2612394 # [5,] 0.2730063 0.1993929 0.5276008 are (dataset.ilr <- ilr(dataset.compositional)) # [,1] [,2] # [1,] 0.12206935 -0.3618850 # [2,] 0.04017035 -0.4959822 # [3,] -0.22682715 0.2226876 # [4,] -0.44191428 -0.2435951 # [5,] -0.22218525 0.6662235 By default, the ilr function uses the basis (in columns) (B <- exp(ilrBase(D=3)) # 1 0.4930687 0.6648138 # 2 2.0281150 0.6648138 # 3 1.0000000 2.2625592 which means that your original sample can be obtained from the orthnormal basis B and the ilr coordinates. X1 = t(apply(dataset.ilr, 1, function(x){ B[,1]^x[1] * B[,2]^x[2] })) X1 / rowSums(X1) # 1 2 3 # [1,] 0.3462279 0.4114672 0.2423048 # [2,] 0.3818417 0.4041619 0.2139964 # [3,] 0.3515582 0.2550841 0.3933578 # [4,] 0.4811888 0.2575718 0.2612394 # [5,] 0.2730063 0.1993929 0.5276008 In this case, taking into an account the basis B, we see that (except for a constant term) the first column of the ilr coordinates is comparing the first component against the second component 1/sqrt(2) * log(X[,2]/X[,1]) # Compare with first column of dataset.ilr # [1] 0.12206935 0.04017035 -0.22682715 -0.44191428 -0.22218525 the second column is comparing (expect for a constant term) the thir component against the other components (in fact, against the geometric mean of first and second component) sqrt(2)/sqrt(3) * log(X[,3] / (X[,1]*X[,2])^(1/2)) # [1] -0.3618850 -0.4959822 0.2226876 -0.2435951 0.6662235 Finally, I think that a good place to find more information about the subject: articles, books, ... is http://www.compositionaldata.com/material.php
How to use isometric logratio ilr() from a package "compositions" If your data is compositional, it means that the only relevant information available in your data is the relative information you have between parts. Therefore, you are interested in studying the rela
41,529
What is Contextual Embedding?
The contextual embedding of a word is just the corresponding hidden state of a bi-GRU: In our model the document encoder $f$ is implemented as a bidirectional Gated Recurrent Unit (GRU) network whose hidden states form the contextual word embeddings, that is $f_i(d) = \overrightarrow{f_i}(d) \,\, ||\,\, \overleftarrow{f_i}(d)$, where $||$ denotes vector concatenation and $\overrightarrow{f_i}$ and $\overleftarrow{f_i}$ denote forward and backward contextual embeddings from the respective recurrent networks. In red is the contextual embedding of the first word:
What is Contextual Embedding?
The contextual embedding of a word is just the corresponding hidden state of a bi-GRU: In our model the document encoder $f$ is implemented as a bidirectional Gated Recurrent Unit (GRU) network whose
What is Contextual Embedding? The contextual embedding of a word is just the corresponding hidden state of a bi-GRU: In our model the document encoder $f$ is implemented as a bidirectional Gated Recurrent Unit (GRU) network whose hidden states form the contextual word embeddings, that is $f_i(d) = \overrightarrow{f_i}(d) \,\, ||\,\, \overleftarrow{f_i}(d)$, where $||$ denotes vector concatenation and $\overrightarrow{f_i}$ and $\overleftarrow{f_i}$ denote forward and backward contextual embeddings from the respective recurrent networks. In red is the contextual embedding of the first word:
What is Contextual Embedding? The contextual embedding of a word is just the corresponding hidden state of a bi-GRU: In our model the document encoder $f$ is implemented as a bidirectional Gated Recurrent Unit (GRU) network whose
41,530
How does $\Bbb P(A) = \Bbb E(I_A)$ translate in plain English?
First let's define the indicator function: $$ \mathbb{I_A}=\left\{ \begin{array}{ll} 1, & x \in A\\ 0, & x \not \in A\\ \end{array} \right. $$ Now, find the expectation: $$E(\mathbb{I_A}) = 1\times P(X \in A) + 0\times P(X \not \in A) = P(X \in A)$$ Therefore the expected value of the indicator function for an event $A$ is the same as the probability of $A$ happening.
How does $\Bbb P(A) = \Bbb E(I_A)$ translate in plain English?
First let's define the indicator function: $$ \mathbb{I_A}=\left\{ \begin{array}{ll} 1, & x \in A\\ 0, & x \not \in A\\ \end{ar
How does $\Bbb P(A) = \Bbb E(I_A)$ translate in plain English? First let's define the indicator function: $$ \mathbb{I_A}=\left\{ \begin{array}{ll} 1, & x \in A\\ 0, & x \not \in A\\ \end{array} \right. $$ Now, find the expectation: $$E(\mathbb{I_A}) = 1\times P(X \in A) + 0\times P(X \not \in A) = P(X \in A)$$ Therefore the expected value of the indicator function for an event $A$ is the same as the probability of $A$ happening.
How does $\Bbb P(A) = \Bbb E(I_A)$ translate in plain English? First let's define the indicator function: $$ \mathbb{I_A}=\left\{ \begin{array}{ll} 1, & x \in A\\ 0, & x \not \in A\\ \end{ar
41,531
How to report RMSE of Lasso using glmnet in R
Specifically, do I report the RMSE of the model itself (i.e., how it performs with the training data used to create it) or do I report the RMSE of the model's performance with new data (aka test data)? ...Or both? These are called training error and test error, respectively. It's useful to report both, but test error is more important, presuming your interest is in the predictive accuracy of the model. Training error is, in general, an optimistically biased estimate of true error for the entire population, because of overfitting. If so, is the best way to do this simply to calculate new values using predict and then compare them to the actual values from the test data using the following equation? Yes. How do I approach calculating and reporting RMSE if I lack a tet data set and instead have to use cross-validation of my availabel data? Pretty much the same way. The catch is that you also need to use cross-validation to choose the lasso penalty. The way to handle this is to use nested cross-validation—that is, inside each fold of the cross-validation loop, do more cross-validation loops on the training part to choose the lasso penalty.
How to report RMSE of Lasso using glmnet in R
Specifically, do I report the RMSE of the model itself (i.e., how it performs with the training data used to create it) or do I report the RMSE of the model's performance with new data (aka test data)
How to report RMSE of Lasso using glmnet in R Specifically, do I report the RMSE of the model itself (i.e., how it performs with the training data used to create it) or do I report the RMSE of the model's performance with new data (aka test data)? ...Or both? These are called training error and test error, respectively. It's useful to report both, but test error is more important, presuming your interest is in the predictive accuracy of the model. Training error is, in general, an optimistically biased estimate of true error for the entire population, because of overfitting. If so, is the best way to do this simply to calculate new values using predict and then compare them to the actual values from the test data using the following equation? Yes. How do I approach calculating and reporting RMSE if I lack a tet data set and instead have to use cross-validation of my availabel data? Pretty much the same way. The catch is that you also need to use cross-validation to choose the lasso penalty. The way to handle this is to use nested cross-validation—that is, inside each fold of the cross-validation loop, do more cross-validation loops on the training part to choose the lasso penalty.
How to report RMSE of Lasso using glmnet in R Specifically, do I report the RMSE of the model itself (i.e., how it performs with the training data used to create it) or do I report the RMSE of the model's performance with new data (aka test data)
41,532
Are "kernel methods" and "reproducing kernel Hilbert spaces" related?
The Wikipedia pages for "Kernel Method" and "reproducing kernel Hilbert space" both refer to Mercer's theorem, which is the connection. If the kernel used in a kernel method is a "Mercer kernel" (that is, it satisfies the Mercer condition), then the method works "as if" it was operating in the Hilbert space (a function space) corresponding to the kernel. This is called the kernel trick. Note that kernel methods can be applied with a non-Mercer kernel however. To quote the Wikipedia page: "Empirically, for machine learning heuristics, choices of a function $k$ that do not satisfy Mercer's condition may still perform reasonably if $k$ at least approximates the intuitive idea of similarity."
Are "kernel methods" and "reproducing kernel Hilbert spaces" related?
The Wikipedia pages for "Kernel Method" and "reproducing kernel Hilbert space" both refer to Mercer's theorem, which is the connection. If the kernel used in a kernel method is a "Mercer kernel" (that
Are "kernel methods" and "reproducing kernel Hilbert spaces" related? The Wikipedia pages for "Kernel Method" and "reproducing kernel Hilbert space" both refer to Mercer's theorem, which is the connection. If the kernel used in a kernel method is a "Mercer kernel" (that is, it satisfies the Mercer condition), then the method works "as if" it was operating in the Hilbert space (a function space) corresponding to the kernel. This is called the kernel trick. Note that kernel methods can be applied with a non-Mercer kernel however. To quote the Wikipedia page: "Empirically, for machine learning heuristics, choices of a function $k$ that do not satisfy Mercer's condition may still perform reasonably if $k$ at least approximates the intuitive idea of similarity."
Are "kernel methods" and "reproducing kernel Hilbert spaces" related? The Wikipedia pages for "Kernel Method" and "reproducing kernel Hilbert space" both refer to Mercer's theorem, which is the connection. If the kernel used in a kernel method is a "Mercer kernel" (that
41,533
Combining samples based off mean and standard error
If your first population has mean $\mu_1$ and variance $\sigma_1^2,$ then the sample mean ${\bar{x}_1}$ of your data has variance ${\sigma_1^2 \over n_1},$ where $n_1$ is the sample size. Similarly for your second sample the variance of the sample mean ${\bar{x}_2}$ is ${\sigma_2^2 \over n_2}.$ The variance of the combined sample mean ${\frac{1}{2}}\left(\bar{x}_1+\bar{x}_2\right)$ is then ${\frac{1}{4}}\left({\sigma_1^2 \over n_1}+{\sigma_2^2 \over n_2}\right).$ So its standard deviation is ${\frac{1}{2}}\sqrt{{\sigma_1^2 \over n_1}+{\sigma_2^2 \over n_2}}$ The standard error, which is an estimate of this standard deviation, is given by ${\frac{1}{2}}\sqrt{{s_1^2 \over n_1}+{s_2^2 \over n_2}},$ where $s_1$ and $s_2$ are the sample standard deviations. Note that this is for a simple average of the two sample means, not a weighted version.
Combining samples based off mean and standard error
If your first population has mean $\mu_1$ and variance $\sigma_1^2,$ then the sample mean ${\bar{x}_1}$ of your data has variance ${\sigma_1^2 \over n_1},$ where $n_1$ is the sample size. Similarly fo
Combining samples based off mean and standard error If your first population has mean $\mu_1$ and variance $\sigma_1^2,$ then the sample mean ${\bar{x}_1}$ of your data has variance ${\sigma_1^2 \over n_1},$ where $n_1$ is the sample size. Similarly for your second sample the variance of the sample mean ${\bar{x}_2}$ is ${\sigma_2^2 \over n_2}.$ The variance of the combined sample mean ${\frac{1}{2}}\left(\bar{x}_1+\bar{x}_2\right)$ is then ${\frac{1}{4}}\left({\sigma_1^2 \over n_1}+{\sigma_2^2 \over n_2}\right).$ So its standard deviation is ${\frac{1}{2}}\sqrt{{\sigma_1^2 \over n_1}+{\sigma_2^2 \over n_2}}$ The standard error, which is an estimate of this standard deviation, is given by ${\frac{1}{2}}\sqrt{{s_1^2 \over n_1}+{s_2^2 \over n_2}},$ where $s_1$ and $s_2$ are the sample standard deviations. Note that this is for a simple average of the two sample means, not a weighted version.
Combining samples based off mean and standard error If your first population has mean $\mu_1$ and variance $\sigma_1^2,$ then the sample mean ${\bar{x}_1}$ of your data has variance ${\sigma_1^2 \over n_1},$ where $n_1$ is the sample size. Similarly fo
41,534
Combining samples based off mean and standard error
In your case it seems that you're trying to do a sort of meta-analysis where you want to act as if the two studies are one, with the commensurate larger N. Keep in mind that the variance of a sample mean is tied to the N from which the same is taken. You can only average the variance of sample means across studies when the N's are equal. This averaged variance does not seem to be what you're looking for. What you want to do instead is get a weighted variance (not of the sample mean, but the variance estimate for each sample) across the studies and use that to then get the standard error of the sample mean considering the combined N as the sample. So for the weighted variance you can just combine the variances in the usual fashion. Given that you only have Ns and SEs then you first need to get the variance for each study. var1 = SE1^2 * n1 var2 = SE2^2 * n2 Then pool those resulting variances ( var1 * (n1-1) + var2 * (n2 - 1) ) / (n2 + n1 - 2) and then calculate the new standard error. SE = sqrt(varPooled / N) Given the description in your comment of what you wanted to find out you should probably go this way.
Combining samples based off mean and standard error
In your case it seems that you're trying to do a sort of meta-analysis where you want to act as if the two studies are one, with the commensurate larger N. Keep in mind that the variance of a sample m
Combining samples based off mean and standard error In your case it seems that you're trying to do a sort of meta-analysis where you want to act as if the two studies are one, with the commensurate larger N. Keep in mind that the variance of a sample mean is tied to the N from which the same is taken. You can only average the variance of sample means across studies when the N's are equal. This averaged variance does not seem to be what you're looking for. What you want to do instead is get a weighted variance (not of the sample mean, but the variance estimate for each sample) across the studies and use that to then get the standard error of the sample mean considering the combined N as the sample. So for the weighted variance you can just combine the variances in the usual fashion. Given that you only have Ns and SEs then you first need to get the variance for each study. var1 = SE1^2 * n1 var2 = SE2^2 * n2 Then pool those resulting variances ( var1 * (n1-1) + var2 * (n2 - 1) ) / (n2 + n1 - 2) and then calculate the new standard error. SE = sqrt(varPooled / N) Given the description in your comment of what you wanted to find out you should probably go this way.
Combining samples based off mean and standard error In your case it seems that you're trying to do a sort of meta-analysis where you want to act as if the two studies are one, with the commensurate larger N. Keep in mind that the variance of a sample m
41,535
What paper introduced max norm regularization (as used in neural network training)?
This paper specifically discusses max-norm with SGD. It references Srebro and Shraibman (2005), which makes me think that it/your implementation does in fact correspond to the technique you described. Max-norm regularization has been previously used in the context of collaborative filtering (Srebro and Shraibman, 2005). It typically improves the performance of stochastic gradient descent training of deep neural nets, even when no dropout is used.
What paper introduced max norm regularization (as used in neural network training)?
This paper specifically discusses max-norm with SGD. It references Srebro and Shraibman (2005), which makes me think that it/your implementation does in fact correspond to the technique you described.
What paper introduced max norm regularization (as used in neural network training)? This paper specifically discusses max-norm with SGD. It references Srebro and Shraibman (2005), which makes me think that it/your implementation does in fact correspond to the technique you described. Max-norm regularization has been previously used in the context of collaborative filtering (Srebro and Shraibman, 2005). It typically improves the performance of stochastic gradient descent training of deep neural nets, even when no dropout is used.
What paper introduced max norm regularization (as used in neural network training)? This paper specifically discusses max-norm with SGD. It references Srebro and Shraibman (2005), which makes me think that it/your implementation does in fact correspond to the technique you described.
41,536
How to distinguish fixed from random effects in a model equation?
There are common notations which can be used which make it very easy to know what is fixed and random, but the equation you posted does not adopt such a notation. In your case there is no way to tell, except for the residuals (which are very commonly denoted with $e$ and since it is indexed the same way as the response variable, this makes it rather likely that is it a subject-level residual). Even the description beneath the variables does not help, so you have to rely on the text that follows on from there, where you find that $HYS_l$ and $c_m$ are also random ! Here is one easy notation scheme: denote fixed effects with $X_1$, $X_2$ and $X_3 ...$ and random effects with lower case letters: $e$ (typically reserved for subject residuals), $u$ and $v...$. So a random intercepts model with 2 $X$ variables and a response $Y$ could be simply written as $Y = \beta_0 + \beta_1X_1 + \beta_2X_2 + u + e$ where $u$ are the random intercepts and $e$ are the subject residuals. To be more explicit, this type of model is often presented with indexing: Observations in each group are indexed with $i$ and $j$ referring to the $i$th subject in the $j$th group, where $i$ ranges from $1$ to $n_j$ and $j$ ranges from $1$ to $J$ where $J$ is the total number of groups. Thus we have $Y_{ij}$ is the response variable for the $i$th subject in the $j$th cluster. $X_{1ij}$ is the value of $X_1$ for the $i$th subject in the $j$th cluster. $X_{2ij}$ is the value of $X_2$ for the $i$th subject in the $j$th cluster. Then, the above random intercepts model is $$ Y_{ij}= (\beta_0 + u_{0j})+\beta_1 X_{1ij} +\beta_2 X_{2ij} +e_{ij}, $$ Since every subject has their own residual, $e$ are indexed by $e_{ij}$, and since every group has it's own residual, these are indexed by $u_{0j}$ (where the $0$ in the subscript corresponds to the zero in the $\beta$ subscript because $u_{0j}$ is the random intercept and $\beta_0$ is the global intercept). Using this notation we can easily introduce a random slope for $X_1$ which will simply be another cluster-level residual, $u_{1j}$ $$ y_{ij}= (\beta_0 + u_{0j})+(\beta_1 + u_{1j}) X_{1ij} +\beta_2 X_{2ij} +e_{ij}, $$ and again for a random slope ($u_{2j}$) for $x_2$ $$ Y_{ij}= (\beta_0 + u_{0j})+(\beta_1 + u_{1j}) X_{1ij} +(\beta_2 +u_{2j}) X_{2ij} +e_{ij}, $$ Note how the subscripts on the beta-coefficient match those of the fixed effects $X_1$ and $X_2$ and the random effects $u_{0j}$ and $u_{1j}$ We can further extend this with interaction, further $X$ variables and further "levels". However it should be apparent that if we were to do that then this kind of notation quickly becomes difficult to work with, so there are 2 common ways to proceed. The first is to write: \begin{align} \\ Y_{ij}&= \beta_{0j}+ \beta_{1j} X_{1ij} + \beta_{2j}X_{2ij} +e_{ij} \\ \textrm{where} \\ \beta_{0j}&=\beta_0 + u_{0j} \\ \beta_{1j}&=\beta_1 + u_{1j} \\ \beta_{2j}&=\beta_{2} +u_{2j} \end{align} and this is usually the approach taken by the multilevel and hierarchical linear modelling worlds (see for example the very well known book by Snjders and Bosker Edit: To address the comment, in the case of an interaction we would write: $$ Y_{ij}= \beta_{0j}+ \beta_{1j} X_{1ij} + \beta_{2j}X_{2ij}+ \beta_{3}X_{1ij}X_{2ij} +e_{ij} $$ where in this case only the fixed effect of the interaction is modelled. We could easily include a random slope for the interaction too, in the same way that we did for $X_1$ and $X_2$. A second way is to work in matrix form: $$ \mathbf{y}=\mathbf{X\beta} + \mathbf{Z b} + \mathbf{e} $$ where $\mathbf{y}$ is the response vector, $\mathbf{X}$ is a design matrix for the fixed effects ($\mathbf{\beta}$) and $\mathbf{Z}$ is a block-diagonal design matrix for the random effects ($\mathbf{b}$). This is popular in the mixed effects world (see for example the book by Demidenko). To see how this notation works, we can partition the matrices for each group: $$\begin{bmatrix} \mathbf{y_1} \\ \mathbf{y_2} \\ \vdots \\ \mathbf{y_J} \end{bmatrix}= \begin{bmatrix} X_1 \\ X_2 \\ \vdots \\ X_J \end{bmatrix} \begin{bmatrix} \beta \end{bmatrix}+\begin{bmatrix} \mathbf{Z_1} & 0 & 0 & 0 \\ 0 & \mathbf{Z_2} & 0 & 0 \\ \vdots & & \ddots & \\ 0 & 0 & 0 & \mathbf{Z_J} \end{bmatrix} +\begin{bmatrix} b_1 \\ b_2 \\ \vdots \\ b_J \end{bmatrix}+\begin{bmatrix} e_1 \\ e_2 \\ \vdots \\ e_J \end{bmatrix}$$ where, in the case of the model without the interaction, but with random slopes for both $X_1$ and $X_2$, $\mathbf{y_j} = \begin{bmatrix} y_{1j}\\ y_{2j}\\ \vdots \\ y_{n_jj} \end{bmatrix},$ $\mathbf{X_j}=\mathbf{Z_j}=\begin{bmatrix} 1 & X_{11j} & X_{21j}\\ 1 & X_{12j} & X_{22j}\\ \vdots & \vdots & \vdots\\ 1 & X_{1n_jj} & X_{2n_jj} \end{bmatrix}, e_j = \begin{bmatrix} e_{1j}\\ e_{2j}\\ \vdots \\ e_{n_jj} \end{bmatrix},$ $\beta = \begin{pmatrix} \beta_0 \\ \beta_1 \\ \beta_2 \end{pmatrix}$ and $ b_j=\begin{pmatrix} u_{0j}\\ u_{1j} \\ u_{2j} \end{pmatrix}$ Note that for this model we have that $\mathbf{X_j}=\mathbf{Z_J}$ because we have random effects for all 3 fixed effects (intercept, $X_1$ and $X_2$). If we had random slopes for only $X_1$ then we would have: $\mathbf{Z_J}=\begin{bmatrix} 1 & X_{11j} \\ 1 & X_{12j} \\ \vdots & \vdots \\ 1 & X_{1n_jj} \end{bmatrix}$ and if we had random intercepts only, we would have: $\mathbf{Z_J}=\begin{bmatrix} 1 \\ 1 \\ \vdots \\ 1 \end{bmatrix}$
How to distinguish fixed from random effects in a model equation?
There are common notations which can be used which make it very easy to know what is fixed and random, but the equation you posted does not adopt such a notation. In your case there is no way to tell,
How to distinguish fixed from random effects in a model equation? There are common notations which can be used which make it very easy to know what is fixed and random, but the equation you posted does not adopt such a notation. In your case there is no way to tell, except for the residuals (which are very commonly denoted with $e$ and since it is indexed the same way as the response variable, this makes it rather likely that is it a subject-level residual). Even the description beneath the variables does not help, so you have to rely on the text that follows on from there, where you find that $HYS_l$ and $c_m$ are also random ! Here is one easy notation scheme: denote fixed effects with $X_1$, $X_2$ and $X_3 ...$ and random effects with lower case letters: $e$ (typically reserved for subject residuals), $u$ and $v...$. So a random intercepts model with 2 $X$ variables and a response $Y$ could be simply written as $Y = \beta_0 + \beta_1X_1 + \beta_2X_2 + u + e$ where $u$ are the random intercepts and $e$ are the subject residuals. To be more explicit, this type of model is often presented with indexing: Observations in each group are indexed with $i$ and $j$ referring to the $i$th subject in the $j$th group, where $i$ ranges from $1$ to $n_j$ and $j$ ranges from $1$ to $J$ where $J$ is the total number of groups. Thus we have $Y_{ij}$ is the response variable for the $i$th subject in the $j$th cluster. $X_{1ij}$ is the value of $X_1$ for the $i$th subject in the $j$th cluster. $X_{2ij}$ is the value of $X_2$ for the $i$th subject in the $j$th cluster. Then, the above random intercepts model is $$ Y_{ij}= (\beta_0 + u_{0j})+\beta_1 X_{1ij} +\beta_2 X_{2ij} +e_{ij}, $$ Since every subject has their own residual, $e$ are indexed by $e_{ij}$, and since every group has it's own residual, these are indexed by $u_{0j}$ (where the $0$ in the subscript corresponds to the zero in the $\beta$ subscript because $u_{0j}$ is the random intercept and $\beta_0$ is the global intercept). Using this notation we can easily introduce a random slope for $X_1$ which will simply be another cluster-level residual, $u_{1j}$ $$ y_{ij}= (\beta_0 + u_{0j})+(\beta_1 + u_{1j}) X_{1ij} +\beta_2 X_{2ij} +e_{ij}, $$ and again for a random slope ($u_{2j}$) for $x_2$ $$ Y_{ij}= (\beta_0 + u_{0j})+(\beta_1 + u_{1j}) X_{1ij} +(\beta_2 +u_{2j}) X_{2ij} +e_{ij}, $$ Note how the subscripts on the beta-coefficient match those of the fixed effects $X_1$ and $X_2$ and the random effects $u_{0j}$ and $u_{1j}$ We can further extend this with interaction, further $X$ variables and further "levels". However it should be apparent that if we were to do that then this kind of notation quickly becomes difficult to work with, so there are 2 common ways to proceed. The first is to write: \begin{align} \\ Y_{ij}&= \beta_{0j}+ \beta_{1j} X_{1ij} + \beta_{2j}X_{2ij} +e_{ij} \\ \textrm{where} \\ \beta_{0j}&=\beta_0 + u_{0j} \\ \beta_{1j}&=\beta_1 + u_{1j} \\ \beta_{2j}&=\beta_{2} +u_{2j} \end{align} and this is usually the approach taken by the multilevel and hierarchical linear modelling worlds (see for example the very well known book by Snjders and Bosker Edit: To address the comment, in the case of an interaction we would write: $$ Y_{ij}= \beta_{0j}+ \beta_{1j} X_{1ij} + \beta_{2j}X_{2ij}+ \beta_{3}X_{1ij}X_{2ij} +e_{ij} $$ where in this case only the fixed effect of the interaction is modelled. We could easily include a random slope for the interaction too, in the same way that we did for $X_1$ and $X_2$. A second way is to work in matrix form: $$ \mathbf{y}=\mathbf{X\beta} + \mathbf{Z b} + \mathbf{e} $$ where $\mathbf{y}$ is the response vector, $\mathbf{X}$ is a design matrix for the fixed effects ($\mathbf{\beta}$) and $\mathbf{Z}$ is a block-diagonal design matrix for the random effects ($\mathbf{b}$). This is popular in the mixed effects world (see for example the book by Demidenko). To see how this notation works, we can partition the matrices for each group: $$\begin{bmatrix} \mathbf{y_1} \\ \mathbf{y_2} \\ \vdots \\ \mathbf{y_J} \end{bmatrix}= \begin{bmatrix} X_1 \\ X_2 \\ \vdots \\ X_J \end{bmatrix} \begin{bmatrix} \beta \end{bmatrix}+\begin{bmatrix} \mathbf{Z_1} & 0 & 0 & 0 \\ 0 & \mathbf{Z_2} & 0 & 0 \\ \vdots & & \ddots & \\ 0 & 0 & 0 & \mathbf{Z_J} \end{bmatrix} +\begin{bmatrix} b_1 \\ b_2 \\ \vdots \\ b_J \end{bmatrix}+\begin{bmatrix} e_1 \\ e_2 \\ \vdots \\ e_J \end{bmatrix}$$ where, in the case of the model without the interaction, but with random slopes for both $X_1$ and $X_2$, $\mathbf{y_j} = \begin{bmatrix} y_{1j}\\ y_{2j}\\ \vdots \\ y_{n_jj} \end{bmatrix},$ $\mathbf{X_j}=\mathbf{Z_j}=\begin{bmatrix} 1 & X_{11j} & X_{21j}\\ 1 & X_{12j} & X_{22j}\\ \vdots & \vdots & \vdots\\ 1 & X_{1n_jj} & X_{2n_jj} \end{bmatrix}, e_j = \begin{bmatrix} e_{1j}\\ e_{2j}\\ \vdots \\ e_{n_jj} \end{bmatrix},$ $\beta = \begin{pmatrix} \beta_0 \\ \beta_1 \\ \beta_2 \end{pmatrix}$ and $ b_j=\begin{pmatrix} u_{0j}\\ u_{1j} \\ u_{2j} \end{pmatrix}$ Note that for this model we have that $\mathbf{X_j}=\mathbf{Z_J}$ because we have random effects for all 3 fixed effects (intercept, $X_1$ and $X_2$). If we had random slopes for only $X_1$ then we would have: $\mathbf{Z_J}=\begin{bmatrix} 1 & X_{11j} \\ 1 & X_{12j} \\ \vdots & \vdots \\ 1 & X_{1n_jj} \end{bmatrix}$ and if we had random intercepts only, we would have: $\mathbf{Z_J}=\begin{bmatrix} 1 \\ 1 \\ \vdots \\ 1 \end{bmatrix}$
How to distinguish fixed from random effects in a model equation? There are common notations which can be used which make it very easy to know what is fixed and random, but the equation you posted does not adopt such a notation. In your case there is no way to tell,
41,537
What's wrong with ''multiple testing correction'' compared to ''joint tests''?
I think you are missing @FrankHarrell's point here (I do not currently have access to the Perneger's paper discussed in the linked thread, so cannot comment on it). The debate is not about math, it is about philosophy. Everything you wrote here is mathematically correct, and clearly Bonferroni correction allows to control the familywise type I error rate, as your "joint test" also does. The debate is not at all about the specifics of Bonferroni itself, it is about multiple testing adjustments in general. Everybody knows an argument for multiple testing corrections, as illustrated by the famous XKCD jelly beans comic: Here is a counter-argument: if I developed a really convincing theory predicting that specifically green jelly beans should cause acne; and if I ran experiment to test for it and got nice and clear $p=0.003$; and if it so happened that some other PhD student in the same lab for whatever reason ran nineteen tests for all other jelly beans colors getting $p>05$ every time; and if now our advisor wants to put all of that in one single paper; -- then I would be totally against "adjusting" my p-value from $p=0.003$ to $p=0.003\cdot 20 = 0.06$. Note that the experimental data in the Argument and in the Counter-Argument might be exactly the same. But the interpretation differs. This is fine, but illustrates that one should not be obliged by doing multiple testing corrections in all situations. It is ultimately a matter of judgment. Crucially, real-life scenarios are usually not as clear cut as here and tend to be in between #1 and #2. See also Frank's example in his answer.
What's wrong with ''multiple testing correction'' compared to ''joint tests''?
I think you are missing @FrankHarrell's point here (I do not currently have access to the Perneger's paper discussed in the linked thread, so cannot comment on it). The debate is not about math, it is
What's wrong with ''multiple testing correction'' compared to ''joint tests''? I think you are missing @FrankHarrell's point here (I do not currently have access to the Perneger's paper discussed in the linked thread, so cannot comment on it). The debate is not about math, it is about philosophy. Everything you wrote here is mathematically correct, and clearly Bonferroni correction allows to control the familywise type I error rate, as your "joint test" also does. The debate is not at all about the specifics of Bonferroni itself, it is about multiple testing adjustments in general. Everybody knows an argument for multiple testing corrections, as illustrated by the famous XKCD jelly beans comic: Here is a counter-argument: if I developed a really convincing theory predicting that specifically green jelly beans should cause acne; and if I ran experiment to test for it and got nice and clear $p=0.003$; and if it so happened that some other PhD student in the same lab for whatever reason ran nineteen tests for all other jelly beans colors getting $p>05$ every time; and if now our advisor wants to put all of that in one single paper; -- then I would be totally against "adjusting" my p-value from $p=0.003$ to $p=0.003\cdot 20 = 0.06$. Note that the experimental data in the Argument and in the Counter-Argument might be exactly the same. But the interpretation differs. This is fine, but illustrates that one should not be obliged by doing multiple testing corrections in all situations. It is ultimately a matter of judgment. Crucially, real-life scenarios are usually not as clear cut as here and tend to be in between #1 and #2. See also Frank's example in his answer.
What's wrong with ''multiple testing correction'' compared to ''joint tests''? I think you are missing @FrankHarrell's point here (I do not currently have access to the Perneger's paper discussed in the linked thread, so cannot comment on it). The debate is not about math, it is
41,538
What's wrong with ''multiple testing correction'' compared to ''joint tests''?
@amoeba: on the example with the jelly beans I would like to argue as follows (note, I just want to understand): Let's say that there are 20 different colors of jelly beans, let's call these $c_1, c_2, \dots , c_{20}$, and let $c_{10}$ be the color 'green'. So, with your example the p-values for color $i$ (we note this as $p^{(i)}$) will be $p^{(i)} > 0.05$ when $i \ne 10$ and $p^{(10)}=0.003$. Theory 1: green jelly beans cause acne If you have developed a theory that green jelly beans cause acne, then you should test the hypothesis $H_0$: ''jelly beans of color $c_{10}$ have no effect on acne'' versus $H_1$: ''jelly beans of color $c_{10}$ cause acne''. This is obviously not a multiple testing problem, so you do not have to adjust the p-values. Theory 2: only green jelly beans cause acne In that case you should have ''$H_1$: green jelly beans cause acne AND jelly beans of color $c_i, i\ne 10$ do not cause acne'' and $H_0$ is then ''green jelly beans do not cause acne OR $\exists i|i \ne 10$ such that beans of color $c_i$ cause acne''. This is a multiple testing problem and requires adjusted p-values. Theory 3: jelly beans (of whatever color) cause acne In that case $H_1$: ''jelly beans of color $c_1$ cause acne AND ''jelly beans of color $c_2$ cause acne AND .... AND ''jelly beans of color $c_{20}$ cause acne'' and $H_0$ is the opposite. This is again a multiple testing problem. Theory ... Conclusion Anyhow, it can be seen that these theories are fundamentally different and whether or not p-value adjustment is required depends on that, not on ''philosophy'', at least that is my understanding. P.S. for the reaction to the example of @FrankHarrell see ''EDIT'' at the bottom of my answer to What's wrong with Bonferroni adjustments?
What's wrong with ''multiple testing correction'' compared to ''joint tests''?
@amoeba: on the example with the jelly beans I would like to argue as follows (note, I just want to understand): Let's say that there are 20 different colors of jelly beans, let's call these $c_1, c_
What's wrong with ''multiple testing correction'' compared to ''joint tests''? @amoeba: on the example with the jelly beans I would like to argue as follows (note, I just want to understand): Let's say that there are 20 different colors of jelly beans, let's call these $c_1, c_2, \dots , c_{20}$, and let $c_{10}$ be the color 'green'. So, with your example the p-values for color $i$ (we note this as $p^{(i)}$) will be $p^{(i)} > 0.05$ when $i \ne 10$ and $p^{(10)}=0.003$. Theory 1: green jelly beans cause acne If you have developed a theory that green jelly beans cause acne, then you should test the hypothesis $H_0$: ''jelly beans of color $c_{10}$ have no effect on acne'' versus $H_1$: ''jelly beans of color $c_{10}$ cause acne''. This is obviously not a multiple testing problem, so you do not have to adjust the p-values. Theory 2: only green jelly beans cause acne In that case you should have ''$H_1$: green jelly beans cause acne AND jelly beans of color $c_i, i\ne 10$ do not cause acne'' and $H_0$ is then ''green jelly beans do not cause acne OR $\exists i|i \ne 10$ such that beans of color $c_i$ cause acne''. This is a multiple testing problem and requires adjusted p-values. Theory 3: jelly beans (of whatever color) cause acne In that case $H_1$: ''jelly beans of color $c_1$ cause acne AND ''jelly beans of color $c_2$ cause acne AND .... AND ''jelly beans of color $c_{20}$ cause acne'' and $H_0$ is the opposite. This is again a multiple testing problem. Theory ... Conclusion Anyhow, it can be seen that these theories are fundamentally different and whether or not p-value adjustment is required depends on that, not on ''philosophy'', at least that is my understanding. P.S. for the reaction to the example of @FrankHarrell see ''EDIT'' at the bottom of my answer to What's wrong with Bonferroni adjustments?
What's wrong with ''multiple testing correction'' compared to ''joint tests''? @amoeba: on the example with the jelly beans I would like to argue as follows (note, I just want to understand): Let's say that there are 20 different colors of jelly beans, let's call these $c_1, c_
41,539
What's wrong with ''multiple testing correction'' compared to ''joint tests''?
I'll leave my old answer at the end to provide context for your comment. It seems to me that your rectangular-versus-ellipsoid thought experiment gives an interesting hint of a problem with multiple comparisons: your multiple test example is in some sense projecting information down in dimensionality, then back up, losing information in the process. That is, the joint probability is ellipsoid precisely because you have two Gaussian distributions, which will jointly yield an ellipsoid, whose circularity is determined by the relative variance of the two distributions, and whose major axis' slope is determined by the correlation of the two sets of data. Since you specify the two datasets are independent, the major axis is parallel to the x or y axis. On the other hand, your two-test example projects Gaussian distributions down to a 1-D range and when you then combine the two tests into a single, 2-D graph (projecting back up), you have lost information and the resulting 95% area is a rectangular rather than the appropriate ellipsoid. And things get worse if the two datasets are correlated. So it seems to me that this might be an indication that multiple testing is losing information due to what we might describe as projecting information down -- losing information in the process -- then back up. So the shape of the resulting pseudo-joint density is incorrect and attempting to scale its axes via something like a Boneferroni can't fix that. So in answer to your question, I'd say yes, we prefer an ellipse in our joint distribution rather than the incorrect (due to loss of information) rectangle of our pseudo-joint distribution. Or perhaps the issue is that you've created a pseudo-joint density in the first place. BUT your question is more philosophical than that, and I have to support Amoeba's answer that it's not simply a matter of the math. For example, what if you pre-registered your jellybean experiment with a precise "green jelly beans" as part of your hypothesis, rather than an imprecise "greenish". You perform the experiment and find no statistically significant effect. Then your lab assistant shows you a photo they took of themselves in front of all of the jellybean doses -- what a Herculean task they performed! And something you say leads the assistant to realize that you are partially colorblind. It turns out that what you called "green" we're actually green and aqua jellybeans! With the help of the photo, the assistant properly codes the results and it turns out green jellybeans are significant! Your career is saved! Except you've just done a multiple comparison: you took two swipes at the data, and if you had found significance in the first place, no one would have ever known any different. This isn't a matter of you p-value-hacking. It was an honest correction, but your motivation doesn't matter here. And if we're being totally honest, "green" is no more specific than "greenish". First, in terms of the actual color, and then in terms of the fact that green is most likely a proxy for other ingredients. And what if you had never discovered your error, but for some reason your assistant replicated the experiment and the second results were significant? Basically the same case, though you did collect two sets of data. At this point, I'm starting to wander, so let me summarize by again saying I believe Amoeba has it right and your "it is or isn't because of mathematics" idea is technically correct, but not tractable in the real world. OLD answer: Is this question actually about correlation? I'm thinking more of a Mahalanobis Distance kind of issue, where independently looking at the 95% x1 and the 95% x2 yields a rectangle, but this assumes that x1 and x2 are not correlated. While using the Mahalanobis Distance (an ellipse that is shaped based on the correlation between x1 and x2) is superior. The ellipse extends outside of the rectangle, so it accepts some points that are outside of the rectangle, but it also rejects points inside the rectangle. Assuming x1 and x2 are correlated to some degree. Otherwise, if you assume x1 and x2 have 0 correlation, what distribution are you assuming for each? If uniform, you'd get a rectangular region, if normal you'll get an elliptical region. Again, this would be independent of multiple testing corrections or not.
What's wrong with ''multiple testing correction'' compared to ''joint tests''?
I'll leave my old answer at the end to provide context for your comment. It seems to me that your rectangular-versus-ellipsoid thought experiment gives an interesting hint of a problem with multiple c
What's wrong with ''multiple testing correction'' compared to ''joint tests''? I'll leave my old answer at the end to provide context for your comment. It seems to me that your rectangular-versus-ellipsoid thought experiment gives an interesting hint of a problem with multiple comparisons: your multiple test example is in some sense projecting information down in dimensionality, then back up, losing information in the process. That is, the joint probability is ellipsoid precisely because you have two Gaussian distributions, which will jointly yield an ellipsoid, whose circularity is determined by the relative variance of the two distributions, and whose major axis' slope is determined by the correlation of the two sets of data. Since you specify the two datasets are independent, the major axis is parallel to the x or y axis. On the other hand, your two-test example projects Gaussian distributions down to a 1-D range and when you then combine the two tests into a single, 2-D graph (projecting back up), you have lost information and the resulting 95% area is a rectangular rather than the appropriate ellipsoid. And things get worse if the two datasets are correlated. So it seems to me that this might be an indication that multiple testing is losing information due to what we might describe as projecting information down -- losing information in the process -- then back up. So the shape of the resulting pseudo-joint density is incorrect and attempting to scale its axes via something like a Boneferroni can't fix that. So in answer to your question, I'd say yes, we prefer an ellipse in our joint distribution rather than the incorrect (due to loss of information) rectangle of our pseudo-joint distribution. Or perhaps the issue is that you've created a pseudo-joint density in the first place. BUT your question is more philosophical than that, and I have to support Amoeba's answer that it's not simply a matter of the math. For example, what if you pre-registered your jellybean experiment with a precise "green jelly beans" as part of your hypothesis, rather than an imprecise "greenish". You perform the experiment and find no statistically significant effect. Then your lab assistant shows you a photo they took of themselves in front of all of the jellybean doses -- what a Herculean task they performed! And something you say leads the assistant to realize that you are partially colorblind. It turns out that what you called "green" we're actually green and aqua jellybeans! With the help of the photo, the assistant properly codes the results and it turns out green jellybeans are significant! Your career is saved! Except you've just done a multiple comparison: you took two swipes at the data, and if you had found significance in the first place, no one would have ever known any different. This isn't a matter of you p-value-hacking. It was an honest correction, but your motivation doesn't matter here. And if we're being totally honest, "green" is no more specific than "greenish". First, in terms of the actual color, and then in terms of the fact that green is most likely a proxy for other ingredients. And what if you had never discovered your error, but for some reason your assistant replicated the experiment and the second results were significant? Basically the same case, though you did collect two sets of data. At this point, I'm starting to wander, so let me summarize by again saying I believe Amoeba has it right and your "it is or isn't because of mathematics" idea is technically correct, but not tractable in the real world. OLD answer: Is this question actually about correlation? I'm thinking more of a Mahalanobis Distance kind of issue, where independently looking at the 95% x1 and the 95% x2 yields a rectangle, but this assumes that x1 and x2 are not correlated. While using the Mahalanobis Distance (an ellipse that is shaped based on the correlation between x1 and x2) is superior. The ellipse extends outside of the rectangle, so it accepts some points that are outside of the rectangle, but it also rejects points inside the rectangle. Assuming x1 and x2 are correlated to some degree. Otherwise, if you assume x1 and x2 have 0 correlation, what distribution are you assuming for each? If uniform, you'd get a rectangular region, if normal you'll get an elliptical region. Again, this would be independent of multiple testing corrections or not.
What's wrong with ''multiple testing correction'' compared to ''joint tests''? I'll leave my old answer at the end to provide context for your comment. It seems to me that your rectangular-versus-ellipsoid thought experiment gives an interesting hint of a problem with multiple c
41,540
How do you interpret the area under the precision-recall curve?
Yes, it is average precision, where the average is taken across different thresholds for saying "yes". The precision-recall curve typically starts out relatively high, and descends though not monotonically. On the right edge, to guarantee perfect recall you just say "yes" to everything, so precision will be down at the base rate. On the left, you require absolute certainty to say "yes", so you miss a lot, but hopefully everything you identify is a target. Because of noise there will be fluctuations in the line. If the base rate is low, it's possible that a model has a high area under the ROC curve but still a low area under the PR curve. For example, Andy Berger notes this is the case for conflict studies, and provides some example graphs.
How do you interpret the area under the precision-recall curve?
Yes, it is average precision, where the average is taken across different thresholds for saying "yes". The precision-recall curve typically starts out relatively high, and descends though not monoto
How do you interpret the area under the precision-recall curve? Yes, it is average precision, where the average is taken across different thresholds for saying "yes". The precision-recall curve typically starts out relatively high, and descends though not monotonically. On the right edge, to guarantee perfect recall you just say "yes" to everything, so precision will be down at the base rate. On the left, you require absolute certainty to say "yes", so you miss a lot, but hopefully everything you identify is a target. Because of noise there will be fluctuations in the line. If the base rate is low, it's possible that a model has a high area under the ROC curve but still a low area under the PR curve. For example, Andy Berger notes this is the case for conflict studies, and provides some example graphs.
How do you interpret the area under the precision-recall curve? Yes, it is average precision, where the average is taken across different thresholds for saying "yes". The precision-recall curve typically starts out relatively high, and descends though not monoto
41,541
Class imbalance in clustering
In general: yes, this could very well be problematic. Imagine you have a number of clusters of unknown, but different classes. Clustering is usually done using a distance measure between samples. Many approaches thereby implicitly assume that the clusters share certain properties, at least within certain boundaries - like distances between clusters only diverging within a certain maximum, or more likely the scale of cluster spread only diverging within a certain maximum. This can be problematic in case you e.g. have one prominent, largely and unequally scattered class, that to some extent shadows other, less prominent, and as well unequally scattered classes - which further have very different distances between clusters. This could lead to your not-so-prominent clusters to not be found at all, as they e.g. get just pushed away from the prominent cluster (e.g. K-means), or could end up at just some slightly-above-average area of the prominent class (e.g. SOM, to some extent). But if this is the case with your problem, clustering will pretty likely be quite difficult with any clustering approach. Two thoughts about possible approaches: If you don't have any idea about the class prevalence, changing the data/data weight (e.g. subsampling using the density observed in your data) might defeat the purpose of clustering (imagine the extreme scenario of flattening out the whole feature space, which means discarding the information you would need for building clusters). But it could be that there are scenarios where this makes sense. If you have a rough idea of class prevalence, as @hxd1011 mentioned, using some weight for your clusters/distributions could be helpful. I guess that adapting the prevalence, using sampling techniques, the estimated prevalence, and the density observed in your data might be possible too (but keep in mind that when you use a mixed, observed density of different classes, your assumptions and simplifications might not be completely true, as mentioned in the first part of the answer).
Class imbalance in clustering
In general: yes, this could very well be problematic. Imagine you have a number of clusters of unknown, but different classes. Clustering is usually done using a distance measure between samples. Many
Class imbalance in clustering In general: yes, this could very well be problematic. Imagine you have a number of clusters of unknown, but different classes. Clustering is usually done using a distance measure between samples. Many approaches thereby implicitly assume that the clusters share certain properties, at least within certain boundaries - like distances between clusters only diverging within a certain maximum, or more likely the scale of cluster spread only diverging within a certain maximum. This can be problematic in case you e.g. have one prominent, largely and unequally scattered class, that to some extent shadows other, less prominent, and as well unequally scattered classes - which further have very different distances between clusters. This could lead to your not-so-prominent clusters to not be found at all, as they e.g. get just pushed away from the prominent cluster (e.g. K-means), or could end up at just some slightly-above-average area of the prominent class (e.g. SOM, to some extent). But if this is the case with your problem, clustering will pretty likely be quite difficult with any clustering approach. Two thoughts about possible approaches: If you don't have any idea about the class prevalence, changing the data/data weight (e.g. subsampling using the density observed in your data) might defeat the purpose of clustering (imagine the extreme scenario of flattening out the whole feature space, which means discarding the information you would need for building clusters). But it could be that there are scenarios where this makes sense. If you have a rough idea of class prevalence, as @hxd1011 mentioned, using some weight for your clusters/distributions could be helpful. I guess that adapting the prevalence, using sampling techniques, the estimated prevalence, and the density observed in your data might be possible too (but keep in mind that when you use a mixed, observed density of different classes, your assumptions and simplifications might not be completely true, as mentioned in the first part of the answer).
Class imbalance in clustering In general: yes, this could very well be problematic. Imagine you have a number of clusters of unknown, but different classes. Clustering is usually done using a distance measure between samples. Many
41,542
Class imbalance in clustering
https://www.researchgate.net/post/Can_anyone_recommend_algorithms_to_deal_with_unbalanced_clusters_for_classification I think "try agglomerative ones (single link, complete link, Ward, etc.)" may be a good answer
Class imbalance in clustering
https://www.researchgate.net/post/Can_anyone_recommend_algorithms_to_deal_with_unbalanced_clusters_for_classification I think "try agglomerative ones (single link, complete link, Ward, etc.)" may be a
Class imbalance in clustering https://www.researchgate.net/post/Can_anyone_recommend_algorithms_to_deal_with_unbalanced_clusters_for_classification I think "try agglomerative ones (single link, complete link, Ward, etc.)" may be a good answer
Class imbalance in clustering https://www.researchgate.net/post/Can_anyone_recommend_algorithms_to_deal_with_unbalanced_clusters_for_classification I think "try agglomerative ones (single link, complete link, Ward, etc.)" may be a
41,543
Is correlation between parameters a problem when fitting a Bayesian model using MCMC?
TLDR: There will almost always be correlation in the parameters in the Bayesian world; even if you use independent priors. Correlation might affect mixing rates, but that is going to be on a case by case basis. In general, you want to ask, "how can I account for the correlations"? Multivariate estimators of the asymptotic covariance of your estimators let you do that. There are two "correlations" between parameters that are present in this scenario (and in general in most MCMC scenarios) Correlation between parameters in the posterior. So the true covariance in the posterior is not a diagonal matrix. Lag correlation across parameters as a consequence of MCMC sampling. So $Cov\left(\beta_1^{(1)}, \beta_2^{(1+k)}\right)$, etc. (Look at a cross-correlation plot to see how significant these lag correlations are). Just like in frequentist settings, correlation does not necessarily impact the point estimates for the posterior means, but it affects the quality of the point estimate. So if $\mu = (\beta_0, \dots, \beta_p, \sigma)$ is the $p+2$ dimensional vector of interest, and you obtain $N$ MCMC samples ($\mu_i$), the point estimate is $$\mu_n = \dfrac{1}{N}\sum_{i=1}^{N} \mu_i. $$ The two correlations mentioned above affect the quality of this estimator, since due to the Markov chain CLT, $$\sqrt{n}(\mu_n - \mu) \overset{d}{\to} N_{p+2}(0, \Sigma)\,, $$ where $\Sigma$ is a $(p+2) \times (p+2)$ covariance matrix. Interestingly, $\Sigma$ breaks up nicely and explains exactly the two correlations mentioned above $$\Sigma = \underbrace{Var(\mu_1)}_{\text{Posterior covariance structure}} + \underbrace{2 \sum_{k=1}^{\infty} Cov(\mu_1,\mu_{1+k})}_{\text{Covariance due to correlated samples}}. $$ Just like in the usual MLE setup, if you can account for $\Sigma$, you account for all the correlation in estimation process. Recently consistent estimators for $\Sigma$ have been proposed, and you can now actually use these to say, "well this is the amount of error in the estimator, so do I have enough samples?". The R package mcmcse lets you estimate $\Sigma$. You can also use functions called multiESS and minESS in it to find out how many effective samples you need, and what your effective sample size is. These calculations are done using estimates of $\Sigma$, and thus account for the correlation. This paper explains in detail.
Is correlation between parameters a problem when fitting a Bayesian model using MCMC?
TLDR: There will almost always be correlation in the parameters in the Bayesian world; even if you use independent priors. Correlation might affect mixing rates, but that is going to be on a case by c
Is correlation between parameters a problem when fitting a Bayesian model using MCMC? TLDR: There will almost always be correlation in the parameters in the Bayesian world; even if you use independent priors. Correlation might affect mixing rates, but that is going to be on a case by case basis. In general, you want to ask, "how can I account for the correlations"? Multivariate estimators of the asymptotic covariance of your estimators let you do that. There are two "correlations" between parameters that are present in this scenario (and in general in most MCMC scenarios) Correlation between parameters in the posterior. So the true covariance in the posterior is not a diagonal matrix. Lag correlation across parameters as a consequence of MCMC sampling. So $Cov\left(\beta_1^{(1)}, \beta_2^{(1+k)}\right)$, etc. (Look at a cross-correlation plot to see how significant these lag correlations are). Just like in frequentist settings, correlation does not necessarily impact the point estimates for the posterior means, but it affects the quality of the point estimate. So if $\mu = (\beta_0, \dots, \beta_p, \sigma)$ is the $p+2$ dimensional vector of interest, and you obtain $N$ MCMC samples ($\mu_i$), the point estimate is $$\mu_n = \dfrac{1}{N}\sum_{i=1}^{N} \mu_i. $$ The two correlations mentioned above affect the quality of this estimator, since due to the Markov chain CLT, $$\sqrt{n}(\mu_n - \mu) \overset{d}{\to} N_{p+2}(0, \Sigma)\,, $$ where $\Sigma$ is a $(p+2) \times (p+2)$ covariance matrix. Interestingly, $\Sigma$ breaks up nicely and explains exactly the two correlations mentioned above $$\Sigma = \underbrace{Var(\mu_1)}_{\text{Posterior covariance structure}} + \underbrace{2 \sum_{k=1}^{\infty} Cov(\mu_1,\mu_{1+k})}_{\text{Covariance due to correlated samples}}. $$ Just like in the usual MLE setup, if you can account for $\Sigma$, you account for all the correlation in estimation process. Recently consistent estimators for $\Sigma$ have been proposed, and you can now actually use these to say, "well this is the amount of error in the estimator, so do I have enough samples?". The R package mcmcse lets you estimate $\Sigma$. You can also use functions called multiESS and minESS in it to find out how many effective samples you need, and what your effective sample size is. These calculations are done using estimates of $\Sigma$, and thus account for the correlation. This paper explains in detail.
Is correlation between parameters a problem when fitting a Bayesian model using MCMC? TLDR: There will almost always be correlation in the parameters in the Bayesian world; even if you use independent priors. Correlation might affect mixing rates, but that is going to be on a case by c
41,544
Why is prewhitening important?
The reason that you pre-whiten X is to identify a filter that can transform Y and X into y and x where x is white noise i.e. serially independent or free of autocorrelation in order to IDENTIFY an appropriate model. Note that one filter (ARMA developed on X ) is used on both the Y and X. Now with y and x you can form/identify a potential relationship which is then applied to the Y and X to construct/identify a polynomial distributed lag model (PDL/ADL/DGF . Fundamentally you are adjusting the Y and X ( transforming/filtering) so that the resultant cross-correlation between y and x (proxies) can be correctly/efficiently be interpreted and used on the observed series Y and X. The single filter doesn't distort the causative structure. Note that differencing operators required for X and Y are not necessarily the same and are not necessarily part of the final model relating Y and X. To further numerically illustrate this consider the GASX problem from the Box-Jenkins text where PINK reflects the predictor series . A simple filter (2,1,0) was used to prewhiten creating "adjusted cross-correlations or prewhitened cross-correlations" suggesting/identifying a three period delay culminating in this useful equation . Note clearly that Y is not CONDITIONALLY a function of X contemporarily (or lag 1 or lag 2) given the model form. In simpler terms X significantly affects Y after two periods and not before. In contrast consider the simple (naive) cross-correlation between Y and X falsely suggesting structure (induced by the auto-correlation within the series ) . It is interesting to me that most significant of these cross-correlations are at lags 3,4 and 5 illustrating that however flawed/contaminated they can still be directionally important.
Why is prewhitening important?
The reason that you pre-whiten X is to identify a filter that can transform Y and X into y and x where x is white noise i.e. serially independent or free of autocorrelation in order to IDENTIFY an app
Why is prewhitening important? The reason that you pre-whiten X is to identify a filter that can transform Y and X into y and x where x is white noise i.e. serially independent or free of autocorrelation in order to IDENTIFY an appropriate model. Note that one filter (ARMA developed on X ) is used on both the Y and X. Now with y and x you can form/identify a potential relationship which is then applied to the Y and X to construct/identify a polynomial distributed lag model (PDL/ADL/DGF . Fundamentally you are adjusting the Y and X ( transforming/filtering) so that the resultant cross-correlation between y and x (proxies) can be correctly/efficiently be interpreted and used on the observed series Y and X. The single filter doesn't distort the causative structure. Note that differencing operators required for X and Y are not necessarily the same and are not necessarily part of the final model relating Y and X. To further numerically illustrate this consider the GASX problem from the Box-Jenkins text where PINK reflects the predictor series . A simple filter (2,1,0) was used to prewhiten creating "adjusted cross-correlations or prewhitened cross-correlations" suggesting/identifying a three period delay culminating in this useful equation . Note clearly that Y is not CONDITIONALLY a function of X contemporarily (or lag 1 or lag 2) given the model form. In simpler terms X significantly affects Y after two periods and not before. In contrast consider the simple (naive) cross-correlation between Y and X falsely suggesting structure (induced by the auto-correlation within the series ) . It is interesting to me that most significant of these cross-correlations are at lags 3,4 and 5 illustrating that however flawed/contaminated they can still be directionally important.
Why is prewhitening important? The reason that you pre-whiten X is to identify a filter that can transform Y and X into y and x where x is white noise i.e. serially independent or free of autocorrelation in order to IDENTIFY an app
41,545
Why is prewhitening important?
geophysical time series are auto-correlated, which means the measurement value at 12:00 would be similar to 13:00, but more different to 19:00, like air temperature, this is just an example. Pre-whitening is used to detrend, and make the measurement "White", namely independent between each measurement.
Why is prewhitening important?
geophysical time series are auto-correlated, which means the measurement value at 12:00 would be similar to 13:00, but more different to 19:00, like air temperature, this is just an example. Pre-white
Why is prewhitening important? geophysical time series are auto-correlated, which means the measurement value at 12:00 would be similar to 13:00, but more different to 19:00, like air temperature, this is just an example. Pre-whitening is used to detrend, and make the measurement "White", namely independent between each measurement.
Why is prewhitening important? geophysical time series are auto-correlated, which means the measurement value at 12:00 would be similar to 13:00, but more different to 19:00, like air temperature, this is just an example. Pre-white
41,546
Why is prewhitening important?
The need for prewhiten your time series will depend on the model that you will use to analyze your data. For example, if you want to perform Pearson correlation analysis between two-time series, the pre-whitening will be needed because the autocorrelation in the time points (if it is the case) will violate the assumptions behind Pearson Correlation. For example, suppose that you get a correlation of value C12 between time-series 1 and 2. Is C12 significant? You can infer the probability of getting the result C12 by chance given the number of points in each time series. However, if there is autocorrelation in any of the time series 1 and 2, you lose the real meaning of the calculated probability. Another example, suppose that you want to apply some general linear analysis in a given times series (y) with a design matrix (x) such that y=x*beta + error. If y presents autocorrelation, it will introduce serially correlated errors, violating the Gauss Markov theorem.
Why is prewhitening important?
The need for prewhiten your time series will depend on the model that you will use to analyze your data. For example, if you want to perform Pearson correlation analysis between two-time series, the p
Why is prewhitening important? The need for prewhiten your time series will depend on the model that you will use to analyze your data. For example, if you want to perform Pearson correlation analysis between two-time series, the pre-whitening will be needed because the autocorrelation in the time points (if it is the case) will violate the assumptions behind Pearson Correlation. For example, suppose that you get a correlation of value C12 between time-series 1 and 2. Is C12 significant? You can infer the probability of getting the result C12 by chance given the number of points in each time series. However, if there is autocorrelation in any of the time series 1 and 2, you lose the real meaning of the calculated probability. Another example, suppose that you want to apply some general linear analysis in a given times series (y) with a design matrix (x) such that y=x*beta + error. If y presents autocorrelation, it will introduce serially correlated errors, violating the Gauss Markov theorem.
Why is prewhitening important? The need for prewhiten your time series will depend on the model that you will use to analyze your data. For example, if you want to perform Pearson correlation analysis between two-time series, the p
41,547
Pearson's correlation for non-linear data
Pearson's correlation coefficient is a measure of strength of linear relationship between the variable. So, it may provide false results for non-linear relationship. Read a more detailed answer on Correlation and dependence
Pearson's correlation for non-linear data
Pearson's correlation coefficient is a measure of strength of linear relationship between the variable. So, it may provide false results for non-linear relationship. Read a more detailed answer on Cor
Pearson's correlation for non-linear data Pearson's correlation coefficient is a measure of strength of linear relationship between the variable. So, it may provide false results for non-linear relationship. Read a more detailed answer on Correlation and dependence
Pearson's correlation for non-linear data Pearson's correlation coefficient is a measure of strength of linear relationship between the variable. So, it may provide false results for non-linear relationship. Read a more detailed answer on Cor
41,548
Pearson's correlation for non-linear data
Adding on Dr Nisha Arora's answer, the following provides a method to compute meaningful Pearson linear correlation coefficient (PLCC) in such cases. Suppose, you have $$y=f(x)=x^2$$ Take log on both sides $$log(y) = 2 \ log(x)$$ Now have a linear relationship. Find Pearson's Correlation Coefficient now. Read this answer for more details.
Pearson's correlation for non-linear data
Adding on Dr Nisha Arora's answer, the following provides a method to compute meaningful Pearson linear correlation coefficient (PLCC) in such cases. Suppose, you have $$y=f(x)=x^2$$ Take log on both
Pearson's correlation for non-linear data Adding on Dr Nisha Arora's answer, the following provides a method to compute meaningful Pearson linear correlation coefficient (PLCC) in such cases. Suppose, you have $$y=f(x)=x^2$$ Take log on both sides $$log(y) = 2 \ log(x)$$ Now have a linear relationship. Find Pearson's Correlation Coefficient now. Read this answer for more details.
Pearson's correlation for non-linear data Adding on Dr Nisha Arora's answer, the following provides a method to compute meaningful Pearson linear correlation coefficient (PLCC) in such cases. Suppose, you have $$y=f(x)=x^2$$ Take log on both
41,549
How does batch normalization compute the population statistics after training?
Typically, the population statistics are taken from the training set. If you include the test set, at test time, you will have information that technically, you shouldn't have access to (information about the whole dataset). For the same reason, the validation set shouldn't be used to compute those statistics. Keep in mind that due to the fact that batch-normalization isn't only at the input layer, the population's statistics will vary from epoch to epoch, as the network learns and changes its parameters (and therefore, its outputs at each layer). Therefore the common way to compute these statistics is to keep a (exponentially decaying or moving) averages during training. This will smoothen out the stochastic variations due to mini-batch training, and stay up to date to the current status of learning. You can see an example of this in the torch code for batch norm : https://github.com/torch/nn/blob/master/lib/THNN/generic/BatchNormalization.c#L22 The paper mentions that they use moving averages instead of just keeping the last computed statistics : Using moving averages instead, we can track the accuracy of a model as it trains. For your second question, they are saying that they use that unbiased estimate to estimate the population variance (for future inference).
How does batch normalization compute the population statistics after training?
Typically, the population statistics are taken from the training set. If you include the test set, at test time, you will have information that technically, you shouldn't have access to (information a
How does batch normalization compute the population statistics after training? Typically, the population statistics are taken from the training set. If you include the test set, at test time, you will have information that technically, you shouldn't have access to (information about the whole dataset). For the same reason, the validation set shouldn't be used to compute those statistics. Keep in mind that due to the fact that batch-normalization isn't only at the input layer, the population's statistics will vary from epoch to epoch, as the network learns and changes its parameters (and therefore, its outputs at each layer). Therefore the common way to compute these statistics is to keep a (exponentially decaying or moving) averages during training. This will smoothen out the stochastic variations due to mini-batch training, and stay up to date to the current status of learning. You can see an example of this in the torch code for batch norm : https://github.com/torch/nn/blob/master/lib/THNN/generic/BatchNormalization.c#L22 The paper mentions that they use moving averages instead of just keeping the last computed statistics : Using moving averages instead, we can track the accuracy of a model as it trains. For your second question, they are saying that they use that unbiased estimate to estimate the population variance (for future inference).
How does batch normalization compute the population statistics after training? Typically, the population statistics are taken from the training set. If you include the test set, at test time, you will have information that technically, you shouldn't have access to (information a
41,550
How does batch normalization compute the population statistics after training?
In inference even if your batch size is not one the batch norm is also based on the whole training set(making the inference stable).
How does batch normalization compute the population statistics after training?
In inference even if your batch size is not one the batch norm is also based on the whole training set(making the inference stable).
How does batch normalization compute the population statistics after training? In inference even if your batch size is not one the batch norm is also based on the whole training set(making the inference stable).
How does batch normalization compute the population statistics after training? In inference even if your batch size is not one the batch norm is also based on the whole training set(making the inference stable).
41,551
Is the margin of error for a survey a "fake" statistic?
The level of statistical rigor your company chooses to abide by is a business question that should be answered by the people paid to answer these questions. If this person is you, think hard about where you are on that spectrum. If this person is not you, find out where your company is on this spectrum and decide whether you're going to follow the company line, fight to change it, or find a new job. What I have done in my career is go with “educate them about the statistics of real life sample surveys” as I had the philosophy that being correct will win business. I would explain this by saying something like, "As you know, a margin of error of +/- 5 has to do with the precision* in the survey estimate; which is highly related to the sample size in the survey. Assuming X, we would need a sample size of N. The options are either to pay for this sample size or accept a larger margin of error". *Do not say "uncertainty", to a client this can mean you're not certain you did your job correctly. Do not say "error", to a client this can mean you made a mistake.
Is the margin of error for a survey a "fake" statistic?
The level of statistical rigor your company chooses to abide by is a business question that should be answered by the people paid to answer these questions. If this person is you, think hard about whe
Is the margin of error for a survey a "fake" statistic? The level of statistical rigor your company chooses to abide by is a business question that should be answered by the people paid to answer these questions. If this person is you, think hard about where you are on that spectrum. If this person is not you, find out where your company is on this spectrum and decide whether you're going to follow the company line, fight to change it, or find a new job. What I have done in my career is go with “educate them about the statistics of real life sample surveys” as I had the philosophy that being correct will win business. I would explain this by saying something like, "As you know, a margin of error of +/- 5 has to do with the precision* in the survey estimate; which is highly related to the sample size in the survey. Assuming X, we would need a sample size of N. The options are either to pay for this sample size or accept a larger margin of error". *Do not say "uncertainty", to a client this can mean you're not certain you did your job correctly. Do not say "error", to a client this can mean you made a mistake.
Is the margin of error for a survey a "fake" statistic? The level of statistical rigor your company chooses to abide by is a business question that should be answered by the people paid to answer these questions. If this person is you, think hard about whe
41,552
Entropy of the multinomial distribution
Ok so I guess I should have done a bit of experimentation before posting this question. I just assumed that since the Wikipedia article for the multinomial distribution didn't mention entropy, and since I couldn't find anything about it on google, that it was very difficult to compute. Let $${\bf X}\sim \text{Multinomial}(n,{\bf p})$$ The entropy for $\bf X$ is given by: $$\text{H}({\bf X})=-\hspace{-4mm}\sum_{\substack{ {\bf x}\geq0\\\\\\ \sum_ix_i=n}}\frac{n!}{x_1!\cdots x_k!}p_1^{x_1}\cdots p_k^{x_k}\log\Big[\frac{n!}{x_1!\cdots x_k!}p_1^{x_1}\cdots p_k^{x_k}\Big].$$ Using the logarithm to break this up we obtain: \begin{align} \text{H}({\bf X}) &= -\log n! - \sum_{i=1}^k\log p_i\text{E}[X_i]+\sum_{i=1}^k\text{E}[\log X_i!]\notag\\ &=-\log n! - n\sum_{i=1}^kp_i\log p_i+\sum_{i=1}^k\text{E}[\log X_i!]\notag\\ &=-\log n! - n\sum_{i=1}^kp_i\log p_i+\sum_{i=1}^k\sum_{x_i=0}^n\binom{n}{x_i}p_i^{x_i}(1-p_i)^{n-x_i}\log x_i!.\notag \end{align} Thus we see that instead of summing over all distinct permutations of the partitions of $n$, which scales exponentially with both the size of $n$ and $k$, the derived form scales as $O((n+1)k)$, which is linear in both $n$ and $k$.
Entropy of the multinomial distribution
Ok so I guess I should have done a bit of experimentation before posting this question. I just assumed that since the Wikipedia article for the multinomial distribution didn't mention entropy, and si
Entropy of the multinomial distribution Ok so I guess I should have done a bit of experimentation before posting this question. I just assumed that since the Wikipedia article for the multinomial distribution didn't mention entropy, and since I couldn't find anything about it on google, that it was very difficult to compute. Let $${\bf X}\sim \text{Multinomial}(n,{\bf p})$$ The entropy for $\bf X$ is given by: $$\text{H}({\bf X})=-\hspace{-4mm}\sum_{\substack{ {\bf x}\geq0\\\\\\ \sum_ix_i=n}}\frac{n!}{x_1!\cdots x_k!}p_1^{x_1}\cdots p_k^{x_k}\log\Big[\frac{n!}{x_1!\cdots x_k!}p_1^{x_1}\cdots p_k^{x_k}\Big].$$ Using the logarithm to break this up we obtain: \begin{align} \text{H}({\bf X}) &= -\log n! - \sum_{i=1}^k\log p_i\text{E}[X_i]+\sum_{i=1}^k\text{E}[\log X_i!]\notag\\ &=-\log n! - n\sum_{i=1}^kp_i\log p_i+\sum_{i=1}^k\text{E}[\log X_i!]\notag\\ &=-\log n! - n\sum_{i=1}^kp_i\log p_i+\sum_{i=1}^k\sum_{x_i=0}^n\binom{n}{x_i}p_i^{x_i}(1-p_i)^{n-x_i}\log x_i!.\notag \end{align} Thus we see that instead of summing over all distinct permutations of the partitions of $n$, which scales exponentially with both the size of $n$ and $k$, the derived form scales as $O((n+1)k)$, which is linear in both $n$ and $k$.
Entropy of the multinomial distribution Ok so I guess I should have done a bit of experimentation before posting this question. I just assumed that since the Wikipedia article for the multinomial distribution didn't mention entropy, and si
41,553
Where do the default values in the Elo ratings formulas come from?
I found a slightly different equation for the calculation of the estimate: E = 1/(1+10^((ra-rb)/400)). And the number 400 contained in the formula was chosen by Arpad Elo so, that the Elo numbers are as compatible as possible with the numbers of the formerly used rating system by Kenneth Harkness. In fact one can see the Harkness-Model as a stepwise linear approximation towards the Elo-Model. If the rating difference between player A and B, i.e. |R_B - R_A| is more than 400 points, the number 400 (or -400) is used instead of the real difference.
Where do the default values in the Elo ratings formulas come from?
I found a slightly different equation for the calculation of the estimate: E = 1/(1+10^((ra-rb)/400)). And the number 400 contained in the formula was chosen by Arpad Elo so, that the Elo numbers are
Where do the default values in the Elo ratings formulas come from? I found a slightly different equation for the calculation of the estimate: E = 1/(1+10^((ra-rb)/400)). And the number 400 contained in the formula was chosen by Arpad Elo so, that the Elo numbers are as compatible as possible with the numbers of the formerly used rating system by Kenneth Harkness. In fact one can see the Harkness-Model as a stepwise linear approximation towards the Elo-Model. If the rating difference between player A and B, i.e. |R_B - R_A| is more than 400 points, the number 400 (or -400) is used instead of the real difference.
Where do the default values in the Elo ratings formulas come from? I found a slightly different equation for the calculation of the estimate: E = 1/(1+10^((ra-rb)/400)). And the number 400 contained in the formula was chosen by Arpad Elo so, that the Elo numbers are
41,554
Where do the default values in the Elo ratings formulas come from?
Regarding last question (Lastly, I've read the default average rating in the Elo system is 1500, is this connected to 400 as well?), the answer is: no. The starting rating is arbitrary (in Elo, as in Glicko, etc. E.g. in rankade, our ranking system, players starts at 2000), it doesn't matter what number you pick. Starting Elo at 1500 leads to serious difficulties to go under 1000 (so nearly all scores are in 4-digits format), a significant quality benchmark at 2000 and an unsurpassed limit at 3000 (Magnus Carlsen peaked at 2882), but none of these seems to be the main reason for choosing it. Even if it's out of your question, probably most debate is on $K$ constant value, indeed.
Where do the default values in the Elo ratings formulas come from?
Regarding last question (Lastly, I've read the default average rating in the Elo system is 1500, is this connected to 400 as well?), the answer is: no. The starting rating is arbitrary (in Elo, as in
Where do the default values in the Elo ratings formulas come from? Regarding last question (Lastly, I've read the default average rating in the Elo system is 1500, is this connected to 400 as well?), the answer is: no. The starting rating is arbitrary (in Elo, as in Glicko, etc. E.g. in rankade, our ranking system, players starts at 2000), it doesn't matter what number you pick. Starting Elo at 1500 leads to serious difficulties to go under 1000 (so nearly all scores are in 4-digits format), a significant quality benchmark at 2000 and an unsurpassed limit at 3000 (Magnus Carlsen peaked at 2882), but none of these seems to be the main reason for choosing it. Even if it's out of your question, probably most debate is on $K$ constant value, indeed.
Where do the default values in the Elo ratings formulas come from? Regarding last question (Lastly, I've read the default average rating in the Elo system is 1500, is this connected to 400 as well?), the answer is: no. The starting rating is arbitrary (in Elo, as in
41,555
Expectation of the maximum of two correlated normal variables
The solution is contained in the paper https://www.gwern.net/docs/conscientiousness/2008-nadarajah.pdf cited by @Lucas in his answer at Distribution of the maximum of two correlated normal variables I will give the answer here, maybe I come back to add a proof ... Let $(X_1,X_2)$ be a bivariate random vector with a binormal distribution, with means $\mu_1, \mu_2$, standard deviations $\sigma_1, \sigma_2$ and correlation coefficient $\rho$. Then $X=\max(X_1, X_2)$ has probability density function $f(x) = f_1(-x)+f_2(-x)$ where $$ f_1(x)= \frac1{\sigma_1}\phi(\frac{x+\mu_1}{\sigma_1})\cdot \Phi\left( \frac{\rho(x+\mu_1)}{\sigma_1\sqrt{1-\rho^2}}-\frac{x+\mu_2}{\sigma_2\sqrt{1-\rho^2}} \right) \\ f_2(x)= \frac1{\sigma_2}\phi(\frac{x+\mu_2}{\sigma_2})\cdot \Phi\left( \frac{\rho(x+\mu_2)}{\sigma_2\sqrt{1-\rho^2}}-\frac{x+\mu_1}{\sigma_1\sqrt{1-\rho^2}} \right) $$ where $\phi, \Phi$ are the density and cumulative distribution function of the standard normal. This paper also gives an exact expression for the expectation: $$ \DeclareMathOperator{\E}{\mathbb{E}} \E X = \mu_1 \Phi\left( \frac{\mu_1-\mu_2}{\theta} \right) + \mu_2 \Phi\left( \frac{\mu_2-\mu_1}{\theta} \right) + \theta \phi\left( \frac{\mu_1-\mu_2}{\theta} \right) $$ where $\theta = \sqrt{\sigma_1^2 +\sigma_2^2 - 2\rho\sigma_1\sigma_2}$. (the paper contains more, like the variance and moment generating functions).
Expectation of the maximum of two correlated normal variables
The solution is contained in the paper https://www.gwern.net/docs/conscientiousness/2008-nadarajah.pdf cited by @Lucas in his answer at Distribution of the maximum of two correlated normal variables
Expectation of the maximum of two correlated normal variables The solution is contained in the paper https://www.gwern.net/docs/conscientiousness/2008-nadarajah.pdf cited by @Lucas in his answer at Distribution of the maximum of two correlated normal variables I will give the answer here, maybe I come back to add a proof ... Let $(X_1,X_2)$ be a bivariate random vector with a binormal distribution, with means $\mu_1, \mu_2$, standard deviations $\sigma_1, \sigma_2$ and correlation coefficient $\rho$. Then $X=\max(X_1, X_2)$ has probability density function $f(x) = f_1(-x)+f_2(-x)$ where $$ f_1(x)= \frac1{\sigma_1}\phi(\frac{x+\mu_1}{\sigma_1})\cdot \Phi\left( \frac{\rho(x+\mu_1)}{\sigma_1\sqrt{1-\rho^2}}-\frac{x+\mu_2}{\sigma_2\sqrt{1-\rho^2}} \right) \\ f_2(x)= \frac1{\sigma_2}\phi(\frac{x+\mu_2}{\sigma_2})\cdot \Phi\left( \frac{\rho(x+\mu_2)}{\sigma_2\sqrt{1-\rho^2}}-\frac{x+\mu_1}{\sigma_1\sqrt{1-\rho^2}} \right) $$ where $\phi, \Phi$ are the density and cumulative distribution function of the standard normal. This paper also gives an exact expression for the expectation: $$ \DeclareMathOperator{\E}{\mathbb{E}} \E X = \mu_1 \Phi\left( \frac{\mu_1-\mu_2}{\theta} \right) + \mu_2 \Phi\left( \frac{\mu_2-\mu_1}{\theta} \right) + \theta \phi\left( \frac{\mu_1-\mu_2}{\theta} \right) $$ where $\theta = \sqrt{\sigma_1^2 +\sigma_2^2 - 2\rho\sigma_1\sigma_2}$. (the paper contains more, like the variance and moment generating functions).
Expectation of the maximum of two correlated normal variables The solution is contained in the paper https://www.gwern.net/docs/conscientiousness/2008-nadarajah.pdf cited by @Lucas in his answer at Distribution of the maximum of two correlated normal variables
41,556
Expectation of the maximum of two correlated normal variables
About the distribution |X-Y|, the Folded normal distribution may be helpful.
Expectation of the maximum of two correlated normal variables
About the distribution |X-Y|, the Folded normal distribution may be helpful.
Expectation of the maximum of two correlated normal variables About the distribution |X-Y|, the Folded normal distribution may be helpful.
Expectation of the maximum of two correlated normal variables About the distribution |X-Y|, the Folded normal distribution may be helpful.
41,557
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE
For the Gaussian model (with variance $\sigma_{\epsilon}^2 = \hat{\sigma}_{\epsilon}^2$ assumed known), the AIC statistic is equivalent to $C_p$, and so we refer to them collectively as AIC. Suppose a Gaussian model with variance $\sigma_{\epsilon}^2 = \hat{\sigma}_{\epsilon}^2 = \sigma^2$ Mallow's $C_p$ [ C_p = \frac{1}{n} (RSS + 2 d \sigma^2) ] AIC is \begin{equation*} \begin{aligned} \text{AIC} & = -2 \log L + 2 d \\ & = -2 (- \frac{n}{2} \log(2 \pi \sigma^2) - \frac{\sum_{i=1}^{n} (y_i - \hat{y}_i ) ^ 2 }{2\sigma^2} ) + 2 d \\ & = n \log(2 \pi \sigma^2) + \frac{\sum_{i=1}^{n} (y_i - \hat{y}_i ) ^ 2 }{\sigma^2} + 2 d \\ & = n \log(2 \pi \sigma^2) + \frac{RSS}{\sigma^2} + 2 d \\ & = n \log(2 \pi \sigma^2) + \frac{n}{\sigma^2} C_p \end{aligned} \end{equation*} Since they differ by a constant which is only a function of costants $\sigma^2, n$, it doesn't affect model selection by using AIC or $C_p$ in such a situation (equivalance).
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE
For the Gaussian model (with variance $\sigma_{\epsilon}^2 = \hat{\sigma}_{\epsilon}^2$ assumed known), the AIC statistic is equivalent to $C_p$, and so we refer to them collectively as AIC. Suppose a
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE For the Gaussian model (with variance $\sigma_{\epsilon}^2 = \hat{\sigma}_{\epsilon}^2$ assumed known), the AIC statistic is equivalent to $C_p$, and so we refer to them collectively as AIC. Suppose a Gaussian model with variance $\sigma_{\epsilon}^2 = \hat{\sigma}_{\epsilon}^2 = \sigma^2$ Mallow's $C_p$ [ C_p = \frac{1}{n} (RSS + 2 d \sigma^2) ] AIC is \begin{equation*} \begin{aligned} \text{AIC} & = -2 \log L + 2 d \\ & = -2 (- \frac{n}{2} \log(2 \pi \sigma^2) - \frac{\sum_{i=1}^{n} (y_i - \hat{y}_i ) ^ 2 }{2\sigma^2} ) + 2 d \\ & = n \log(2 \pi \sigma^2) + \frac{\sum_{i=1}^{n} (y_i - \hat{y}_i ) ^ 2 }{\sigma^2} + 2 d \\ & = n \log(2 \pi \sigma^2) + \frac{RSS}{\sigma^2} + 2 d \\ & = n \log(2 \pi \sigma^2) + \frac{n}{\sigma^2} C_p \end{aligned} \end{equation*} Since they differ by a constant which is only a function of costants $\sigma^2, n$, it doesn't affect model selection by using AIC or $C_p$ in such a situation (equivalance).
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE For the Gaussian model (with variance $\sigma_{\epsilon}^2 = \hat{\sigma}_{\epsilon}^2$ assumed known), the AIC statistic is equivalent to $C_p$, and so we refer to them collectively as AIC. Suppose a
41,558
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE
Regarding showing Mallows' Cp is unbiased, use $\text{tr}(\mathbf{A}) = \text{rank}(\mathbf{A})$ for idempotent matrices $\mathbf{A}$, and the following technique to get expectations of quadratic forms \begin{align*} E\left[\mathbf{y}^\intercal \mathbf{A} \mathbf{y}\right] &= E\left[\text{tr}(\mathbf{y}^\intercal \mathbf{A} \mathbf{y})\right] \\ &= E\left[\text{tr}( \mathbf{A} \mathbf{y}\mathbf{y}^\intercal)\right] \\ &= \text{tr}(E\left[ \mathbf{A} \mathbf{y}\mathbf{y}^\intercal\right] ) \\ &= \text{tr}( \mathbf{A} E\left[ \mathbf{y}\mathbf{y}^\intercal\right] ) \\ &= \text{tr}( \mathbf{A} V[\mathbf{y}] + \mathbf{A}(E\left[ \mathbf{y}\right])(E\left[ \mathbf{y}\right])^\intercal ) \end{align*} Regarding the showing that these two criteria are equivalent--they're not. If you plug in the ML estimators into the normal density, you should get $$ \log L = -\frac{n}{2}\log(2\pi) - \frac{n}{2}\log(\hat{\sigma}^2 ) - \frac{1}{2 \hat{\sigma}^2}\sum_{i=1}^n \left( y_i - \hat{y}_i \right)^2 = \underbrace{-\frac{n}{2}(\log(2\pi) +1)}_{\text{often ignored}}- \frac{n}{2}\log\left(\frac{RSS}{n} \right) . $$ Take note of 1.) $\hat{\sigma}^2 = SS_{Res}/n$, the MLE, being different from mean squared error, and 2.) there's a lot of cancellation in the sum term. Let $d_1$ and $d_2$ be the number of degrees of freedom in two models. Using the following definitions of AIC and Mallows' CP, respectively (there are several) $n \log\left(\frac{SS_{Res}}{n} \right) + 2p$, $ 1/n(RSS+2d\hat\sigma^2)$ equivalence, to me, would mean $$ n \log\left(\frac{RSS(M_1)}{n} \right) + 2d_1 \le n \log\left(\frac{RSS(M_2)}{n} \right) + 2d_2 $$ if and only if $$ 1/n(RSS(M_1)+2d_1 \hat\sigma^2) \le 1/n(RSS(M_2)+2d_2\hat\sigma^2). $$ You could rearrange the Mallows' inequality to $$ \left(RSS(M_1) - RSS(M_2)\right) \le 2c (d_2 - d_1) $$ and the AIC one too $$ \left(\log RSS(M_1) - \log RSS(M_2)\right) \le 2c'(d_2 - d_1). $$ They're close, but not the same.
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE
Regarding showing Mallows' Cp is unbiased, use $\text{tr}(\mathbf{A}) = \text{rank}(\mathbf{A})$ for idempotent matrices $\mathbf{A}$, and the following technique to get expectations of quadratic for
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE Regarding showing Mallows' Cp is unbiased, use $\text{tr}(\mathbf{A}) = \text{rank}(\mathbf{A})$ for idempotent matrices $\mathbf{A}$, and the following technique to get expectations of quadratic forms \begin{align*} E\left[\mathbf{y}^\intercal \mathbf{A} \mathbf{y}\right] &= E\left[\text{tr}(\mathbf{y}^\intercal \mathbf{A} \mathbf{y})\right] \\ &= E\left[\text{tr}( \mathbf{A} \mathbf{y}\mathbf{y}^\intercal)\right] \\ &= \text{tr}(E\left[ \mathbf{A} \mathbf{y}\mathbf{y}^\intercal\right] ) \\ &= \text{tr}( \mathbf{A} E\left[ \mathbf{y}\mathbf{y}^\intercal\right] ) \\ &= \text{tr}( \mathbf{A} V[\mathbf{y}] + \mathbf{A}(E\left[ \mathbf{y}\right])(E\left[ \mathbf{y}\right])^\intercal ) \end{align*} Regarding the showing that these two criteria are equivalent--they're not. If you plug in the ML estimators into the normal density, you should get $$ \log L = -\frac{n}{2}\log(2\pi) - \frac{n}{2}\log(\hat{\sigma}^2 ) - \frac{1}{2 \hat{\sigma}^2}\sum_{i=1}^n \left( y_i - \hat{y}_i \right)^2 = \underbrace{-\frac{n}{2}(\log(2\pi) +1)}_{\text{often ignored}}- \frac{n}{2}\log\left(\frac{RSS}{n} \right) . $$ Take note of 1.) $\hat{\sigma}^2 = SS_{Res}/n$, the MLE, being different from mean squared error, and 2.) there's a lot of cancellation in the sum term. Let $d_1$ and $d_2$ be the number of degrees of freedom in two models. Using the following definitions of AIC and Mallows' CP, respectively (there are several) $n \log\left(\frac{SS_{Res}}{n} \right) + 2p$, $ 1/n(RSS+2d\hat\sigma^2)$ equivalence, to me, would mean $$ n \log\left(\frac{RSS(M_1)}{n} \right) + 2d_1 \le n \log\left(\frac{RSS(M_2)}{n} \right) + 2d_2 $$ if and only if $$ 1/n(RSS(M_1)+2d_1 \hat\sigma^2) \le 1/n(RSS(M_2)+2d_2\hat\sigma^2). $$ You could rearrange the Mallows' inequality to $$ \left(RSS(M_1) - RSS(M_2)\right) \le 2c (d_2 - d_1) $$ and the AIC one too $$ \left(\log RSS(M_1) - \log RSS(M_2)\right) \le 2c'(d_2 - d_1). $$ They're close, but not the same.
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE Regarding showing Mallows' Cp is unbiased, use $\text{tr}(\mathbf{A}) = \text{rank}(\mathbf{A})$ for idempotent matrices $\mathbf{A}$, and the following technique to get expectations of quadratic for
41,559
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE
They are equivalent if you use the normalized Mallows' C*p which is $$RSS/\sigma^2+2d-n$$ since they differ by a constant which is only a function of $$\sigma^2,n$$ and so doesn't affect model selection (variance is estimated with the full population). unnormalized mallows is just an affine transorm of normalized mallows: $$C_p = 1 /n \sigma^2(C^*_ p + n)$$
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE
They are equivalent if you use the normalized Mallows' C*p which is $$RSS/\sigma^2+2d-n$$ since they differ by a constant which is only a function of $$\sigma^2,n$$ and so doesn't affect model selec
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE They are equivalent if you use the normalized Mallows' C*p which is $$RSS/\sigma^2+2d-n$$ since they differ by a constant which is only a function of $$\sigma^2,n$$ and so doesn't affect model selection (variance is estimated with the full population). unnormalized mallows is just an affine transorm of normalized mallows: $$C_p = 1 /n \sigma^2(C^*_ p + n)$$
AIC equivalent to Mallows' Cp and Mallows' Cp unbiased for test MSE They are equivalent if you use the normalized Mallows' C*p which is $$RSS/\sigma^2+2d-n$$ since they differ by a constant which is only a function of $$\sigma^2,n$$ and so doesn't affect model selec
41,560
Bayes Factor approximation
The answer to your first question is "yes": Using notation similar to Wikipedia, the Bayes factor is $$ K = \frac{P(D|M_1)}{P(D|M_2)} = \frac{\int P(D|\theta_1,M_1) P(\theta_1|M_1) \,d\theta_1} {\int P(D|\theta_2,M_2) P(\theta_2|M_2) \,d\theta_2}, $$ and the procedure you describe just replaces both numerator and denominator with Monte Carlo estimates: for the numerator we get $$ \int P(D|\theta_1,M_1) P(\theta_1|M_1) \,d\theta_1 = E_{M_1} \bigl( P(D|\theta, M_1) \bigr) \approx \frac{1}{N} \sum_{j=1}^N P(D|\theta_1^{(j)}, M_1), $$ where the subscript $M_1$ at the expectation indicates that $\theta$ in the expectation is distributed according to (the prior of) model 1 and, correspondingly, the $\theta_1^{(j)}$ on the right-hand side are independent and identically distributed samples from the prior of model 1. Using the same approximation for the denominator, we get $$ K \approx \frac{\frac{1}{N} \sum_{j=1}^N P(D|\theta_1^{(j)}, M_1)} {\frac{1}{N} \sum_{j=1}^N P(D|\theta_2^{(j)}, M_2)}. $$ The law of large numbers guarantees that this estimate converges to the correct value $K$ as the sample size $N$ increases. There are a few things to consider: If $P(D|M_2)$ is small, the estimate will likely perform badly: small fluctuations in the estimate for the denominator will turn into large fluctuations of the estimate for $K$. Variance reduction methods (like importance sampling) can be used to make the estimates for the denominator and numerator more efficient. The estimates for the denominator and numerator are unbiased, but the estimate for $K$ is not. I believe that more detail about the adaptive version is required before a definite answer to your second question can be given.
Bayes Factor approximation
The answer to your first question is "yes": Using notation similar to Wikipedia, the Bayes factor is $$ K = \frac{P(D|M_1)}{P(D|M_2)} = \frac{\int P(D|\theta_1,M_1) P(\theta_1|M_1) \,d\theta_1}
Bayes Factor approximation The answer to your first question is "yes": Using notation similar to Wikipedia, the Bayes factor is $$ K = \frac{P(D|M_1)}{P(D|M_2)} = \frac{\int P(D|\theta_1,M_1) P(\theta_1|M_1) \,d\theta_1} {\int P(D|\theta_2,M_2) P(\theta_2|M_2) \,d\theta_2}, $$ and the procedure you describe just replaces both numerator and denominator with Monte Carlo estimates: for the numerator we get $$ \int P(D|\theta_1,M_1) P(\theta_1|M_1) \,d\theta_1 = E_{M_1} \bigl( P(D|\theta, M_1) \bigr) \approx \frac{1}{N} \sum_{j=1}^N P(D|\theta_1^{(j)}, M_1), $$ where the subscript $M_1$ at the expectation indicates that $\theta$ in the expectation is distributed according to (the prior of) model 1 and, correspondingly, the $\theta_1^{(j)}$ on the right-hand side are independent and identically distributed samples from the prior of model 1. Using the same approximation for the denominator, we get $$ K \approx \frac{\frac{1}{N} \sum_{j=1}^N P(D|\theta_1^{(j)}, M_1)} {\frac{1}{N} \sum_{j=1}^N P(D|\theta_2^{(j)}, M_2)}. $$ The law of large numbers guarantees that this estimate converges to the correct value $K$ as the sample size $N$ increases. There are a few things to consider: If $P(D|M_2)$ is small, the estimate will likely perform badly: small fluctuations in the estimate for the denominator will turn into large fluctuations of the estimate for $K$. Variance reduction methods (like importance sampling) can be used to make the estimates for the denominator and numerator more efficient. The estimates for the denominator and numerator are unbiased, but the estimate for $K$ is not. I believe that more detail about the adaptive version is required before a definite answer to your second question can be given.
Bayes Factor approximation The answer to your first question is "yes": Using notation similar to Wikipedia, the Bayes factor is $$ K = \frac{P(D|M_1)}{P(D|M_2)} = \frac{\int P(D|\theta_1,M_1) P(\theta_1|M_1) \,d\theta_1}
41,561
Bayes Factor approximation
The answer to your second question is yes as well if you consider the sequence of Bayes factors: $$\mathfrak{B}_{12}^t=\dfrac{\int f_1(x_1,\ldots,x_t|\theta_1)\pi_1(\theta_1)\text{d}\theta_1}{\int f_2(x_1,\ldots,x_t|\theta_2)\pi_2(\theta_2)\text{d}\theta_2}\qquad t=1,\ldots,T$$ Then, assuming the observations are iid, \begin{align}\mathfrak{B}_{12}^{t+1}&=\dfrac{\int f_1(x_{t+1}|\theta_1)f_1(x_1,\ldots,x_t|\theta_1)\pi_1(\theta_1)\text{d}\theta_1}{\int f_2(x_{t+1}|\theta_2)f_2(x_1,\ldots,x_t|\theta_2)\pi_2(\theta_2)\text{d}\theta_2}\\ &=\dfrac{\int f_1(x_{t+1}|\theta_1)\dfrac{f_1(x_1,\ldots,x_t|\theta_1)\pi_1(\theta_1)}{\int f_1(x_1,\ldots,x_t|\theta_1)\pi_1(\theta_1)\text{d}\theta_1}\text{d}\theta_1}{\int f_2(x_{t+1}|\theta_2)\dfrac{f_2(x_1,\ldots,x_t|\theta_2)\pi_2(\theta_2)}{\int f_2(x_1,\ldots,x_t|\theta_2)\pi_2(\theta_2)\text{d}\theta_2}\text{d}\theta_2}\times \mathfrak{B}_{12}^t\\ &=\dfrac{\int f_1(x_{t+1}|\theta_1)\pi_1(\theta_1|x_1,\ldots,x_t)\text{d}\theta_1}{\int f_2(x_{t+1}|\theta_2)\pi_2(\theta_2|x_1,\ldots,x_t)\text{d}\theta_2}\times \mathfrak{B}_{12}^t\\ \end{align} This representation means that if You already have an approximation of $\mathfrak{B}_{12}^t$, $\hat{\mathfrak{B}}_{12}^t$; You have samples from both posteriors $\pi_1(\theta_1|x_1,\ldots,x_t|\theta_1)$ and $\pi_2(\theta_2|x_1,\ldots,x_t)$; you can derive an approximation of the first ratio using those samples and hence deduce an approximation of $\mathfrak{B}_{12}^{t+1}$. However you have to update your samples at each step $t$ in order to get samples from both posteriors $\pi_1(\theta_1|x_1,\ldots,x_{t+1})$ and $\pi_2(\theta_2|x_1,\ldots,x_{t+1})$. Which is why I do not believe this form of update is particularly useful, as indicated in a question of mine's.
Bayes Factor approximation
The answer to your second question is yes as well if you consider the sequence of Bayes factors: $$\mathfrak{B}_{12}^t=\dfrac{\int f_1(x_1,\ldots,x_t|\theta_1)\pi_1(\theta_1)\text{d}\theta_1}{\int f_2
Bayes Factor approximation The answer to your second question is yes as well if you consider the sequence of Bayes factors: $$\mathfrak{B}_{12}^t=\dfrac{\int f_1(x_1,\ldots,x_t|\theta_1)\pi_1(\theta_1)\text{d}\theta_1}{\int f_2(x_1,\ldots,x_t|\theta_2)\pi_2(\theta_2)\text{d}\theta_2}\qquad t=1,\ldots,T$$ Then, assuming the observations are iid, \begin{align}\mathfrak{B}_{12}^{t+1}&=\dfrac{\int f_1(x_{t+1}|\theta_1)f_1(x_1,\ldots,x_t|\theta_1)\pi_1(\theta_1)\text{d}\theta_1}{\int f_2(x_{t+1}|\theta_2)f_2(x_1,\ldots,x_t|\theta_2)\pi_2(\theta_2)\text{d}\theta_2}\\ &=\dfrac{\int f_1(x_{t+1}|\theta_1)\dfrac{f_1(x_1,\ldots,x_t|\theta_1)\pi_1(\theta_1)}{\int f_1(x_1,\ldots,x_t|\theta_1)\pi_1(\theta_1)\text{d}\theta_1}\text{d}\theta_1}{\int f_2(x_{t+1}|\theta_2)\dfrac{f_2(x_1,\ldots,x_t|\theta_2)\pi_2(\theta_2)}{\int f_2(x_1,\ldots,x_t|\theta_2)\pi_2(\theta_2)\text{d}\theta_2}\text{d}\theta_2}\times \mathfrak{B}_{12}^t\\ &=\dfrac{\int f_1(x_{t+1}|\theta_1)\pi_1(\theta_1|x_1,\ldots,x_t)\text{d}\theta_1}{\int f_2(x_{t+1}|\theta_2)\pi_2(\theta_2|x_1,\ldots,x_t)\text{d}\theta_2}\times \mathfrak{B}_{12}^t\\ \end{align} This representation means that if You already have an approximation of $\mathfrak{B}_{12}^t$, $\hat{\mathfrak{B}}_{12}^t$; You have samples from both posteriors $\pi_1(\theta_1|x_1,\ldots,x_t|\theta_1)$ and $\pi_2(\theta_2|x_1,\ldots,x_t)$; you can derive an approximation of the first ratio using those samples and hence deduce an approximation of $\mathfrak{B}_{12}^{t+1}$. However you have to update your samples at each step $t$ in order to get samples from both posteriors $\pi_1(\theta_1|x_1,\ldots,x_{t+1})$ and $\pi_2(\theta_2|x_1,\ldots,x_{t+1})$. Which is why I do not believe this form of update is particularly useful, as indicated in a question of mine's.
Bayes Factor approximation The answer to your second question is yes as well if you consider the sequence of Bayes factors: $$\mathfrak{B}_{12}^t=\dfrac{\int f_1(x_1,\ldots,x_t|\theta_1)\pi_1(\theta_1)\text{d}\theta_1}{\int f_2
41,562
Is there a name for a scatter plot which compares predicted vs observed values?
A scatter plot of observed and predicted is emphatically not a quantile-quantile plot (which defines a never-decreasing sequence of points). People often just talk informally in terms of what is on which axis, say observed versus or against predicted or fitted (e.g. Chambers et al. 1983). I'd suggest that plotting observed on the vertical or $y$ axis and predicted or fitted on the horizontal or $x$ axis is marginally preferable to the opposite convention for two reasons: Plotting response or outcome variable on the vertical axis is a common convention throughout science. This matches the very common convention of plotting residuals on the vertical axis and predicted or fitted on the horizontal axis in a very common associated plot. (Plots of observed versus fitted and of residual versus fitted show the same information; the first conveys the good news and can be easier to think of substantively, while the second conveys the bad news and can be easier to think of statistically, particularly when considering whether a model is adequate or can be improved.) On which is the right way round with versus, see discussion at versus (vs.): how to properly use this word in data analysis A more formal name is calibration plot (e.g. Harrell 2001, 2015; Venables and Ripley 2002; Gelman and Hill 2007). Chambers, J.M., Cleveland, W.S., Kleiner, B. and Tukey, P.A. 1983. Graphical Methods for Data Analysis. Belmont, CA: Wadsworth. Gelman, A. and J. Hill. 2007. Data Analysis Using Regression and Multilevel/Hierarchical Models. New York: Cambridge University Press. Harrell Jr., F.E. 2001. Regression Modeling Strategies: With Applications to Linear Models, Logistic Regression, and Survival Analysis. New York: Springer. Harrell Jr., F.E. 2015. Regression Modeling Strategies: With Applications to Linear Models, Logistic and Ordinal Regression, and Survival Analysis. Cham: Springer. Venables, W.N. and Ripley, B.D. 2002. Modern Applied Statistics with S. New York: Springer.
Is there a name for a scatter plot which compares predicted vs observed values?
A scatter plot of observed and predicted is emphatically not a quantile-quantile plot (which defines a never-decreasing sequence of points). People often just talk informally in terms of what is on w
Is there a name for a scatter plot which compares predicted vs observed values? A scatter plot of observed and predicted is emphatically not a quantile-quantile plot (which defines a never-decreasing sequence of points). People often just talk informally in terms of what is on which axis, say observed versus or against predicted or fitted (e.g. Chambers et al. 1983). I'd suggest that plotting observed on the vertical or $y$ axis and predicted or fitted on the horizontal or $x$ axis is marginally preferable to the opposite convention for two reasons: Plotting response or outcome variable on the vertical axis is a common convention throughout science. This matches the very common convention of plotting residuals on the vertical axis and predicted or fitted on the horizontal axis in a very common associated plot. (Plots of observed versus fitted and of residual versus fitted show the same information; the first conveys the good news and can be easier to think of substantively, while the second conveys the bad news and can be easier to think of statistically, particularly when considering whether a model is adequate or can be improved.) On which is the right way round with versus, see discussion at versus (vs.): how to properly use this word in data analysis A more formal name is calibration plot (e.g. Harrell 2001, 2015; Venables and Ripley 2002; Gelman and Hill 2007). Chambers, J.M., Cleveland, W.S., Kleiner, B. and Tukey, P.A. 1983. Graphical Methods for Data Analysis. Belmont, CA: Wadsworth. Gelman, A. and J. Hill. 2007. Data Analysis Using Regression and Multilevel/Hierarchical Models. New York: Cambridge University Press. Harrell Jr., F.E. 2001. Regression Modeling Strategies: With Applications to Linear Models, Logistic Regression, and Survival Analysis. New York: Springer. Harrell Jr., F.E. 2015. Regression Modeling Strategies: With Applications to Linear Models, Logistic and Ordinal Regression, and Survival Analysis. Cham: Springer. Venables, W.N. and Ripley, B.D. 2002. Modern Applied Statistics with S. New York: Springer.
Is there a name for a scatter plot which compares predicted vs observed values? A scatter plot of observed and predicted is emphatically not a quantile-quantile plot (which defines a never-decreasing sequence of points). People often just talk informally in terms of what is on w
41,563
Quadratic terms in logistic regression
After building a model based on general linear model (as you would typically be doing when you have a binary outcome), you have several methods available for checking for violations of the assumptions supporting statistical validity. The assumption that would be violated when the prediction relationship was polynomial is linearity of residuals (or equivalently the prediction-vs-predictor on the fitted scale, logistic in the case of binary outcomes). The details will vary depending on your computing platform, but you should be thinking of residual (or fitted values) versus predictor plots. The test for needing a polynomial would be "eyeball"-driven. If you get a "smile" or a "frown" then a squared term might be appropriate. If you get a minus-plus-minus-plus sort of pattern then a higher order polynomial might be needed. You should be thinking about the underlying scientific implications during this process of model building. Cubic polynomials should have a higher degree of skepticism. You need to balance the degree of fit against complexity. The other approach is to use regression splines which allow an automatic penalty to be imposed. Frank Harrell's "Regression Modeling Strategies" has many worked examples using the S/R platform.
Quadratic terms in logistic regression
After building a model based on general linear model (as you would typically be doing when you have a binary outcome), you have several methods available for checking for violations of the assumptions
Quadratic terms in logistic regression After building a model based on general linear model (as you would typically be doing when you have a binary outcome), you have several methods available for checking for violations of the assumptions supporting statistical validity. The assumption that would be violated when the prediction relationship was polynomial is linearity of residuals (or equivalently the prediction-vs-predictor on the fitted scale, logistic in the case of binary outcomes). The details will vary depending on your computing platform, but you should be thinking of residual (or fitted values) versus predictor plots. The test for needing a polynomial would be "eyeball"-driven. If you get a "smile" or a "frown" then a squared term might be appropriate. If you get a minus-plus-minus-plus sort of pattern then a higher order polynomial might be needed. You should be thinking about the underlying scientific implications during this process of model building. Cubic polynomials should have a higher degree of skepticism. You need to balance the degree of fit against complexity. The other approach is to use regression splines which allow an automatic penalty to be imposed. Frank Harrell's "Regression Modeling Strategies" has many worked examples using the S/R platform.
Quadratic terms in logistic regression After building a model based on general linear model (as you would typically be doing when you have a binary outcome), you have several methods available for checking for violations of the assumptions
41,564
Quadratic terms in logistic regression
During EDA, you can take the (continuous) predictor and discretize it by either creating equal-sized or equal-spaced bins. Then you can plot the event rates across all bins to visually detect a linear or quadratic relationship (if it exists). E.g., an inverted U-shaped curve would suggest the presence of a quadratic relationship. Another way to create such bins is by using CHAID (or other) decision tree algorithm to split your sample into statistically-derived bins.
Quadratic terms in logistic regression
During EDA, you can take the (continuous) predictor and discretize it by either creating equal-sized or equal-spaced bins. Then you can plot the event rates across all bins to visually detect a linear
Quadratic terms in logistic regression During EDA, you can take the (continuous) predictor and discretize it by either creating equal-sized or equal-spaced bins. Then you can plot the event rates across all bins to visually detect a linear or quadratic relationship (if it exists). E.g., an inverted U-shaped curve would suggest the presence of a quadratic relationship. Another way to create such bins is by using CHAID (or other) decision tree algorithm to split your sample into statistically-derived bins.
Quadratic terms in logistic regression During EDA, you can take the (continuous) predictor and discretize it by either creating equal-sized or equal-spaced bins. Then you can plot the event rates across all bins to visually detect a linear
41,565
Simulating a stochastic integral
You have two sources of divergence from 0.5, and you're only making changes to one of them; as a result you won't expect to see the sort of convergence you suggest. [Instead you'd expect to see a slight improvement at the smallest $n$ values which then disappears into noise as you increase $n$ further.] The first source of divergence is recognized in your question -- the approximation of the continuous process by a discrete approximation. The second source is the random variation due to simulation. At some finite number of simulations ($b$), you expect that the sample variation calculation will be different from the underlying "true" value you'd get with any given discrete approximation as $b\to\infty$. To see whether this is indeed the issue, you might try a sequence of $n$ values, say n=100,1000,10000 (and perhaps more if you can) at each $n$. Alternatively, you can compute a theoretical variance of the quantities you print out (and hence standard error), from which you can tell whether your results are clearly inconsistent with 1/2 (as $n$ becomes large you should find the inconsistency becomes harder to see because it would require much larger $b$ to identify).
Simulating a stochastic integral
You have two sources of divergence from 0.5, and you're only making changes to one of them; as a result you won't expect to see the sort of convergence you suggest. [Instead you'd expect to see a slig
Simulating a stochastic integral You have two sources of divergence from 0.5, and you're only making changes to one of them; as a result you won't expect to see the sort of convergence you suggest. [Instead you'd expect to see a slight improvement at the smallest $n$ values which then disappears into noise as you increase $n$ further.] The first source of divergence is recognized in your question -- the approximation of the continuous process by a discrete approximation. The second source is the random variation due to simulation. At some finite number of simulations ($b$), you expect that the sample variation calculation will be different from the underlying "true" value you'd get with any given discrete approximation as $b\to\infty$. To see whether this is indeed the issue, you might try a sequence of $n$ values, say n=100,1000,10000 (and perhaps more if you can) at each $n$. Alternatively, you can compute a theoretical variance of the quantities you print out (and hence standard error), from which you can tell whether your results are clearly inconsistent with 1/2 (as $n$ becomes large you should find the inconsistency becomes harder to see because it would require much larger $b$ to identify).
Simulating a stochastic integral You have two sources of divergence from 0.5, and you're only making changes to one of them; as a result you won't expect to see the sort of convergence you suggest. [Instead you'd expect to see a slig
41,566
Simulating a stochastic integral
Let $X_i := B(t_i) [B(t_{i+1}) - B(t_i)]$ for $i=0$ to $n-1$. The rv.s $X_i$ are gaussian and independent due to the independence of the increments of $B(t)$. Moreover $\mathbb{E}(X_i) = 0$ and $$ \text{Var}(X_i) = E[X_i^2] = \mathbb{E}[B(t_i)^2] \, \mathbb{E}[(B(t_{i+1}) - B(t_i))^2] = t_i \, (t_{i+1} - t_i), %% = \frac{i}{n} \frac{1}{n} = \frac{i}{n^2} $$ so $\text{Var}(X_i) = i / n^2$ if the points $t_i := i /n$ are used. Then $$ \text{Var}(I^{(n)}) = \sum_{i=0}^{n-1} \text{Var}(X_i) = \frac{1}{n^2} \sum_{i=0}^{n-1} i = \frac{1}{n^2} \, \frac{(n-1)n}{2} = \left[1 - \frac{1}{n}\right] \frac{1}{2}. $$ Up to the term $1/n$, the distribution of $I^{(n)}$ remains nearly the same for all $n$. By drawing a number, say $N_{\text{sim}}$, of independent $I^{(n)}$, we get a sample of size $N_{\text{sim}}$ from a distribution depending only slightly of $n$ and which is nearly the normal with mean $0$ and variance $1/2$. So in the program, the elements of v_sim corresponding to n are (unless n is small) simply the variances of independent samples of size $N_{\text{sim}}$ from $\text{Norm}(0, \,1/2)$. The number $n$ of points is nearly irrelevant here because of the specific integrand considered. The situation can be compared to the evaluation of the non-stochastic integral $\int_0^1 t \,\text{d}t$ using the trapezoidal rule. The result will not change when more trapezes are used. Obviously things would be different if a different adapted process or function was used as integrand, a denser design $[t_i]_i$ leading then to a smaller bias.
Simulating a stochastic integral
Let $X_i := B(t_i) [B(t_{i+1}) - B(t_i)]$ for $i=0$ to $n-1$. The rv.s $X_i$ are gaussian and independent due to the independence of the increments of $B(t)$. Moreover $\mathbb{E}(X_i) = 0$ and $$
Simulating a stochastic integral Let $X_i := B(t_i) [B(t_{i+1}) - B(t_i)]$ for $i=0$ to $n-1$. The rv.s $X_i$ are gaussian and independent due to the independence of the increments of $B(t)$. Moreover $\mathbb{E}(X_i) = 0$ and $$ \text{Var}(X_i) = E[X_i^2] = \mathbb{E}[B(t_i)^2] \, \mathbb{E}[(B(t_{i+1}) - B(t_i))^2] = t_i \, (t_{i+1} - t_i), %% = \frac{i}{n} \frac{1}{n} = \frac{i}{n^2} $$ so $\text{Var}(X_i) = i / n^2$ if the points $t_i := i /n$ are used. Then $$ \text{Var}(I^{(n)}) = \sum_{i=0}^{n-1} \text{Var}(X_i) = \frac{1}{n^2} \sum_{i=0}^{n-1} i = \frac{1}{n^2} \, \frac{(n-1)n}{2} = \left[1 - \frac{1}{n}\right] \frac{1}{2}. $$ Up to the term $1/n$, the distribution of $I^{(n)}$ remains nearly the same for all $n$. By drawing a number, say $N_{\text{sim}}$, of independent $I^{(n)}$, we get a sample of size $N_{\text{sim}}$ from a distribution depending only slightly of $n$ and which is nearly the normal with mean $0$ and variance $1/2$. So in the program, the elements of v_sim corresponding to n are (unless n is small) simply the variances of independent samples of size $N_{\text{sim}}$ from $\text{Norm}(0, \,1/2)$. The number $n$ of points is nearly irrelevant here because of the specific integrand considered. The situation can be compared to the evaluation of the non-stochastic integral $\int_0^1 t \,\text{d}t$ using the trapezoidal rule. The result will not change when more trapezes are used. Obviously things would be different if a different adapted process or function was used as integrand, a denser design $[t_i]_i$ leading then to a smaller bias.
Simulating a stochastic integral Let $X_i := B(t_i) [B(t_{i+1}) - B(t_i)]$ for $i=0$ to $n-1$. The rv.s $X_i$ are gaussian and independent due to the independence of the increments of $B(t)$. Moreover $\mathbb{E}(X_i) = 0$ and $$
41,567
Simulating a stochastic integral
To simulate the convergence, simulate the mean of the squared DIFFERENCE between the integral based on n steps and the integral based on 2n steps. Then the same for the difference between the integrals for 2n steps and 4n steps. Then the difference between 4n steps and 8n steps. Use the SAME Brownian motion trajectory (in the unit time period) for all. The same convergence pattern can be seen by using the variance of the DIFFERENCE between the pairs of integrals mentioned above. Section 3.4 of my book covers this. Ubbo
Simulating a stochastic integral
To simulate the convergence, simulate the mean of the squared DIFFERENCE between the integral based on n steps and the integral based on 2n steps. Then the same for the difference between the integral
Simulating a stochastic integral To simulate the convergence, simulate the mean of the squared DIFFERENCE between the integral based on n steps and the integral based on 2n steps. Then the same for the difference between the integrals for 2n steps and 4n steps. Then the difference between 4n steps and 8n steps. Use the SAME Brownian motion trajectory (in the unit time period) for all. The same convergence pattern can be seen by using the variance of the DIFFERENCE between the pairs of integrals mentioned above. Section 3.4 of my book covers this. Ubbo
Simulating a stochastic integral To simulate the convergence, simulate the mean of the squared DIFFERENCE between the integral based on n steps and the integral based on 2n steps. Then the same for the difference between the integral
41,568
Simulating a stochastic integral
3.9.10 BdB.R integral B.dB rephrase exercise 3.9.10 as follows: delete line 5 and onward until line 8 sentence that starts with Repeat also delete sentence starting with Compare set.seed(123) # optional; positive integer sims <- 1000 # number of simulations BdB.sim <- function(n) { B.steps <- 2*n # number of time steps in Brownian Motion path # integrals B.dB based on successively halved time partitions I.n <- numeric(sims) # n steps I.2n <- numeric(sims) # 2*n steps dt <- 1/B.steps sqrt.dt <- sqrt(dt) k.max <- 1+B.steps # last timepoint index of B # timepoints # --------------------------------------- k.seq.n <- seq(from=3,to=k.max,by=2) length(k.seq.n) k.seq.2n <- seq(from=2,to=k.max,by=1) length(k.seq.2n) k.seq.step <- seq(from=3,to=k.max-1,by=2) length(k.seq.step) # --------------------------------------- for(sim.nr in 1:sims) { # each simulation starts by generating a Brownian Motion path of n timesteps, denoted B B <- c(0,cumsum(rnorm(B.steps,mean=0,sd=sqrt.dt))) # Brownian Motion path timestep dt; B[1]=0 for(k in k.seq.n) {I.n[sim.nr] <- I.n[sim.nr] + B[k-2]*(B[k]-B[k-2])} for(k in k.seq.2n) {I.2n[sim.nr] <- I.2n[sim.nr] + B[k-1]*(B[k]-B[k-1])} } mean.sq.diff <- mean((I.n-I.2n)^2) exact <- 1/(4*n) return(data.frame(n=n,double=2*n,mean.sq.diff=mean.sq.diff,exact=exact)) } (n.seq <- c(2^8, 2^9, 2^10,2^11)) trail <- data.frame(n=NA,double=NA,mean.sq.diff=NA,exact=NA) for(m in 1:length(n.seq)) { out <- BdB.sim(n.seq[m]) trail <- rbind(trail,out) } trail[-1,] # shows convergence write.csv(trail[-1,],"3.9.10 BdB convergence.csv",row.names=FALSE) # optional -------------------------- Ubbo Wiersema 26 Feb 2018
Simulating a stochastic integral
3.9.10 BdB.R integral B.dB rephrase exercise 3.9.10 as follows: delete line 5 and onward until line 8 sentence that starts with Repeat also delete sentence starting with Compare set.seed(123) # o
Simulating a stochastic integral 3.9.10 BdB.R integral B.dB rephrase exercise 3.9.10 as follows: delete line 5 and onward until line 8 sentence that starts with Repeat also delete sentence starting with Compare set.seed(123) # optional; positive integer sims <- 1000 # number of simulations BdB.sim <- function(n) { B.steps <- 2*n # number of time steps in Brownian Motion path # integrals B.dB based on successively halved time partitions I.n <- numeric(sims) # n steps I.2n <- numeric(sims) # 2*n steps dt <- 1/B.steps sqrt.dt <- sqrt(dt) k.max <- 1+B.steps # last timepoint index of B # timepoints # --------------------------------------- k.seq.n <- seq(from=3,to=k.max,by=2) length(k.seq.n) k.seq.2n <- seq(from=2,to=k.max,by=1) length(k.seq.2n) k.seq.step <- seq(from=3,to=k.max-1,by=2) length(k.seq.step) # --------------------------------------- for(sim.nr in 1:sims) { # each simulation starts by generating a Brownian Motion path of n timesteps, denoted B B <- c(0,cumsum(rnorm(B.steps,mean=0,sd=sqrt.dt))) # Brownian Motion path timestep dt; B[1]=0 for(k in k.seq.n) {I.n[sim.nr] <- I.n[sim.nr] + B[k-2]*(B[k]-B[k-2])} for(k in k.seq.2n) {I.2n[sim.nr] <- I.2n[sim.nr] + B[k-1]*(B[k]-B[k-1])} } mean.sq.diff <- mean((I.n-I.2n)^2) exact <- 1/(4*n) return(data.frame(n=n,double=2*n,mean.sq.diff=mean.sq.diff,exact=exact)) } (n.seq <- c(2^8, 2^9, 2^10,2^11)) trail <- data.frame(n=NA,double=NA,mean.sq.diff=NA,exact=NA) for(m in 1:length(n.seq)) { out <- BdB.sim(n.seq[m]) trail <- rbind(trail,out) } trail[-1,] # shows convergence write.csv(trail[-1,],"3.9.10 BdB convergence.csv",row.names=FALSE) # optional -------------------------- Ubbo Wiersema 26 Feb 2018
Simulating a stochastic integral 3.9.10 BdB.R integral B.dB rephrase exercise 3.9.10 as follows: delete line 5 and onward until line 8 sentence that starts with Repeat also delete sentence starting with Compare set.seed(123) # o
41,569
How to know if a statistic prediction is right?
"This question can be extended ..." -- that's absolutely right. But of course, if you want to step all the way back -- that's the case for every phenomenon. Every time you flip a coin, it gets a little dented, and changes the likelihood of coming up heads. Every time you shoot a basket, your arms are a little more tired (or a little better rested) and your chance of the ball going in are just a little different. As an applied statistician, an enormous part of your job is trying to determine what events are similar enough to be counted as the same. You will never have a bunch of people taking drugs, or a bunch of students being tested, or a bunch of cities implementing policies, that are exactly the same. Much of the meat of your job is in trying to determine what to control for so that, when you're done, they're similar enough to give you back a meaningful answer. When it comes to predictions, the best you can do is try to train, and then test, on things you think are sufficiently similar. The whole point of cross-validation is to examine how internally consistent your data and model are. If you can train on some, and accurately predict on the rest, a solid interpretation is that the two sets of data are "similar enough." (Assuming away the other enormous part, that your model is correct.) So for observed data, you can assess predictive accuracy with cross-validation. But for the unseen future, the best answer to your question is just "For the predictions to be correct, you have to assume that tomorrow's weather is drawn from the same distribution as all the weather on which the predictive model was fit." And any question of how close becomes dependent upon a particular model, and preference.
How to know if a statistic prediction is right?
"This question can be extended ..." -- that's absolutely right. But of course, if you want to step all the way back -- that's the case for every phenomenon. Every time you flip a coin, it gets a littl
How to know if a statistic prediction is right? "This question can be extended ..." -- that's absolutely right. But of course, if you want to step all the way back -- that's the case for every phenomenon. Every time you flip a coin, it gets a little dented, and changes the likelihood of coming up heads. Every time you shoot a basket, your arms are a little more tired (or a little better rested) and your chance of the ball going in are just a little different. As an applied statistician, an enormous part of your job is trying to determine what events are similar enough to be counted as the same. You will never have a bunch of people taking drugs, or a bunch of students being tested, or a bunch of cities implementing policies, that are exactly the same. Much of the meat of your job is in trying to determine what to control for so that, when you're done, they're similar enough to give you back a meaningful answer. When it comes to predictions, the best you can do is try to train, and then test, on things you think are sufficiently similar. The whole point of cross-validation is to examine how internally consistent your data and model are. If you can train on some, and accurately predict on the rest, a solid interpretation is that the two sets of data are "similar enough." (Assuming away the other enormous part, that your model is correct.) So for observed data, you can assess predictive accuracy with cross-validation. But for the unseen future, the best answer to your question is just "For the predictions to be correct, you have to assume that tomorrow's weather is drawn from the same distribution as all the weather on which the predictive model was fit." And any question of how close becomes dependent upon a particular model, and preference.
How to know if a statistic prediction is right? "This question can be extended ..." -- that's absolutely right. But of course, if you want to step all the way back -- that's the case for every phenomenon. Every time you flip a coin, it gets a littl
41,570
How to know if a statistic prediction is right?
This is a great question and a common one as well. The property you seem to be interested in is ergodicity. If a stochastic process you're interested in is ergodic, then (roughly) these "different day" observations that you see can be combined to assess how successful the weather predictions are; can be combined to derive some convergence results. If the process does not exhibit ergodicity, however, then—as you stated—one would need to observe the same day several times and see if this probability of rain is accurate or not. Ergodicity is difficult to verify with real data and is typically taken as an assumption. For a rigorous, but empirical treatment of ergodicity, check out this chapter of E. Zivot's time series book. For a very nice intuitive example, watch this video from 16:55.
How to know if a statistic prediction is right?
This is a great question and a common one as well. The property you seem to be interested in is ergodicity. If a stochastic process you're interested in is ergodic, then (roughly) these "different day
How to know if a statistic prediction is right? This is a great question and a common one as well. The property you seem to be interested in is ergodicity. If a stochastic process you're interested in is ergodic, then (roughly) these "different day" observations that you see can be combined to assess how successful the weather predictions are; can be combined to derive some convergence results. If the process does not exhibit ergodicity, however, then—as you stated—one would need to observe the same day several times and see if this probability of rain is accurate or not. Ergodicity is difficult to verify with real data and is typically taken as an assumption. For a rigorous, but empirical treatment of ergodicity, check out this chapter of E. Zivot's time series book. For a very nice intuitive example, watch this video from 16:55.
How to know if a statistic prediction is right? This is a great question and a common one as well. The property you seem to be interested in is ergodicity. If a stochastic process you're interested in is ergodic, then (roughly) these "different day
41,571
How to know if a statistic prediction is right?
Time series econometrics deals with a similar question: If $y_t$ and $x_t$ are time series variables, should you trust a linear regression with the two variables? The answer is "it depends". It depends on whether the observed relationship between the two variables would continue to be true in the future. If $y_t$ and $x_t$ are both non-stationary, then the observed relationship may break apart in the future. If $y_t$ and $x_t$ are both stationary, then the observed relationship should hold in the future. Here's a simulated example. The variables, $x_t$ and $y_t$, are both non-stationary by design. Although the regression model says that the observed relationship is strong (based on p-value and $R^2$), the out-of-time $R^2$ is horrible (the model is far worse than using the average as a prediction). ### create two non-stationary variables set.seed(12345) x <- 100 + cumsum(rnorm(1000)) y <- 200 + cumsum(rnorm(1000)) df <- data.frame(y=y, x=x) ### split between training and test train <- df[1:800, ] ## 80% train test <- df[801:1000, ] ## 20% train ### linear regression lm.mod <- lm(y~x, data=train) summary(lm.mod) ### measure fit library(caret) in.sample.R2 <- R2(lm.mod$fitted.values, train$y, formula="traditional") out.sample.R2 <- R2(predict(lm.mod, newdata=test), test$y, formula="traditional") in.sample.R2 out.sample.R2 TLDR; Predicting the future is hard. Linear regression using time series data may be extremely misleading. Hold-out some of your data based on sequential time (e.g., hold out the last 9 quarters of your time series). Validate your model using the hold-out data.
How to know if a statistic prediction is right?
Time series econometrics deals with a similar question: If $y_t$ and $x_t$ are time series variables, should you trust a linear regression with the two variables? The answer is "it depends". It depend
How to know if a statistic prediction is right? Time series econometrics deals with a similar question: If $y_t$ and $x_t$ are time series variables, should you trust a linear regression with the two variables? The answer is "it depends". It depends on whether the observed relationship between the two variables would continue to be true in the future. If $y_t$ and $x_t$ are both non-stationary, then the observed relationship may break apart in the future. If $y_t$ and $x_t$ are both stationary, then the observed relationship should hold in the future. Here's a simulated example. The variables, $x_t$ and $y_t$, are both non-stationary by design. Although the regression model says that the observed relationship is strong (based on p-value and $R^2$), the out-of-time $R^2$ is horrible (the model is far worse than using the average as a prediction). ### create two non-stationary variables set.seed(12345) x <- 100 + cumsum(rnorm(1000)) y <- 200 + cumsum(rnorm(1000)) df <- data.frame(y=y, x=x) ### split between training and test train <- df[1:800, ] ## 80% train test <- df[801:1000, ] ## 20% train ### linear regression lm.mod <- lm(y~x, data=train) summary(lm.mod) ### measure fit library(caret) in.sample.R2 <- R2(lm.mod$fitted.values, train$y, formula="traditional") out.sample.R2 <- R2(predict(lm.mod, newdata=test), test$y, formula="traditional") in.sample.R2 out.sample.R2 TLDR; Predicting the future is hard. Linear regression using time series data may be extremely misleading. Hold-out some of your data based on sequential time (e.g., hold out the last 9 quarters of your time series). Validate your model using the hold-out data.
How to know if a statistic prediction is right? Time series econometrics deals with a similar question: If $y_t$ and $x_t$ are time series variables, should you trust a linear regression with the two variables? The answer is "it depends". It depend
41,572
Interpreting glm model output, assessing quality of fit
First, as you have little prior experience with regression models, I would suggest that you obtain two freely available references. An Introduction to Statistical Learning covers linear regression and some examples of generalized linear models in a usefully broad context. Practical Regression and Anova using R, by Faraway, is more specifically focused on some of the questions you have. Second, the glm model you presented seems to be equivalent to a standard linear regression model as usually analyzed by lm in R. The output of summary from an lm result might be more useful if your problem is a standard linear regression. glm is used for models that generalize linear regression techniques to "Output" or response variables that, for example, are classifications or counts rather than continuous real numbers. The glm summary may omit some types of lm summary values that are not properly provided by these generalized models, but it does provide the AIC value that is appropriate for models fit by the maximum-likelihood approach that glm uses. Third, you need to be aware of an important distinction between different meanings of "goodness-of-fit." One meaning, captured readily from the output from lm, is how well the model fits the particular sample of data that you have. Depending on your application, however, you might be more interested in how well the model will generalize to new data samples. For that latter interest you will have to combine regressions with techniques like bootstrapping or cross-validation. Fourth, as you have listed your predictor variables as "Input" and your outcome variable as "Output," you might be analyzing time-series variables. In that case more specialized techniques may be required to take into account issues like trends and autocorrelations. See this Cross Validated page as one place to start. Now for your questions: The summary of an lm model includes an "Adjusted R-squared" value that is a simple summary of overall goodness of fit; it's essentially a measure of the fraction of overall variance that the model accounts for, with a correction for the number of variables that the model fits. That, however, is insufficient for testing the validity of a linear regression. For that you need to evaluate whether residual errors are relatively independent of fitted values, whether particular data points are unduly affecting the results, and so on. A plot of an lm model is a good way to start. The Faraway reference noted above goes into some detail. (See below for confidence intervals.) The estimated regression coefficients, under the usual assumptions of linear regression, follow a Student t distribution. The probabilities listed in the summary specify how frequently a coefficient of that magnitude would be found by chance, if the coefficient were truly 0 with that standard error of estimation. The standard errors can be used to set up confidence intervals for the coefficients (question 1), as the Faraway reference demonstrates. This is essentially covered in the answer to (1) above. I caution you to pay less attention to general measures of goodness-of-fit and more attention to the more detailed tests noted above that document whether the linear model is even a reasonable fit to begin with. In standard frequentist statistical testing, threshold p-values are pre-specified and those cases that pass that threshold are deemed "significant." If you had pre-specified p < 0.05, then all coefficients except for Input4 would be considered significantly different from 0, and the interaction term between Input1 and Input2 would also be significant, based on the t-tests noted in the answer to (2). AIC values are useful for comparing among different models of the same data. The Wikipedia page explains it well, and the Faraway reference also explains it in the context of choosing among linear regression models. AIC is a measure of the likelihood (in a technical sense) of the model, corrected for the number of parameter values fit by the model. As for any such measure, what's a "good" AIC depends heavily on the subject matter; what might be spectacularly good for a clinical study would be terrible for particle physics. Some software reports AIC values without constant terms that can be ignored in model comparisons where only differences in AIC matter. Thus I would suggest that you not trust AIC values reported by a particular statistical package to be "true" AIC values unless you know the package very well.
Interpreting glm model output, assessing quality of fit
First, as you have little prior experience with regression models, I would suggest that you obtain two freely available references. An Introduction to Statistical Learning covers linear regression and
Interpreting glm model output, assessing quality of fit First, as you have little prior experience with regression models, I would suggest that you obtain two freely available references. An Introduction to Statistical Learning covers linear regression and some examples of generalized linear models in a usefully broad context. Practical Regression and Anova using R, by Faraway, is more specifically focused on some of the questions you have. Second, the glm model you presented seems to be equivalent to a standard linear regression model as usually analyzed by lm in R. The output of summary from an lm result might be more useful if your problem is a standard linear regression. glm is used for models that generalize linear regression techniques to "Output" or response variables that, for example, are classifications or counts rather than continuous real numbers. The glm summary may omit some types of lm summary values that are not properly provided by these generalized models, but it does provide the AIC value that is appropriate for models fit by the maximum-likelihood approach that glm uses. Third, you need to be aware of an important distinction between different meanings of "goodness-of-fit." One meaning, captured readily from the output from lm, is how well the model fits the particular sample of data that you have. Depending on your application, however, you might be more interested in how well the model will generalize to new data samples. For that latter interest you will have to combine regressions with techniques like bootstrapping or cross-validation. Fourth, as you have listed your predictor variables as "Input" and your outcome variable as "Output," you might be analyzing time-series variables. In that case more specialized techniques may be required to take into account issues like trends and autocorrelations. See this Cross Validated page as one place to start. Now for your questions: The summary of an lm model includes an "Adjusted R-squared" value that is a simple summary of overall goodness of fit; it's essentially a measure of the fraction of overall variance that the model accounts for, with a correction for the number of variables that the model fits. That, however, is insufficient for testing the validity of a linear regression. For that you need to evaluate whether residual errors are relatively independent of fitted values, whether particular data points are unduly affecting the results, and so on. A plot of an lm model is a good way to start. The Faraway reference noted above goes into some detail. (See below for confidence intervals.) The estimated regression coefficients, under the usual assumptions of linear regression, follow a Student t distribution. The probabilities listed in the summary specify how frequently a coefficient of that magnitude would be found by chance, if the coefficient were truly 0 with that standard error of estimation. The standard errors can be used to set up confidence intervals for the coefficients (question 1), as the Faraway reference demonstrates. This is essentially covered in the answer to (1) above. I caution you to pay less attention to general measures of goodness-of-fit and more attention to the more detailed tests noted above that document whether the linear model is even a reasonable fit to begin with. In standard frequentist statistical testing, threshold p-values are pre-specified and those cases that pass that threshold are deemed "significant." If you had pre-specified p < 0.05, then all coefficients except for Input4 would be considered significantly different from 0, and the interaction term between Input1 and Input2 would also be significant, based on the t-tests noted in the answer to (2). AIC values are useful for comparing among different models of the same data. The Wikipedia page explains it well, and the Faraway reference also explains it in the context of choosing among linear regression models. AIC is a measure of the likelihood (in a technical sense) of the model, corrected for the number of parameter values fit by the model. As for any such measure, what's a "good" AIC depends heavily on the subject matter; what might be spectacularly good for a clinical study would be terrible for particle physics. Some software reports AIC values without constant terms that can be ignored in model comparisons where only differences in AIC matter. Thus I would suggest that you not trust AIC values reported by a particular statistical package to be "true" AIC values unless you know the package very well.
Interpreting glm model output, assessing quality of fit First, as you have little prior experience with regression models, I would suggest that you obtain two freely available references. An Introduction to Statistical Learning covers linear regression and
41,573
Interpreting glm model output, assessing quality of fit
Let me add some messages about the lm output and glm output. About lm output, this page may help you a lot. It interprets the lm() function output in summary(). About glm, info in this page may help. Additionally, AIC is an estimate of a constant plus the relative distance between the unknown true likelihood function of the data and the fitted likelihood function of the model, so that a lower AIC means a model is considered to be closer to the truth. Trying to understand those tests and statistics is a way help in understanding the model.
Interpreting glm model output, assessing quality of fit
Let me add some messages about the lm output and glm output. About lm output, this page may help you a lot. It interprets the lm() function output in summary(). About glm, info in this page may hel
Interpreting glm model output, assessing quality of fit Let me add some messages about the lm output and glm output. About lm output, this page may help you a lot. It interprets the lm() function output in summary(). About glm, info in this page may help. Additionally, AIC is an estimate of a constant plus the relative distance between the unknown true likelihood function of the data and the fitted likelihood function of the model, so that a lower AIC means a model is considered to be closer to the truth. Trying to understand those tests and statistics is a way help in understanding the model.
Interpreting glm model output, assessing quality of fit Let me add some messages about the lm output and glm output. About lm output, this page may help you a lot. It interprets the lm() function output in summary(). About glm, info in this page may hel
41,574
Estimation derived from ignorance
The problem you are describing is related to doomsday argument and sunrise problem. Estimating something from ignorance in this case relates to Bayesian estimation with uniform prior. In basically any inference problem you have some data $D$ and some parameter $\theta$ that you want to learn about using your data. There are multiple different methods that can be applied to such problems and Bayesian approach is one of them. The general idea is that you can use your prior knowledge about $\theta$, data and Bayes theorem to learn something about $\theta$ (i.e. posterior): $$ \underbrace{P(\theta|D)}_\text{posterior} \propto \underbrace{P(D|\theta)}_\text{likelihood} \times \underbrace{P(\theta)}_\text{prior} $$ The basic idea is that you plug-in your prior into this formula and then check which of your prior expectations are likely given the data you have. Prior is some distribution for $\theta$ that is assumed a priori, that is, before seeing the data. You can make different assumptions about $\theta$ based on your actual problem and your subjective judgment. One simple choice that can be made is to assume that you have no knowledge whatsoever about $\theta$ just that it lies in some $[a,b]$ interval (so in fact you have some knowledge and make assumptions). In such case you use uniform distribution $\mathcal{U}(a,b)$ for $\theta$ and assume a priori that all the values in this interval are equally likely. Next, you update your assumptions by confronting them with the data. In this case ignorance-prior is used to make assumptions about $\theta$ that are to be tested and verified against the data. This is helpful because it gives you method of finding candidate values of $\theta$. Rephrasing it differently, you know nothing about $\theta$, but still you start with something to plug-in in the place the unknown to learn about it. Notice that when using uniform priors this approach is coherent with maximum likelihood estimation, but when using non-uniform priors it can lead to different results that are influenced less or more by the prior. Bayesian approach could be also helpful in situations like the one described in your quote, where we do not have much data about problem of interest, where priors help to overcome those limitations by including out-of-data information in our statistical model. J. Richard Gotts (1993) example is pretty simple and it needs only few assumptions and some basic algebra to understand it. Imagine that you have some point $x$ that lies on the line $[a, b]$, but you do not know exactly where it lies. For a moment let's forget what value does exactly have the beginning of the line $a$ and the end $b$, but let's think of them as $0\%$ and $100\%$ of total length $b-a$. Let's assume that $x$ can lie anywhere on the line, i.e. $X$ is a random variable uniformly distributed over $[a,b]$ interval. Making this assumptions lead us to conclusion that we have $0.95$ probability that $x$ is somewhere in the $95\%$ middle part of the line (recall that for uniform distribution $P(X < x) = \frac{x-a}{b-a}$). So if we are in the $95\%$ middle region of the line, than $x$ is at least $0.025(b-a)$ or at most $0.975(b-a)$. Gott, J. R. (1993). Implications of the Copernican principle for our future prospects. Nature, 363(6427), 315-319.
Estimation derived from ignorance
The problem you are describing is related to doomsday argument and sunrise problem. Estimating something from ignorance in this case relates to Bayesian estimation with uniform prior. In basically any
Estimation derived from ignorance The problem you are describing is related to doomsday argument and sunrise problem. Estimating something from ignorance in this case relates to Bayesian estimation with uniform prior. In basically any inference problem you have some data $D$ and some parameter $\theta$ that you want to learn about using your data. There are multiple different methods that can be applied to such problems and Bayesian approach is one of them. The general idea is that you can use your prior knowledge about $\theta$, data and Bayes theorem to learn something about $\theta$ (i.e. posterior): $$ \underbrace{P(\theta|D)}_\text{posterior} \propto \underbrace{P(D|\theta)}_\text{likelihood} \times \underbrace{P(\theta)}_\text{prior} $$ The basic idea is that you plug-in your prior into this formula and then check which of your prior expectations are likely given the data you have. Prior is some distribution for $\theta$ that is assumed a priori, that is, before seeing the data. You can make different assumptions about $\theta$ based on your actual problem and your subjective judgment. One simple choice that can be made is to assume that you have no knowledge whatsoever about $\theta$ just that it lies in some $[a,b]$ interval (so in fact you have some knowledge and make assumptions). In such case you use uniform distribution $\mathcal{U}(a,b)$ for $\theta$ and assume a priori that all the values in this interval are equally likely. Next, you update your assumptions by confronting them with the data. In this case ignorance-prior is used to make assumptions about $\theta$ that are to be tested and verified against the data. This is helpful because it gives you method of finding candidate values of $\theta$. Rephrasing it differently, you know nothing about $\theta$, but still you start with something to plug-in in the place the unknown to learn about it. Notice that when using uniform priors this approach is coherent with maximum likelihood estimation, but when using non-uniform priors it can lead to different results that are influenced less or more by the prior. Bayesian approach could be also helpful in situations like the one described in your quote, where we do not have much data about problem of interest, where priors help to overcome those limitations by including out-of-data information in our statistical model. J. Richard Gotts (1993) example is pretty simple and it needs only few assumptions and some basic algebra to understand it. Imagine that you have some point $x$ that lies on the line $[a, b]$, but you do not know exactly where it lies. For a moment let's forget what value does exactly have the beginning of the line $a$ and the end $b$, but let's think of them as $0\%$ and $100\%$ of total length $b-a$. Let's assume that $x$ can lie anywhere on the line, i.e. $X$ is a random variable uniformly distributed over $[a,b]$ interval. Making this assumptions lead us to conclusion that we have $0.95$ probability that $x$ is somewhere in the $95\%$ middle part of the line (recall that for uniform distribution $P(X < x) = \frac{x-a}{b-a}$). So if we are in the $95\%$ middle region of the line, than $x$ is at least $0.025(b-a)$ or at most $0.975(b-a)$. Gott, J. R. (1993). Implications of the Copernican principle for our future prospects. Nature, 363(6427), 315-319.
Estimation derived from ignorance The problem you are describing is related to doomsday argument and sunrise problem. Estimating something from ignorance in this case relates to Bayesian estimation with uniform prior. In basically any
41,575
Estimation derived from ignorance
As a addition to Tim answer, I would note that Gelman and Robert wrote in the paper "The perceived absurdity of Bayesian inference" (http://arxiv.org/pdf/1006.5366v2.pdf) in Section 4 called "The doomsday argument and confusion between frequentist and Bayesian ideas" that the doomsday argument (and Gotts one) is essentially a frequentist and not a bayesian view: For our purposes here, the (sociologically) interesting thing about this argument is that it’s been presented as Bayesian (see, for example, Dieks) but it isn’t a Bayesian analysis at all! The ”doomsday argument” is actually a classical frequentist confidence interval. And explain in plain english why. Moreover, they also comment that The doomsday argument is pretty silly and also, it’s fundamentally not Bayesian. I am no such an expert to claim these two points but as both Gelman and Robert agree on that, I think it is good to know...
Estimation derived from ignorance
As a addition to Tim answer, I would note that Gelman and Robert wrote in the paper "The perceived absurdity of Bayesian inference" (http://arxiv.org/pdf/1006.5366v2.pdf) in Section 4 called "The doom
Estimation derived from ignorance As a addition to Tim answer, I would note that Gelman and Robert wrote in the paper "The perceived absurdity of Bayesian inference" (http://arxiv.org/pdf/1006.5366v2.pdf) in Section 4 called "The doomsday argument and confusion between frequentist and Bayesian ideas" that the doomsday argument (and Gotts one) is essentially a frequentist and not a bayesian view: For our purposes here, the (sociologically) interesting thing about this argument is that it’s been presented as Bayesian (see, for example, Dieks) but it isn’t a Bayesian analysis at all! The ”doomsday argument” is actually a classical frequentist confidence interval. And explain in plain english why. Moreover, they also comment that The doomsday argument is pretty silly and also, it’s fundamentally not Bayesian. I am no such an expert to claim these two points but as both Gelman and Robert agree on that, I think it is good to know...
Estimation derived from ignorance As a addition to Tim answer, I would note that Gelman and Robert wrote in the paper "The perceived absurdity of Bayesian inference" (http://arxiv.org/pdf/1006.5366v2.pdf) in Section 4 called "The doom
41,576
Two-sample Kolmogorov-Smirnov test with errors on data points
This is a great question, and it blows my mind that there is not an obvious answer, given that this is essentially the most fundamental statistical comparison scientists make. I came here to ask the exact same question. I don't have a full answer, but I can tell you the inelegant way I'm approaching this problem. 1) Rather than treating each element as a precise value, construct a probability distribution for each element in your samples, (Pi(x)). If your errors are approximately normal then this would probably be a Gaussian distribution centered on your measured value. In your case this gives you ~240 different probability distributions for each sample. 2) Co-add all the probability distributions in each sample (and normalize by the number of measurements in your sample) to create the total sample's distribution probability density (D(x)): D(x)=( SUM[Pi(x)] from i=1 to N ) / N (where N is the number of sources in asample) Do this for both samples. 3) Use the distribution probability densities to come up with cumulative density functions for each sample: CDF(x)=Integral[ D(y) dy] from y=-infinity to x Do this for both samples. 4) Compare these CDFs as you would in a normal KS test. Find their max difference, D. This D is essentially equivalent to the KS D statistic, but does it translate the same way into a probability of rejecting the null hypothesis? I think the KS test is theoretically rooted in data with single values, so I'm not sure we can certain. To get around this theoretical discomfort, we can at least check to see if your measured D value is significantly greater than any random permutation of samples composed of all the elements in your two samples. 5) Once you have your "real" D value, go back and randomly shuffle which elements are in sample 1 and which are in sample 2 (but keep the total number of elements in each sample the same as before). Repeat steps 1-4 to come up with a D value for this randomly assembled comparison of samples. Do this a few hundred or thousand times and you'll come up with a distribution of D values. 6) How does your "real" D value compare to this distribution? If it is greater than 99% (or 95% or 90%...) of them, that's a good indication your samples' distributions differ significantly more than would be expected if they truly represented the same underlying distribution. Since this is such an important and basic scientific question, part of me assumes that there just MUST be a theoretically-grounded approach to it. So far I haven't found it.
Two-sample Kolmogorov-Smirnov test with errors on data points
This is a great question, and it blows my mind that there is not an obvious answer, given that this is essentially the most fundamental statistical comparison scientists make. I came here to ask the e
Two-sample Kolmogorov-Smirnov test with errors on data points This is a great question, and it blows my mind that there is not an obvious answer, given that this is essentially the most fundamental statistical comparison scientists make. I came here to ask the exact same question. I don't have a full answer, but I can tell you the inelegant way I'm approaching this problem. 1) Rather than treating each element as a precise value, construct a probability distribution for each element in your samples, (Pi(x)). If your errors are approximately normal then this would probably be a Gaussian distribution centered on your measured value. In your case this gives you ~240 different probability distributions for each sample. 2) Co-add all the probability distributions in each sample (and normalize by the number of measurements in your sample) to create the total sample's distribution probability density (D(x)): D(x)=( SUM[Pi(x)] from i=1 to N ) / N (where N is the number of sources in asample) Do this for both samples. 3) Use the distribution probability densities to come up with cumulative density functions for each sample: CDF(x)=Integral[ D(y) dy] from y=-infinity to x Do this for both samples. 4) Compare these CDFs as you would in a normal KS test. Find their max difference, D. This D is essentially equivalent to the KS D statistic, but does it translate the same way into a probability of rejecting the null hypothesis? I think the KS test is theoretically rooted in data with single values, so I'm not sure we can certain. To get around this theoretical discomfort, we can at least check to see if your measured D value is significantly greater than any random permutation of samples composed of all the elements in your two samples. 5) Once you have your "real" D value, go back and randomly shuffle which elements are in sample 1 and which are in sample 2 (but keep the total number of elements in each sample the same as before). Repeat steps 1-4 to come up with a D value for this randomly assembled comparison of samples. Do this a few hundred or thousand times and you'll come up with a distribution of D values. 6) How does your "real" D value compare to this distribution? If it is greater than 99% (or 95% or 90%...) of them, that's a good indication your samples' distributions differ significantly more than would be expected if they truly represented the same underlying distribution. Since this is such an important and basic scientific question, part of me assumes that there just MUST be a theoretically-grounded approach to it. So far I haven't found it.
Two-sample Kolmogorov-Smirnov test with errors on data points This is a great question, and it blows my mind that there is not an obvious answer, given that this is essentially the most fundamental statistical comparison scientists make. I came here to ask the e
41,577
Two-sample Kolmogorov-Smirnov test with errors on data points
The K-S test compares two probability density functions (see e.g. Wikipedia). To my knowledge, it is not meant to compare measurements with errors. One way to approach your problem is perhaps to fit an ensemble of PDF models to your data, for instance using a Monte Carlo approach to sample sensible model parameters. This leads to two sets of models, one set for each of your distributions. Then use the K-S test to compare all models in one set to all models in the other set. You can then study the resulting set of K-S statistics, for instance by looking at its distribution, or by just taking the average and variance. This way you are back to one K-S statistic and an error on that value. Whether this is solid statistics, I wouldn't dare to say. Edit: The Wikipedia page also suggests using Monte Carlo: If either the form or the parameters of $F(x)$ are determined from the data $X_i$ the critical values determined in this way are invalid. In such cases, Monte Carlo or other methods may be required, but tables have been prepared for some cases. Details for the required modifications to the test statistic and for the critical values for the normal distribution and the exponential distribution have been published,[5] and later publications also include the Gumbel distribution.[6] The Lilliefors test represents a special case of this for the normal distribution. The logarithm transformation may help to overcome cases where the Kolmogorov test data does not seem to fit the assumption that it came from the normal distribution.
Two-sample Kolmogorov-Smirnov test with errors on data points
The K-S test compares two probability density functions (see e.g. Wikipedia). To my knowledge, it is not meant to compare measurements with errors. One way to approach your problem is perhaps to fit a
Two-sample Kolmogorov-Smirnov test with errors on data points The K-S test compares two probability density functions (see e.g. Wikipedia). To my knowledge, it is not meant to compare measurements with errors. One way to approach your problem is perhaps to fit an ensemble of PDF models to your data, for instance using a Monte Carlo approach to sample sensible model parameters. This leads to two sets of models, one set for each of your distributions. Then use the K-S test to compare all models in one set to all models in the other set. You can then study the resulting set of K-S statistics, for instance by looking at its distribution, or by just taking the average and variance. This way you are back to one K-S statistic and an error on that value. Whether this is solid statistics, I wouldn't dare to say. Edit: The Wikipedia page also suggests using Monte Carlo: If either the form or the parameters of $F(x)$ are determined from the data $X_i$ the critical values determined in this way are invalid. In such cases, Monte Carlo or other methods may be required, but tables have been prepared for some cases. Details for the required modifications to the test statistic and for the critical values for the normal distribution and the exponential distribution have been published,[5] and later publications also include the Gumbel distribution.[6] The Lilliefors test represents a special case of this for the normal distribution. The logarithm transformation may help to overcome cases where the Kolmogorov test data does not seem to fit the assumption that it came from the normal distribution.
Two-sample Kolmogorov-Smirnov test with errors on data points The K-S test compares two probability density functions (see e.g. Wikipedia). To my knowledge, it is not meant to compare measurements with errors. One way to approach your problem is perhaps to fit a
41,578
Calculate sample size based on Conversion Rate, Minimum Detectable Effect, Statistical power and Significance level
I feel your pain. I blew so many hours yesterday looking at sites like: http://www.evanmiller.org/ab-testing/sample-size.html#!3;80;5;20;1 https://www.stat.ubc.ca/~rollin/stats/ssize/b2.html https://select-statistics.co.uk/calculators/sample-size-calculator-two-proportions/ And none of them provided a formula, which was disappointing, but the really aggravating part was that their results did not match each other's! Finally, I found a formula: $n = (Z_{α/2}+Z_β)^2 * (p_1(1-p_1)+p_2(1-p_2)) / (p_1-p_2)^2$ Then it took me several more hours to convert it to an Excel formula that I could actually use, such as: =(-NORMSINV(0.05/2)+normsinv(0.8))^2*(0.03*(1-0.03)+0.036*(1-0.036))/(0.03-0.036)^2 = 13,911 (Required Observations Per Variation) (This calculator's result matches that of my Excel formula, which is comforting.) If this answer looks helpful, please upvote. And see What to do after calculating the required sample size for a Marketing A-B test for more context.
Calculate sample size based on Conversion Rate, Minimum Detectable Effect, Statistical power and Sig
I feel your pain. I blew so many hours yesterday looking at sites like: http://www.evanmiller.org/ab-testing/sample-size.html#!3;80;5;20;1 https://www.stat.ubc.ca/~rollin/stats/ssize/b2.html https:/
Calculate sample size based on Conversion Rate, Minimum Detectable Effect, Statistical power and Significance level I feel your pain. I blew so many hours yesterday looking at sites like: http://www.evanmiller.org/ab-testing/sample-size.html#!3;80;5;20;1 https://www.stat.ubc.ca/~rollin/stats/ssize/b2.html https://select-statistics.co.uk/calculators/sample-size-calculator-two-proportions/ And none of them provided a formula, which was disappointing, but the really aggravating part was that their results did not match each other's! Finally, I found a formula: $n = (Z_{α/2}+Z_β)^2 * (p_1(1-p_1)+p_2(1-p_2)) / (p_1-p_2)^2$ Then it took me several more hours to convert it to an Excel formula that I could actually use, such as: =(-NORMSINV(0.05/2)+normsinv(0.8))^2*(0.03*(1-0.03)+0.036*(1-0.036))/(0.03-0.036)^2 = 13,911 (Required Observations Per Variation) (This calculator's result matches that of my Excel formula, which is comforting.) If this answer looks helpful, please upvote. And see What to do after calculating the required sample size for a Marketing A-B test for more context.
Calculate sample size based on Conversion Rate, Minimum Detectable Effect, Statistical power and Sig I feel your pain. I blew so many hours yesterday looking at sites like: http://www.evanmiller.org/ab-testing/sample-size.html#!3;80;5;20;1 https://www.stat.ubc.ca/~rollin/stats/ssize/b2.html https:/
41,579
Calculate sample size based on Conversion Rate, Minimum Detectable Effect, Statistical power and Significance level
This calculator has the formulas: http://powerandsamplesize.com/Calculators/Compare-2-Proportions/2-Sample-Equality for pB you need to enter pA+MDE, I believe.
Calculate sample size based on Conversion Rate, Minimum Detectable Effect, Statistical power and Sig
This calculator has the formulas: http://powerandsamplesize.com/Calculators/Compare-2-Proportions/2-Sample-Equality for pB you need to enter pA+MDE, I believe.
Calculate sample size based on Conversion Rate, Minimum Detectable Effect, Statistical power and Significance level This calculator has the formulas: http://powerandsamplesize.com/Calculators/Compare-2-Proportions/2-Sample-Equality for pB you need to enter pA+MDE, I believe.
Calculate sample size based on Conversion Rate, Minimum Detectable Effect, Statistical power and Sig This calculator has the formulas: http://powerandsamplesize.com/Calculators/Compare-2-Proportions/2-Sample-Equality for pB you need to enter pA+MDE, I believe.
41,580
Relative importance of variables in Cox regression
Thanks for trying those functions. I believe that both metrics you mentioned are excellent in this context. This is useful for any model that gives rise to Wald statistics (which is virtually all models) although likelihood ratio $\chi^2$ statistics would be even better (but more tedious to compute). You can use the bootstrap to get confidence intervals for the ranks of variables computed these ways. For the example code type ?anova.rms. All this is related to the "adequacy index". Two papers using the approach that have appeared in the medical literature are http://www.citeulike.org/user/harrelfe/article/13265566 and http://www.citeulike.org/user/harrelfe/article/13263849 .
Relative importance of variables in Cox regression
Thanks for trying those functions. I believe that both metrics you mentioned are excellent in this context. This is useful for any model that gives rise to Wald statistics (which is virtually all mo
Relative importance of variables in Cox regression Thanks for trying those functions. I believe that both metrics you mentioned are excellent in this context. This is useful for any model that gives rise to Wald statistics (which is virtually all models) although likelihood ratio $\chi^2$ statistics would be even better (but more tedious to compute). You can use the bootstrap to get confidence intervals for the ranks of variables computed these ways. For the example code type ?anova.rms. All this is related to the "adequacy index". Two papers using the approach that have appeared in the medical literature are http://www.citeulike.org/user/harrelfe/article/13265566 and http://www.citeulike.org/user/harrelfe/article/13263849 .
Relative importance of variables in Cox regression Thanks for trying those functions. I believe that both metrics you mentioned are excellent in this context. This is useful for any model that gives rise to Wald statistics (which is virtually all mo
41,581
If a decision tree already has very low entropy, do we still need a random forest
The short answer is variance. The long answer is variance and also generalization. Decision trees have high variance: a slight change in the training data can cause a big change in how the splits occur, and therefore the predictions aren't very stable. Before RF, there was a lot of attention paid to pruning decision trees and so on to get better generalization. But by taking the average of many i.i.d. decision trees (a random forest), that variation is averaged out, and we get to have our cake and eat it by having a low bais, low variance classifier with excellent out-of-sample generalization. This is explained in more detail in Elements of Statistical Learning.
If a decision tree already has very low entropy, do we still need a random forest
The short answer is variance. The long answer is variance and also generalization. Decision trees have high variance: a slight change in the training data can cause a big change in how the splits occu
If a decision tree already has very low entropy, do we still need a random forest The short answer is variance. The long answer is variance and also generalization. Decision trees have high variance: a slight change in the training data can cause a big change in how the splits occur, and therefore the predictions aren't very stable. Before RF, there was a lot of attention paid to pruning decision trees and so on to get better generalization. But by taking the average of many i.i.d. decision trees (a random forest), that variation is averaged out, and we get to have our cake and eat it by having a low bais, low variance classifier with excellent out-of-sample generalization. This is explained in more detail in Elements of Statistical Learning.
If a decision tree already has very low entropy, do we still need a random forest The short answer is variance. The long answer is variance and also generalization. Decision trees have high variance: a slight change in the training data can cause a big change in how the splits occu
41,582
Bootstrap method- downsides
There's two different ways to interpret this question: 1.) Is there any types of data such that bootstrapping standard estimators leads to invalid inference? 2.) Are there any non standard estimators such that bootstrap leads to invalid inference? The answer to both questions is yes. In the first case, as you mention in your comments, the Cauchy distribution will cause problems in regards to comparing simple means, as will any $t$ distribution with degrees of freedom $\leq 2$. This is because the variance (in the true population) in these cases is infinite. The validity of the bootstrap depends on the sampled data being approximately distributed approximately the same as the true population. But of course there will not be the case when the variance is infinite, as the variance will be finite in any sample. The practical implications of these are difficult to imagine, however. In practice, we don't usually think of sampling data from a population with an infinite variance. A better rule of thumb is to consider that you need to have your sample as a good representation of your population of interest. Hence the issue with outliers: if you have very few, highly influential outliers in your sample, you need to recognize that the distribution of your estimator is very heavily influenced by the tails of the distribution, for which you have very little data. Thus, what the bootstrap tells you about the distribution of your estimator is likely to be inaccurate, as it is highly dependent on an aspect of the population's distribution that you empirically know very little about. In terms of case 2, perhaps the most well known example of the bootstrap failing is the case of the MLE for the uniform distribution. Suppose you know that $X_i \sim$ uniform(0, $\theta$). Then the MLE based on samples $x_1, ..., x_n$ is $\max(x_i)$. But clearly, if you try to do a non-parametric bootstrap CI based on resampled $x_i$'s, the maximum value resampled will necessarily be less than or equal to $\max(x_i)$. With probability 1, $\max(x_i) < \theta$. Therefore, your non-parametric CI will not contain $\theta$. A less trivial example is the Grenander estimator (or strictly monotonic density estimator). See http://arxiv.org/abs/1010.3825. Similarly, the non-parametric maximum likelihood estimator for interval censored data (or NPMLE, a generalization of the better known Kaplan Meier curve) suffers a similar problem. See http://arxiv.org/pdf/1312.6341.pdf.
Bootstrap method- downsides
There's two different ways to interpret this question: 1.) Is there any types of data such that bootstrapping standard estimators leads to invalid inference? 2.) Are there any non standard estimators
Bootstrap method- downsides There's two different ways to interpret this question: 1.) Is there any types of data such that bootstrapping standard estimators leads to invalid inference? 2.) Are there any non standard estimators such that bootstrap leads to invalid inference? The answer to both questions is yes. In the first case, as you mention in your comments, the Cauchy distribution will cause problems in regards to comparing simple means, as will any $t$ distribution with degrees of freedom $\leq 2$. This is because the variance (in the true population) in these cases is infinite. The validity of the bootstrap depends on the sampled data being approximately distributed approximately the same as the true population. But of course there will not be the case when the variance is infinite, as the variance will be finite in any sample. The practical implications of these are difficult to imagine, however. In practice, we don't usually think of sampling data from a population with an infinite variance. A better rule of thumb is to consider that you need to have your sample as a good representation of your population of interest. Hence the issue with outliers: if you have very few, highly influential outliers in your sample, you need to recognize that the distribution of your estimator is very heavily influenced by the tails of the distribution, for which you have very little data. Thus, what the bootstrap tells you about the distribution of your estimator is likely to be inaccurate, as it is highly dependent on an aspect of the population's distribution that you empirically know very little about. In terms of case 2, perhaps the most well known example of the bootstrap failing is the case of the MLE for the uniform distribution. Suppose you know that $X_i \sim$ uniform(0, $\theta$). Then the MLE based on samples $x_1, ..., x_n$ is $\max(x_i)$. But clearly, if you try to do a non-parametric bootstrap CI based on resampled $x_i$'s, the maximum value resampled will necessarily be less than or equal to $\max(x_i)$. With probability 1, $\max(x_i) < \theta$. Therefore, your non-parametric CI will not contain $\theta$. A less trivial example is the Grenander estimator (or strictly monotonic density estimator). See http://arxiv.org/abs/1010.3825. Similarly, the non-parametric maximum likelihood estimator for interval censored data (or NPMLE, a generalization of the better known Kaplan Meier curve) suffers a similar problem. See http://arxiv.org/pdf/1312.6341.pdf.
Bootstrap method- downsides There's two different ways to interpret this question: 1.) Is there any types of data such that bootstrapping standard estimators leads to invalid inference? 2.) Are there any non standard estimators
41,583
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training set or gradient of the loss function?
I've implemented this here in a way that performs comparably to other implementations at least in my testing. At each step you have a residual R calculated across the entire data set (before any base learners are fit its the residual from predicting the average). You subsample without replacement and fit the learner to the values of R for the points in that subsample. Then you apply that learner to get a prediction across the entire data set and update R using that prediction. So you're still updating the residual across the entire data set, you're just randomizing the process of fitting each base learner a bit.
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training
I've implemented this here in a way that performs comparably to other implementations at least in my testing. At each step you have a residual R calculated across the entire data set (before any bas
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training set or gradient of the loss function? I've implemented this here in a way that performs comparably to other implementations at least in my testing. At each step you have a residual R calculated across the entire data set (before any base learners are fit its the residual from predicting the average). You subsample without replacement and fit the learner to the values of R for the points in that subsample. Then you apply that learner to get a prediction across the entire data set and update R using that prediction. So you're still updating the residual across the entire data set, you're just randomizing the process of fitting each base learner a bit.
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training I've implemented this here in a way that performs comparably to other implementations at least in my testing. At each step you have a residual R calculated across the entire data set (before any bas
41,584
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training set or gradient of the loss function?
I tried to decipher the steps in the original Friedman 2002 paper. If I am not wrong, it appears that we actually both deal with the current residuals and the original training set. Especially, the algorithm is as follows: Here is what I have understood, step by step. Please tell me if there is something amiss. See (*) below for some notation. line 1: $F_{0}(x)$ is just an initial guess (and that's not what I'm interested in here) line 4: we compute the current "pseudo-residuals" for a random subsample of the training set $(y_{\pi(i)},x_{\pi(i)})$ as the negative gradient of the loss function. By current, I mean that we want to add the $m^{th}$ base learner, and that the model so far is a sequence of $m-1$ base learners. line 5: the $m^{th}$ base learner is a regression tree that partitions the space of the $x_{\pi(i)}$'s into $L$ disjoint regions $R_{lm}$ so that the within-region variance in terms of pseudo-residuals (computed at line 4) is minimized (this is how a tree works). The predictions $\bar{y}_{lm}$ made by the tree are the means of the current pseudo-residuals in each region. This is what I was referring to in my question by: how can we fit each new base model on the residuals of the current model... line 6: within each region $R_{lm}$ found at line 5, we pick the expansion coefficient $\gamma_{lm}$ that minimizes the loss function (not its gradient, so we're not dealing with residuals here) evaluated on the random subsample of the target $y_{\pi(i)}$ and the corresponding predictions of the current model $F_{m-1}(x_{\pi(i)})$. This is what I was referring to in my question by: ...and at the same time on a random subsample of the original training set? line 7: we add the (contribution of) the new base learner to the sequence as its expansion coefficients for each region multiplied by the learning rate. This final step is still a bit weird to me, as we are not directly adding the new base learner itself (unlike what the widespread belief about Boosting might suggest). But I guess this is equivalent, since the $\gamma_{lm}$'s inherently encode the information about the new base learner (they were estimated within each leaf of the tree). *Some notation: $(y_{i},x_{i})$ is the training set (target, predictor) the goal of Boosting (like any other ML algo) is to approximate the function $F(x)$ that maps $x$ to $y$ The approximation of $F$ proposed by Boosting takes the form $F(x)=\sum_{m=0}^{M} \beta_{m}h(x,a_{m})$, where the $\beta$'s are expansion coefficients and the $a$'s are parameters of the base learners $h$'s (which are regression trees in Tree Boosting). So the $a$'s are the splits of the tree (optimizing the $a$'s=building the tree). $m$ is the number of base learners in the sequence. For trees, there is one $\beta_{m}$ per leaf, they are referred to as the $\gamma_{lm}$'s $\Psi$ is any differentiable loss function. We want the $F$ that minimizes the expected value of $\Psi(y,F(x))$. At each step, $F_{m}(x)=F_{m-1}(x)+\nu\beta_{m}h(x,a_{m})$
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training
I tried to decipher the steps in the original Friedman 2002 paper. If I am not wrong, it appears that we actually both deal with the current residuals and the original training set. Especially, the al
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training set or gradient of the loss function? I tried to decipher the steps in the original Friedman 2002 paper. If I am not wrong, it appears that we actually both deal with the current residuals and the original training set. Especially, the algorithm is as follows: Here is what I have understood, step by step. Please tell me if there is something amiss. See (*) below for some notation. line 1: $F_{0}(x)$ is just an initial guess (and that's not what I'm interested in here) line 4: we compute the current "pseudo-residuals" for a random subsample of the training set $(y_{\pi(i)},x_{\pi(i)})$ as the negative gradient of the loss function. By current, I mean that we want to add the $m^{th}$ base learner, and that the model so far is a sequence of $m-1$ base learners. line 5: the $m^{th}$ base learner is a regression tree that partitions the space of the $x_{\pi(i)}$'s into $L$ disjoint regions $R_{lm}$ so that the within-region variance in terms of pseudo-residuals (computed at line 4) is minimized (this is how a tree works). The predictions $\bar{y}_{lm}$ made by the tree are the means of the current pseudo-residuals in each region. This is what I was referring to in my question by: how can we fit each new base model on the residuals of the current model... line 6: within each region $R_{lm}$ found at line 5, we pick the expansion coefficient $\gamma_{lm}$ that minimizes the loss function (not its gradient, so we're not dealing with residuals here) evaluated on the random subsample of the target $y_{\pi(i)}$ and the corresponding predictions of the current model $F_{m-1}(x_{\pi(i)})$. This is what I was referring to in my question by: ...and at the same time on a random subsample of the original training set? line 7: we add the (contribution of) the new base learner to the sequence as its expansion coefficients for each region multiplied by the learning rate. This final step is still a bit weird to me, as we are not directly adding the new base learner itself (unlike what the widespread belief about Boosting might suggest). But I guess this is equivalent, since the $\gamma_{lm}$'s inherently encode the information about the new base learner (they were estimated within each leaf of the tree). *Some notation: $(y_{i},x_{i})$ is the training set (target, predictor) the goal of Boosting (like any other ML algo) is to approximate the function $F(x)$ that maps $x$ to $y$ The approximation of $F$ proposed by Boosting takes the form $F(x)=\sum_{m=0}^{M} \beta_{m}h(x,a_{m})$, where the $\beta$'s are expansion coefficients and the $a$'s are parameters of the base learners $h$'s (which are regression trees in Tree Boosting). So the $a$'s are the splits of the tree (optimizing the $a$'s=building the tree). $m$ is the number of base learners in the sequence. For trees, there is one $\beta_{m}$ per leaf, they are referred to as the $\gamma_{lm}$'s $\Psi$ is any differentiable loss function. We want the $F$ that minimizes the expected value of $\Psi(y,F(x))$. At each step, $F_{m}(x)=F_{m-1}(x)+\nu\beta_{m}h(x,a_{m})$
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training I tried to decipher the steps in the original Friedman 2002 paper. If I am not wrong, it appears that we actually both deal with the current residuals and the original training set. Especially, the al
41,585
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training set or gradient of the loss function?
The concept of residuals makes sense on any set of data for which: You can use your model to make predictions and You have a true response value on each record So, if you, for example, split your full training data in two halves and then train on the first half, you can still predict on the second half and compute the residuals there. I want to note though, that each base learner is fit to residuals in only the gaussian case of a gradient booster. In the general case the weak learners are fit to the gradient of the loss function, which in the gaussian case turns out to be equivalent, but in all others are not. You make this note as well, but I thought it was worth repeating.
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training
The concept of residuals makes sense on any set of data for which: You can use your model to make predictions and You have a true response value on each record So, if you, for example, split your fu
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training set or gradient of the loss function? The concept of residuals makes sense on any set of data for which: You can use your model to make predictions and You have a true response value on each record So, if you, for example, split your full training data in two halves and then train on the first half, you can still predict on the second half and compute the residuals there. I want to note though, that each base learner is fit to residuals in only the gaussian case of a gradient booster. In the general case the weak learners are fit to the gradient of the loss function, which in the gaussian case turns out to be equivalent, but in all others are not. You make this note as well, but I thought it was worth repeating.
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training The concept of residuals makes sense on any set of data for which: You can use your model to make predictions and You have a true response value on each record So, if you, for example, split your fu
41,586
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training set or gradient of the loss function?
I think you are confusing the features with the dependent variable. In gradient boosting models you fit the tree on the current gradient (which coincides with residuals for Gaussian models) using already existing features. Features do not change, only the gradient is changing at each step, because of the updating. Gradient is computed for each observation in the training set, so when you randomly select half of the training set it is easy to track which gradients to use. See Figure 2 in R package gbm vignette for better explanation, or the gradient tree boosting algorithm in section 10 in Elements of Statistical Learning.
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training
I think you are confusing the features with the dependent variable. In gradient boosting models you fit the tree on the current gradient (which coincides with residuals for Gaussian models) using alre
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training set or gradient of the loss function? I think you are confusing the features with the dependent variable. In gradient boosting models you fit the tree on the current gradient (which coincides with residuals for Gaussian models) using already existing features. Features do not change, only the gradient is changing at each step, because of the updating. Gradient is computed for each observation in the training set, so when you randomly select half of the training set it is easy to track which gradients to use. See Figure 2 in R package gbm vignette for better explanation, or the gradient tree boosting algorithm in section 10 in Elements of Statistical Learning.
Which data are used at each step of Stochastic Gradient Boosting? Subsample of the original training I think you are confusing the features with the dependent variable. In gradient boosting models you fit the tree on the current gradient (which coincides with residuals for Gaussian models) using alre
41,587
Expected value of product of non independent Bernoulli random variables (correlations are known)
Ordinarily, bivariate relationships do not determine multivariate ones, so we ought to expect that you cannot compute this expectation in terms of just the first two moments. The following describes a method to produce loads of counterexamples and exhibits an explicit one for four correlated Bernoulli variables. Generally, consider $k$ Bernoulli variables $X_i, i=1,\ldots, k$. Arranging the $2^k$ possible values of $(X_1, X_2, \ldots, X_k)$ in rows produces a $2^k \times k$ matrix with columns I will call $x_1, \ldots, x_k$. Let the corresponding probabilities of those $2^k$ $k$-tuples be given by the column vector $p=(p_1, p_2, \ldots, p_{2^k})$. Then the expectations of the $X_i$ are computed in the usual way as a sum of values times probabilities; viz., $$\mathbb{E}(X_i) = p^\prime \cdot x_i.$$ Similarly, the second (non-central) moments are found for $i\ne j$ as $$\mathbb{E}(X_iX_j) = p^\prime \cdot (x_i x_j).$$ The adjunction of two vectors within parentheses denotes their term-by-term product (which is another vector of the same length). Of course when $i=j$, $(x_ix_j) = (x_ix_i) = x_i$ implies that the second moments $\mathbb{E}(X_i^2) = \mathbb{E}(X_i)$ are already determined. Because $p$ represents a probability distribution, it must be the case that $$p \ge 0$$ (meaning all components of $p$ are non-negative) and $$p^\prime \cdot \mathbf{1} = 1$$ (where $\mathbf{1}$ is a $2^k$-vector of ones). We can collect all the foregoing information by forming a $2^k \times (1 + k + \binom{k}{2})$ matrix $\mathbb{X}$ whose columns are $\mathbf{1}$, the $x_i$, and the $(x_ix_j)$ for $1 \le i \lt j \le k$. Corresponding to these columns are the numbers $1$, $\mathbb{E}(X_i)$, and $\mathbb{E}(X_iX_j)$. Putting these numbers into a vector $\mu$ gives the linear relationships $$p^\prime \mathbb{X} = \mu^\prime.$$ The problem of finding such a vector $p$ subject to the linear constraints $p \ge 0$ is the first step of linear programming: the solutions are the feasible ones. In general either there is no solution or, when there is, there will be an entire manifold of them of dimension at least $2^k - (1 + k + \binom{k}{2})$. When $k\ge 3$, we can therefore expect there to be infinitely many distributions on $(X_1,\ldots, X_k)$ that reproduce the specified moment vector $\mu$. Now the expectation $\mathbb{E}(X_1X_2\cdots X_k)$ is simply the probability of $(1,1,\ldots, 1)$. So if we can find two of them that differ on the outcome $(1,1,\ldots, 1)$, we will have a counterexample. I am unable to construct a counterexample for $k=3$, but they are abundant for $k=4$. For example, suppose all the $X_i$ are Bernoulli$(1/2)$ variables and $\mathbb{E}(X_iX_j) = 3/14$ for $i\ne j$. (If you prefer, $\rho_{ij} = 6/7$.) Arrange the $2^k=16$ values in the usual binary order from $(0,0,0,0), (0,0,0,1), \ldots, (1,1,1,1)$. Then (for example) the distributions $$p^{(1)} = (1,0,0,2,0,2,2,0,0,2,2,0,2,0,0,1)/14$$ and $$p^{(2)} = (1,0,0,2,0,2,2,0,1,1,1,1,1,1,1,0)/14$$ reproduce all moments through order $2$ but give different expectations for the product: $1/14$ for $p^{(1)}$ and $0$ for $p^{(2)}$. Here is the array $\mathbb{X}$ adjoined with the two probability distributions, shown as a table: $$\begin{array}{cccccccccccccc} & 1 & x_1 & x_2 & x_3 & x_4 & x_1x_2 & x_1x_3 & x_2x_3 & x_1x_4 & x_2x_4 & x_3x_4 & p^{(1)} & p^{(2)} \\ & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \frac{1}{14} & \frac{1}{14} \\ & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & \frac{1}{7} & \frac{1}{7} \\ & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & \frac{1}{7} & \frac{1}{7} \\ & 1 & 0 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & \frac{1}{7} & \frac{1}{7} \\ & 1 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 \\ & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \frac{1}{14} \\ & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & \frac{1}{7} & \frac{1}{14} \\ & 1 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & \frac{1}{7} & \frac{1}{14} \\ & 1 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & \frac{1}{14} \\ & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & \frac{1}{7} & \frac{1}{14} \\ & 1 & 1 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & \frac{1}{14} \\ & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 0 & \frac{1}{14} \\ & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & \frac{1}{14} & 0 \\ \end{array}$$ The best you can do with the information given is to find a range for the expectation. Since the feasible solutions are a closed convex set, the possible values of $\mathbb{E}(X_1\cdots X_k)$ will be a closed interval (possibly an empty one if you specified mathematically impossible correlations or expectations). Find its endpoints by first maximizing $p_{2^k}$ and then minimizing it using any linear programming algorithm.
Expected value of product of non independent Bernoulli random variables (correlations are known)
Ordinarily, bivariate relationships do not determine multivariate ones, so we ought to expect that you cannot compute this expectation in terms of just the first two moments. The following describes
Expected value of product of non independent Bernoulli random variables (correlations are known) Ordinarily, bivariate relationships do not determine multivariate ones, so we ought to expect that you cannot compute this expectation in terms of just the first two moments. The following describes a method to produce loads of counterexamples and exhibits an explicit one for four correlated Bernoulli variables. Generally, consider $k$ Bernoulli variables $X_i, i=1,\ldots, k$. Arranging the $2^k$ possible values of $(X_1, X_2, \ldots, X_k)$ in rows produces a $2^k \times k$ matrix with columns I will call $x_1, \ldots, x_k$. Let the corresponding probabilities of those $2^k$ $k$-tuples be given by the column vector $p=(p_1, p_2, \ldots, p_{2^k})$. Then the expectations of the $X_i$ are computed in the usual way as a sum of values times probabilities; viz., $$\mathbb{E}(X_i) = p^\prime \cdot x_i.$$ Similarly, the second (non-central) moments are found for $i\ne j$ as $$\mathbb{E}(X_iX_j) = p^\prime \cdot (x_i x_j).$$ The adjunction of two vectors within parentheses denotes their term-by-term product (which is another vector of the same length). Of course when $i=j$, $(x_ix_j) = (x_ix_i) = x_i$ implies that the second moments $\mathbb{E}(X_i^2) = \mathbb{E}(X_i)$ are already determined. Because $p$ represents a probability distribution, it must be the case that $$p \ge 0$$ (meaning all components of $p$ are non-negative) and $$p^\prime \cdot \mathbf{1} = 1$$ (where $\mathbf{1}$ is a $2^k$-vector of ones). We can collect all the foregoing information by forming a $2^k \times (1 + k + \binom{k}{2})$ matrix $\mathbb{X}$ whose columns are $\mathbf{1}$, the $x_i$, and the $(x_ix_j)$ for $1 \le i \lt j \le k$. Corresponding to these columns are the numbers $1$, $\mathbb{E}(X_i)$, and $\mathbb{E}(X_iX_j)$. Putting these numbers into a vector $\mu$ gives the linear relationships $$p^\prime \mathbb{X} = \mu^\prime.$$ The problem of finding such a vector $p$ subject to the linear constraints $p \ge 0$ is the first step of linear programming: the solutions are the feasible ones. In general either there is no solution or, when there is, there will be an entire manifold of them of dimension at least $2^k - (1 + k + \binom{k}{2})$. When $k\ge 3$, we can therefore expect there to be infinitely many distributions on $(X_1,\ldots, X_k)$ that reproduce the specified moment vector $\mu$. Now the expectation $\mathbb{E}(X_1X_2\cdots X_k)$ is simply the probability of $(1,1,\ldots, 1)$. So if we can find two of them that differ on the outcome $(1,1,\ldots, 1)$, we will have a counterexample. I am unable to construct a counterexample for $k=3$, but they are abundant for $k=4$. For example, suppose all the $X_i$ are Bernoulli$(1/2)$ variables and $\mathbb{E}(X_iX_j) = 3/14$ for $i\ne j$. (If you prefer, $\rho_{ij} = 6/7$.) Arrange the $2^k=16$ values in the usual binary order from $(0,0,0,0), (0,0,0,1), \ldots, (1,1,1,1)$. Then (for example) the distributions $$p^{(1)} = (1,0,0,2,0,2,2,0,0,2,2,0,2,0,0,1)/14$$ and $$p^{(2)} = (1,0,0,2,0,2,2,0,1,1,1,1,1,1,1,0)/14$$ reproduce all moments through order $2$ but give different expectations for the product: $1/14$ for $p^{(1)}$ and $0$ for $p^{(2)}$. Here is the array $\mathbb{X}$ adjoined with the two probability distributions, shown as a table: $$\begin{array}{cccccccccccccc} & 1 & x_1 & x_2 & x_3 & x_4 & x_1x_2 & x_1x_3 & x_2x_3 & x_1x_4 & x_2x_4 & x_3x_4 & p^{(1)} & p^{(2)} \\ & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \frac{1}{14} & \frac{1}{14} \\ & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & \frac{1}{7} & \frac{1}{7} \\ & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & \frac{1}{7} & \frac{1}{7} \\ & 1 & 0 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & \frac{1}{7} & \frac{1}{7} \\ & 1 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 \\ & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \frac{1}{14} \\ & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 0 & \frac{1}{7} & \frac{1}{14} \\ & 1 & 1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & \frac{1}{7} & \frac{1}{14} \\ & 1 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & \frac{1}{14} \\ & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & \frac{1}{7} & \frac{1}{14} \\ & 1 & 1 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & \frac{1}{14} \\ & 1 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 0 & \frac{1}{14} \\ & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & \frac{1}{14} & 0 \\ \end{array}$$ The best you can do with the information given is to find a range for the expectation. Since the feasible solutions are a closed convex set, the possible values of $\mathbb{E}(X_1\cdots X_k)$ will be a closed interval (possibly an empty one if you specified mathematically impossible correlations or expectations). Find its endpoints by first maximizing $p_{2^k}$ and then minimizing it using any linear programming algorithm.
Expected value of product of non independent Bernoulli random variables (correlations are known) Ordinarily, bivariate relationships do not determine multivariate ones, so we ought to expect that you cannot compute this expectation in terms of just the first two moments. The following describes
41,588
Testing for Granger Causality
Follow this procedure (Engle-Granger Test for Cointegration): 1) Test to see if your series are stationary using adfuller test (stock prices and GDP levels are usually not) 2) If they are not, difference them and see if the differenced series are now stationary (they usually are). 3) If they are, your ORIGINAL series are said to be each integrated (I did not say co-integrated) of order 1; concisely noted as I(1). 4) If they are not both I(1), you can say safely say that they can not be co-integrated of order 1. 5) If they are both I(1), run a simple OLS regression of one of the other. 6) Check the residual of the OLS for stationarity. If they are stationary, then your original series are co-integrated of order 1. Shortcomings of this method: 1) It may matter which variable you regress on the other, 2) it works only when you have two variables. For a better test, you can use Johansen's procedure (https://github.com/josef-pkt/statsmodels/commit/29f0aa27d284ac0026e90ff9d877f7920a2c6056) http://nbviewer.jupyter.org/github/mapsa/seminario-doc-2014/blob/master/cointegration-example.ipynb.
Testing for Granger Causality
Follow this procedure (Engle-Granger Test for Cointegration): 1) Test to see if your series are stationary using adfuller test (stock prices and GDP levels are usually not) 2) If they are not, differe
Testing for Granger Causality Follow this procedure (Engle-Granger Test for Cointegration): 1) Test to see if your series are stationary using adfuller test (stock prices and GDP levels are usually not) 2) If they are not, difference them and see if the differenced series are now stationary (they usually are). 3) If they are, your ORIGINAL series are said to be each integrated (I did not say co-integrated) of order 1; concisely noted as I(1). 4) If they are not both I(1), you can say safely say that they can not be co-integrated of order 1. 5) If they are both I(1), run a simple OLS regression of one of the other. 6) Check the residual of the OLS for stationarity. If they are stationary, then your original series are co-integrated of order 1. Shortcomings of this method: 1) It may matter which variable you regress on the other, 2) it works only when you have two variables. For a better test, you can use Johansen's procedure (https://github.com/josef-pkt/statsmodels/commit/29f0aa27d284ac0026e90ff9d877f7920a2c6056) http://nbviewer.jupyter.org/github/mapsa/seminario-doc-2014/blob/master/cointegration-example.ipynb.
Testing for Granger Causality Follow this procedure (Engle-Granger Test for Cointegration): 1) Test to see if your series are stationary using adfuller test (stock prices and GDP levels are usually not) 2) If they are not, differe
41,589
The relationship between cumulative distribution vs cumulative density vs probability density
Looking at the links you provided, and what I'v seen in the past, there seems to be a lot of different names for what is essentially a particular function and its derivative. First, let's cross off one of the names you mention in the title: cumulative density function. That just doesn't make sense. A density function concerns itself with local properties of a phenomenon, while a cumulative function would be looking at global properties. A parallel term in calculus perhaps would be "integral derivative function", which makes no sense. So, the term "cumulative density" is just incorrect. Now let's deal with the remaining terms: cumulative distribution function, distribution function, probability density function, and probability mass function. The terms cumulative distribution function, probability density function, and probability mass function have unique meanings, which I will try to explain below. I can't remember seeing the term "distribution function" being used as an equivalent to "probability density function" and "probability mass function", but it doesn't mean it is not used, considering that so many different disciplines use these concepts. But in measure theoretical probability, the term "distribution function" always refers to "cumulative distribution function", and the "cumulative" part is always dropped. Next, let's define the terms and see what is their relationship. If you really want a truly complete answer, you'll need to know some measure theory, but I'm going to try to give a reasonable answer without using any measure theory. Nevertheless, a good understanding of calculus is inevitable. If $X$ is a random variable, then its cumulative distribution function (CDF) is a function $F_X$ defined on real numbers as follows: \begin{equation} F_X(x) = P(X \leq x) \end{equation} It is not hard to see that $F_X$ is increasing: if $a < b$, then $F_x(a) \leq F_X(b)$. We can also show that $F_X$ is right-continuous at every $x$, meaning that if you approach $x$ through values larger than $x$, you'll get $F_X(x)$. In mathematical notation, this is written as \begin{equation} \lim_{z \to x^+} F_X(z) =F_X(x). \end{equation} But $F_X$ can have jump points: points where it is discontinuous. Since $F_X$ is continuous from right everywhere, these discontinuities must be from the left. What that means is that if you approach such a point (say $a$) through values smaller than $a$, then the value of $F_X$ at those points does not approach the value of $F_X(a)$. As a simple example, consider the random variable $X$ that always takes the value $3$. Then it is easy to see that $F_X(x) = 0$ for $x < 3$ and $F_X(x) = 1$ for $3 \leq x$. If you approach 3 via values larger than 3, then $F_X(x) = 1$ and the closer you get to 3, the value of $F_X(x)$ stays at 1. However, if you approach 3 through values less than $3$, then $F_X(x) = 0$ for these $x$, and regardless of how close to $3$ you get, you'll still get $F_X(x) = 0$. In mathematical notation, we write that as $F_X(3+) = F_X(3) = 1$ and $F_X(3-) = 0$. In general, if we indicate by $F_X(a-)$ the value that $F_X(x)$ approaches to as $x$ approaches $a$ through values smaller than $a$, then the jump points of $F_X$ are those points $a$ such that $F_X(a) - F_X(a-) \neq 0.$ But remember that $F_X$ is increasing, and that implies that $F_X(a) - F_X(a-) > 0$ at jump points. Another corollary of the increasing property of $F_X$ is that it can have at most countably many jump points. That means that we can put them in a list (though the list can be infinite). Let's assume that $a_1,a_2,\ldots,$ is the (possibly infinite) set of jump points of $F_X$. We will try to extract that part of $F_X$ that corresponds to the $a_i$s. Define a point mass at $a$ to be the following function: \begin{equation} \delta_a(x) = \left\{ \begin{array}{ll} 0 & \mbox{if } x < a \\ 1 & \mbox{if } x \geq a. \end{array} \right. \end{equation} Let $F_X(a_i) - F_X(a_i-) = b_i$. Define the function $F_X^d$ as follows. \begin{equation} F_X^d(x) = \sum_i b_i \delta_{a_i}(x). \end{equation} If $F_X(x) = F^d_X(x)$ for all $x$, then $X$ is called a discrete random variable, and the function \begin{equation} p_X(x) = \left\{ \begin{array}{ll} 0 & \mbox{if } x \neq a_1,a_2,\ldots \\ b_i & \mbox{if } x = a_i \qquad i = 1,2,\ldots \end{array} \right. \end{equation} is called the probability mass function of $X$. If $F_X$ is differentiable function, with $F_X' = f$, then $f$ is called the probability density function. It is easy to see from the fundamental theorem of calculus that for any $a$ and $b$, \begin{equation} \int_a^b f(x)dx = F_X(b) - F_X(a) = P(a < X \leq b). \end{equation} Notice that there is a vast sea between between when a probability mass function is defined ($F_X$ is a sum of point masses), and when a probability density function is defined ($F_X$ is differentiable). To understand what is in between, you need to study probability from a measure theoretical perspective.
The relationship between cumulative distribution vs cumulative density vs probability density
Looking at the links you provided, and what I'v seen in the past, there seems to be a lot of different names for what is essentially a particular function and its derivative. First, let's cross off o
The relationship between cumulative distribution vs cumulative density vs probability density Looking at the links you provided, and what I'v seen in the past, there seems to be a lot of different names for what is essentially a particular function and its derivative. First, let's cross off one of the names you mention in the title: cumulative density function. That just doesn't make sense. A density function concerns itself with local properties of a phenomenon, while a cumulative function would be looking at global properties. A parallel term in calculus perhaps would be "integral derivative function", which makes no sense. So, the term "cumulative density" is just incorrect. Now let's deal with the remaining terms: cumulative distribution function, distribution function, probability density function, and probability mass function. The terms cumulative distribution function, probability density function, and probability mass function have unique meanings, which I will try to explain below. I can't remember seeing the term "distribution function" being used as an equivalent to "probability density function" and "probability mass function", but it doesn't mean it is not used, considering that so many different disciplines use these concepts. But in measure theoretical probability, the term "distribution function" always refers to "cumulative distribution function", and the "cumulative" part is always dropped. Next, let's define the terms and see what is their relationship. If you really want a truly complete answer, you'll need to know some measure theory, but I'm going to try to give a reasonable answer without using any measure theory. Nevertheless, a good understanding of calculus is inevitable. If $X$ is a random variable, then its cumulative distribution function (CDF) is a function $F_X$ defined on real numbers as follows: \begin{equation} F_X(x) = P(X \leq x) \end{equation} It is not hard to see that $F_X$ is increasing: if $a < b$, then $F_x(a) \leq F_X(b)$. We can also show that $F_X$ is right-continuous at every $x$, meaning that if you approach $x$ through values larger than $x$, you'll get $F_X(x)$. In mathematical notation, this is written as \begin{equation} \lim_{z \to x^+} F_X(z) =F_X(x). \end{equation} But $F_X$ can have jump points: points where it is discontinuous. Since $F_X$ is continuous from right everywhere, these discontinuities must be from the left. What that means is that if you approach such a point (say $a$) through values smaller than $a$, then the value of $F_X$ at those points does not approach the value of $F_X(a)$. As a simple example, consider the random variable $X$ that always takes the value $3$. Then it is easy to see that $F_X(x) = 0$ for $x < 3$ and $F_X(x) = 1$ for $3 \leq x$. If you approach 3 via values larger than 3, then $F_X(x) = 1$ and the closer you get to 3, the value of $F_X(x)$ stays at 1. However, if you approach 3 through values less than $3$, then $F_X(x) = 0$ for these $x$, and regardless of how close to $3$ you get, you'll still get $F_X(x) = 0$. In mathematical notation, we write that as $F_X(3+) = F_X(3) = 1$ and $F_X(3-) = 0$. In general, if we indicate by $F_X(a-)$ the value that $F_X(x)$ approaches to as $x$ approaches $a$ through values smaller than $a$, then the jump points of $F_X$ are those points $a$ such that $F_X(a) - F_X(a-) \neq 0.$ But remember that $F_X$ is increasing, and that implies that $F_X(a) - F_X(a-) > 0$ at jump points. Another corollary of the increasing property of $F_X$ is that it can have at most countably many jump points. That means that we can put them in a list (though the list can be infinite). Let's assume that $a_1,a_2,\ldots,$ is the (possibly infinite) set of jump points of $F_X$. We will try to extract that part of $F_X$ that corresponds to the $a_i$s. Define a point mass at $a$ to be the following function: \begin{equation} \delta_a(x) = \left\{ \begin{array}{ll} 0 & \mbox{if } x < a \\ 1 & \mbox{if } x \geq a. \end{array} \right. \end{equation} Let $F_X(a_i) - F_X(a_i-) = b_i$. Define the function $F_X^d$ as follows. \begin{equation} F_X^d(x) = \sum_i b_i \delta_{a_i}(x). \end{equation} If $F_X(x) = F^d_X(x)$ for all $x$, then $X$ is called a discrete random variable, and the function \begin{equation} p_X(x) = \left\{ \begin{array}{ll} 0 & \mbox{if } x \neq a_1,a_2,\ldots \\ b_i & \mbox{if } x = a_i \qquad i = 1,2,\ldots \end{array} \right. \end{equation} is called the probability mass function of $X$. If $F_X$ is differentiable function, with $F_X' = f$, then $f$ is called the probability density function. It is easy to see from the fundamental theorem of calculus that for any $a$ and $b$, \begin{equation} \int_a^b f(x)dx = F_X(b) - F_X(a) = P(a < X \leq b). \end{equation} Notice that there is a vast sea between between when a probability mass function is defined ($F_X$ is a sum of point masses), and when a probability density function is defined ($F_X$ is differentiable). To understand what is in between, you need to study probability from a measure theoretical perspective.
The relationship between cumulative distribution vs cumulative density vs probability density Looking at the links you provided, and what I'v seen in the past, there seems to be a lot of different names for what is essentially a particular function and its derivative. First, let's cross off o
41,590
The relationship between cumulative distribution vs cumulative density vs probability density
I see that the terminology is taking toll here. The basic concept behind those are very simple but takes one to visualize it properly. First of all, PMF is individual probabilities of each discrete points. PDF is a tool or hack that we use in case of continuous random variable. Among other tasks (as highlighted in comment) CDF is also used for simulations where you need to generate data points from your choice of arbitrary complex PDF or PMF (but that's for later, here I'll say more about PDF). PDF is all you need for continuous r.v. A rather more interesting question would be: why do we need PDF at all. Why is PMF not sufficient even for continuous r.v.? Actually at individual point, probability is zero (for continuous random variable), hence we take collective points and find group probability to make sense of what's going on in probabilistic world even if individual probability is zero. Density helps in that case. Other answers & comments here have rightly addressed this with mathematical derivations, but as mentioned it doesn't clarify deep seated doubt/curiosity. So without repeating the same verbose, here is youtube visualizations that build the concept from ground zero. Why cannot we use Probability Mass Function (PMF) for continuous random variable? What actually is Probability Density Function (PDF)?
The relationship between cumulative distribution vs cumulative density vs probability density
I see that the terminology is taking toll here. The basic concept behind those are very simple but takes one to visualize it properly. First of all, PMF is individual probabilities of each discrete po
The relationship between cumulative distribution vs cumulative density vs probability density I see that the terminology is taking toll here. The basic concept behind those are very simple but takes one to visualize it properly. First of all, PMF is individual probabilities of each discrete points. PDF is a tool or hack that we use in case of continuous random variable. Among other tasks (as highlighted in comment) CDF is also used for simulations where you need to generate data points from your choice of arbitrary complex PDF or PMF (but that's for later, here I'll say more about PDF). PDF is all you need for continuous r.v. A rather more interesting question would be: why do we need PDF at all. Why is PMF not sufficient even for continuous r.v.? Actually at individual point, probability is zero (for continuous random variable), hence we take collective points and find group probability to make sense of what's going on in probabilistic world even if individual probability is zero. Density helps in that case. Other answers & comments here have rightly addressed this with mathematical derivations, but as mentioned it doesn't clarify deep seated doubt/curiosity. So without repeating the same verbose, here is youtube visualizations that build the concept from ground zero. Why cannot we use Probability Mass Function (PMF) for continuous random variable? What actually is Probability Density Function (PDF)?
The relationship between cumulative distribution vs cumulative density vs probability density I see that the terminology is taking toll here. The basic concept behind those are very simple but takes one to visualize it properly. First of all, PMF is individual probabilities of each discrete po
41,591
Estimating the best length of n-gram
There could be some statistical criteria for selecting the best $n$, but I believe the best way to select any parameter is to use cross-validation. Suppose you're building a system for detecting the language of an article and you decided to use n-grams (n-shingles) to represent the documents. Then to select the best $n$, you split your dataset into training and testing subsets, and then run 10-fold cross-validation on the training set for each $n \in \{1, 2, 3, 4, \ ... \}$ and select such $n$ that minimizes the validation error. CV can also be used in unsupervised learning, see e.g. (1) [1] Patrick O. Perry, "Cross-Validation for Unsupervised Learning", http://arxiv.org/abs/0909.3052
Estimating the best length of n-gram
There could be some statistical criteria for selecting the best $n$, but I believe the best way to select any parameter is to use cross-validation. Suppose you're building a system for detecting the
Estimating the best length of n-gram There could be some statistical criteria for selecting the best $n$, but I believe the best way to select any parameter is to use cross-validation. Suppose you're building a system for detecting the language of an article and you decided to use n-grams (n-shingles) to represent the documents. Then to select the best $n$, you split your dataset into training and testing subsets, and then run 10-fold cross-validation on the training set for each $n \in \{1, 2, 3, 4, \ ... \}$ and select such $n$ that minimizes the validation error. CV can also be used in unsupervised learning, see e.g. (1) [1] Patrick O. Perry, "Cross-Validation for Unsupervised Learning", http://arxiv.org/abs/0909.3052
Estimating the best length of n-gram There could be some statistical criteria for selecting the best $n$, but I believe the best way to select any parameter is to use cross-validation. Suppose you're building a system for detecting the
41,592
Where must we use Bagging or Boosting?
Boosting in general has a higher risk of overfitting than bagging. Mislabeled cases cause much more serious trouble with boosting than with bagging, similar to the outliers you mention. I'd expect boosting to yield better results than bagging if you can reasonably expect that your submodels don't by themselves put enough weight on cases close to the class boundaries: bagging won't help with this particular aspect, but boosting would up-weight those cases. Ensemble models in general help only in situations where the lack of performance is due to model instability. Variance uncertainty in the model prediction can have at least 2 causes: variance uncertainty in the model (instability) and variance uncertainty on the input data (noisy measurements). An aggregated predictor has improved stability (the "model noise" is averaged), but if the submodels were already stable (and the noise comes e.g. from the input data), aggregation won't improve the prediction*. As boosting is iteratively refining the model, you need an "outer" independent test, whereas for bagged models you can use the out-of-bag cases for testing. * Depending on the type of classifier and the actual procedure of aggregation (e.g. boosting to put more weight on cases close to the class boundaries), also the bias can be influenced - but typically only within the limits of the variance of the submodels much: if you think of the point cloud of the submodel prediction and of the aggregated prediction, the aggregated prediction will be within the cloud of submodel predictions.
Where must we use Bagging or Boosting?
Boosting in general has a higher risk of overfitting than bagging. Mislabeled cases cause much more serious trouble with boosting than with bagging, similar to the outliers you mention. I'd expect bo
Where must we use Bagging or Boosting? Boosting in general has a higher risk of overfitting than bagging. Mislabeled cases cause much more serious trouble with boosting than with bagging, similar to the outliers you mention. I'd expect boosting to yield better results than bagging if you can reasonably expect that your submodels don't by themselves put enough weight on cases close to the class boundaries: bagging won't help with this particular aspect, but boosting would up-weight those cases. Ensemble models in general help only in situations where the lack of performance is due to model instability. Variance uncertainty in the model prediction can have at least 2 causes: variance uncertainty in the model (instability) and variance uncertainty on the input data (noisy measurements). An aggregated predictor has improved stability (the "model noise" is averaged), but if the submodels were already stable (and the noise comes e.g. from the input data), aggregation won't improve the prediction*. As boosting is iteratively refining the model, you need an "outer" independent test, whereas for bagged models you can use the out-of-bag cases for testing. * Depending on the type of classifier and the actual procedure of aggregation (e.g. boosting to put more weight on cases close to the class boundaries), also the bias can be influenced - but typically only within the limits of the variance of the submodels much: if you think of the point cloud of the submodel prediction and of the aggregated prediction, the aggregated prediction will be within the cloud of submodel predictions.
Where must we use Bagging or Boosting? Boosting in general has a higher risk of overfitting than bagging. Mislabeled cases cause much more serious trouble with boosting than with bagging, similar to the outliers you mention. I'd expect bo
41,593
Estimation with MLE and returning the score/gradient (QMLE)
The numDeriv package can indeed be used to compute the gradient and the hessian (if needed). In both cases the argument y of the log-likelihood is passed through the dots mechanism, using an argument with the suitable name. For a vector-valued function, the jacobian function of the same package can be used similarly. You could also consider computing analytical derivatives rather than numerical ones. library(numDeriv) H <- hessian(func = loglik, x = b$par, y = y) g <- grad(func = loglik, x = b$par, y = y) We can compute as well the Jacobian of a function returning a vector of length $T-1$. mlogDens <- function(theta, y) { T <- length(y) -dnorm(y[2:T], mean = theta[1] + theta[2] * y[1:(T-1)], sd = theta[3], log = TRUE) } ## a matrix with dim (T-1, 3) G <- jacobian(func = mlogDens, x = b$par, y = y) ## a matrix with dim (9, T-1) GG <- apply(G, MARGIN = 1, FUN = tcrossprod) ## a vector with length 9 representing a symmetric mat. GGsum0 <- apply(GG, MARGIN = 1, FUN = sum) ## a symmetric mat. GGsum <- matrix(GGsum0, nrow = 3, ncol = 3)
Estimation with MLE and returning the score/gradient (QMLE)
The numDeriv package can indeed be used to compute the gradient and the hessian (if needed). In both cases the argument y of the log-likelihood is passed through the dots mechanism, using an argument
Estimation with MLE and returning the score/gradient (QMLE) The numDeriv package can indeed be used to compute the gradient and the hessian (if needed). In both cases the argument y of the log-likelihood is passed through the dots mechanism, using an argument with the suitable name. For a vector-valued function, the jacobian function of the same package can be used similarly. You could also consider computing analytical derivatives rather than numerical ones. library(numDeriv) H <- hessian(func = loglik, x = b$par, y = y) g <- grad(func = loglik, x = b$par, y = y) We can compute as well the Jacobian of a function returning a vector of length $T-1$. mlogDens <- function(theta, y) { T <- length(y) -dnorm(y[2:T], mean = theta[1] + theta[2] * y[1:(T-1)], sd = theta[3], log = TRUE) } ## a matrix with dim (T-1, 3) G <- jacobian(func = mlogDens, x = b$par, y = y) ## a matrix with dim (9, T-1) GG <- apply(G, MARGIN = 1, FUN = tcrossprod) ## a vector with length 9 representing a symmetric mat. GGsum0 <- apply(GG, MARGIN = 1, FUN = sum) ## a symmetric mat. GGsum <- matrix(GGsum0, nrow = 3, ncol = 3)
Estimation with MLE and returning the score/gradient (QMLE) The numDeriv package can indeed be used to compute the gradient and the hessian (if needed). In both cases the argument y of the log-likelihood is passed through the dots mechanism, using an argument
41,594
Regularization in Neural networks
Just a guess, but training using something like SGD (which can be considered a type of online learning, in the sense that it sees only a fraction of the data at a time) looks like this w.r.t. the objective function. That is, the "trajcetory" of the objective is declining, but it's stochastically bouncing around. Early stopping means you're picking a point earlier in that trajectory, with parameters that are "suboptimal" in the sense that lower entropy could be obtained on the training data with further training and fine-tuning of parameter estimates. Later in your question, you write that you expect more samples can avoid over-fitting. More training samples can provide more precise parameter estimates, but can't prevent over-fitting on its own. Especially in the case of neural nets, the NN can learn a very complicated function (in the presence of almost any amount of data), but that function may not generalize well to unseen data. Consider a continuum from an underfit model to an optimal model to an overfit model. More training data can move you from underfit to optimal, but moving from optimal to overfit can happen because of a failure to regularize; in the early-stopping paradigm, that means using all available data. Note that there are alternative strategies to addressing overfitting in neural nets, though. One approach is to place a prior over the parameters that penalizes values further from 0. This is usually expressed as adding a term $\lambda\sum_i w_i^2$ to the objective function, where $w$ is the vector of weights, i.e. a 0-mean Gaussian prior over each $w_i$, with variance controlled via $\lambda$. Cross-validation is used to select the optimal $\lambda$.
Regularization in Neural networks
Just a guess, but training using something like SGD (which can be considered a type of online learning, in the sense that it sees only a fraction of the data at a time) looks like this w.r.t. the obje
Regularization in Neural networks Just a guess, but training using something like SGD (which can be considered a type of online learning, in the sense that it sees only a fraction of the data at a time) looks like this w.r.t. the objective function. That is, the "trajcetory" of the objective is declining, but it's stochastically bouncing around. Early stopping means you're picking a point earlier in that trajectory, with parameters that are "suboptimal" in the sense that lower entropy could be obtained on the training data with further training and fine-tuning of parameter estimates. Later in your question, you write that you expect more samples can avoid over-fitting. More training samples can provide more precise parameter estimates, but can't prevent over-fitting on its own. Especially in the case of neural nets, the NN can learn a very complicated function (in the presence of almost any amount of data), but that function may not generalize well to unseen data. Consider a continuum from an underfit model to an optimal model to an overfit model. More training data can move you from underfit to optimal, but moving from optimal to overfit can happen because of a failure to regularize; in the early-stopping paradigm, that means using all available data. Note that there are alternative strategies to addressing overfitting in neural nets, though. One approach is to place a prior over the parameters that penalizes values further from 0. This is usually expressed as adding a term $\lambda\sum_i w_i^2$ to the objective function, where $w$ is the vector of weights, i.e. a 0-mean Gaussian prior over each $w_i$, with variance controlled via $\lambda$. Cross-validation is used to select the optimal $\lambda$.
Regularization in Neural networks Just a guess, but training using something like SGD (which can be considered a type of online learning, in the sense that it sees only a fraction of the data at a time) looks like this w.r.t. the obje
41,595
At what point does cross-validation become overtraining?
Over-optimism with cross validation for stepwise feature selection As @KarlOveHufthammer already explained, using cross validation for (step-wise) feature selection means that the cross validation is part of the model training. More generally, this applies to all kinds of data-driven feature selection, model comparison or optimization procedures. And yes, the problem of overfitting is much more pronounced for iterative training procedures such as a forward selection. (And I think he means that step-wise feature selection usually isn't a good idea - IMHO it would be better to use a regularization that selects features, e.g. LASSO) Iterated/Repeated $k$-fold cross validation defeating its purpose? Iterated aka repeated cross validation covers a particular source of variance in the modeling-testing calculations: the instability of predictions due to slight changes in the composition of the training data, i.e. a particular view on model instability. This is very useful information in case you want to build a predictive model from the particular data set you have at hand (for the particular application). This variance you can measure and successfully reduce by repeated/iterated cross validation (same holds for out-of-bootstrap). Another practically very important source of variance at least for classifier validation results is the variance due to the finite number of test cases. Repeating the cross validation does not change the actual number of independent test cases, so neither is the variance caused by this affected by the repetitions. In small sample size situations and in particular with figures of merit which are proportions of tested cases (overall accuracy, sensitivity, specificity, predictive values etc.) which suffer from high variance, this second source of variance may be the dominating factor of uncertainty. This multiple run approach does generate a distribution of performance values that would be useful to compare different methods Be careful here: CV does not cover the variance between training sets of size $n_{train}$ drawn freshly from the underlying population, only the variance for exchanging a few cases (slightly disturbing the training data) is covered. So you may be able to compare different methods for the data set at hand, but strictly speaking you cannot extend that conclusion to a data set of size $n$. So there's a big difference here whether your focus is on solving the application problem (with whatever method) from the data set at hand or whether you interest are the properties of the method or the underlying population and you don't care for the particular data set as it is just an example. This difference is the part of variance that is underestimated by cross validation from Bengio's point of view (their focus is on the methods, so they would need the variance between disjunct data sets) in Bengio, Y. and Grandvalet, Y. No Unbiased Estimator of the Variance of K-Fold Cross-Validation Journal of Machine Learning Research, 2004, 5, 1089-1105.
At what point does cross-validation become overtraining?
Over-optimism with cross validation for stepwise feature selection As @KarlOveHufthammer already explained, using cross validation for (step-wise) feature selection means that the cross validation is
At what point does cross-validation become overtraining? Over-optimism with cross validation for stepwise feature selection As @KarlOveHufthammer already explained, using cross validation for (step-wise) feature selection means that the cross validation is part of the model training. More generally, this applies to all kinds of data-driven feature selection, model comparison or optimization procedures. And yes, the problem of overfitting is much more pronounced for iterative training procedures such as a forward selection. (And I think he means that step-wise feature selection usually isn't a good idea - IMHO it would be better to use a regularization that selects features, e.g. LASSO) Iterated/Repeated $k$-fold cross validation defeating its purpose? Iterated aka repeated cross validation covers a particular source of variance in the modeling-testing calculations: the instability of predictions due to slight changes in the composition of the training data, i.e. a particular view on model instability. This is very useful information in case you want to build a predictive model from the particular data set you have at hand (for the particular application). This variance you can measure and successfully reduce by repeated/iterated cross validation (same holds for out-of-bootstrap). Another practically very important source of variance at least for classifier validation results is the variance due to the finite number of test cases. Repeating the cross validation does not change the actual number of independent test cases, so neither is the variance caused by this affected by the repetitions. In small sample size situations and in particular with figures of merit which are proportions of tested cases (overall accuracy, sensitivity, specificity, predictive values etc.) which suffer from high variance, this second source of variance may be the dominating factor of uncertainty. This multiple run approach does generate a distribution of performance values that would be useful to compare different methods Be careful here: CV does not cover the variance between training sets of size $n_{train}$ drawn freshly from the underlying population, only the variance for exchanging a few cases (slightly disturbing the training data) is covered. So you may be able to compare different methods for the data set at hand, but strictly speaking you cannot extend that conclusion to a data set of size $n$. So there's a big difference here whether your focus is on solving the application problem (with whatever method) from the data set at hand or whether you interest are the properties of the method or the underlying population and you don't care for the particular data set as it is just an example. This difference is the part of variance that is underestimated by cross validation from Bengio's point of view (their focus is on the methods, so they would need the variance between disjunct data sets) in Bengio, Y. and Grandvalet, Y. No Unbiased Estimator of the Variance of K-Fold Cross-Validation Journal of Machine Learning Research, 2004, 5, 1089-1105.
At what point does cross-validation become overtraining? Over-optimism with cross validation for stepwise feature selection As @KarlOveHufthammer already explained, using cross validation for (step-wise) feature selection means that the cross validation is
41,596
How to choose the regularization parameter in ZCA whitening?
If the data was Gaussian distributed with mean $0$ and unknown covariance $\Sigma$ and we put an inverse-Wishart prior on $\Sigma$, \begin{align} \Sigma &\sim \mathcal{W^{-1}}(\Psi, \nu), \\ x &\sim \mathcal{N}(0, \Sigma), \end{align} the posterior expectation of $\Sigma$ would be $$\frac{XX^\top + \Psi}{n + \nu - p - 1},$$ where $n$ is the number of data points and $p$ is the dimensionality of the data. Choosing $\Psi = I$ and $\nu = p + 1$, for example, we would get $$\frac{XX^\top + I}{n} = C + \frac{1}{n}I = L\left(D + \frac{1}{n}I\right)L^\top,$$ where $C = XX^\top/n$. A sensible choice for $\epsilon$ therefore might be $1/n$. You could go one step further and properly estimate the covariance using a normal-inverse-Wishart prior, i.e., taking the uncertainty of the mean into account as well. Derivations for the posterior can be found in (Murphy, 2007).
How to choose the regularization parameter in ZCA whitening?
If the data was Gaussian distributed with mean $0$ and unknown covariance $\Sigma$ and we put an inverse-Wishart prior on $\Sigma$, \begin{align} \Sigma &\sim \mathcal{W^{-1}}(\Psi, \nu), \\ x &\sim \
How to choose the regularization parameter in ZCA whitening? If the data was Gaussian distributed with mean $0$ and unknown covariance $\Sigma$ and we put an inverse-Wishart prior on $\Sigma$, \begin{align} \Sigma &\sim \mathcal{W^{-1}}(\Psi, \nu), \\ x &\sim \mathcal{N}(0, \Sigma), \end{align} the posterior expectation of $\Sigma$ would be $$\frac{XX^\top + \Psi}{n + \nu - p - 1},$$ where $n$ is the number of data points and $p$ is the dimensionality of the data. Choosing $\Psi = I$ and $\nu = p + 1$, for example, we would get $$\frac{XX^\top + I}{n} = C + \frac{1}{n}I = L\left(D + \frac{1}{n}I\right)L^\top,$$ where $C = XX^\top/n$. A sensible choice for $\epsilon$ therefore might be $1/n$. You could go one step further and properly estimate the covariance using a normal-inverse-Wishart prior, i.e., taking the uncertainty of the mean into account as well. Derivations for the posterior can be found in (Murphy, 2007).
How to choose the regularization parameter in ZCA whitening? If the data was Gaussian distributed with mean $0$ and unknown covariance $\Sigma$ and we put an inverse-Wishart prior on $\Sigma$, \begin{align} \Sigma &\sim \mathcal{W^{-1}}(\Psi, \nu), \\ x &\sim \
41,597
Analyzing Ranked Data: Correlation and Factor Analysis?
Yes. However, not very seldom rankings are treated as interval data and are analyzed by parametric procedures (such as ANOVA). For example, this is customarily done in classic conjoint analysis. Conceptually, psychometrically, rankings are ordinal while ratings are potentially interval (albeit often cautiously treated as ordinal as well). Still, statistically both are just numbers on a quantititative scale, therefore unless specifically statistical assumptions are strongly violated they could be processed in the same manner. Especially by a univariate analysis. Note that if somebody considers each of the 6 variables that you generated in your example separately he will not be able to say whether they are “rankings” or “ratings”. Yes. However, those tests are sensible with interval data either. Yes. However, Spearman is sensible with interval data either, to capture nonlinear monotonic relationship. No. Classic (linear) factor analysis is only for Pearson correlation (and similar SSCP-type measures, read also). Spearman is based on nonlinearly transformed values, ranks (not your original "ranks", rankings - but the ones the procedure internally produces). Linear FA will erroneously "think" that those transformed values are the original values or are linearly transformed original values and will "uncover" linear underlying constructs which actually are not linear or even do not exist in your actual data. So use Pearson - if you dare to see the rakings data as ratings data. Alternatively, there exist special factor analytic procedures for categorical data, such as factor analysis on polychoric correlations, IRT factor analysis, PCA with optimal scaling (CATPCA). Whatever factor analysis or other multivariate analysis you do on the rankings data you should be aware that the ordered multinomial (no ties) nature of ranking task induces negative correlations in the the data. In your code, for example, you generate 6 variables which are random ranking from 1 to 6. Expected correlations between the variables will be all -1/(6-1) = -0.2. (See also, about compsitional data in general>) If these were ratings, the expected correlations would be all 0. I’m speaking of the baseline or background correlations – expected in the absence of substantive factors of interest. The presence of a background general factor does not preclude doing factor analysis, generally, but it may be a complex issue – how to deal with it the best way.
Analyzing Ranked Data: Correlation and Factor Analysis?
Yes. However, not very seldom rankings are treated as interval data and are analyzed by parametric procedures (such as ANOVA). For example, this is customarily done in classic conjoint analysis. Conce
Analyzing Ranked Data: Correlation and Factor Analysis? Yes. However, not very seldom rankings are treated as interval data and are analyzed by parametric procedures (such as ANOVA). For example, this is customarily done in classic conjoint analysis. Conceptually, psychometrically, rankings are ordinal while ratings are potentially interval (albeit often cautiously treated as ordinal as well). Still, statistically both are just numbers on a quantititative scale, therefore unless specifically statistical assumptions are strongly violated they could be processed in the same manner. Especially by a univariate analysis. Note that if somebody considers each of the 6 variables that you generated in your example separately he will not be able to say whether they are “rankings” or “ratings”. Yes. However, those tests are sensible with interval data either. Yes. However, Spearman is sensible with interval data either, to capture nonlinear monotonic relationship. No. Classic (linear) factor analysis is only for Pearson correlation (and similar SSCP-type measures, read also). Spearman is based on nonlinearly transformed values, ranks (not your original "ranks", rankings - but the ones the procedure internally produces). Linear FA will erroneously "think" that those transformed values are the original values or are linearly transformed original values and will "uncover" linear underlying constructs which actually are not linear or even do not exist in your actual data. So use Pearson - if you dare to see the rakings data as ratings data. Alternatively, there exist special factor analytic procedures for categorical data, such as factor analysis on polychoric correlations, IRT factor analysis, PCA with optimal scaling (CATPCA). Whatever factor analysis or other multivariate analysis you do on the rankings data you should be aware that the ordered multinomial (no ties) nature of ranking task induces negative correlations in the the data. In your code, for example, you generate 6 variables which are random ranking from 1 to 6. Expected correlations between the variables will be all -1/(6-1) = -0.2. (See also, about compsitional data in general>) If these were ratings, the expected correlations would be all 0. I’m speaking of the baseline or background correlations – expected in the absence of substantive factors of interest. The presence of a background general factor does not preclude doing factor analysis, generally, but it may be a complex issue – how to deal with it the best way.
Analyzing Ranked Data: Correlation and Factor Analysis? Yes. However, not very seldom rankings are treated as interval data and are analyzed by parametric procedures (such as ANOVA). For example, this is customarily done in classic conjoint analysis. Conce
41,598
GAM versus GLM: same fit, different significance of predictors
The reason that the significance of the coefficients differs is because, under the modeling assumptions, the calculation of standard errors differs. The correct answer is to choose the model that is most appropriate for--not the data--the scientific question at hand. For instance, suppose I am interested in measuring a difference in rates of some disease in communities before and after applying some intervention. I could model the additive rates using a Poisson GLM with the identity link. This presumes that the distribution of rates follows a Poisson distribution. On the other hand, I could model these rates using a simple t-test. This makes no assumption about the distribution of rates and accounts for the possible underdispersion due to infections within a community not necessarily having a constant inter-arrival time. These two models will estimate the same rate difference, but give different standard errors. Which, then, is correct? Well, the adequacy of the underpinning assumptions is what is called into question. Therefore, you should endeavor to describe and rationalize the model that is appropriate for the data--whether or not that model happens to be significant.
GAM versus GLM: same fit, different significance of predictors
The reason that the significance of the coefficients differs is because, under the modeling assumptions, the calculation of standard errors differs. The correct answer is to choose the model that is m
GAM versus GLM: same fit, different significance of predictors The reason that the significance of the coefficients differs is because, under the modeling assumptions, the calculation of standard errors differs. The correct answer is to choose the model that is most appropriate for--not the data--the scientific question at hand. For instance, suppose I am interested in measuring a difference in rates of some disease in communities before and after applying some intervention. I could model the additive rates using a Poisson GLM with the identity link. This presumes that the distribution of rates follows a Poisson distribution. On the other hand, I could model these rates using a simple t-test. This makes no assumption about the distribution of rates and accounts for the possible underdispersion due to infections within a community not necessarily having a constant inter-arrival time. These two models will estimate the same rate difference, but give different standard errors. Which, then, is correct? Well, the adequacy of the underpinning assumptions is what is called into question. Therefore, you should endeavor to describe and rationalize the model that is appropriate for the data--whether or not that model happens to be significant.
GAM versus GLM: same fit, different significance of predictors The reason that the significance of the coefficients differs is because, under the modeling assumptions, the calculation of standard errors differs. The correct answer is to choose the model that is m
41,599
Model comparison between glm (with Firth correction), random Forest, penalised SVM
Its a very big & open question on which metrics are best to use to access classifier performance. This paper did a great job comparing them: Caruana, Rich, and Alexandru Niculescu-Mizil. "Data mining in metric space: an empirical analysis of supervised learning performance criteria." Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining. ACM, 2004. They actually concluded that AUC is one of the best metrics to use - however, its far from foolproof since some methods do better with one metric than another. For example, I'd suspect SVM & RF will do very well with AUC, but GLM might do much better with a probability-based metric such as cross-entropy. tl;dr: no one will criticize you for using AUC, but know that this metric will still be biased towards some methods over others since there is no 'perfect' metric.
Model comparison between glm (with Firth correction), random Forest, penalised SVM
Its a very big & open question on which metrics are best to use to access classifier performance. This paper did a great job comparing them: Caruana, Rich, and Alexandru Niculescu-Mizil. "Data mining
Model comparison between glm (with Firth correction), random Forest, penalised SVM Its a very big & open question on which metrics are best to use to access classifier performance. This paper did a great job comparing them: Caruana, Rich, and Alexandru Niculescu-Mizil. "Data mining in metric space: an empirical analysis of supervised learning performance criteria." Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining. ACM, 2004. They actually concluded that AUC is one of the best metrics to use - however, its far from foolproof since some methods do better with one metric than another. For example, I'd suspect SVM & RF will do very well with AUC, but GLM might do much better with a probability-based metric such as cross-entropy. tl;dr: no one will criticize you for using AUC, but know that this metric will still be biased towards some methods over others since there is no 'perfect' metric.
Model comparison between glm (with Firth correction), random Forest, penalised SVM Its a very big & open question on which metrics are best to use to access classifier performance. This paper did a great job comparing them: Caruana, Rich, and Alexandru Niculescu-Mizil. "Data mining
41,600
Diebold-Mariano test for predictive accuracy
First, you are supposed to supply raw forecast errors to the Diebold-Mariano test function dm.test. However, you are supplying squared forecast errors (in the text part above the separating line). Second, the choice of power is entirely due to the loss function, as you noted. It is only you who knows your loss function. Suppose you lose $x$ dollars if the forecast error is $x$. Then your loss function is linear and you should use the option power=1. On the other hand, your pain may be growing quadratically such that you lose $x^2$ dollars when the forecast error is $x$. Then you should use power=2. If you are unsure about your own loss function, you may ask another question at this site giving the context of your application. But since at one point you say that you are using RMSE as the forecast accuracy measure, it may be sensible to use power=2 to be consistent. Third, $p$-value tells us how likely you are to observe a difference in the losses (due to the forecast errors) that is at least as large as the one currently observed if the losses (due to the forecast errors) were actually equal in population. Sorry for such a long sentence. Finally, I would not be comfortable with an approach like I want to underpin statistically that model 2 has a better accuracy. Shouldn't you care about finding out the truth as much as the available data and the statistical methods can help you? If model 1 was better than model 2 in reality, wouldn't you want to learn that? It may be tempting to abuse statistics to obtain a result you are wishing for, but... But perhaps I am misinterpreting you.
Diebold-Mariano test for predictive accuracy
First, you are supposed to supply raw forecast errors to the Diebold-Mariano test function dm.test. However, you are supplying squared forecast errors (in the text part above the separating line). Sec
Diebold-Mariano test for predictive accuracy First, you are supposed to supply raw forecast errors to the Diebold-Mariano test function dm.test. However, you are supplying squared forecast errors (in the text part above the separating line). Second, the choice of power is entirely due to the loss function, as you noted. It is only you who knows your loss function. Suppose you lose $x$ dollars if the forecast error is $x$. Then your loss function is linear and you should use the option power=1. On the other hand, your pain may be growing quadratically such that you lose $x^2$ dollars when the forecast error is $x$. Then you should use power=2. If you are unsure about your own loss function, you may ask another question at this site giving the context of your application. But since at one point you say that you are using RMSE as the forecast accuracy measure, it may be sensible to use power=2 to be consistent. Third, $p$-value tells us how likely you are to observe a difference in the losses (due to the forecast errors) that is at least as large as the one currently observed if the losses (due to the forecast errors) were actually equal in population. Sorry for such a long sentence. Finally, I would not be comfortable with an approach like I want to underpin statistically that model 2 has a better accuracy. Shouldn't you care about finding out the truth as much as the available data and the statistical methods can help you? If model 1 was better than model 2 in reality, wouldn't you want to learn that? It may be tempting to abuse statistics to obtain a result you are wishing for, but... But perhaps I am misinterpreting you.
Diebold-Mariano test for predictive accuracy First, you are supposed to supply raw forecast errors to the Diebold-Mariano test function dm.test. However, you are supplying squared forecast errors (in the text part above the separating line). Sec