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
12,801
Why does batch norm have learnable scale and shift?
There is a perfect answer in the Deep Learning Book, Section 8.7.1: Normalizing the mean and standard deviation of a unit can reduce the expressive power of the neural network containing that unit. To maintain the expressive power of the network, it is common to replace the batch of hidden unit activations H with γH+β rather than simply the normalized H. The variables γ and β are learned parameters that allow the new variable to have any mean and standard deviation. At first glance, this may seem useless — why did we set the mean to 0, and then introduce a parameter that allows it to be set back to any arbitrary value β? The answer is that the new parametrization can represent the same family of functions of the input as the old parametrization, but the new parametrization has different learning dynamics. In the old parametrization, the mean of H was determined by a complicated interaction between the parameters in the layers below H. In the new parametrization, the mean of γH+β is determined solely by β. The new parametrization is much easier to learn with gradient descent.
Why does batch norm have learnable scale and shift?
There is a perfect answer in the Deep Learning Book, Section 8.7.1: Normalizing the mean and standard deviation of a unit can reduce the expressive power of the neural network containing that unit. T
Why does batch norm have learnable scale and shift? There is a perfect answer in the Deep Learning Book, Section 8.7.1: Normalizing the mean and standard deviation of a unit can reduce the expressive power of the neural network containing that unit. To maintain the expressive power of the network, it is common to replace the batch of hidden unit activations H with γH+β rather than simply the normalized H. The variables γ and β are learned parameters that allow the new variable to have any mean and standard deviation. At first glance, this may seem useless — why did we set the mean to 0, and then introduce a parameter that allows it to be set back to any arbitrary value β? The answer is that the new parametrization can represent the same family of functions of the input as the old parametrization, but the new parametrization has different learning dynamics. In the old parametrization, the mean of H was determined by a complicated interaction between the parameters in the layers below H. In the new parametrization, the mean of γH+β is determined solely by β. The new parametrization is much easier to learn with gradient descent.
Why does batch norm have learnable scale and shift? There is a perfect answer in the Deep Learning Book, Section 8.7.1: Normalizing the mean and standard deviation of a unit can reduce the expressive power of the neural network containing that unit. T
12,802
Can splines be used for prediction?
From my interpretation of the question, the underlying question you are asking is whether or not you can model time as a spline. The first question I will attempt to answer is whether or not you can use splines to extrapolate your data. The short answer is it depends, but the majority of the time, splines are not that great for extrapolation. Splines are essentially a interpolation method, they partition the space your data lies on, and at each partition they fit a simple regressor. So lets look at the method of MARS. The MARS method is defined as $$\hat f(x) = \sum_{i=1}^{n} \alpha_iB_i(x_{[i]})$$ where $\alpha_i$ is the constant at the i'th term in the MARS model, $B_i$ is the bases function at the i'th term, and $x_{[i]}$ represents the feature selected from your feature vector at the i'th term. The basis function can either be a constant or can be a hinge function (rectifier). The hinge function is simply $$max(0,x_{[i]} + c_i)$$ What the hinge function forces the model is to create a piecewise linear function (it is interesting to note that a neural network with a rectified linear activation function can be seen as the superset model of the MARS model). So to get back to the question of why splines are usually not that great for extrapolation is to realize that once the point you need extrapolated starts to lie pasts the boundaries of the interpolation only either a very small part of your model will be"activated" or a very large part of it will be "activated", and therefore the power of the model disappears (because of the lack of variation). To get a little bit more intuition about this let us pretend that we are trying to fit a MARS model to a feature space lying in $\mathbb{R}$. So given one number we try to predict another. The MARS model comes up with a function that looks something like this: $$\hat f(x)= 5 + max(0,x - 5) + 2max(0,x-10)$$ If the extrapolation occurs past the number $10$ the function now becomes $$\hat f(x) = 10 +2(x-10)= 2x-10$$ The MARS model we had before now boils down to a single linear function and therefore the power of the MARS model disappears (this is the case of the majority of terms "activating"). The same thing will happen for extrapolation before the number $5$. The output of the MARS model will then simply be a constant. This is why the majority of the time, splines are not suited for extrapolation. This also explains the problem you mentioned in the comments of your posts, about extrapolated predictions being "very off for new values" and that they tend to "continue in the same direction" for different time series. Now lets get back to time series. Time series are a pretty special case in machine learning. They tend to have a bit of structure, whether it be partial in-variance or one of the many different types of substructures, and this structure can be exploited. But special algorithms are needed that are able to exploit this structure, unfortunately splines do not do this. There are a couple things I would recommend you try out. The first one would be reccurent networks. If your time series is not that long (and does not have long term dependencies) you should be able to get away with using a simple vanilla recurrent network. If you wanted to be able to understand what is happening, you could use a rectified linear unit with biases as an activation function and that will be equivalent to doing MARS modelling on the subset of the timeseries and the "memory" that the recurrent neural net holds. It'd be hard to interpret how the memory is managed by the net, but you should gain some idea how the subspace is being handled with respect to the piecewise linear function generated. Also if you have static features that do not belong to the time series it is relatively easy to still use them in the net. If the time series you have is very long and might have long term dependencies, I recommend using one of the gated recurrent networks, something like GRU or LSTM. On the more classical side of time series classification you could use hidden markov models. I won't go further into these, because I am not as familiar with them. In conclusion, I would not recommend using splines for two reasons. One, it is not able to handle complicated extrapolation problems, which seems to be the problem that you are describing. And two, splines do not exploit the substructures of time series which can be very powerful in time series classification. Hope this helps.
Can splines be used for prediction?
From my interpretation of the question, the underlying question you are asking is whether or not you can model time as a spline. The first question I will attempt to answer is whether or not you ca
Can splines be used for prediction? From my interpretation of the question, the underlying question you are asking is whether or not you can model time as a spline. The first question I will attempt to answer is whether or not you can use splines to extrapolate your data. The short answer is it depends, but the majority of the time, splines are not that great for extrapolation. Splines are essentially a interpolation method, they partition the space your data lies on, and at each partition they fit a simple regressor. So lets look at the method of MARS. The MARS method is defined as $$\hat f(x) = \sum_{i=1}^{n} \alpha_iB_i(x_{[i]})$$ where $\alpha_i$ is the constant at the i'th term in the MARS model, $B_i$ is the bases function at the i'th term, and $x_{[i]}$ represents the feature selected from your feature vector at the i'th term. The basis function can either be a constant or can be a hinge function (rectifier). The hinge function is simply $$max(0,x_{[i]} + c_i)$$ What the hinge function forces the model is to create a piecewise linear function (it is interesting to note that a neural network with a rectified linear activation function can be seen as the superset model of the MARS model). So to get back to the question of why splines are usually not that great for extrapolation is to realize that once the point you need extrapolated starts to lie pasts the boundaries of the interpolation only either a very small part of your model will be"activated" or a very large part of it will be "activated", and therefore the power of the model disappears (because of the lack of variation). To get a little bit more intuition about this let us pretend that we are trying to fit a MARS model to a feature space lying in $\mathbb{R}$. So given one number we try to predict another. The MARS model comes up with a function that looks something like this: $$\hat f(x)= 5 + max(0,x - 5) + 2max(0,x-10)$$ If the extrapolation occurs past the number $10$ the function now becomes $$\hat f(x) = 10 +2(x-10)= 2x-10$$ The MARS model we had before now boils down to a single linear function and therefore the power of the MARS model disappears (this is the case of the majority of terms "activating"). The same thing will happen for extrapolation before the number $5$. The output of the MARS model will then simply be a constant. This is why the majority of the time, splines are not suited for extrapolation. This also explains the problem you mentioned in the comments of your posts, about extrapolated predictions being "very off for new values" and that they tend to "continue in the same direction" for different time series. Now lets get back to time series. Time series are a pretty special case in machine learning. They tend to have a bit of structure, whether it be partial in-variance or one of the many different types of substructures, and this structure can be exploited. But special algorithms are needed that are able to exploit this structure, unfortunately splines do not do this. There are a couple things I would recommend you try out. The first one would be reccurent networks. If your time series is not that long (and does not have long term dependencies) you should be able to get away with using a simple vanilla recurrent network. If you wanted to be able to understand what is happening, you could use a rectified linear unit with biases as an activation function and that will be equivalent to doing MARS modelling on the subset of the timeseries and the "memory" that the recurrent neural net holds. It'd be hard to interpret how the memory is managed by the net, but you should gain some idea how the subspace is being handled with respect to the piecewise linear function generated. Also if you have static features that do not belong to the time series it is relatively easy to still use them in the net. If the time series you have is very long and might have long term dependencies, I recommend using one of the gated recurrent networks, something like GRU or LSTM. On the more classical side of time series classification you could use hidden markov models. I won't go further into these, because I am not as familiar with them. In conclusion, I would not recommend using splines for two reasons. One, it is not able to handle complicated extrapolation problems, which seems to be the problem that you are describing. And two, splines do not exploit the substructures of time series which can be very powerful in time series classification. Hope this helps.
Can splines be used for prediction? From my interpretation of the question, the underlying question you are asking is whether or not you can model time as a spline. The first question I will attempt to answer is whether or not you ca
12,803
What to say to a client that thinks confidence intervals are too wide to be useful?
It depends on what the client means by "useful". Your client's suggestion that you arbitrarily narrow the intervals seems to reflect a misunderstanding that, by narrowing the intervals you've somehow magically decreased the margin of error. Assuming the data set has already been collected and is fixed (if this isn't the case, @shabbychef's joke in the comments gives you your answer), any response to your client should emphasize and describe why there's no "free lunch" and that you are sacrificing something by narrowing the intervals. Specifically, since the data set is fixed, the only way you can reduce the width of the confidence interval is by decreasing the confidence level. Therefore, you have the choice between a wider interval that you're more confident contains the true parameter value or a narrower interval that you're less confident about. That is, wider confidence intervals are more conservative. Of course, you can never just optimize either width or confidence level mindlessly, since you can vacuously generate a $100 \%$ confidence interval by letting it span the entire parameter space and can get an infinitely narrow confidence interval, although it will have $0 \%$ coverage. Whether or not a less conservative interval is more useful clearly depends both on the context and how the width of the interval varies as a function of the confidence level, but I'm having trouble envisioning an application where using a much lower confidence level to obtain narrower intervals would be preferable. Also, it's worth pointing out that the $95 \%$ confidence interval has become so ubiquitous that it will be hard to justify why you're, for example, using a $60\%$ confidence interval.
What to say to a client that thinks confidence intervals are too wide to be useful?
It depends on what the client means by "useful". Your client's suggestion that you arbitrarily narrow the intervals seems to reflect a misunderstanding that, by narrowing the intervals you've somehow
What to say to a client that thinks confidence intervals are too wide to be useful? It depends on what the client means by "useful". Your client's suggestion that you arbitrarily narrow the intervals seems to reflect a misunderstanding that, by narrowing the intervals you've somehow magically decreased the margin of error. Assuming the data set has already been collected and is fixed (if this isn't the case, @shabbychef's joke in the comments gives you your answer), any response to your client should emphasize and describe why there's no "free lunch" and that you are sacrificing something by narrowing the intervals. Specifically, since the data set is fixed, the only way you can reduce the width of the confidence interval is by decreasing the confidence level. Therefore, you have the choice between a wider interval that you're more confident contains the true parameter value or a narrower interval that you're less confident about. That is, wider confidence intervals are more conservative. Of course, you can never just optimize either width or confidence level mindlessly, since you can vacuously generate a $100 \%$ confidence interval by letting it span the entire parameter space and can get an infinitely narrow confidence interval, although it will have $0 \%$ coverage. Whether or not a less conservative interval is more useful clearly depends both on the context and how the width of the interval varies as a function of the confidence level, but I'm having trouble envisioning an application where using a much lower confidence level to obtain narrower intervals would be preferable. Also, it's worth pointing out that the $95 \%$ confidence interval has become so ubiquitous that it will be hard to justify why you're, for example, using a $60\%$ confidence interval.
What to say to a client that thinks confidence intervals are too wide to be useful? It depends on what the client means by "useful". Your client's suggestion that you arbitrarily narrow the intervals seems to reflect a misunderstanding that, by narrowing the intervals you've somehow
12,804
What to say to a client that thinks confidence intervals are too wide to be useful?
I would suggest it entirely depends on what your client wants to use the confidence intervals for. Some sort of report/publication/etc. where 95% CI's are normally reported. I might very well tell him "That's not statistically justified" and leave it there, depending on whether or not the client tends to defer to your expertise. If they don't, you have to make a judgement about your own professional comfort with what they want. Some sort of internal document - I'd make it clear you disagree, and make it clear what type of confidence interval the reader is now looking at, since it's not 95%. As a measure of estimate uncertainty, say to determine how much sensitivity analysis one might have to do? I'd give them a figure showing the full distribution with both the 95% CI and something like a 68% CI marked and let them have at it. I would be quite proud of myself if I managed to keep "So run a bigger study" from being the first thing out of my mouth.
What to say to a client that thinks confidence intervals are too wide to be useful?
I would suggest it entirely depends on what your client wants to use the confidence intervals for. Some sort of report/publication/etc. where 95% CI's are normally reported. I might very well tell h
What to say to a client that thinks confidence intervals are too wide to be useful? I would suggest it entirely depends on what your client wants to use the confidence intervals for. Some sort of report/publication/etc. where 95% CI's are normally reported. I might very well tell him "That's not statistically justified" and leave it there, depending on whether or not the client tends to defer to your expertise. If they don't, you have to make a judgement about your own professional comfort with what they want. Some sort of internal document - I'd make it clear you disagree, and make it clear what type of confidence interval the reader is now looking at, since it's not 95%. As a measure of estimate uncertainty, say to determine how much sensitivity analysis one might have to do? I'd give them a figure showing the full distribution with both the 95% CI and something like a 68% CI marked and let them have at it. I would be quite proud of myself if I managed to keep "So run a bigger study" from being the first thing out of my mouth.
What to say to a client that thinks confidence intervals are too wide to be useful? I would suggest it entirely depends on what your client wants to use the confidence intervals for. Some sort of report/publication/etc. where 95% CI's are normally reported. I might very well tell h
12,805
What to say to a client that thinks confidence intervals are too wide to be useful?
Use the Standard Deviation, as most people do. 95% CI can be scary when people are used to the 68%CI.
What to say to a client that thinks confidence intervals are too wide to be useful?
Use the Standard Deviation, as most people do. 95% CI can be scary when people are used to the 68%CI.
What to say to a client that thinks confidence intervals are too wide to be useful? Use the Standard Deviation, as most people do. 95% CI can be scary when people are used to the 68%CI.
What to say to a client that thinks confidence intervals are too wide to be useful? Use the Standard Deviation, as most people do. 95% CI can be scary when people are used to the 68%CI.
12,806
What to say to a client that thinks confidence intervals are too wide to be useful?
You provide a confidence interval at a certain standard level such as 90% or 95%. The client can judge whether or not the interval is too wide to be useful. But of course that does not mean that you can shorten it to make it useful. You can suggest that increasing the sample size will decrease the width of an interval at a given confidence level as it decreases roughly by a factor of the square root of the sample size.
What to say to a client that thinks confidence intervals are too wide to be useful?
You provide a confidence interval at a certain standard level such as 90% or 95%. The client can judge whether or not the interval is too wide to be useful. But of course that does not mean that you
What to say to a client that thinks confidence intervals are too wide to be useful? You provide a confidence interval at a certain standard level such as 90% or 95%. The client can judge whether or not the interval is too wide to be useful. But of course that does not mean that you can shorten it to make it useful. You can suggest that increasing the sample size will decrease the width of an interval at a given confidence level as it decreases roughly by a factor of the square root of the sample size.
What to say to a client that thinks confidence intervals are too wide to be useful? You provide a confidence interval at a certain standard level such as 90% or 95%. The client can judge whether or not the interval is too wide to be useful. But of course that does not mean that you
12,807
How to fix the problem in this XKCD comic?
"What is the correct way to analyze this data?" There have been good answer suggesting analyses already. I'd like to add that there is no unique "correct" analysis of the data. For example, does it make sense to assume linearity given that the grade scale is limited? Obviously a linear model will be wrong, but then "all models are wrong but some are useful" - this one may or may not be useful, and an effective sample size of three (beyond which you don't go repeating observations for the three students) for sure is not enough to assess how good or harmful the linearity assumption actually is. One could do something like a logit transform of the exam (percentage) grades, and based on the fact that this at least produces the correct value range (unless people score 0 or 100, but this is easy to repair, if not in a uniquely correct manner) arguably this should be preferred, but once more the data do not allow to assess this in any detail. Furthermore, if we're talking about students from the same class, there may be dependence even between the students, for which there is no way to assess this from the data alone - and collecting more students from the same class won't help with that either. So the baseline is that any analysis will require subjective decisions for or against which there may be arguments, in some way or another taking background knowledge into account that may go further than what we actually know (like grade distributions from earlier courses), but there is no formal "objective" way to decide between them (other than pointing out obvious flaws in certain analyses as the ignorance of dependence in the cartoon), and so there is no single "correct way" to analyse these (or any) data.
How to fix the problem in this XKCD comic?
"What is the correct way to analyze this data?" There have been good answer suggesting analyses already. I'd like to add that there is no unique "correct" analysis of the data. For example, does it ma
How to fix the problem in this XKCD comic? "What is the correct way to analyze this data?" There have been good answer suggesting analyses already. I'd like to add that there is no unique "correct" analysis of the data. For example, does it make sense to assume linearity given that the grade scale is limited? Obviously a linear model will be wrong, but then "all models are wrong but some are useful" - this one may or may not be useful, and an effective sample size of three (beyond which you don't go repeating observations for the three students) for sure is not enough to assess how good or harmful the linearity assumption actually is. One could do something like a logit transform of the exam (percentage) grades, and based on the fact that this at least produces the correct value range (unless people score 0 or 100, but this is easy to repair, if not in a uniquely correct manner) arguably this should be preferred, but once more the data do not allow to assess this in any detail. Furthermore, if we're talking about students from the same class, there may be dependence even between the students, for which there is no way to assess this from the data alone - and collecting more students from the same class won't help with that either. So the baseline is that any analysis will require subjective decisions for or against which there may be arguments, in some way or another taking background knowledge into account that may go further than what we actually know (like grade distributions from earlier courses), but there is no formal "objective" way to decide between them (other than pointing out obvious flaws in certain analyses as the ignorance of dependence in the cartoon), and so there is no single "correct way" to analyse these (or any) data.
How to fix the problem in this XKCD comic? "What is the correct way to analyze this data?" There have been good answer suggesting analyses already. I'd like to add that there is no unique "correct" analysis of the data. For example, does it ma
12,808
How to fix the problem in this XKCD comic?
Your question is composed of multiple questions/issues. I can answer the first one, the second is still unclear to me. summary(lmer(grade ~ loudness + (1 | student), pane3)) What happened here is that the mixed effects model is effectively fitting three lines that have different (random) intercepts, instead of a single line. This results in the following output for fixed effects Fixed effects: Estimate Std. Error t value (Intercept) 76.521 11.866 6.449 loudness 0.111 0.119 0.933 the slope of $\beta = 0.111$ instead of $\beta = 1.94$ is more like an effect within subjects rather than between subjects. It could be possible that the effect of loudness has an effect within subjects, and by measuring the subjects many times, you could observe a significant effect. summary(lm.cluster(data = pane3, formula = grade ~ loudness, cluster = "student")) to be continued, it is not so clear what this method does, but giving a p-value of 0.12 is indeed weird In addition you have a third question How to fix the problem in this XKCD comic? You fix this by sampling more people. Alternatively, you can sample the same people multiple times*. This should reduce the noise in the case that there is not only an error from person to person, but also within the persons. If you sample the same person multiple times then you get more accurate information about that average performance of that person, and you reduce the influence of the noise due to the same person potentially having different exam results. In the first pane of the XKCD image, the results where highly variable. In the third pane it was still the same. The XKCD comic, stages the situation where the exam grade is not much variable within the same person. (Or it is even the same because they seem to have only repeated the loudness measurements and the variations in exam grade are due to your data scraping). That is not necessarily the case when some resampling is done. Consider the following Of course, it might be still doubtful whether inference with only three data points is a good idea. And possibly one should use a model that considers the error in the x-variable (like Deming regression). But the point is that repetitions within subjects can improve the accuracy of the estimates. *In fact, this way might be even better, because it allows you to observe the within subject error and assess the goodness of fit. This is why scientists in quantitative fields like to perform duplicate or triplicate measurements.
How to fix the problem in this XKCD comic?
Your question is composed of multiple questions/issues. I can answer the first one, the second is still unclear to me. summary(lmer(grade ~ loudness + (1 | student), pane3)) What happened here is th
How to fix the problem in this XKCD comic? Your question is composed of multiple questions/issues. I can answer the first one, the second is still unclear to me. summary(lmer(grade ~ loudness + (1 | student), pane3)) What happened here is that the mixed effects model is effectively fitting three lines that have different (random) intercepts, instead of a single line. This results in the following output for fixed effects Fixed effects: Estimate Std. Error t value (Intercept) 76.521 11.866 6.449 loudness 0.111 0.119 0.933 the slope of $\beta = 0.111$ instead of $\beta = 1.94$ is more like an effect within subjects rather than between subjects. It could be possible that the effect of loudness has an effect within subjects, and by measuring the subjects many times, you could observe a significant effect. summary(lm.cluster(data = pane3, formula = grade ~ loudness, cluster = "student")) to be continued, it is not so clear what this method does, but giving a p-value of 0.12 is indeed weird In addition you have a third question How to fix the problem in this XKCD comic? You fix this by sampling more people. Alternatively, you can sample the same people multiple times*. This should reduce the noise in the case that there is not only an error from person to person, but also within the persons. If you sample the same person multiple times then you get more accurate information about that average performance of that person, and you reduce the influence of the noise due to the same person potentially having different exam results. In the first pane of the XKCD image, the results where highly variable. In the third pane it was still the same. The XKCD comic, stages the situation where the exam grade is not much variable within the same person. (Or it is even the same because they seem to have only repeated the loudness measurements and the variations in exam grade are due to your data scraping). That is not necessarily the case when some resampling is done. Consider the following Of course, it might be still doubtful whether inference with only three data points is a good idea. And possibly one should use a model that considers the error in the x-variable (like Deming regression). But the point is that repetitions within subjects can improve the accuracy of the estimates. *In fact, this way might be even better, because it allows you to observe the within subject error and assess the goodness of fit. This is why scientists in quantitative fields like to perform duplicate or triplicate measurements.
How to fix the problem in this XKCD comic? Your question is composed of multiple questions/issues. I can answer the first one, the second is still unclear to me. summary(lmer(grade ~ loudness + (1 | student), pane3)) What happened here is th
12,809
How to fix the problem in this XKCD comic?
This can be done with the nlme or lme4 packaes easily, all you have to add is a random effect for the students (and slope). > library(nlme) > summary(lme(grade~loudness,random=~1|student/loudness,data=pane3)) ... Random effects: Formula: ~1 | student (Intercept) StdDev: 9.131586 Formula: ~1 | loudness %in% student (Intercept) Residual StdDev: 0.04725001 0.07510526 Fixed effects: grade ~ loudness Value Std.Error DF t-value p-value (Intercept) 76.52081 11.866096 8 6.448693 0.0002 loudness 0.11097 0.118994 8 0.932552 0.3783 ... loudness not significant.
How to fix the problem in this XKCD comic?
This can be done with the nlme or lme4 packaes easily, all you have to add is a random effect for the students (and slope). > library(nlme) > summary(lme(grade~loudness,random=~1|student/loudness,data
How to fix the problem in this XKCD comic? This can be done with the nlme or lme4 packaes easily, all you have to add is a random effect for the students (and slope). > library(nlme) > summary(lme(grade~loudness,random=~1|student/loudness,data=pane3)) ... Random effects: Formula: ~1 | student (Intercept) StdDev: 9.131586 Formula: ~1 | loudness %in% student (Intercept) Residual StdDev: 0.04725001 0.07510526 Fixed effects: grade ~ loudness Value Std.Error DF t-value p-value (Intercept) 76.52081 11.866096 8 6.448693 0.0002 loudness 0.11097 0.118994 8 0.932552 0.3783 ... loudness not significant.
How to fix the problem in this XKCD comic? This can be done with the nlme or lme4 packaes easily, all you have to add is a random effect for the students (and slope). > library(nlme) > summary(lme(grade~loudness,random=~1|student/loudness,data
12,810
What are the disadvantages of the profile likelihood?
The estimate of $\theta_1$ from the profile likelihood is just the MLE. Maximizing with respect to $\theta_2$ for each possible $\theta_1$ and then maximizing with respect to $\theta_1$ is the same as maximizing with respect to $(\theta_1, \theta_2)$ jointly. The key weakness is that, if you base your estimate of the SE of $\hat{\theta}_1$ on the curvature of the profile likelihood, you are not fully accounting for the uncertainty in $\theta_2$. McCullagh and Nelder, Generalized linear models, 2nd edition, has a short section on profile likelihood (Sec 7.2.4, pgs 254-255). They say: [A]pproximate confidence sets may be obtained in the usual way....such confidence intervals are often satisfactory if [the dimension of $\theta_2$] is small in relation to the total Fisher information, but are liable to be misleading otherwise.... Unfortunately [the profile log likelihood] is not a log likelihood function in the usual sense. Most obviously, its derivative does not have zero mean, a property that is essential for estimating equations.
What are the disadvantages of the profile likelihood?
The estimate of $\theta_1$ from the profile likelihood is just the MLE. Maximizing with respect to $\theta_2$ for each possible $\theta_1$ and then maximizing with respect to $\theta_1$ is the same a
What are the disadvantages of the profile likelihood? The estimate of $\theta_1$ from the profile likelihood is just the MLE. Maximizing with respect to $\theta_2$ for each possible $\theta_1$ and then maximizing with respect to $\theta_1$ is the same as maximizing with respect to $(\theta_1, \theta_2)$ jointly. The key weakness is that, if you base your estimate of the SE of $\hat{\theta}_1$ on the curvature of the profile likelihood, you are not fully accounting for the uncertainty in $\theta_2$. McCullagh and Nelder, Generalized linear models, 2nd edition, has a short section on profile likelihood (Sec 7.2.4, pgs 254-255). They say: [A]pproximate confidence sets may be obtained in the usual way....such confidence intervals are often satisfactory if [the dimension of $\theta_2$] is small in relation to the total Fisher information, but are liable to be misleading otherwise.... Unfortunately [the profile log likelihood] is not a log likelihood function in the usual sense. Most obviously, its derivative does not have zero mean, a property that is essential for estimating equations.
What are the disadvantages of the profile likelihood? The estimate of $\theta_1$ from the profile likelihood is just the MLE. Maximizing with respect to $\theta_2$ for each possible $\theta_1$ and then maximizing with respect to $\theta_1$ is the same a
12,811
What are the disadvantages of the profile likelihood?
The major drawback is that the profile likelihood is completely meaningless. The profile likelihood should be viewed as intermediate quantity that facilitates applications of asymptotic approximations (Wilks etc) for the purpose of constructing a confidence intervals and regions. By itself, however, it doesn't have any coherent meaning or interpretation that I'm aware of.
What are the disadvantages of the profile likelihood?
The major drawback is that the profile likelihood is completely meaningless. The profile likelihood should be viewed as intermediate quantity that facilitates applications of asymptotic approximations
What are the disadvantages of the profile likelihood? The major drawback is that the profile likelihood is completely meaningless. The profile likelihood should be viewed as intermediate quantity that facilitates applications of asymptotic approximations (Wilks etc) for the purpose of constructing a confidence intervals and regions. By itself, however, it doesn't have any coherent meaning or interpretation that I'm aware of.
What are the disadvantages of the profile likelihood? The major drawback is that the profile likelihood is completely meaningless. The profile likelihood should be viewed as intermediate quantity that facilitates applications of asymptotic approximations
12,812
When do Markov random fields $\neq$ exponential families?
You are entirely correct -- the argument you presented relates the exponential family to the principle of maximum entropy, but doesn't have anything to do with MRFs. To address your three initial questions: Can all members from the Exponential families be represented as an MRF? Yes. In fact, any density or mass function can be represented as an MRF! According to Wikipedia [1], an MRF is defined as a set of random variables that are Markov with respect to an undirected graph. Equivalently, the joint distribution of the variables can be written with the following factorization: $$P(X=x) = \prod_{C \in cl(G)} \phi_C(X_C = x_C)$$ where $cl(G)$ is the set of maximal cliques in $G$. From this definition you can see that a fully connected graph, while completely uninformative, is consistent with any distribution. Are all MRFs members of the Exponential families? No. Since all distributions can be represented as MRFs (and not all distributions belong to the exponential family) there must be some "MRF members" that are not exponential family members. Still, this is a perfectly natural question -- it seems like the vast majority of MRFs people use in practice $are$ exponential family distributions. All finite-domain discrete MRFs and Gaussian MRFs are members of the exponential family. In fact, since products of exponential family distributions are also in the exponential family, the joint distribution of any MRF in which every potential function has the form of an (unnormalized) exponential family member will itself be in the exponential family. If MRFs $\neq$ Exponential families, what are some good examples of distributions of one type not included in the other? Mixture distributions are common examples of non-exponential family distributions. Consider the linear Gaussian state space model (like a hidden Markov model, but with continuous hidden states and Gaussian transition and emission distributions). If you replace the transition kernel with a mixture of Gaussians, the resulting distribution is no longer in the exponential family (but it still retains the rich conditional independence structure characteristic of practical graphical models). [1] http://en.wikipedia.org/wiki/Markov_random_field
When do Markov random fields $\neq$ exponential families?
You are entirely correct -- the argument you presented relates the exponential family to the principle of maximum entropy, but doesn't have anything to do with MRFs. To address your three initial ques
When do Markov random fields $\neq$ exponential families? You are entirely correct -- the argument you presented relates the exponential family to the principle of maximum entropy, but doesn't have anything to do with MRFs. To address your three initial questions: Can all members from the Exponential families be represented as an MRF? Yes. In fact, any density or mass function can be represented as an MRF! According to Wikipedia [1], an MRF is defined as a set of random variables that are Markov with respect to an undirected graph. Equivalently, the joint distribution of the variables can be written with the following factorization: $$P(X=x) = \prod_{C \in cl(G)} \phi_C(X_C = x_C)$$ where $cl(G)$ is the set of maximal cliques in $G$. From this definition you can see that a fully connected graph, while completely uninformative, is consistent with any distribution. Are all MRFs members of the Exponential families? No. Since all distributions can be represented as MRFs (and not all distributions belong to the exponential family) there must be some "MRF members" that are not exponential family members. Still, this is a perfectly natural question -- it seems like the vast majority of MRFs people use in practice $are$ exponential family distributions. All finite-domain discrete MRFs and Gaussian MRFs are members of the exponential family. In fact, since products of exponential family distributions are also in the exponential family, the joint distribution of any MRF in which every potential function has the form of an (unnormalized) exponential family member will itself be in the exponential family. If MRFs $\neq$ Exponential families, what are some good examples of distributions of one type not included in the other? Mixture distributions are common examples of non-exponential family distributions. Consider the linear Gaussian state space model (like a hidden Markov model, but with continuous hidden states and Gaussian transition and emission distributions). If you replace the transition kernel with a mixture of Gaussians, the resulting distribution is no longer in the exponential family (but it still retains the rich conditional independence structure characteristic of practical graphical models). [1] http://en.wikipedia.org/wiki/Markov_random_field
When do Markov random fields $\neq$ exponential families? You are entirely correct -- the argument you presented relates the exponential family to the principle of maximum entropy, but doesn't have anything to do with MRFs. To address your three initial ques
12,813
Need for centering and standardizing data in regression
You are correct about zeroing the means of the columns of $A$ and $b$. However, as for adjusting the norms of the columns of $A$, consider what would happen if you started out with a normed $A$, and all the elements of $x$ were of roughly the same magnitude. Then let us multiply one column by, say, $10^{-6}$. The corresponding element of $x$ would, in an unregularized regression, be increased by a factor of $10^6$. See what would happen to the regularization term? The regularization would, for all practical purposes, apply only to that one coefficient. By norming the columns of $A$, we, writing intuitively, put them all on the same scale. Consequently, differences in the magnitudes of the elements of $x$ are directly related to the "wiggliness" of the explanatory function ($Ax$), which is, loosely speaking, what the regularization tries to control. Without it, a coefficient value of, e.g., 0.1 vs. another of 10.0 would tell you, in the absence of knowledge about $A$, nothing about which coefficient was contributing the most to the "wiggliness" of $Ax$. (For a linear function, like $Ax$, "wiggliness" is related to deviation from 0.) To return to your explanation, if one column of $A$ has a very high norm, and for some reason gets a low coefficient in $x$, we would not conclude that the column of $A$ doesn't "explain" $x$ well. $A$ doesn't "explain" $x$ at all.
Need for centering and standardizing data in regression
You are correct about zeroing the means of the columns of $A$ and $b$. However, as for adjusting the norms of the columns of $A$, consider what would happen if you started out with a normed $A$, and
Need for centering and standardizing data in regression You are correct about zeroing the means of the columns of $A$ and $b$. However, as for adjusting the norms of the columns of $A$, consider what would happen if you started out with a normed $A$, and all the elements of $x$ were of roughly the same magnitude. Then let us multiply one column by, say, $10^{-6}$. The corresponding element of $x$ would, in an unregularized regression, be increased by a factor of $10^6$. See what would happen to the regularization term? The regularization would, for all practical purposes, apply only to that one coefficient. By norming the columns of $A$, we, writing intuitively, put them all on the same scale. Consequently, differences in the magnitudes of the elements of $x$ are directly related to the "wiggliness" of the explanatory function ($Ax$), which is, loosely speaking, what the regularization tries to control. Without it, a coefficient value of, e.g., 0.1 vs. another of 10.0 would tell you, in the absence of knowledge about $A$, nothing about which coefficient was contributing the most to the "wiggliness" of $Ax$. (For a linear function, like $Ax$, "wiggliness" is related to deviation from 0.) To return to your explanation, if one column of $A$ has a very high norm, and for some reason gets a low coefficient in $x$, we would not conclude that the column of $A$ doesn't "explain" $x$ well. $A$ doesn't "explain" $x$ at all.
Need for centering and standardizing data in regression You are correct about zeroing the means of the columns of $A$ and $b$. However, as for adjusting the norms of the columns of $A$, consider what would happen if you started out with a normed $A$, and
12,814
"Semi supervised learning" - is this overfitting?
It doesn't appear to be overfitting. Intuitively, overfitting implies training to the quirks (noise) of the training set and therefore doing worse on a held-out test set which does not share these quirks. If I understand what happened, they did not do unexpectedly-poorly on held-out test data and so that empirically rules out overfitting. (They have another issue, which I'll mention at the end, but it's not overfitting.) So you are correct that it takes advantage of the available (30%?) test data. The question is: how? If the available test data has labels associated with it, you could simply lump it into your training data and enlarge your training data, which in general would yield better results in an obvious way. No real accomplishment there. Note that the labels wouldn't have to be explicitly listed if you have access to an accuracy score. You could simply climb the accuracy gradient by repeatedly submitting scores, which is what people have done in the past with poorly-designed competitions. Given that the available test data does not have labels associated with it -- directly or indirectly -- there are at least two other possibilities: First, this could be an indirect boosting method where you're focusing on cases where your predictions with only the training data disagree with your predictions with the pseudo-labeled test data included. Second, it could be straightforward semi-supervised learning. Intuitively: you could be using the density of unlabeled data to help shape the classification boundaries of a supervised method. See the illustration (https://en.wikipedia.org/wiki/Semi-supervised_learning#/media/File:Example_of_unlabeled_data_in_semisupervised_learning.png) in the Wikipedia definition of semi-supervised learning to clarify. BUT this doesn't mean that there isn't a trick here. And that trick comes from the definition of training and test data. In principle, training data represents data that you could have in hand when you are ready to deploy your model. And test data represents future data that will come into your system once it's operational. In that case, training on test data is a leak from the future, where you are taking advantage of data you would not have seen yet. This is a major issue in the real world, where some variables may not exist until after the fact (say after an investigation is done) or may be updated at a later date. So they are meta-gaming here: what they did is legitimate within the rules of the competition, because they were given access to some of the test data. But it's not legitimate in the real world, where the true test is how well it does in the future, on new data.
"Semi supervised learning" - is this overfitting?
It doesn't appear to be overfitting. Intuitively, overfitting implies training to the quirks (noise) of the training set and therefore doing worse on a held-out test set which does not share these qui
"Semi supervised learning" - is this overfitting? It doesn't appear to be overfitting. Intuitively, overfitting implies training to the quirks (noise) of the training set and therefore doing worse on a held-out test set which does not share these quirks. If I understand what happened, they did not do unexpectedly-poorly on held-out test data and so that empirically rules out overfitting. (They have another issue, which I'll mention at the end, but it's not overfitting.) So you are correct that it takes advantage of the available (30%?) test data. The question is: how? If the available test data has labels associated with it, you could simply lump it into your training data and enlarge your training data, which in general would yield better results in an obvious way. No real accomplishment there. Note that the labels wouldn't have to be explicitly listed if you have access to an accuracy score. You could simply climb the accuracy gradient by repeatedly submitting scores, which is what people have done in the past with poorly-designed competitions. Given that the available test data does not have labels associated with it -- directly or indirectly -- there are at least two other possibilities: First, this could be an indirect boosting method where you're focusing on cases where your predictions with only the training data disagree with your predictions with the pseudo-labeled test data included. Second, it could be straightforward semi-supervised learning. Intuitively: you could be using the density of unlabeled data to help shape the classification boundaries of a supervised method. See the illustration (https://en.wikipedia.org/wiki/Semi-supervised_learning#/media/File:Example_of_unlabeled_data_in_semisupervised_learning.png) in the Wikipedia definition of semi-supervised learning to clarify. BUT this doesn't mean that there isn't a trick here. And that trick comes from the definition of training and test data. In principle, training data represents data that you could have in hand when you are ready to deploy your model. And test data represents future data that will come into your system once it's operational. In that case, training on test data is a leak from the future, where you are taking advantage of data you would not have seen yet. This is a major issue in the real world, where some variables may not exist until after the fact (say after an investigation is done) or may be updated at a later date. So they are meta-gaming here: what they did is legitimate within the rules of the competition, because they were given access to some of the test data. But it's not legitimate in the real world, where the true test is how well it does in the future, on new data.
"Semi supervised learning" - is this overfitting? It doesn't appear to be overfitting. Intuitively, overfitting implies training to the quirks (noise) of the training set and therefore doing worse on a held-out test set which does not share these qui
12,815
"Semi supervised learning" - is this overfitting?
It is not gross over fitting (depending on definition). Target information of test set is preserved. Semi-supervised allow to generate an extra synthetic data set to train the model on. In the described approach, original training data is mixed unweighted with synthetic in ratio 4:3. Thus, if the quality of the synthetic data is poor, the approach would turn out disastrous. I guess for any problem where predictions are uncertain, the synthetic data set would be of poor accuracy. If the the underlying structure is very complex and system has low noise, it may help to generate synthetic data, I guess. I think semi-supervised learning is quite big within deep learning (not my expertise), where the feature representation is to be learned also. I have tried to reproduce increased accuracy with semi.supervised training on several data sets with both rf and xgboost without any positive result. [Feel free to edit my code.] I notice the actual improvement of accuracy using semi-supervised is quite modest in the kaggle report, maybe random? rm(list=ls()) #define a data structure fy2 = function(nobs=2000,nclass=9) sample(1:nclass-1,nobs,replace=T) fX2 = function(y,noise=.05,twist=8,min.width=.7) { x1 = runif(length(y)) * twist helixStart = seq(0,2*pi,le=length(unique(y))+1)[-1] x2 = sin(helixStart[y+1]+x1)*(abs(x1)+min.width) + rnorm(length(y))*noise x3 = cos(helixStart[y+1]+x1)*(abs(x1)+min.width) + rnorm(length(y))*noise cbind(x1,x2,x3) } #define a wrapper to predict n-1 folds of test set and retrain and predict last fold smartTrainPred = function(model,trainX,trainy,testX,nfold=4,...) { obj = model(trainX,trainy,...) folds = split(sample(1:dim(trainX)[1]),1:nfold) predDF = do.call(rbind,lapply(folds, function(fold) { bigX = rbind(trainX ,testX[-fold,]) bigy = c(trainy,predict(obj,testX[-fold,])) if(is.factor(trainy)) bigy=factor(bigy-1) bigModel = model(bigX,bigy,...) predFold = predict(bigModel,testX[fold,]) data.frame(sampleID=fold, pred=predFold) })) smartPreds = predDF[sort(predDF$sampleID,ind=T)$ix,2] } library(xgboost) library(randomForest) #complex but perfect separatable trainy = fy2(); trainX = fX2(trainy) testy = fy2(); testX = fX2(testy ) pairs(trainX,col=trainy+1) #try with randomForest rf = randomForest(trainX,factor(trainy)) normPred = predict(rf,testX) cat("\n supervised rf", mean(testy!=normPred)) smartPred = smartTrainPred(randomForest,trainX,factor(trainy),testX,nfold=4) cat("\n semi-supervised rf",mean(testy!=smartPred)) #try with xgboost xgb = xgboost(trainX,trainy, nrounds=35,verbose=F,objective="multi:softmax",num_class=9) normPred = predict(xgb,testX) cat("\n supervised xgboost",mean(testy!=normPred)) smartPred = smartTrainPred(xgboost,trainX,trainy,testX,nfold=4, nrounds=35,verbose=F,objective="multi:softmax",num_class=9) cat("\n semi-supervised xgboost",mean(testy!=smartPred)) printing prediction error: supervised rf 0.007 semi-supervised rf 0.0085 supervised xgboost 0.046 semi-supervised xgboost 0.049
"Semi supervised learning" - is this overfitting?
It is not gross over fitting (depending on definition). Target information of test set is preserved. Semi-supervised allow to generate an extra synthetic data set to train the model on. In the describ
"Semi supervised learning" - is this overfitting? It is not gross over fitting (depending on definition). Target information of test set is preserved. Semi-supervised allow to generate an extra synthetic data set to train the model on. In the described approach, original training data is mixed unweighted with synthetic in ratio 4:3. Thus, if the quality of the synthetic data is poor, the approach would turn out disastrous. I guess for any problem where predictions are uncertain, the synthetic data set would be of poor accuracy. If the the underlying structure is very complex and system has low noise, it may help to generate synthetic data, I guess. I think semi-supervised learning is quite big within deep learning (not my expertise), where the feature representation is to be learned also. I have tried to reproduce increased accuracy with semi.supervised training on several data sets with both rf and xgboost without any positive result. [Feel free to edit my code.] I notice the actual improvement of accuracy using semi-supervised is quite modest in the kaggle report, maybe random? rm(list=ls()) #define a data structure fy2 = function(nobs=2000,nclass=9) sample(1:nclass-1,nobs,replace=T) fX2 = function(y,noise=.05,twist=8,min.width=.7) { x1 = runif(length(y)) * twist helixStart = seq(0,2*pi,le=length(unique(y))+1)[-1] x2 = sin(helixStart[y+1]+x1)*(abs(x1)+min.width) + rnorm(length(y))*noise x3 = cos(helixStart[y+1]+x1)*(abs(x1)+min.width) + rnorm(length(y))*noise cbind(x1,x2,x3) } #define a wrapper to predict n-1 folds of test set and retrain and predict last fold smartTrainPred = function(model,trainX,trainy,testX,nfold=4,...) { obj = model(trainX,trainy,...) folds = split(sample(1:dim(trainX)[1]),1:nfold) predDF = do.call(rbind,lapply(folds, function(fold) { bigX = rbind(trainX ,testX[-fold,]) bigy = c(trainy,predict(obj,testX[-fold,])) if(is.factor(trainy)) bigy=factor(bigy-1) bigModel = model(bigX,bigy,...) predFold = predict(bigModel,testX[fold,]) data.frame(sampleID=fold, pred=predFold) })) smartPreds = predDF[sort(predDF$sampleID,ind=T)$ix,2] } library(xgboost) library(randomForest) #complex but perfect separatable trainy = fy2(); trainX = fX2(trainy) testy = fy2(); testX = fX2(testy ) pairs(trainX,col=trainy+1) #try with randomForest rf = randomForest(trainX,factor(trainy)) normPred = predict(rf,testX) cat("\n supervised rf", mean(testy!=normPred)) smartPred = smartTrainPred(randomForest,trainX,factor(trainy),testX,nfold=4) cat("\n semi-supervised rf",mean(testy!=smartPred)) #try with xgboost xgb = xgboost(trainX,trainy, nrounds=35,verbose=F,objective="multi:softmax",num_class=9) normPred = predict(xgb,testX) cat("\n supervised xgboost",mean(testy!=normPred)) smartPred = smartTrainPred(xgboost,trainX,trainy,testX,nfold=4, nrounds=35,verbose=F,objective="multi:softmax",num_class=9) cat("\n semi-supervised xgboost",mean(testy!=smartPred)) printing prediction error: supervised rf 0.007 semi-supervised rf 0.0085 supervised xgboost 0.046 semi-supervised xgboost 0.049
"Semi supervised learning" - is this overfitting? It is not gross over fitting (depending on definition). Target information of test set is preserved. Semi-supervised allow to generate an extra synthetic data set to train the model on. In the describ
12,816
"Semi supervised learning" - is this overfitting?
No, it is not overfitting. I think your worry here is that the model is byhearting the data instead of modeling it. That depends on the complexity of the model (which remained the same) and size of the data. It happens when the model is too complex and/or when the training data is too small, neither of which is the case here. The fact that the test error (cross-validation error) is minimized after the semi-supervised learning should imply that it is not over-fitted. On why such an approach is even working The approach used here is not out-of-world, I have seen many people doing this in many machine-learning competitions (Sorry, I tried, but cannot recollect where I have seen this). When you predict a portion of test data and include that in the training, the model will be exposed to new features. In this case, the test data is as big as the training data, no wonder they are gaining so much by semi-supervised learning. Hope this explains Thanks
"Semi supervised learning" - is this overfitting?
No, it is not overfitting. I think your worry here is that the model is byhearting the data instead of modeling it. That depends on the complexity of the model (which remained the same) and size of
"Semi supervised learning" - is this overfitting? No, it is not overfitting. I think your worry here is that the model is byhearting the data instead of modeling it. That depends on the complexity of the model (which remained the same) and size of the data. It happens when the model is too complex and/or when the training data is too small, neither of which is the case here. The fact that the test error (cross-validation error) is minimized after the semi-supervised learning should imply that it is not over-fitted. On why such an approach is even working The approach used here is not out-of-world, I have seen many people doing this in many machine-learning competitions (Sorry, I tried, but cannot recollect where I have seen this). When you predict a portion of test data and include that in the training, the model will be exposed to new features. In this case, the test data is as big as the training data, no wonder they are gaining so much by semi-supervised learning. Hope this explains Thanks
"Semi supervised learning" - is this overfitting? No, it is not overfitting. I think your worry here is that the model is byhearting the data instead of modeling it. That depends on the complexity of the model (which remained the same) and size of
12,817
"Semi supervised learning" - is this overfitting?
By this definition: "Overfitting occurs when a statistical model describes random error or noise instead of the underlying relationship."(wikipedia), the solution is not overfitting. But in this situation: - Test data is a stream of items and not a fixed set of items. OR - Prediction process should not contain learning phase (for example because of performance issues) The mentioned solution is overfitting. Because the accuracy of modeling is more than real situations.
"Semi supervised learning" - is this overfitting?
By this definition: "Overfitting occurs when a statistical model describes random error or noise instead of the underlying relationship."(wikipedia), the solution is not overfitting. But in this situa
"Semi supervised learning" - is this overfitting? By this definition: "Overfitting occurs when a statistical model describes random error or noise instead of the underlying relationship."(wikipedia), the solution is not overfitting. But in this situation: - Test data is a stream of items and not a fixed set of items. OR - Prediction process should not contain learning phase (for example because of performance issues) The mentioned solution is overfitting. Because the accuracy of modeling is more than real situations.
"Semi supervised learning" - is this overfitting? By this definition: "Overfitting occurs when a statistical model describes random error or noise instead of the underlying relationship."(wikipedia), the solution is not overfitting. But in this situa
12,818
For which distributions does uncorrelatedness imply independence?
"Nevertheless if the two variables are normally distributed, then uncorrelatedness does imply independence" is a very common fallacy. That only applies if they are jointly normally distributed. The counterexample I have seen most often is normal $X \sim N(0,1)$ and independent Rademacher $Y$ (so that it is 1 or -1 with probability 0.5 each); then $Z=XY$ is also normal (clear from considering its distribution function), $\operatorname{Cov}(X,Z)=0$ (the problem here is to show $\mathbb{E}(XZ)=0$ e.g. by iterating expectation on $Y$, and noting that $XZ$ is $X^2$ or $-X^2$ with probability 0.5 each) and it is clear the variables are dependent (e.g. if I know $X>2$ then either $Z>2$ or $Z<-2$, so information about $X$ gives me information about $Z$). It's also worth bearing in mind that marginal distributions do not uniquely determine joint distribution. Take any two real RVs $X$ and $Y$ with marginal CDFs $F_X(x)$ and $G_Y(y)$. Then for any $\alpha<1$ the function: $$H_{X,Y}(x,y)=F_X(x)G_Y(y)\left(1+\alpha\big(1-F_X(x)\big)\big(1-G_Y(y)\big)\right)$$ will be a bivariate CDF. (To obtain the marginal $F_X(x)$ from $H_{X,Y}(x,y)$ take the limit as $y$ goes to infinity, where $G_Y(y)=1$. Vice-versa for $Y$.) Clearly by selecting different values of $\alpha$ you can obtain different joint distributions!
For which distributions does uncorrelatedness imply independence?
"Nevertheless if the two variables are normally distributed, then uncorrelatedness does imply independence" is a very common fallacy. That only applies if they are jointly normally distributed. The co
For which distributions does uncorrelatedness imply independence? "Nevertheless if the two variables are normally distributed, then uncorrelatedness does imply independence" is a very common fallacy. That only applies if they are jointly normally distributed. The counterexample I have seen most often is normal $X \sim N(0,1)$ and independent Rademacher $Y$ (so that it is 1 or -1 with probability 0.5 each); then $Z=XY$ is also normal (clear from considering its distribution function), $\operatorname{Cov}(X,Z)=0$ (the problem here is to show $\mathbb{E}(XZ)=0$ e.g. by iterating expectation on $Y$, and noting that $XZ$ is $X^2$ or $-X^2$ with probability 0.5 each) and it is clear the variables are dependent (e.g. if I know $X>2$ then either $Z>2$ or $Z<-2$, so information about $X$ gives me information about $Z$). It's also worth bearing in mind that marginal distributions do not uniquely determine joint distribution. Take any two real RVs $X$ and $Y$ with marginal CDFs $F_X(x)$ and $G_Y(y)$. Then for any $\alpha<1$ the function: $$H_{X,Y}(x,y)=F_X(x)G_Y(y)\left(1+\alpha\big(1-F_X(x)\big)\big(1-G_Y(y)\big)\right)$$ will be a bivariate CDF. (To obtain the marginal $F_X(x)$ from $H_{X,Y}(x,y)$ take the limit as $y$ goes to infinity, where $G_Y(y)=1$. Vice-versa for $Y$.) Clearly by selecting different values of $\alpha$ you can obtain different joint distributions!
For which distributions does uncorrelatedness imply independence? "Nevertheless if the two variables are normally distributed, then uncorrelatedness does imply independence" is a very common fallacy. That only applies if they are jointly normally distributed. The co
12,819
Power analysis for Kruskal-Wallis or Mann-Whitney U test using R?
It's certainly possible to calculate power. To be more specific - if you make sufficient assumptions to obtain a situation in which you can calculate (in some fashion) the probability of rejection, you can compute power. In the Wilcoxon-Mann-Whitney, if (for example) you assume the distribution shapes (make an assumption about the distributional form(s)) and make some assumption about the scales (spreads) and specific values of the locations or difference in locations, you might be able to compute the power either algebraically or via numerical integration; failing that you can simulate the rejection rate. So for example if we assume sampling from $t_5$ distributions with specified location-difference (standardized for a common scale), then given the sample sizes we could simulate many data sets satisfying all those conditions and so obtain an estimate of the rejection rate. So let's assume we have two samples of $t_5$ distributions (location-scale family) with unit scale ($\sigma=1$) - without loss of generality - and with location difference $\delta=\mu_2-\mu_1=1$. Again, without loss of generality we could take $\mu_1=0$. Then for some specified sample size -- $n_1=6,n_2=9$ (say) -- we can simulate the observations and hence the power for that particular value of $\delta/\sigma$ (i.e. $1$). Here's a quick example in R: n1=6;n2=9;tdf=5;delta=1;al=0.05;nsim=10000 res = replicate(nsim,{y1=rt(n1,tdf);y2=rt(n2,tdf)+delta;wilcox.test(y1,y2)$p.value<=al}) mean(res) # res will be logical ("TRUE" = reject); mean is rej rate Three simulations like that produced rejection rates of 0.321, 0.321 and 0.316; the power is apparently in the vicinity of 0.32 (you can compute a confidence interval from just a single one of those simulations, since the rejection count is binomial). In practice I tend to use larger simulations, but if you're simulating a lot of different $n$'s or $\delta$'s you may not want to go much higher than 10000 simulations for each one. By doing it for many values of the location shift you can even get a power curve for that set of circumstances as the location shift changes if you wish. In large samples doubling $n_1$ and $n_2$ will be like halving $\sigma^2$ (and so increasing $\delta/\sigma$ at a given $\delta$) so you can often get good approximations at various $n$ from simulations at only a few $n$ values. Similarly, for one tailed tests, if $1-b_i$ is the rejection rate at $\delta=\delta_i$ then $\Phi^{-1}(1-b)$ tends to be close to linear in $\delta$ (again, allowing a good approximation at various $\delta$ values from simulations at only a few values of $\delta$ (a dozen well chosen values is often plenty). Sensible choices of smoothing will often produce remarkably good approximation of the power at other values of $n$ or $\delta$. You needn't limit yourself to location shifts of course. Any change in parameters that would tend to lead to a change in $P(Y_2>Y_1)$ will be something you can investigate. Note that while these tests are distribution-free (for continuous distributions) under the null, the behavior is different under different distributional assumptions for the alternatives. The situation for the Kruskal-Wallis is similar, but you have more location shifts (or whatever other situation you're looking at) to specify. The plot in this answer shows a comparison of a power curve for a paired t test against simulated power for a signed rank test at a particular sample size, across a variety of standardized location shifts for sampling from normal distributions with a specified correlation between pairs. Similar calculations can be done for the Mann-Whitney and the Kruskal-Wallis.
Power analysis for Kruskal-Wallis or Mann-Whitney U test using R?
It's certainly possible to calculate power. To be more specific - if you make sufficient assumptions to obtain a situation in which you can calculate (in some fashion) the probability of rejection, yo
Power analysis for Kruskal-Wallis or Mann-Whitney U test using R? It's certainly possible to calculate power. To be more specific - if you make sufficient assumptions to obtain a situation in which you can calculate (in some fashion) the probability of rejection, you can compute power. In the Wilcoxon-Mann-Whitney, if (for example) you assume the distribution shapes (make an assumption about the distributional form(s)) and make some assumption about the scales (spreads) and specific values of the locations or difference in locations, you might be able to compute the power either algebraically or via numerical integration; failing that you can simulate the rejection rate. So for example if we assume sampling from $t_5$ distributions with specified location-difference (standardized for a common scale), then given the sample sizes we could simulate many data sets satisfying all those conditions and so obtain an estimate of the rejection rate. So let's assume we have two samples of $t_5$ distributions (location-scale family) with unit scale ($\sigma=1$) - without loss of generality - and with location difference $\delta=\mu_2-\mu_1=1$. Again, without loss of generality we could take $\mu_1=0$. Then for some specified sample size -- $n_1=6,n_2=9$ (say) -- we can simulate the observations and hence the power for that particular value of $\delta/\sigma$ (i.e. $1$). Here's a quick example in R: n1=6;n2=9;tdf=5;delta=1;al=0.05;nsim=10000 res = replicate(nsim,{y1=rt(n1,tdf);y2=rt(n2,tdf)+delta;wilcox.test(y1,y2)$p.value<=al}) mean(res) # res will be logical ("TRUE" = reject); mean is rej rate Three simulations like that produced rejection rates of 0.321, 0.321 and 0.316; the power is apparently in the vicinity of 0.32 (you can compute a confidence interval from just a single one of those simulations, since the rejection count is binomial). In practice I tend to use larger simulations, but if you're simulating a lot of different $n$'s or $\delta$'s you may not want to go much higher than 10000 simulations for each one. By doing it for many values of the location shift you can even get a power curve for that set of circumstances as the location shift changes if you wish. In large samples doubling $n_1$ and $n_2$ will be like halving $\sigma^2$ (and so increasing $\delta/\sigma$ at a given $\delta$) so you can often get good approximations at various $n$ from simulations at only a few $n$ values. Similarly, for one tailed tests, if $1-b_i$ is the rejection rate at $\delta=\delta_i$ then $\Phi^{-1}(1-b)$ tends to be close to linear in $\delta$ (again, allowing a good approximation at various $\delta$ values from simulations at only a few values of $\delta$ (a dozen well chosen values is often plenty). Sensible choices of smoothing will often produce remarkably good approximation of the power at other values of $n$ or $\delta$. You needn't limit yourself to location shifts of course. Any change in parameters that would tend to lead to a change in $P(Y_2>Y_1)$ will be something you can investigate. Note that while these tests are distribution-free (for continuous distributions) under the null, the behavior is different under different distributional assumptions for the alternatives. The situation for the Kruskal-Wallis is similar, but you have more location shifts (or whatever other situation you're looking at) to specify. The plot in this answer shows a comparison of a power curve for a paired t test against simulated power for a signed rank test at a particular sample size, across a variety of standardized location shifts for sampling from normal distributions with a specified correlation between pairs. Similar calculations can be done for the Mann-Whitney and the Kruskal-Wallis.
Power analysis for Kruskal-Wallis or Mann-Whitney U test using R? It's certainly possible to calculate power. To be more specific - if you make sufficient assumptions to obtain a situation in which you can calculate (in some fashion) the probability of rejection, yo
12,820
Power analysis for Kruskal-Wallis or Mann-Whitney U test using R?
I had exactly the same question as you. After searching a bit I found the MultNonParam package in R (pdf): kwpower(nreps, shifts, distname=c("normal","logistic"), level=0.05, mc=0, taylor=FALSE) nreps: The numbers in each group. shifts: The offsets for the various populations, under the alternative hypothesis. distname: The distribution of the underlying observations; normal and logistic are currently supported. level: The test level. mc: 0 for asymptotic calculation, or positive for mc approximation. taylor: logical determining whether Taylor series approximation is used for probabilities.
Power analysis for Kruskal-Wallis or Mann-Whitney U test using R?
I had exactly the same question as you. After searching a bit I found the MultNonParam package in R (pdf): kwpower(nreps, shifts, distname=c("normal","logistic"), level=0.05, mc=0, taylor=FALSE) nre
Power analysis for Kruskal-Wallis or Mann-Whitney U test using R? I had exactly the same question as you. After searching a bit I found the MultNonParam package in R (pdf): kwpower(nreps, shifts, distname=c("normal","logistic"), level=0.05, mc=0, taylor=FALSE) nreps: The numbers in each group. shifts: The offsets for the various populations, under the alternative hypothesis. distname: The distribution of the underlying observations; normal and logistic are currently supported. level: The test level. mc: 0 for asymptotic calculation, or positive for mc approximation. taylor: logical determining whether Taylor series approximation is used for probabilities.
Power analysis for Kruskal-Wallis or Mann-Whitney U test using R? I had exactly the same question as you. After searching a bit I found the MultNonParam package in R (pdf): kwpower(nreps, shifts, distname=c("normal","logistic"), level=0.05, mc=0, taylor=FALSE) nre
12,821
Why is there -1 in beta distribution density function?
This is a story about degrees of freedom and statistical parameters and why it is nice that the two have a direct simple connection. Historically, the "$-1$" terms appeared in Euler's studies of the Beta function. He was using that parameterization by 1763, and so was Adrien-Marie Legendre: their usage established the subsequent mathematical convention. This work antedates all known statistical applications. Modern mathematical theory provides ample indications, through the wealth of applications in analysis, number theory, and geometry, that the "$-1$" terms actually have some meaning. I have sketched some of those reasons in comments to the question. Of more interest is what the "right" statistical parameterization ought to be. That is not quite as clear and it doesn't have to be the same as the mathematical convention. There is a huge web of commonly used, well-known, interrelated families of probability distributions. Thus, the conventions used to name (that is, parameterize) one family typically imply related conventions to name related families. Change one parameterization and you will want to change them all. We might therefore look at these relationships for clues. Few people would disagree that the most important distribution families derive from the Normal family. Recall that a random variable $X$ is said to be "Normally distributed" when $(X-\mu)/\sigma$ has a probability density $f(x)$ proportional to $\exp(-x^2/2)$. When $\sigma=1$ and $\mu=0$, $X$ is said to have a standard normal distribution. Many datasets $x_1, x_2, \ldots, x_n$ are studied using relatively simple statistics involving rational combinations of the data and low powers (typically squares). When those data are modeled as random samples from a Normal distribution--so that each $x_i$ is viewed as a realization of a Normal variable $X_i$, all the $X_i$ share a common distribution, and are independent--the distributions of those statistics are determined by that Normal distribution. The ones that arise most often in practice are $t_\nu$, the Student $t$ distribution with $\nu = n-1$ "degrees of freedom." This is the distribution of the statistic $$t = \frac{\bar X}{\operatorname{se}(X)}$$ where $\bar X = (X_1 + X_2 + \cdots + X_n)/n$ models the mean of the data and $\operatorname{se}(X) = (1/\sqrt{n})\sqrt{(X_1^2+X_2^2 + \cdots + X_n^2)/(n-1) - \bar X^2}$ is the standard error of the mean. The division by $n-1$ shows that $n$ must be $2$ or greater, whence $\nu$ is an integer $1$ or greater. The formula, although apparently a little complicated, is the square root of a rational function of the data of degree two: it is relatively simple. $\chi^2_\nu$, the $\chi^2$ (chi-squared) distribution with $\nu$ "degrees of freedom" (d.f.). This is the distribution of the sum of squares of $\nu$ independent standard Normal variables. The distribution of the mean of the squares of these variables will therefore be a $\chi^2$ distribution scaled by $1/\nu$: I will refer to this as a "normalized" $\chi^2$ distribution. $F_{\nu_1, \nu_2}$, the $F$ ratio distribution with parameters $(\nu_1, \nu_2)$ is the ratio of two independent normalized $\chi^2$ distributions with $\nu_1$ and $\nu_2$ degrees of freedom. Mathematical calculations show that all three of these distributions have densities. Importantly, the density of the $\chi^2_\nu$ distribution is proportional to the integrand in Euler's integral definition of the Gamma ($\Gamma$) function. Let's compare them: $$f_{\chi^2_\nu}(2x) \propto x^{\nu/2 - 1}e^{-x};\quad f_{\Gamma(\nu)}(x) \propto x^{\nu-1}e^{-x}.$$ This shows that twice a $\chi^2_\nu$ variable has a Gamma distribution with parameter $\nu/2$. The factor of one-half is bothersome enough, but subtracting $1$ would make the relationship much worse. This already supplies a compelling answer to the question: if we want the parameter of a $\chi^2$ distribution to count the number of squared Normal variables that produce it (up to a factor of $1/2$), then the exponent in its density function must be one less than half that count. Why is the factor of $1/2$ less troublesome than a difference of $1$? The reason is that the factor will remain consistent when we add things up. If the sum of squares of $n$ independent standard Normals is proportional to a Gamma distribution with parameter $n$ (times some factor), then the sum of squares of $m$ independent standard Normals is proportional to a Gamma distribution with parameter $m$ (times the same factor), whence the sum of squares of all $n+m$ variables is proportional to a Gamma distribution with parameter $m+n$ (still times the same factor). The fact that adding the parameters so closely emulates adding the counts is very helpful. If, however, we were to remove that pesky-looking "$-1$" from the mathematical formulas, these nice relationships would become more complicated. For example, if we changed the parameterization of Gamma distributions to refer to the actual power of $x$ in the formula, so that a $\chi^2_1$ distribution would be related to a "Gamma$(0)$" distribution (since the power of $x$ in its PDF is $1-1=0$), then the sum of three $\chi^2_1$ distributions would have to be called a "Gamma$(2)$" distribution. In short, the close additive relationship between degrees of freedom and the parameter in Gamma distributions would be lost by removing the $-1$ from the formula and absorbing it in the parameter. Similarly, the probability function of an $F$ ratio distribution is closely related to Beta distributions. Indeed, when $Y$ has an $F$ ratio distribution, the distribution of $Z=\nu_1 Y/(\nu_1 Y + \nu_2)$ has a Beta$(\nu_1/2, \nu_2/2)$ distribution. Its density function is proportional to $$f_Z(z) \propto z^{\nu_1/2 - 1}(1-z)^{\nu_2/2-1}.$$ Furthermore--taking these ideas full circle--the square of a Student $t$ distribution with $\nu$ d.f. has an $F$ ratio distribution with parameters $(1,\nu)$. Once more it is apparent that keeping the conventional parameterization maintains a clear relationship with the underlying counts that contribute to the degrees of freedom. From a statistical point of view, then, it would be most natural and simplest to use a variation of the conventional mathematical parameterizations of $\Gamma$ and Beta distributions: we should prefer calling a $\Gamma(\alpha)$ distribution a "$\Gamma(2\alpha)$ distribution" and the Beta$(\alpha, \beta)$ distribution ought to be called a "Beta$(2\alpha, 2\beta)$ distribution." In fact, we have already done that: this is precisely why we continue to use the names "Chi-squared" and "$F$ Ratio" distribution instead of "Gamma" and "Beta". Regardless, in no case would we want to remove the "$-1$" terms that appear in the mathematical formulas for their densities. If we did that, we would lose the direct connection between the parameters in the densities and the data counts with which they are associated: we would always be off by one.
Why is there -1 in beta distribution density function?
This is a story about degrees of freedom and statistical parameters and why it is nice that the two have a direct simple connection. Historically, the "$-1$" terms appeared in Euler's studies of the B
Why is there -1 in beta distribution density function? This is a story about degrees of freedom and statistical parameters and why it is nice that the two have a direct simple connection. Historically, the "$-1$" terms appeared in Euler's studies of the Beta function. He was using that parameterization by 1763, and so was Adrien-Marie Legendre: their usage established the subsequent mathematical convention. This work antedates all known statistical applications. Modern mathematical theory provides ample indications, through the wealth of applications in analysis, number theory, and geometry, that the "$-1$" terms actually have some meaning. I have sketched some of those reasons in comments to the question. Of more interest is what the "right" statistical parameterization ought to be. That is not quite as clear and it doesn't have to be the same as the mathematical convention. There is a huge web of commonly used, well-known, interrelated families of probability distributions. Thus, the conventions used to name (that is, parameterize) one family typically imply related conventions to name related families. Change one parameterization and you will want to change them all. We might therefore look at these relationships for clues. Few people would disagree that the most important distribution families derive from the Normal family. Recall that a random variable $X$ is said to be "Normally distributed" when $(X-\mu)/\sigma$ has a probability density $f(x)$ proportional to $\exp(-x^2/2)$. When $\sigma=1$ and $\mu=0$, $X$ is said to have a standard normal distribution. Many datasets $x_1, x_2, \ldots, x_n$ are studied using relatively simple statistics involving rational combinations of the data and low powers (typically squares). When those data are modeled as random samples from a Normal distribution--so that each $x_i$ is viewed as a realization of a Normal variable $X_i$, all the $X_i$ share a common distribution, and are independent--the distributions of those statistics are determined by that Normal distribution. The ones that arise most often in practice are $t_\nu$, the Student $t$ distribution with $\nu = n-1$ "degrees of freedom." This is the distribution of the statistic $$t = \frac{\bar X}{\operatorname{se}(X)}$$ where $\bar X = (X_1 + X_2 + \cdots + X_n)/n$ models the mean of the data and $\operatorname{se}(X) = (1/\sqrt{n})\sqrt{(X_1^2+X_2^2 + \cdots + X_n^2)/(n-1) - \bar X^2}$ is the standard error of the mean. The division by $n-1$ shows that $n$ must be $2$ or greater, whence $\nu$ is an integer $1$ or greater. The formula, although apparently a little complicated, is the square root of a rational function of the data of degree two: it is relatively simple. $\chi^2_\nu$, the $\chi^2$ (chi-squared) distribution with $\nu$ "degrees of freedom" (d.f.). This is the distribution of the sum of squares of $\nu$ independent standard Normal variables. The distribution of the mean of the squares of these variables will therefore be a $\chi^2$ distribution scaled by $1/\nu$: I will refer to this as a "normalized" $\chi^2$ distribution. $F_{\nu_1, \nu_2}$, the $F$ ratio distribution with parameters $(\nu_1, \nu_2)$ is the ratio of two independent normalized $\chi^2$ distributions with $\nu_1$ and $\nu_2$ degrees of freedom. Mathematical calculations show that all three of these distributions have densities. Importantly, the density of the $\chi^2_\nu$ distribution is proportional to the integrand in Euler's integral definition of the Gamma ($\Gamma$) function. Let's compare them: $$f_{\chi^2_\nu}(2x) \propto x^{\nu/2 - 1}e^{-x};\quad f_{\Gamma(\nu)}(x) \propto x^{\nu-1}e^{-x}.$$ This shows that twice a $\chi^2_\nu$ variable has a Gamma distribution with parameter $\nu/2$. The factor of one-half is bothersome enough, but subtracting $1$ would make the relationship much worse. This already supplies a compelling answer to the question: if we want the parameter of a $\chi^2$ distribution to count the number of squared Normal variables that produce it (up to a factor of $1/2$), then the exponent in its density function must be one less than half that count. Why is the factor of $1/2$ less troublesome than a difference of $1$? The reason is that the factor will remain consistent when we add things up. If the sum of squares of $n$ independent standard Normals is proportional to a Gamma distribution with parameter $n$ (times some factor), then the sum of squares of $m$ independent standard Normals is proportional to a Gamma distribution with parameter $m$ (times the same factor), whence the sum of squares of all $n+m$ variables is proportional to a Gamma distribution with parameter $m+n$ (still times the same factor). The fact that adding the parameters so closely emulates adding the counts is very helpful. If, however, we were to remove that pesky-looking "$-1$" from the mathematical formulas, these nice relationships would become more complicated. For example, if we changed the parameterization of Gamma distributions to refer to the actual power of $x$ in the formula, so that a $\chi^2_1$ distribution would be related to a "Gamma$(0)$" distribution (since the power of $x$ in its PDF is $1-1=0$), then the sum of three $\chi^2_1$ distributions would have to be called a "Gamma$(2)$" distribution. In short, the close additive relationship between degrees of freedom and the parameter in Gamma distributions would be lost by removing the $-1$ from the formula and absorbing it in the parameter. Similarly, the probability function of an $F$ ratio distribution is closely related to Beta distributions. Indeed, when $Y$ has an $F$ ratio distribution, the distribution of $Z=\nu_1 Y/(\nu_1 Y + \nu_2)$ has a Beta$(\nu_1/2, \nu_2/2)$ distribution. Its density function is proportional to $$f_Z(z) \propto z^{\nu_1/2 - 1}(1-z)^{\nu_2/2-1}.$$ Furthermore--taking these ideas full circle--the square of a Student $t$ distribution with $\nu$ d.f. has an $F$ ratio distribution with parameters $(1,\nu)$. Once more it is apparent that keeping the conventional parameterization maintains a clear relationship with the underlying counts that contribute to the degrees of freedom. From a statistical point of view, then, it would be most natural and simplest to use a variation of the conventional mathematical parameterizations of $\Gamma$ and Beta distributions: we should prefer calling a $\Gamma(\alpha)$ distribution a "$\Gamma(2\alpha)$ distribution" and the Beta$(\alpha, \beta)$ distribution ought to be called a "Beta$(2\alpha, 2\beta)$ distribution." In fact, we have already done that: this is precisely why we continue to use the names "Chi-squared" and "$F$ Ratio" distribution instead of "Gamma" and "Beta". Regardless, in no case would we want to remove the "$-1$" terms that appear in the mathematical formulas for their densities. If we did that, we would lose the direct connection between the parameters in the densities and the data counts with which they are associated: we would always be off by one.
Why is there -1 in beta distribution density function? This is a story about degrees of freedom and statistical parameters and why it is nice that the two have a direct simple connection. Historically, the "$-1$" terms appeared in Euler's studies of the B
12,822
Why is there -1 in beta distribution density function?
The notation is misleading you. There is a "hidden $-1$" in your formula $(1)$, because in $(1)$, $\alpha$ and $\beta$ must be bigger than $-1$ (the second link you provided in your question says this explicitly). The $\alpha$'s and $\beta$'s in the two formulas are not the same parameters; they have different ranges: in $(1)$, $\alpha,\beta>-1$, and in $(2)$, $\alpha,\beta>0$. These ranges for $\alpha$ and $\beta$ are necessary to guarantee that the integral of the density doesn't diverge. To see this, consider in $(1)$ the case $\alpha=-1$ (or less) and $\beta=0$, then try to integrate the (kernel of the) density between $0$ and $1$. Equivalently, try the same in $(2)$ for $\alpha=0$ (or less) and $\beta=1$.
Why is there -1 in beta distribution density function?
The notation is misleading you. There is a "hidden $-1$" in your formula $(1)$, because in $(1)$, $\alpha$ and $\beta$ must be bigger than $-1$ (the second link you provided in your question says this
Why is there -1 in beta distribution density function? The notation is misleading you. There is a "hidden $-1$" in your formula $(1)$, because in $(1)$, $\alpha$ and $\beta$ must be bigger than $-1$ (the second link you provided in your question says this explicitly). The $\alpha$'s and $\beta$'s in the two formulas are not the same parameters; they have different ranges: in $(1)$, $\alpha,\beta>-1$, and in $(2)$, $\alpha,\beta>0$. These ranges for $\alpha$ and $\beta$ are necessary to guarantee that the integral of the density doesn't diverge. To see this, consider in $(1)$ the case $\alpha=-1$ (or less) and $\beta=0$, then try to integrate the (kernel of the) density between $0$ and $1$. Equivalently, try the same in $(2)$ for $\alpha=0$ (or less) and $\beta=1$.
Why is there -1 in beta distribution density function? The notation is misleading you. There is a "hidden $-1$" in your formula $(1)$, because in $(1)$, $\alpha$ and $\beta$ must be bigger than $-1$ (the second link you provided in your question says this
12,823
Why is there -1 in beta distribution density function?
For me, the existence of -1 in the exponent is related with the develpment of the Gamma function. The motivation of the Gamma function is to find a smooth curve to connect the points of a factorial $x!$. Since it is not possible to compute $x!$ directly if $x$ is not integer, the idea was to find a function for any $x \geq 0$ that satisfies the recurrence relation defined by the factorial, namely $f(1)=1\\ f(x+1)=x \cdot f(x). $ Solution was by means of the convergence of an integral. For the function defined as $f(x+1) = \displaystyle\int_{0}^{\infty} t^{x}e^{-x} dt, $ integration by parts provides the following: $ \begin{align} f(x+1) & = \displaystyle\int_{0}^{\infty} t^{x}e^{-x} dt \\ & = \Big[-t^{x}e^{-x} \Big]^{\infty}_{0} + \displaystyle\int_{0}^{\infty} x\cdot t^{x-1}e^{-x} dt \\ &= \lim_{x \to \infty} (-t^{x}e^{-x}) - 0 \cdot e^{-0} + x\cdot \displaystyle\int_{0}^{\infty} t^{x-1}e^{-x} dt \\ &= 0 - 0 + x\cdot \displaystyle\int_{0}^{\infty} t^{x-1}e^{-x} dt \\ &= x \cdot f(x) . \end{align} $ So, the function above satisfies this property, and the -1 in the exponent derives from the procedure of integration by parts. See the Wikipedia article https://en.wikipedia.org/wiki/Gamma_function . Edit: I apologise if my post is not fully clear; I am just trying to point that, in my idea, the existence of -1 in the beta distribution comes from the generalisation of the factorial by means of the Gamma function. There are two conditions: $f(1)=1$ and $f(x+1)=x \cdot f(x)$. We have $\Gamma(x) = (x-1)!$, therefore it satisfies $\Gamma(x+1) = x \cdot \Gamma(x) = x \cdot (x-1)! = x!$. In addition, we have $\Gamma(1) = (1-1)! = 0! = 1$. As for the beta distribution with parameters $\alpha, \beta$, generalisation of the Binomial coefficient is $\dfrac{\Gamma(\alpha + \beta)}{\Gamma(\alpha) \cdot \Gamma(\beta)} = \dfrac{(\alpha + \beta - 1)!}{(\alpha-1)! \cdot (\beta-1)!}$. There we have the -1 in the denominator, for both parameters.
Why is there -1 in beta distribution density function?
For me, the existence of -1 in the exponent is related with the develpment of the Gamma function. The motivation of the Gamma function is to find a smooth curve to connect the points of a factorial $x
Why is there -1 in beta distribution density function? For me, the existence of -1 in the exponent is related with the develpment of the Gamma function. The motivation of the Gamma function is to find a smooth curve to connect the points of a factorial $x!$. Since it is not possible to compute $x!$ directly if $x$ is not integer, the idea was to find a function for any $x \geq 0$ that satisfies the recurrence relation defined by the factorial, namely $f(1)=1\\ f(x+1)=x \cdot f(x). $ Solution was by means of the convergence of an integral. For the function defined as $f(x+1) = \displaystyle\int_{0}^{\infty} t^{x}e^{-x} dt, $ integration by parts provides the following: $ \begin{align} f(x+1) & = \displaystyle\int_{0}^{\infty} t^{x}e^{-x} dt \\ & = \Big[-t^{x}e^{-x} \Big]^{\infty}_{0} + \displaystyle\int_{0}^{\infty} x\cdot t^{x-1}e^{-x} dt \\ &= \lim_{x \to \infty} (-t^{x}e^{-x}) - 0 \cdot e^{-0} + x\cdot \displaystyle\int_{0}^{\infty} t^{x-1}e^{-x} dt \\ &= 0 - 0 + x\cdot \displaystyle\int_{0}^{\infty} t^{x-1}e^{-x} dt \\ &= x \cdot f(x) . \end{align} $ So, the function above satisfies this property, and the -1 in the exponent derives from the procedure of integration by parts. See the Wikipedia article https://en.wikipedia.org/wiki/Gamma_function . Edit: I apologise if my post is not fully clear; I am just trying to point that, in my idea, the existence of -1 in the beta distribution comes from the generalisation of the factorial by means of the Gamma function. There are two conditions: $f(1)=1$ and $f(x+1)=x \cdot f(x)$. We have $\Gamma(x) = (x-1)!$, therefore it satisfies $\Gamma(x+1) = x \cdot \Gamma(x) = x \cdot (x-1)! = x!$. In addition, we have $\Gamma(1) = (1-1)! = 0! = 1$. As for the beta distribution with parameters $\alpha, \beta$, generalisation of the Binomial coefficient is $\dfrac{\Gamma(\alpha + \beta)}{\Gamma(\alpha) \cdot \Gamma(\beta)} = \dfrac{(\alpha + \beta - 1)!}{(\alpha-1)! \cdot (\beta-1)!}$. There we have the -1 in the denominator, for both parameters.
Why is there -1 in beta distribution density function? For me, the existence of -1 in the exponent is related with the develpment of the Gamma function. The motivation of the Gamma function is to find a smooth curve to connect the points of a factorial $x
12,824
Regularization for ARIMA models
Answering Question 1. Chen & Chan "Subset ARMA selection via the adaptive Lasso" (2011)* use a workaround to avoid the computationally demanding maximum likelihood estimation. Citing the paper, they propose to find an optimal subset ARMA model by fitting an adaptive Lasso regression of the time series $y_t$ on its own lags and those of the residuals that are obtained from fitting a long autoregression to the $y_t$s. <...> [U]nder mild regularity conditions, the proposed method achieves the oracle properties, namely, it identifies the correct subset ARMA model with probability tending to one as the sample size increases to infinity, and <...> the estimators of the nonzero coefficients are asymptotically normal with the limiting distribution the same as that when the zero coefficients are known a priori. Optionally, they suggest maximum likelihood estimation and model diagnostics for the selected subset ARMA model(s). Wilms et al. "Sparse Identification and Estimation of High-Dimensional Vector AutoRegressive Moving Averages" (2017) do even more than I asked for. Instead of a univariate ARIMA model, they take a vector ARMA (VARMA) in high dimensions, and they use an $L_1$ penalty for estimation and lag order selection. They present the estimation algorithm and develop some asymptotic results. In particular, they employ a two-stage procedure. Consider a VARMA model $$ y_t = \sum_{l=1}^p \Phi_l y_{t-l} + \sum_{m=1}^q \Theta_m \varepsilon_{t-m} + \varepsilon_t $$ which needs to be estimated, but the lag orders $p$ and $q$ are uknown. In Stage 1, they approximate the VARMA model by a high-order VAR model and estimate it using a Hierarchical VAR estimator which places a lag-based hierarchical group-lasso penalty on the autoregressive parameters. (The lag order is set to be $\lfloor 1.5\sqrt{T} \rfloor$. The model equations are estimated jointly and the Frobenius norm of the errors $||y-\hat y||_2^F$ is minimized with a hierarchical group-lasso penalty on the regression coefficients.) They obtain residuals $\hat\varepsilon := y - \hat y$ to be used as proxies for the true errors in Stage 2. In Stage 2, they estimate a VARX model where X represents lagged residuals from Stage 1. That is, they minic a VARMA model but use estimated residuals in place of true errors, $$ y_t = \sum_{l=1}^{\hat p} \Phi_l y_{t-l} + \sum_{m=1}^{\hat q} \Theta_m \hat\varepsilon_{t-m} + u_t, $$ which allows applying the same estimator (hierarchical group-lasso) again just like in Stage 1. ($\hat p$ and $\hat q$ are set to be $\lfloor 1.5\sqrt{T} \rfloor$.) The approach of Wilms et al. is implemented in the R package "bigtime". References Chen, K., & Chan, K. S. (2011). Subset ARMA selection via the adaptive Lasso. Statistics and its Interface, 4(2), 197-205. Wilms, I., Basu, S., Bien, J., & Matteson, D. S. (2017). Sparse Identification and Estimation of High-Dimensional Vector AutoRegressive Moving Averages. arXiv preprint arXiv:1707.09208. *Thanks to @hejseb for the link.
Regularization for ARIMA models
Answering Question 1. Chen & Chan "Subset ARMA selection via the adaptive Lasso" (2011)* use a workaround to avoid the computationally demanding maximum likelihood estimation. Citing the paper, they
Regularization for ARIMA models Answering Question 1. Chen & Chan "Subset ARMA selection via the adaptive Lasso" (2011)* use a workaround to avoid the computationally demanding maximum likelihood estimation. Citing the paper, they propose to find an optimal subset ARMA model by fitting an adaptive Lasso regression of the time series $y_t$ on its own lags and those of the residuals that are obtained from fitting a long autoregression to the $y_t$s. <...> [U]nder mild regularity conditions, the proposed method achieves the oracle properties, namely, it identifies the correct subset ARMA model with probability tending to one as the sample size increases to infinity, and <...> the estimators of the nonzero coefficients are asymptotically normal with the limiting distribution the same as that when the zero coefficients are known a priori. Optionally, they suggest maximum likelihood estimation and model diagnostics for the selected subset ARMA model(s). Wilms et al. "Sparse Identification and Estimation of High-Dimensional Vector AutoRegressive Moving Averages" (2017) do even more than I asked for. Instead of a univariate ARIMA model, they take a vector ARMA (VARMA) in high dimensions, and they use an $L_1$ penalty for estimation and lag order selection. They present the estimation algorithm and develop some asymptotic results. In particular, they employ a two-stage procedure. Consider a VARMA model $$ y_t = \sum_{l=1}^p \Phi_l y_{t-l} + \sum_{m=1}^q \Theta_m \varepsilon_{t-m} + \varepsilon_t $$ which needs to be estimated, but the lag orders $p$ and $q$ are uknown. In Stage 1, they approximate the VARMA model by a high-order VAR model and estimate it using a Hierarchical VAR estimator which places a lag-based hierarchical group-lasso penalty on the autoregressive parameters. (The lag order is set to be $\lfloor 1.5\sqrt{T} \rfloor$. The model equations are estimated jointly and the Frobenius norm of the errors $||y-\hat y||_2^F$ is minimized with a hierarchical group-lasso penalty on the regression coefficients.) They obtain residuals $\hat\varepsilon := y - \hat y$ to be used as proxies for the true errors in Stage 2. In Stage 2, they estimate a VARX model where X represents lagged residuals from Stage 1. That is, they minic a VARMA model but use estimated residuals in place of true errors, $$ y_t = \sum_{l=1}^{\hat p} \Phi_l y_{t-l} + \sum_{m=1}^{\hat q} \Theta_m \hat\varepsilon_{t-m} + u_t, $$ which allows applying the same estimator (hierarchical group-lasso) again just like in Stage 1. ($\hat p$ and $\hat q$ are set to be $\lfloor 1.5\sqrt{T} \rfloor$.) The approach of Wilms et al. is implemented in the R package "bigtime". References Chen, K., & Chan, K. S. (2011). Subset ARMA selection via the adaptive Lasso. Statistics and its Interface, 4(2), 197-205. Wilms, I., Basu, S., Bien, J., & Matteson, D. S. (2017). Sparse Identification and Estimation of High-Dimensional Vector AutoRegressive Moving Averages. arXiv preprint arXiv:1707.09208. *Thanks to @hejseb for the link.
Regularization for ARIMA models Answering Question 1. Chen & Chan "Subset ARMA selection via the adaptive Lasso" (2011)* use a workaround to avoid the computationally demanding maximum likelihood estimation. Citing the paper, they
12,825
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions
Let's take care of the routine calculus for you, so you can get to the heart of the problem and enjoy formulating a solution. It comes down to constructing rectangles as unions and differences of triangles. First, choose values of $a$ and $b$ that make the details as simple as possible. I like $a=0,b=1$: the univariate density of any component of $X=(X_1,X_2,\ldots,X_n)$ is just the indicator function of the interval $[0,1]$. Let's find the distribution function $F$ of $(Y_1,Y_n)$. By definition, for any real numbers $y_1 \le y_n$ this is $$F(y_1,y_n) = \Pr(Y_1\le y_1\text{ and } Y_n \le y_n).\tag{1}$$ The values of $F$ are obviously $0$ or $1$ in case any of $y_1$ or $y_n$ is outside the interval $[a,b] = [0,1]$, so let's assume they're both in this interval. (Let's also assume $n\ge 2$ to avoid discussing trivialities.) In this case the event $(1)$ can be described in terms of the original variables $X=(X_1,X_2,\ldots,X_n)$ as "at least one of the $X_i$ is less than or equal to $y_1$ and none of the $X_i$ exceed $y_n$." Equivalently, all the $X_i$ lie in $[0,y_n]$ but it is not the case that all of them lie in $(y_1,y_n]$. Because the $X_i$ are independent, their probabilities multiply and give $(y_n-0)^n = y_n^n$ and $(y_n-y_1)^n$, respectively, for these two events just mentioned. Thus, $$F(y_1,y_n) = y_n^n - (y_n-y_1)^n.$$ The density $f$ is the mixed partial derivative of $F$, $$f(y_1,y_n) = \frac{\partial^2 F}{\partial y_1 \partial y_n}(y_1,y_n) = n(n-1)(y_n-y_1)^{n-2}.$$ The general case for $(a,b)$ scales the variables by the factor $b-a$ and shifts the location by $a$. Thus, for $a \lt y_1 \le y_n \lt b$, $$F(y_1,y_n; a,b) = \left(\left(\frac{y_n-a}{b-a}\right)^n - \left(\frac{y_n-a}{b-a} - \frac{y_1-a}{b-a}\right)^n\right) = \frac{(y_n-a)^n - (y_n-y_1)^n}{(b-a)^n}.$$ Differentiating as before we obtain $$f(y_1,y_n; a,b) = \frac{n(n-1)}{(b-a)^n}(y_n-y_1)^{n-2}.$$ Consider the definition of completeness. Let $g$ be any measurable function of two real variables. By definition, $$\eqalign{E[g(Y_1,Y_n)] &= \int_{y_1}^b\int_a^b g(y_1,y_n) f(y_1,y_n)dy_1dy_n\\ &\propto\int_{y_1}^b\int_a^b g(y_1,y_n) (y_n-y_1)^{n-2} dy_1dy_n.\tag{2} }$$ We need to show that when this expectation is zero for all $(a,b)$, then it's certain that $g=0$ for any $(a,b)$. Here's your hint. Let $h:\mathbb{R}^2\to \mathbb{R}$ be any measurable function. I would like to express it in the form suggested by $(2)$ as $h(x,y)=g(x,y)(y-x)^{n-2}$. To do that, obviously we must divide $h$ by $(y-x)^{n-2}$. Unfortunately, for $n\gt 2$ this isn't defined whenever $y=x$. The key is that this set has measure zero so we can neglect it. Accordingly, given any measurable $h$, define $$g(x,y) = \left\{\matrix{h(x,y)/(y-x)^{n-2} & x \ne y \\ 0 & x=y}\right.$$ Then $(2)$ becomes $$\int_{y_1}^b\int_a^b h(y_1,y_n) dy_1dy_n \propto E[g(Y_1,Y_n)].\tag{3}$$ (When the task is showing that something is zero, we may ignore nonzero constants of proportionality. Here, I have dropped $n(n-1)/(b-a)^{n-2}$ from the left hand side.) This is an integral over a right triangle with hypotenuse extending from $(a,a)$ to $(b,b)$ and vertex at $(a,b)$. Let's denote such a triangle $\Delta(a,b)$. Ergo, what you need to show is that if the integral of an arbitrary measurable function $h$ over all triangles $\Delta(a,b)$ is zero, then for any $a\lt b$, $h(x,y)=0$ (almost surely) for all $(x,y)\in \Delta(a,b)$. Although it might seem we haven't gotten any further, consider any rectangle $[u_1,u_2]\times [v_1,v_2]$ wholly contained in the half-plane $y \gt x$. It can be expressed in terms of triangles: $$[u_1,u_2]\times [v_1,v_2] = \Delta(u_1,v_2) \setminus\left(\Delta(u_1,v_1) \cup \Delta(u_2,v_2)\right)\cup \Delta(u_2,v_1).$$ In this figure, the rectangle is what is left over from the big triangle when we remove the overlapping red and green triangles (which double counts their brown intersection) and then replace their intersection. Consequently, you may immediately deduce that the integral of $h$ over all such rectangles is zero. It remains only to show that $h(x,y)$ must be zero (apart from its values on some set of measure zero) whenever $y \gt x$. The proof of this (intuitively clear) assertion depends on what approach you want to take to the definition of integration.
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions
Let's take care of the routine calculus for you, so you can get to the heart of the problem and enjoy formulating a solution. It comes down to constructing rectangles as unions and differences of tri
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions Let's take care of the routine calculus for you, so you can get to the heart of the problem and enjoy formulating a solution. It comes down to constructing rectangles as unions and differences of triangles. First, choose values of $a$ and $b$ that make the details as simple as possible. I like $a=0,b=1$: the univariate density of any component of $X=(X_1,X_2,\ldots,X_n)$ is just the indicator function of the interval $[0,1]$. Let's find the distribution function $F$ of $(Y_1,Y_n)$. By definition, for any real numbers $y_1 \le y_n$ this is $$F(y_1,y_n) = \Pr(Y_1\le y_1\text{ and } Y_n \le y_n).\tag{1}$$ The values of $F$ are obviously $0$ or $1$ in case any of $y_1$ or $y_n$ is outside the interval $[a,b] = [0,1]$, so let's assume they're both in this interval. (Let's also assume $n\ge 2$ to avoid discussing trivialities.) In this case the event $(1)$ can be described in terms of the original variables $X=(X_1,X_2,\ldots,X_n)$ as "at least one of the $X_i$ is less than or equal to $y_1$ and none of the $X_i$ exceed $y_n$." Equivalently, all the $X_i$ lie in $[0,y_n]$ but it is not the case that all of them lie in $(y_1,y_n]$. Because the $X_i$ are independent, their probabilities multiply and give $(y_n-0)^n = y_n^n$ and $(y_n-y_1)^n$, respectively, for these two events just mentioned. Thus, $$F(y_1,y_n) = y_n^n - (y_n-y_1)^n.$$ The density $f$ is the mixed partial derivative of $F$, $$f(y_1,y_n) = \frac{\partial^2 F}{\partial y_1 \partial y_n}(y_1,y_n) = n(n-1)(y_n-y_1)^{n-2}.$$ The general case for $(a,b)$ scales the variables by the factor $b-a$ and shifts the location by $a$. Thus, for $a \lt y_1 \le y_n \lt b$, $$F(y_1,y_n; a,b) = \left(\left(\frac{y_n-a}{b-a}\right)^n - \left(\frac{y_n-a}{b-a} - \frac{y_1-a}{b-a}\right)^n\right) = \frac{(y_n-a)^n - (y_n-y_1)^n}{(b-a)^n}.$$ Differentiating as before we obtain $$f(y_1,y_n; a,b) = \frac{n(n-1)}{(b-a)^n}(y_n-y_1)^{n-2}.$$ Consider the definition of completeness. Let $g$ be any measurable function of two real variables. By definition, $$\eqalign{E[g(Y_1,Y_n)] &= \int_{y_1}^b\int_a^b g(y_1,y_n) f(y_1,y_n)dy_1dy_n\\ &\propto\int_{y_1}^b\int_a^b g(y_1,y_n) (y_n-y_1)^{n-2} dy_1dy_n.\tag{2} }$$ We need to show that when this expectation is zero for all $(a,b)$, then it's certain that $g=0$ for any $(a,b)$. Here's your hint. Let $h:\mathbb{R}^2\to \mathbb{R}$ be any measurable function. I would like to express it in the form suggested by $(2)$ as $h(x,y)=g(x,y)(y-x)^{n-2}$. To do that, obviously we must divide $h$ by $(y-x)^{n-2}$. Unfortunately, for $n\gt 2$ this isn't defined whenever $y=x$. The key is that this set has measure zero so we can neglect it. Accordingly, given any measurable $h$, define $$g(x,y) = \left\{\matrix{h(x,y)/(y-x)^{n-2} & x \ne y \\ 0 & x=y}\right.$$ Then $(2)$ becomes $$\int_{y_1}^b\int_a^b h(y_1,y_n) dy_1dy_n \propto E[g(Y_1,Y_n)].\tag{3}$$ (When the task is showing that something is zero, we may ignore nonzero constants of proportionality. Here, I have dropped $n(n-1)/(b-a)^{n-2}$ from the left hand side.) This is an integral over a right triangle with hypotenuse extending from $(a,a)$ to $(b,b)$ and vertex at $(a,b)$. Let's denote such a triangle $\Delta(a,b)$. Ergo, what you need to show is that if the integral of an arbitrary measurable function $h$ over all triangles $\Delta(a,b)$ is zero, then for any $a\lt b$, $h(x,y)=0$ (almost surely) for all $(x,y)\in \Delta(a,b)$. Although it might seem we haven't gotten any further, consider any rectangle $[u_1,u_2]\times [v_1,v_2]$ wholly contained in the half-plane $y \gt x$. It can be expressed in terms of triangles: $$[u_1,u_2]\times [v_1,v_2] = \Delta(u_1,v_2) \setminus\left(\Delta(u_1,v_1) \cup \Delta(u_2,v_2)\right)\cup \Delta(u_2,v_1).$$ In this figure, the rectangle is what is left over from the big triangle when we remove the overlapping red and green triangles (which double counts their brown intersection) and then replace their intersection. Consequently, you may immediately deduce that the integral of $h$ over all such rectangles is zero. It remains only to show that $h(x,y)$ must be zero (apart from its values on some set of measure zero) whenever $y \gt x$. The proof of this (intuitively clear) assertion depends on what approach you want to take to the definition of integration.
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions Let's take care of the routine calculus for you, so you can get to the heart of the problem and enjoy formulating a solution. It comes down to constructing rectangles as unions and differences of tri
12,826
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions
Following @whuber's answer, we have the joint density of $(Y_{(1)},Y_{(n)})$ $$f(y_1, y_n,a,b)=\frac{n(n-1)}{(b-a)^n}(y_n-y_1)^{n-1},\quad\forall a\leq y_1\leq y_n\leq b\text{ and }a,b\in\mathbb{R}$$ For any function $g(x_1,x_n)$ so that $\mathbb{E}_{a,b}\left[g(y_1,y_n)\right]=0,\forall a,b\in\mathbb{R}\text{ and }a<b$, we have $$0=\frac{n(n-1)}{(b-a)^n}\int_{a}^{b}\int_{a}^{y_n}g(y_1,y_n)(y_n-y_1)^{n-2} dy_1dy_n,\forall a,b\in\mathbb{R}\text{ and }a<b.$$ The integral area of $(y_1, y_n)$ is a triangle with vertices $(a,a)$, $(a,b)$ and $(b,b)$. With varying $a\in\mathbb{R}$ $b\in\mathbb{R}$ $a<b$, these triangles generate the Borel $\sigma$-algebra of $\mathcal{B}=\{(x,z)\in\mathbb{R}^2:x\leq z\}$. Thus $$0=\frac{n(n-1)}{(b-a)^n}\int_{A}g(y_1,y_n)(y_n-y_1)^{n-2} d(y_1,y_n),\text{ for any Borel set }A\subset\mathcal{B}.$$ This means $$g(y_1,y_n)(y_n-y_1)^{n-2}\equiv0,a.e.\iff g\equiv 0,a.e.$$ Thus we conclude $(Y_{(1)},Y_{(n)})$ is a complete statistic for $(a,b).$
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions
Following @whuber's answer, we have the joint density of $(Y_{(1)},Y_{(n)})$ $$f(y_1, y_n,a,b)=\frac{n(n-1)}{(b-a)^n}(y_n-y_1)^{n-1},\quad\forall a\leq y_1\leq y_n\leq b\text{ and }a,b\in\mathbb{R}$$
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions Following @whuber's answer, we have the joint density of $(Y_{(1)},Y_{(n)})$ $$f(y_1, y_n,a,b)=\frac{n(n-1)}{(b-a)^n}(y_n-y_1)^{n-1},\quad\forall a\leq y_1\leq y_n\leq b\text{ and }a,b\in\mathbb{R}$$ For any function $g(x_1,x_n)$ so that $\mathbb{E}_{a,b}\left[g(y_1,y_n)\right]=0,\forall a,b\in\mathbb{R}\text{ and }a<b$, we have $$0=\frac{n(n-1)}{(b-a)^n}\int_{a}^{b}\int_{a}^{y_n}g(y_1,y_n)(y_n-y_1)^{n-2} dy_1dy_n,\forall a,b\in\mathbb{R}\text{ and }a<b.$$ The integral area of $(y_1, y_n)$ is a triangle with vertices $(a,a)$, $(a,b)$ and $(b,b)$. With varying $a\in\mathbb{R}$ $b\in\mathbb{R}$ $a<b$, these triangles generate the Borel $\sigma$-algebra of $\mathcal{B}=\{(x,z)\in\mathbb{R}^2:x\leq z\}$. Thus $$0=\frac{n(n-1)}{(b-a)^n}\int_{A}g(y_1,y_n)(y_n-y_1)^{n-2} d(y_1,y_n),\text{ for any Borel set }A\subset\mathcal{B}.$$ This means $$g(y_1,y_n)(y_n-y_1)^{n-2}\equiv0,a.e.\iff g\equiv 0,a.e.$$ Thus we conclude $(Y_{(1)},Y_{(n)})$ is a complete statistic for $(a,b).$
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions Following @whuber's answer, we have the joint density of $(Y_{(1)},Y_{(n)})$ $$f(y_1, y_n,a,b)=\frac{n(n-1)}{(b-a)^n}(y_n-y_1)^{n-1},\quad\forall a\leq y_1\leq y_n\leq b\text{ and }a,b\in\mathbb{R}$$
12,827
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions
I think it is worth elaborating a little bit the step of how to reach $g = 0$ a.e. $\lambda$ from the integral equation in @Tan's and @whuber's answer, as it demonstrates some classical measure theory techniques that could be used in other similar completeness proving problems. Denote $g(x, y)(y - x)^{n - 2}$ by $f(x, y)$, then Tan's answer showed that \begin{align} \int_a^b\int_a^y f(x, y)dxdy = 0\; \text{ for all } a < b. \tag{1} \end{align} whuber's clever geometric argument shows that $(1)$ implies that \begin{align} \int_I f(x, y)dxdy = 0\; \text{ for all } I \in \mathscr{I}. \tag{2} \end{align} where $\mathscr{I}$ is the class of bounded rectangles in $\mathbb{R}^2$: \begin{align} \mathscr{I} = \{(a_1, b_1] \times (a_2, b_2]: a_1 < b_1, a_2 < b_2\}. \end{align} Our goal is to prove by that $f = 0$ a.e. on $\mathbb{R}^2$ under the condition $(2)$ (which obviously implies $g = 0$ a.e. on $\mathbb{R}^2$). This is implied$^\dagger$ by $f = 0$ a.e. on $I_M := (-M, M] \times (-M, M]$ for arbitrary $M > 0$, to which we prove it below. It is well known that $\mathscr{I}$ generates the Borel $\sigma$-field $\mathscr{R}^2$ on $\mathbb{R}^2$, hence $\mathscr{I} \cap I_M$ generates the $\sigma$-field $\mathscr{R}^2 \cap I_M := \{A \cap I_M: A \in \mathscr{R}^2\}$ in $I_M$ (see Theorem 10.1 in Probability and Measure by Patrick Billingsley for the proof). Hence if we can show that the class \begin{align} \mathscr{A} := \left\{A \in \mathscr{R}^2 \cap I_M: \int_A f(x, y)dxdy = 0\right\} \tag{3} \end{align} is a $\sigma$-field in $I_M$, then $\mathscr{I} \cap I_M \subset \mathscr{A}$ (which is implied by $(2)$) and $\sigma(\mathscr{I} \cap I_M) = \mathscr{R}^2 \cap I_M$ together imply that $\mathscr{R}^2 \cap I_M \subset \mathscr{A}$. Since $f$ is measurable, $A_1 := \{(x, y): f(x, y) > 0\} \in \mathscr{R}^2$ and $A_2 := \{(x, y): f(x, y) < 0\} \in \mathscr{R}^2$, whence $A_1 \cap I_M \in \mathscr{A}$, $A_2 \cap I_M \in \mathscr{A}$. It then follows by $\mathscr{I} \cap I_M \subset \mathscr{A}$ and $(3)$ that \begin{align} \int_{A_1 \cap I_M}f(x, y)dxdy = 0, \quad \int_{A_2 \cap I_M} -f(x, y)dxdy = 0. \tag{4} \end{align} Note that $fI_{A_1} = f^+ = \max(f, 0) \geq 0$ and $-fI_{A_2} = f^- = \max(-f, 0) \geq 0$, $(4)$ can be rewritten as \begin{align} \int_{I_M}f^+(x, y)dxdy = \int_{I_M}f^-(x, y)dxdy = 0, \end{align} which implies that $f^+ = f^- = 0$ a.e. on $I_M$. Therefore, $f = f^+ - f^- = 0$ a.e. on $I_M$. Therefore, to complete the proof, it remains to show that $\mathscr{A}$ is a $\sigma$-field. In fact, because $\mathscr{I} \cap I_M$ is a $\pi$-system, it suffices to show that $\mathscr{A}$ is a $\lambda$-system in view of Dynkin's $\pi$-$\lambda$ theorem. To this end: $I_M \in \mathscr{A}$. This follows from $(2)$ directly. If $A \in \mathscr{A}$, then \begin{align} \int_{I_M - A}f(x)dxdy = \int_{I_M}f(x)dxdy - \int_A f(x)dxdy = 0 - 0 = 0, \end{align} which shows $I_M - A$ lies in $\mathscr{A}$. Therefore $\mathscr{A}$ is closed under the formation of complementation. If $A_n$ lies in $\mathscr{A}$ for all $n$ and $A_1, A_2, \ldots$ are disjoint, then $|fI_{\cup_n A_n}| \leq |f|$ (note that $\int_{I_M}fd\lambda = 0$ implies that $f$ is integrable in $I_M$) and Lebesgue's dominated convergence theorem imply that \begin{align} \int_{\cup_n A_n} fd\lambda = \sum_n \int_{A_n}fd\lambda = 0, \end{align} which shows $\cup_n A_n$ lies in $\mathscr{A}$. Therefore $\mathscr{A}$ is closed under the formation of countable disjoint unions. This completes the proof. $^\dagger$: For each $m \in \mathbb{N}$, define $B_m = \{x \in I_m: f(x) \neq 0\}$. Then the sequence $\{B_m\}$ is increasing and converges to the set $\cup_{m = 1}^\infty B_m = \{x \in \mathbb{R}^2: f(x) \neq 0\}$. It then follows by the continuity from below of $\lambda$ and $f = 0$ a.e. on every $I_m$ that $\lambda(\cup_{m = 1}^\infty B_m) = \lim_{m \to \infty}\lambda(B_m) = 0$, i.e., $f = 0$ a.e. on $\mathbb{R}^2$.
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions
I think it is worth elaborating a little bit the step of how to reach $g = 0$ a.e. $\lambda$ from the integral equation in @Tan's and @whuber's answer, as it demonstrates some classical measure theory
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions I think it is worth elaborating a little bit the step of how to reach $g = 0$ a.e. $\lambda$ from the integral equation in @Tan's and @whuber's answer, as it demonstrates some classical measure theory techniques that could be used in other similar completeness proving problems. Denote $g(x, y)(y - x)^{n - 2}$ by $f(x, y)$, then Tan's answer showed that \begin{align} \int_a^b\int_a^y f(x, y)dxdy = 0\; \text{ for all } a < b. \tag{1} \end{align} whuber's clever geometric argument shows that $(1)$ implies that \begin{align} \int_I f(x, y)dxdy = 0\; \text{ for all } I \in \mathscr{I}. \tag{2} \end{align} where $\mathscr{I}$ is the class of bounded rectangles in $\mathbb{R}^2$: \begin{align} \mathscr{I} = \{(a_1, b_1] \times (a_2, b_2]: a_1 < b_1, a_2 < b_2\}. \end{align} Our goal is to prove by that $f = 0$ a.e. on $\mathbb{R}^2$ under the condition $(2)$ (which obviously implies $g = 0$ a.e. on $\mathbb{R}^2$). This is implied$^\dagger$ by $f = 0$ a.e. on $I_M := (-M, M] \times (-M, M]$ for arbitrary $M > 0$, to which we prove it below. It is well known that $\mathscr{I}$ generates the Borel $\sigma$-field $\mathscr{R}^2$ on $\mathbb{R}^2$, hence $\mathscr{I} \cap I_M$ generates the $\sigma$-field $\mathscr{R}^2 \cap I_M := \{A \cap I_M: A \in \mathscr{R}^2\}$ in $I_M$ (see Theorem 10.1 in Probability and Measure by Patrick Billingsley for the proof). Hence if we can show that the class \begin{align} \mathscr{A} := \left\{A \in \mathscr{R}^2 \cap I_M: \int_A f(x, y)dxdy = 0\right\} \tag{3} \end{align} is a $\sigma$-field in $I_M$, then $\mathscr{I} \cap I_M \subset \mathscr{A}$ (which is implied by $(2)$) and $\sigma(\mathscr{I} \cap I_M) = \mathscr{R}^2 \cap I_M$ together imply that $\mathscr{R}^2 \cap I_M \subset \mathscr{A}$. Since $f$ is measurable, $A_1 := \{(x, y): f(x, y) > 0\} \in \mathscr{R}^2$ and $A_2 := \{(x, y): f(x, y) < 0\} \in \mathscr{R}^2$, whence $A_1 \cap I_M \in \mathscr{A}$, $A_2 \cap I_M \in \mathscr{A}$. It then follows by $\mathscr{I} \cap I_M \subset \mathscr{A}$ and $(3)$ that \begin{align} \int_{A_1 \cap I_M}f(x, y)dxdy = 0, \quad \int_{A_2 \cap I_M} -f(x, y)dxdy = 0. \tag{4} \end{align} Note that $fI_{A_1} = f^+ = \max(f, 0) \geq 0$ and $-fI_{A_2} = f^- = \max(-f, 0) \geq 0$, $(4)$ can be rewritten as \begin{align} \int_{I_M}f^+(x, y)dxdy = \int_{I_M}f^-(x, y)dxdy = 0, \end{align} which implies that $f^+ = f^- = 0$ a.e. on $I_M$. Therefore, $f = f^+ - f^- = 0$ a.e. on $I_M$. Therefore, to complete the proof, it remains to show that $\mathscr{A}$ is a $\sigma$-field. In fact, because $\mathscr{I} \cap I_M$ is a $\pi$-system, it suffices to show that $\mathscr{A}$ is a $\lambda$-system in view of Dynkin's $\pi$-$\lambda$ theorem. To this end: $I_M \in \mathscr{A}$. This follows from $(2)$ directly. If $A \in \mathscr{A}$, then \begin{align} \int_{I_M - A}f(x)dxdy = \int_{I_M}f(x)dxdy - \int_A f(x)dxdy = 0 - 0 = 0, \end{align} which shows $I_M - A$ lies in $\mathscr{A}$. Therefore $\mathscr{A}$ is closed under the formation of complementation. If $A_n$ lies in $\mathscr{A}$ for all $n$ and $A_1, A_2, \ldots$ are disjoint, then $|fI_{\cup_n A_n}| \leq |f|$ (note that $\int_{I_M}fd\lambda = 0$ implies that $f$ is integrable in $I_M$) and Lebesgue's dominated convergence theorem imply that \begin{align} \int_{\cup_n A_n} fd\lambda = \sum_n \int_{A_n}fd\lambda = 0, \end{align} which shows $\cup_n A_n$ lies in $\mathscr{A}$. Therefore $\mathscr{A}$ is closed under the formation of countable disjoint unions. This completes the proof. $^\dagger$: For each $m \in \mathbb{N}$, define $B_m = \{x \in I_m: f(x) \neq 0\}$. Then the sequence $\{B_m\}$ is increasing and converges to the set $\cup_{m = 1}^\infty B_m = \{x \in \mathbb{R}^2: f(x) \neq 0\}$. It then follows by the continuity from below of $\lambda$ and $f = 0$ a.e. on every $I_m$ that $\lambda(\cup_{m = 1}^\infty B_m) = \lim_{m \to \infty}\lambda(B_m) = 0$, i.e., $f = 0$ a.e. on $\mathbb{R}^2$.
Jointly Complete Sufficient Statistics for Uniform$(a, b)$ Distributions I think it is worth elaborating a little bit the step of how to reach $g = 0$ a.e. $\lambda$ from the integral equation in @Tan's and @whuber's answer, as it demonstrates some classical measure theory
12,828
Classification with noisy labels?
The right thing to do here is to change the model, not the loss. Your goal is still to correctly classify as many data points as possible (which determines the loss), but your assumptions about the data have changed (which are encoded in a statistical model, the neural network in this case). Let $\mathbf{p}_t$ be a vector of class probabilities produced by the neural network and $\ell(y_t, \mathbf{p}_t)$ be the cross-entropy loss for label $y_t$. To explicitly take into account the assumption that 30% of the labels are noise (assumed to be uniformly random), we could change our model to produce $$\mathbf{\tilde p}_t = 0.3/N + 0.7 \mathbf{p}_t$$ instead and optimize $$\sum_t \ell(y_t, 0.3/N + 0.7 \mathbf{p}_t),$$ where $N$ is the number of classes. This will actually behave somewhat according to your intuition, limiting the loss to be finite.
Classification with noisy labels?
The right thing to do here is to change the model, not the loss. Your goal is still to correctly classify as many data points as possible (which determines the loss), but your assumptions about the da
Classification with noisy labels? The right thing to do here is to change the model, not the loss. Your goal is still to correctly classify as many data points as possible (which determines the loss), but your assumptions about the data have changed (which are encoded in a statistical model, the neural network in this case). Let $\mathbf{p}_t$ be a vector of class probabilities produced by the neural network and $\ell(y_t, \mathbf{p}_t)$ be the cross-entropy loss for label $y_t$. To explicitly take into account the assumption that 30% of the labels are noise (assumed to be uniformly random), we could change our model to produce $$\mathbf{\tilde p}_t = 0.3/N + 0.7 \mathbf{p}_t$$ instead and optimize $$\sum_t \ell(y_t, 0.3/N + 0.7 \mathbf{p}_t),$$ where $N$ is the number of classes. This will actually behave somewhat according to your intuition, limiting the loss to be finite.
Classification with noisy labels? The right thing to do here is to change the model, not the loss. Your goal is still to correctly classify as many data points as possible (which determines the loss), but your assumptions about the da
12,829
Classification with noisy labels?
This approach has been proven to work in many realistic settings with substantive theory for models with error in every predicted probability output for every example. The approach counts up an unnormalized estimate of the joint distribution of true labels and noisy/given labels. Using that estimate, it finds the label errors in the dataset so you can train on clean data. It has been shown to compare favorably to most methods and works for any dataset you can train a classifier on and for most data formats, ML and deep learning frameworks, and data modalities, e.g. image, text, tabular, and audio data. I am an author on this package. link to python package: https://github.com/cleanlab/cleanlab Find label issues in 1 line of code from cleanlab.classification import CleanLearning from cleanlab.filter import find_label_issues # Option 1 - works with sklearn-compatible models - just input the data and labels ツ label_issues_info = CleanLearning(clf=sklearn_compatible_model).find_label_issues(data, labels) # Option 2 - works with ANY ML model - just input the model's predicted probabilities ordered_label_issues = find_label_issues( labels=labels, pred_probs=pred_probs, # out-of-sample predicted probabilities from any model return_indices_ranked_by='self_confidence', ) Train a model as if the dataset did not have errors -- 3 lines of code from sklearn.linear_model import LogisticRegression from cleanlab.classification import CleanLearning cl = CleanLearning(clf=LogisticRegression()) # any sklearn-compatible classifier cl.fit(train_data, labels) # Estimate the predictions you would have gotten if you trained without mislabeled data. predictions = cl.predict(test_data) Journal of AI Research (with theory to prove it works): https://arxiv.org/abs/1911.00068publication errors found using cleanlab: https://labelerrors.com/ Documentation and runnable tutorials for cleanlab: https://docs.cleanlab.ai/
Classification with noisy labels?
This approach has been proven to work in many realistic settings with substantive theory for models with error in every predicted probability output for every example. The approach counts up an unnor
Classification with noisy labels? This approach has been proven to work in many realistic settings with substantive theory for models with error in every predicted probability output for every example. The approach counts up an unnormalized estimate of the joint distribution of true labels and noisy/given labels. Using that estimate, it finds the label errors in the dataset so you can train on clean data. It has been shown to compare favorably to most methods and works for any dataset you can train a classifier on and for most data formats, ML and deep learning frameworks, and data modalities, e.g. image, text, tabular, and audio data. I am an author on this package. link to python package: https://github.com/cleanlab/cleanlab Find label issues in 1 line of code from cleanlab.classification import CleanLearning from cleanlab.filter import find_label_issues # Option 1 - works with sklearn-compatible models - just input the data and labels ツ label_issues_info = CleanLearning(clf=sklearn_compatible_model).find_label_issues(data, labels) # Option 2 - works with ANY ML model - just input the model's predicted probabilities ordered_label_issues = find_label_issues( labels=labels, pred_probs=pred_probs, # out-of-sample predicted probabilities from any model return_indices_ranked_by='self_confidence', ) Train a model as if the dataset did not have errors -- 3 lines of code from sklearn.linear_model import LogisticRegression from cleanlab.classification import CleanLearning cl = CleanLearning(clf=LogisticRegression()) # any sklearn-compatible classifier cl.fit(train_data, labels) # Estimate the predictions you would have gotten if you trained without mislabeled data. predictions = cl.predict(test_data) Journal of AI Research (with theory to prove it works): https://arxiv.org/abs/1911.00068publication errors found using cleanlab: https://labelerrors.com/ Documentation and runnable tutorials for cleanlab: https://docs.cleanlab.ai/
Classification with noisy labels? This approach has been proven to work in many realistic settings with substantive theory for models with error in every predicted probability output for every example. The approach counts up an unnor
12,830
Preventing overfitting of LSTM on small dataset
You could try: Reduce the number of hidden units, I know you said it already seems low, but given that the input layer only has 80 features, it actually can be that 128 is too much. A rule of thumb is to have the number of hidden units be in-between the number of input units (80) and output classes (5); Alternatively, you could increase the dimension of the input representation space to be more than 80 (however this may overfit as well if the representation is already too narrow for any given word). A good way to fit a network is too begin with an overfitting network and then reduce capacity (hidden units and embedding space) until it no longer overfits.
Preventing overfitting of LSTM on small dataset
You could try: Reduce the number of hidden units, I know you said it already seems low, but given that the input layer only has 80 features, it actually can be that 128 is too much. A rule of thumb i
Preventing overfitting of LSTM on small dataset You could try: Reduce the number of hidden units, I know you said it already seems low, but given that the input layer only has 80 features, it actually can be that 128 is too much. A rule of thumb is to have the number of hidden units be in-between the number of input units (80) and output classes (5); Alternatively, you could increase the dimension of the input representation space to be more than 80 (however this may overfit as well if the representation is already too narrow for any given word). A good way to fit a network is too begin with an overfitting network and then reduce capacity (hidden units and embedding space) until it no longer overfits.
Preventing overfitting of LSTM on small dataset You could try: Reduce the number of hidden units, I know you said it already seems low, but given that the input layer only has 80 features, it actually can be that 128 is too much. A rule of thumb i
12,831
Combining information from multiple studies to estimate the mean and variance of normally distributed data - Bayesian vs meta-analytic approaches
The two approaches (meta-analysis and Bayesian updating) are not really that distinct. Meta-analytic models are in fact often framed as Bayesian models, since the idea of adding evidence to prior knowledge (possibly quite vague) about the phenomenon at hand lends itself naturally to a meta-analysis. An article that describes this connection is: Brannick, M. T. (2001). Implications of empirical Bayes meta-analysis for test validation. Journal of Applied Psychology, 86(3), 468-480. (the author uses correlations as the outcome measure for the meta-analysis, but the principle is the same regardless of the measure). A more general article on Bayesian methods for meta-analysis would be: Sutton, A. J., & Abrams, K. R. (2001). Bayesian methods in meta-analysis and evidence synthesis. Statistical Methods in Medical Research, 10(4), 277-303. What you seem to be after (in addition to some combined estimate) is a prediction/credibility interval that describes where in a future study the true outcome/effect is likely to fall. One can obtain such an interval from a "traditional" meta-analysis or from a Bayesian meta-analytic model. The traditional approach is described, for example, in: Riley, R. D., Higgins, J. P., & Deeks, J. J. (2011). Interpretation of random effects meta-analyses. British Medical Journal, 342, d549. In the context of a Bayesian model (take, for example, the random-effects model described by equation 6 in the paper by Sutton & Abrams, 2001), one can easily obtain the posterior distribution of $\theta_i$, where $\theta_i$ is the true outcome/effect in the $i$th study (since these models are typically estimated using MCMC, one just needs to monitor the chain for $\theta_i$ after a suitable burn-in period). From that posterior distribution, one can then obtain the credibility interval.
Combining information from multiple studies to estimate the mean and variance of normally distribute
The two approaches (meta-analysis and Bayesian updating) are not really that distinct. Meta-analytic models are in fact often framed as Bayesian models, since the idea of adding evidence to prior know
Combining information from multiple studies to estimate the mean and variance of normally distributed data - Bayesian vs meta-analytic approaches The two approaches (meta-analysis and Bayesian updating) are not really that distinct. Meta-analytic models are in fact often framed as Bayesian models, since the idea of adding evidence to prior knowledge (possibly quite vague) about the phenomenon at hand lends itself naturally to a meta-analysis. An article that describes this connection is: Brannick, M. T. (2001). Implications of empirical Bayes meta-analysis for test validation. Journal of Applied Psychology, 86(3), 468-480. (the author uses correlations as the outcome measure for the meta-analysis, but the principle is the same regardless of the measure). A more general article on Bayesian methods for meta-analysis would be: Sutton, A. J., & Abrams, K. R. (2001). Bayesian methods in meta-analysis and evidence synthesis. Statistical Methods in Medical Research, 10(4), 277-303. What you seem to be after (in addition to some combined estimate) is a prediction/credibility interval that describes where in a future study the true outcome/effect is likely to fall. One can obtain such an interval from a "traditional" meta-analysis or from a Bayesian meta-analytic model. The traditional approach is described, for example, in: Riley, R. D., Higgins, J. P., & Deeks, J. J. (2011). Interpretation of random effects meta-analyses. British Medical Journal, 342, d549. In the context of a Bayesian model (take, for example, the random-effects model described by equation 6 in the paper by Sutton & Abrams, 2001), one can easily obtain the posterior distribution of $\theta_i$, where $\theta_i$ is the true outcome/effect in the $i$th study (since these models are typically estimated using MCMC, one just needs to monitor the chain for $\theta_i$ after a suitable burn-in period). From that posterior distribution, one can then obtain the credibility interval.
Combining information from multiple studies to estimate the mean and variance of normally distribute The two approaches (meta-analysis and Bayesian updating) are not really that distinct. Meta-analytic models are in fact often framed as Bayesian models, since the idea of adding evidence to prior know
12,832
Combining information from multiple studies to estimate the mean and variance of normally distributed data - Bayesian vs meta-analytic approaches
If I understand your question correctly, then this differs from the usual meta-analysis setup in that you want to estimate not only a common mean, but also a common variance. So the sampling model for the raw data is $y_{ij} \sim N(\mu, \sigma^2)$ for observation $i = 1,...n_j$ from study $j = 1,...,K$. If that is right, then I think the MLE of $\mu$ is simply the pooled sample mean, i.e., $$ \hat\mu = \frac{1}{N} \sum_{j=1}^K n_j \bar{y}_j,\qquad N = \sum_{j=1}^K n_j.$$ The MLE for $\sigma$ is a little trickier because it involves both within- and between-study variance (think one-way ANOVA). But just pooling the sample variances works too (i.e., is an unbiased estimator of $\sigma^2$): $$\tilde\sigma^2 = \frac{1}{N - K}\sum_{j=1}^K (n_j - 1) s_j^2$$ If $N$ is large, $K$ is not too big, and you are using weak priors, then the Bayesian estimates should be quite similar to these.
Combining information from multiple studies to estimate the mean and variance of normally distribute
If I understand your question correctly, then this differs from the usual meta-analysis setup in that you want to estimate not only a common mean, but also a common variance. So the sampling model for
Combining information from multiple studies to estimate the mean and variance of normally distributed data - Bayesian vs meta-analytic approaches If I understand your question correctly, then this differs from the usual meta-analysis setup in that you want to estimate not only a common mean, but also a common variance. So the sampling model for the raw data is $y_{ij} \sim N(\mu, \sigma^2)$ for observation $i = 1,...n_j$ from study $j = 1,...,K$. If that is right, then I think the MLE of $\mu$ is simply the pooled sample mean, i.e., $$ \hat\mu = \frac{1}{N} \sum_{j=1}^K n_j \bar{y}_j,\qquad N = \sum_{j=1}^K n_j.$$ The MLE for $\sigma$ is a little trickier because it involves both within- and between-study variance (think one-way ANOVA). But just pooling the sample variances works too (i.e., is an unbiased estimator of $\sigma^2$): $$\tilde\sigma^2 = \frac{1}{N - K}\sum_{j=1}^K (n_j - 1) s_j^2$$ If $N$ is large, $K$ is not too big, and you are using weak priors, then the Bayesian estimates should be quite similar to these.
Combining information from multiple studies to estimate the mean and variance of normally distribute If I understand your question correctly, then this differs from the usual meta-analysis setup in that you want to estimate not only a common mean, but also a common variance. So the sampling model for
12,833
Test if multidimensional distributions are the same
I just did a lot of research on multivariate two sample tests when I realized that the Kolmogorov-Smirnov test wasn't multivariate. So I looked at the Chi test, Hotelling's T^2, Anderson-Darling, Cramer-von Mises criterion, Shapiro-Wilk, etc. You have to be careful because some of these tests rely on the vectors being compared to be of the same length. Others are only used to reject the assumption of normality, not to compare two sample distributions. The leading solution seems to compare the two samples' cumulative distribution functions with all possible orderings which, as you may suspect, is very computationally intensive, on the order of minutes for a single run of a sample containing a few thousand records: https://cran.r-project.org/web/packages/Peacock.test/Peacock.test.pdf As Xiao's documentation states, the Fasano and Franceschini test is a variant of the Peacock test: http://adsabs.harvard.edu/abs/1987MNRAS.225..155F The Fasano and Franceschini test was specifically intended to be less computationally intensive, but I have not found an implementation of their work in R. For those of you who want to explore the computational aspects of the Peacock versus Fasano and Franceschini test, check out Computationally efficient algorithms for the two-dimensional Kolmogorov–Smirnov test
Test if multidimensional distributions are the same
I just did a lot of research on multivariate two sample tests when I realized that the Kolmogorov-Smirnov test wasn't multivariate. So I looked at the Chi test, Hotelling's T^2, Anderson-Darling, Cram
Test if multidimensional distributions are the same I just did a lot of research on multivariate two sample tests when I realized that the Kolmogorov-Smirnov test wasn't multivariate. So I looked at the Chi test, Hotelling's T^2, Anderson-Darling, Cramer-von Mises criterion, Shapiro-Wilk, etc. You have to be careful because some of these tests rely on the vectors being compared to be of the same length. Others are only used to reject the assumption of normality, not to compare two sample distributions. The leading solution seems to compare the two samples' cumulative distribution functions with all possible orderings which, as you may suspect, is very computationally intensive, on the order of minutes for a single run of a sample containing a few thousand records: https://cran.r-project.org/web/packages/Peacock.test/Peacock.test.pdf As Xiao's documentation states, the Fasano and Franceschini test is a variant of the Peacock test: http://adsabs.harvard.edu/abs/1987MNRAS.225..155F The Fasano and Franceschini test was specifically intended to be less computationally intensive, but I have not found an implementation of their work in R. For those of you who want to explore the computational aspects of the Peacock versus Fasano and Franceschini test, check out Computationally efficient algorithms for the two-dimensional Kolmogorov–Smirnov test
Test if multidimensional distributions are the same I just did a lot of research on multivariate two sample tests when I realized that the Kolmogorov-Smirnov test wasn't multivariate. So I looked at the Chi test, Hotelling's T^2, Anderson-Darling, Cram
12,834
Test if multidimensional distributions are the same
Yes, there are nonparametric ways of testing if two multivariate samples are from the same joint distribution. I will mention details excluding the ones mentioned by L Fischman. The basic problem you are asking can be called as a 'Two-Sample-Problem' and a good amount of research is going on currently in journals like Journal of Machine Learning Research and Annals of Statistics and others. With my little knowledge on this problem, I can give direction as follows One recent way of testing the multivariate sample sets is through Maximum Mean Discrepancy (MMD); related literature:Arthur Gretton 2012,Bharath 2010 and others. Other related methods can be found in these research articles. If interested, please go through the articles citing these articles, to get a big picture of the state-of-art in this problem. And YES, for this there are R implementations. If your interest is to compare various point sets (sample sets) with the reference point set, to see how closely they approximate the reference point set, you can use f-divergence. One popular special case of this is Kullback-Leibler Divergence. This is used in many machine learning regimes. This can again be done in two np ways; through parzen window (kernel) approach and K-Nearest Neighbor PDF estimators. There may also be other ways to approach, this answer is in no way a comprehensive treatment of your question ;)
Test if multidimensional distributions are the same
Yes, there are nonparametric ways of testing if two multivariate samples are from the same joint distribution. I will mention details excluding the ones mentioned by L Fischman. The basic problem you
Test if multidimensional distributions are the same Yes, there are nonparametric ways of testing if two multivariate samples are from the same joint distribution. I will mention details excluding the ones mentioned by L Fischman. The basic problem you are asking can be called as a 'Two-Sample-Problem' and a good amount of research is going on currently in journals like Journal of Machine Learning Research and Annals of Statistics and others. With my little knowledge on this problem, I can give direction as follows One recent way of testing the multivariate sample sets is through Maximum Mean Discrepancy (MMD); related literature:Arthur Gretton 2012,Bharath 2010 and others. Other related methods can be found in these research articles. If interested, please go through the articles citing these articles, to get a big picture of the state-of-art in this problem. And YES, for this there are R implementations. If your interest is to compare various point sets (sample sets) with the reference point set, to see how closely they approximate the reference point set, you can use f-divergence. One popular special case of this is Kullback-Leibler Divergence. This is used in many machine learning regimes. This can again be done in two np ways; through parzen window (kernel) approach and K-Nearest Neighbor PDF estimators. There may also be other ways to approach, this answer is in no way a comprehensive treatment of your question ;)
Test if multidimensional distributions are the same Yes, there are nonparametric ways of testing if two multivariate samples are from the same joint distribution. I will mention details excluding the ones mentioned by L Fischman. The basic problem you
12,835
Test if multidimensional distributions are the same
R package np (non-parametric) has a test for equality of densities of continous and categorical data using integrated squared density. Li, Maasoumi, and Racine(2009) As well as np conditional pdf in section 6.
Test if multidimensional distributions are the same
R package np (non-parametric) has a test for equality of densities of continous and categorical data using integrated squared density. Li, Maasoumi, and Racine(2009) As well as np conditional pdf in s
Test if multidimensional distributions are the same R package np (non-parametric) has a test for equality of densities of continous and categorical data using integrated squared density. Li, Maasoumi, and Racine(2009) As well as np conditional pdf in section 6.
Test if multidimensional distributions are the same R package np (non-parametric) has a test for equality of densities of continous and categorical data using integrated squared density. Li, Maasoumi, and Racine(2009) As well as np conditional pdf in s
12,836
Test if multidimensional distributions are the same
As I am working on the same problem, I can share some of my insights so far (which is far from expertise). You are asking for a test that answers the question whether or not two sample distributions are drawn from the same distribution. A question that is also asked frequently in testing is if two sample distributions are drawn from a distribution with an identical expected value. In this framework, sample distribution sizes are often referred to as $n_1$ and $n_2$, whereas the dimension of the data is referred to as $p$. In the test referring to the location only, the hypothesis are: \begin{equation} H_0: \hspace{1cm} \mu_F=\mu_G \\ H_1: \hspace{1cm} \mu_F \neq \mu_G \end{equation} Implementations for $p>>1$ are: python: https://hotelling.readthedocs.io/en/latest/. I could only access the code via the github repository: https://github.com/dionresearch/hotelling but maybe you are more lucky. R: https://www.rdocumentation.org/packages/highmean/versions/3.0. The respective paper is: https://academic.oup.com/biomet/article/103/3/609/1744173?login=true There is a lot of research going on in that area - maybe you want to consider connected papers for a search: https://www.connectedpapers.com/main/3c14196155b1e9def9241a841e359e6054a4d44b/A-Simple-TwoSample-Test-in-High-Dimensions-Based-on-L2Norm/graph For the first type of test, the hypothesis denotes as the following: \begin{equation} H_0: \hspace{1cm} F(x)=G(x) \\ H_1: \hspace{1cm} F(x)\neq G(x) \end{equation} There have been some approaches in the late 1980s with MST (minimal spanning trees) and nearest neighbor search. For example: https://amstat.tandfonline.com/doi/abs/10.1080/01621459.1986.10478337#.YEjb79wo9EY I think this approach has been dropped, but would be happy to be proven wrong.
Test if multidimensional distributions are the same
As I am working on the same problem, I can share some of my insights so far (which is far from expertise). You are asking for a test that answers the question whether or not two sample distributions a
Test if multidimensional distributions are the same As I am working on the same problem, I can share some of my insights so far (which is far from expertise). You are asking for a test that answers the question whether or not two sample distributions are drawn from the same distribution. A question that is also asked frequently in testing is if two sample distributions are drawn from a distribution with an identical expected value. In this framework, sample distribution sizes are often referred to as $n_1$ and $n_2$, whereas the dimension of the data is referred to as $p$. In the test referring to the location only, the hypothesis are: \begin{equation} H_0: \hspace{1cm} \mu_F=\mu_G \\ H_1: \hspace{1cm} \mu_F \neq \mu_G \end{equation} Implementations for $p>>1$ are: python: https://hotelling.readthedocs.io/en/latest/. I could only access the code via the github repository: https://github.com/dionresearch/hotelling but maybe you are more lucky. R: https://www.rdocumentation.org/packages/highmean/versions/3.0. The respective paper is: https://academic.oup.com/biomet/article/103/3/609/1744173?login=true There is a lot of research going on in that area - maybe you want to consider connected papers for a search: https://www.connectedpapers.com/main/3c14196155b1e9def9241a841e359e6054a4d44b/A-Simple-TwoSample-Test-in-High-Dimensions-Based-on-L2Norm/graph For the first type of test, the hypothesis denotes as the following: \begin{equation} H_0: \hspace{1cm} F(x)=G(x) \\ H_1: \hspace{1cm} F(x)\neq G(x) \end{equation} There have been some approaches in the late 1980s with MST (minimal spanning trees) and nearest neighbor search. For example: https://amstat.tandfonline.com/doi/abs/10.1080/01621459.1986.10478337#.YEjb79wo9EY I think this approach has been dropped, but would be happy to be proven wrong.
Test if multidimensional distributions are the same As I am working on the same problem, I can share some of my insights so far (which is far from expertise). You are asking for a test that answers the question whether or not two sample distributions a
12,837
Test if multidimensional distributions are the same
In summary, this is hard! So it is useful to step back from the abstract question. Why do you want to compare these distributions? Perhaps this goal can be met some other way. For example, one reason for doing this is when training a GAN. In this situation the training is iterative and stochastic. So it is sufficient to use a stochastic approximation to the answer, which can be done as follows: each time you want to measure the distance between the distributions, choose a random projection to one dimension. Then calculate the Kolmogorov-Smirnov metric for the two projected distributions. Apologies, I forget the reference for this method, which was invented by someone smarter than me.
Test if multidimensional distributions are the same
In summary, this is hard! So it is useful to step back from the abstract question. Why do you want to compare these distributions? Perhaps this goal can be met some other way. For example, one reason
Test if multidimensional distributions are the same In summary, this is hard! So it is useful to step back from the abstract question. Why do you want to compare these distributions? Perhaps this goal can be met some other way. For example, one reason for doing this is when training a GAN. In this situation the training is iterative and stochastic. So it is sufficient to use a stochastic approximation to the answer, which can be done as follows: each time you want to measure the distance between the distributions, choose a random projection to one dimension. Then calculate the Kolmogorov-Smirnov metric for the two projected distributions. Apologies, I forget the reference for this method, which was invented by someone smarter than me.
Test if multidimensional distributions are the same In summary, this is hard! So it is useful to step back from the abstract question. Why do you want to compare these distributions? Perhaps this goal can be met some other way. For example, one reason
12,838
How to calculate the confidence interval of the mean of means?
There is a natural exact confidence interval for the grandmean in the balanced random one-way ANOVA model $$(y_{ij} \mid \mu_i) \sim_{\text{iid}} {\cal N}(\mu_i, \sigma^2_w), \quad j=1,\ldots,J, \qquad \mu_i \sim_{\text{iid}} {\cal N}(\mu, \sigma^2_b), \quad i=1,\ldots,I.$$ Indeed, it is easy to check that the distribution of the observed means $\bar{y}_{i\bullet}$ is $\bar{y}_{i\bullet} \sim_{\text{iid}} {\cal N}(\mu, \tau^2)$ with $\tau^2=\sigma^2_b+\frac{\sigma^2_w}{J}$, and it is well known that the between sum of squares $SS_b$ has distribution $$SS_b \sim J\tau^2\chi^2_{I-1}$$ and is independent of the overall observed mean $$\bar y_{\bullet\bullet} \sim {\cal N}(\mu, \frac{\tau^2}{I})$$. Thus $$\frac{\bar y_{\bullet\bullet} - \mu}{\frac{1}{\sqrt{I}}\sqrt{\frac{SS_b}{J(I-1)}}}$$ has a Student $t$ distribution with $I-1$ degrees of freedom, wherefrom it is easy to get an exact confidence interval about $\mu$. Note that this confidence interval is nothing but the classical interval for a Gaussian mean by considering only the group means $\bar{y}_{i\bullet}$ as the observations. Thus the simple approach you mention: The simple approach is to first compute the mean of each experiment: 38.0, 49.3, and 31.7, and then compute the mean, and its 95% confidence interval, of those three values. Using this method, the grand mean is 39.7 with the 95% confidence interval ranging from 17.4 to 61.9. is right. And your intuition about the ignored variation: The problem with that approach is that it totally ignores the variation among triplicates. I wonder if there isn't a good way to account for that variation. is wrong. I also mention the correctness of such a simplification in https://stats.stackexchange.com/a/72578/8402 Update 12/04/2014 Some details are now written on my blog: Reducing a model to get confidence intervals.
How to calculate the confidence interval of the mean of means?
There is a natural exact confidence interval for the grandmean in the balanced random one-way ANOVA model $$(y_{ij} \mid \mu_i) \sim_{\text{iid}} {\cal N}(\mu_i, \sigma^2_w), \quad j=1,\ldots,J, \qqu
How to calculate the confidence interval of the mean of means? There is a natural exact confidence interval for the grandmean in the balanced random one-way ANOVA model $$(y_{ij} \mid \mu_i) \sim_{\text{iid}} {\cal N}(\mu_i, \sigma^2_w), \quad j=1,\ldots,J, \qquad \mu_i \sim_{\text{iid}} {\cal N}(\mu, \sigma^2_b), \quad i=1,\ldots,I.$$ Indeed, it is easy to check that the distribution of the observed means $\bar{y}_{i\bullet}$ is $\bar{y}_{i\bullet} \sim_{\text{iid}} {\cal N}(\mu, \tau^2)$ with $\tau^2=\sigma^2_b+\frac{\sigma^2_w}{J}$, and it is well known that the between sum of squares $SS_b$ has distribution $$SS_b \sim J\tau^2\chi^2_{I-1}$$ and is independent of the overall observed mean $$\bar y_{\bullet\bullet} \sim {\cal N}(\mu, \frac{\tau^2}{I})$$. Thus $$\frac{\bar y_{\bullet\bullet} - \mu}{\frac{1}{\sqrt{I}}\sqrt{\frac{SS_b}{J(I-1)}}}$$ has a Student $t$ distribution with $I-1$ degrees of freedom, wherefrom it is easy to get an exact confidence interval about $\mu$. Note that this confidence interval is nothing but the classical interval for a Gaussian mean by considering only the group means $\bar{y}_{i\bullet}$ as the observations. Thus the simple approach you mention: The simple approach is to first compute the mean of each experiment: 38.0, 49.3, and 31.7, and then compute the mean, and its 95% confidence interval, of those three values. Using this method, the grand mean is 39.7 with the 95% confidence interval ranging from 17.4 to 61.9. is right. And your intuition about the ignored variation: The problem with that approach is that it totally ignores the variation among triplicates. I wonder if there isn't a good way to account for that variation. is wrong. I also mention the correctness of such a simplification in https://stats.stackexchange.com/a/72578/8402 Update 12/04/2014 Some details are now written on my blog: Reducing a model to get confidence intervals.
How to calculate the confidence interval of the mean of means? There is a natural exact confidence interval for the grandmean in the balanced random one-way ANOVA model $$(y_{ij} \mid \mu_i) \sim_{\text{iid}} {\cal N}(\mu_i, \sigma^2_w), \quad j=1,\ldots,J, \qqu
12,839
How to calculate the confidence interval of the mean of means?
This is a question of estimation within a linear mixed effects model. The problem is that the variance of the grand mean is a weighted sum of two variance components which have to be separately estimated (via an ANOVA of the data). The estimates have different degrees of freedom. Therefore, although one can attempt to construct a confidence interval for the mean using the usual small-sample (Student t) formulas, it is unlikely to attain its nominal coverage because the deviations from the mean will not exactly follow a Student t distribution. A recent (2010) article by Eva Jarosova, Estimation with the Linear Mixed Effects Model, discusses this issue. (As of 2015 it no longer appears to be available on the Web.) In the context of a "small" dataset (even so, about three times larger than this one), she uses simulation to evaluate two approximate CI calculations (the well-known Satterthwaite approximation and the "Kenward-Roger's method"). Her conclusions include Simulation study revealed that quality of estimation of covariance parameters and consequently adjustment of confidence intervals in small samples can be quite poor.... A poor estimation may influence not only the true confidence level of conventional intervals but it can also make the adjustment impossible. It is obvious that even for balanced data three types of intervals [conventional, Satterthwaite, K-R] may differ substantially. When a striking difference between the conventional and the adjusted intervals is observed, standard errors of covariance parameter estimates should be checked. On the other hand, when the differences between [the three] types of intervals are small, the adjustment seems to be unnecessary. In short, a good approach seems to be Compute a conventional CI by using the estimates of variance components and pretending a t-distribution applies. Also compute at least one of the adjusted CIs. If the computations are "close," accept the conventional CI. Otherwise, report that there are insufficient data to produce a reliable CI.
How to calculate the confidence interval of the mean of means?
This is a question of estimation within a linear mixed effects model. The problem is that the variance of the grand mean is a weighted sum of two variance components which have to be separately estim
How to calculate the confidence interval of the mean of means? This is a question of estimation within a linear mixed effects model. The problem is that the variance of the grand mean is a weighted sum of two variance components which have to be separately estimated (via an ANOVA of the data). The estimates have different degrees of freedom. Therefore, although one can attempt to construct a confidence interval for the mean using the usual small-sample (Student t) formulas, it is unlikely to attain its nominal coverage because the deviations from the mean will not exactly follow a Student t distribution. A recent (2010) article by Eva Jarosova, Estimation with the Linear Mixed Effects Model, discusses this issue. (As of 2015 it no longer appears to be available on the Web.) In the context of a "small" dataset (even so, about three times larger than this one), she uses simulation to evaluate two approximate CI calculations (the well-known Satterthwaite approximation and the "Kenward-Roger's method"). Her conclusions include Simulation study revealed that quality of estimation of covariance parameters and consequently adjustment of confidence intervals in small samples can be quite poor.... A poor estimation may influence not only the true confidence level of conventional intervals but it can also make the adjustment impossible. It is obvious that even for balanced data three types of intervals [conventional, Satterthwaite, K-R] may differ substantially. When a striking difference between the conventional and the adjusted intervals is observed, standard errors of covariance parameter estimates should be checked. On the other hand, when the differences between [the three] types of intervals are small, the adjustment seems to be unnecessary. In short, a good approach seems to be Compute a conventional CI by using the estimates of variance components and pretending a t-distribution applies. Also compute at least one of the adjusted CIs. If the computations are "close," accept the conventional CI. Otherwise, report that there are insufficient data to produce a reliable CI.
How to calculate the confidence interval of the mean of means? This is a question of estimation within a linear mixed effects model. The problem is that the variance of the grand mean is a weighted sum of two variance components which have to be separately estim
12,840
How to calculate the confidence interval of the mean of means?
You can't have one confidence interval that solves both of your problems. You have to pick one. You can either derive one from a mean square error term of within experiment variance that allows you to say something about how accurately you can estimate the values within experiment or you can do it between and it will be about between experiments. If I just did the former I'd tend to want to plot it around 0 rather than around the grand mean because it doesn't tell you anything about the actual mean value, only about an effect (in this case 0). Or you could just plot both and describe what they do. You've got a handle on the between one. For the within it's just like calculating the error term in an ANOVA to get an MSE to work with and from there the SE for the CI is just sqrt(MSE/n) (n = 3 in this case).
How to calculate the confidence interval of the mean of means?
You can't have one confidence interval that solves both of your problems. You have to pick one. You can either derive one from a mean square error term of within experiment variance that allows you
How to calculate the confidence interval of the mean of means? You can't have one confidence interval that solves both of your problems. You have to pick one. You can either derive one from a mean square error term of within experiment variance that allows you to say something about how accurately you can estimate the values within experiment or you can do it between and it will be about between experiments. If I just did the former I'd tend to want to plot it around 0 rather than around the grand mean because it doesn't tell you anything about the actual mean value, only about an effect (in this case 0). Or you could just plot both and describe what they do. You've got a handle on the between one. For the within it's just like calculating the error term in an ANOVA to get an MSE to work with and from there the SE for the CI is just sqrt(MSE/n) (n = 3 in this case).
How to calculate the confidence interval of the mean of means? You can't have one confidence interval that solves both of your problems. You have to pick one. You can either derive one from a mean square error term of within experiment variance that allows you
12,841
How to calculate the confidence interval of the mean of means?
I think the CI for grand mean is too wide [17,62] even for the range of original data. This experiments are VERY common in chemistry. For example, in certification of reference materials you have to pick up some bottles from whole lot in a random way, and you have to carry out replicate analysis on each bottles. How do you calculate the reference value and its uncertainty? There are a lot of way to do it, but the most sofisticated (and correct, I think) is applying meta-analysis or ML (Dersimonian-Laird, Vangel-Rukhin, etc) What about bootstrap estimates?
How to calculate the confidence interval of the mean of means?
I think the CI for grand mean is too wide [17,62] even for the range of original data. This experiments are VERY common in chemistry. For example, in certification of reference materials you have to p
How to calculate the confidence interval of the mean of means? I think the CI for grand mean is too wide [17,62] even for the range of original data. This experiments are VERY common in chemistry. For example, in certification of reference materials you have to pick up some bottles from whole lot in a random way, and you have to carry out replicate analysis on each bottles. How do you calculate the reference value and its uncertainty? There are a lot of way to do it, but the most sofisticated (and correct, I think) is applying meta-analysis or ML (Dersimonian-Laird, Vangel-Rukhin, etc) What about bootstrap estimates?
How to calculate the confidence interval of the mean of means? I think the CI for grand mean is too wide [17,62] even for the range of original data. This experiments are VERY common in chemistry. For example, in certification of reference materials you have to p
12,842
Standardized VS centered variables
Yes Yes You standardize variables to compare the importance of independent variables in determining the outcome variables. You may want to center a variable when you use an interaction term--its effect will be meaningfully interpretable if the minimum value of one of the interacted variables is not zero. If you are regressing different outcome variables (with different scales) on the same set of independent variables, you can meaningfully compare the estimated coefficients. Yes Yes. Yes. Yes, but bare in mind point 4.
Standardized VS centered variables
Yes Yes You standardize variables to compare the importance of independent variables in determining the outcome variables. You may want to center a variable when you use an interaction term--its effec
Standardized VS centered variables Yes Yes You standardize variables to compare the importance of independent variables in determining the outcome variables. You may want to center a variable when you use an interaction term--its effect will be meaningfully interpretable if the minimum value of one of the interacted variables is not zero. If you are regressing different outcome variables (with different scales) on the same set of independent variables, you can meaningfully compare the estimated coefficients. Yes Yes. Yes. Yes, but bare in mind point 4.
Standardized VS centered variables Yes Yes You standardize variables to compare the importance of independent variables in determining the outcome variables. You may want to center a variable when you use an interaction term--its effec
12,843
Computing prediction intervals for logistic regression
Prediction intervals predict where the actual response data values are predicted to fall with a given probability. Since the possible values of the response of a logistic model are restricted to 0 and 1, the 100% prediction interval is therefore $ 0 <= y <= 1 $. No other intervals really make sense for prediction with logistic regression. Since it is always the same interval it generally is not interesting enough to generate or discuss.
Computing prediction intervals for logistic regression
Prediction intervals predict where the actual response data values are predicted to fall with a given probability. Since the possible values of the response of a logistic model are restricted to 0 an
Computing prediction intervals for logistic regression Prediction intervals predict where the actual response data values are predicted to fall with a given probability. Since the possible values of the response of a logistic model are restricted to 0 and 1, the 100% prediction interval is therefore $ 0 <= y <= 1 $. No other intervals really make sense for prediction with logistic regression. Since it is always the same interval it generally is not interesting enough to generate or discuss.
Computing prediction intervals for logistic regression Prediction intervals predict where the actual response data values are predicted to fall with a given probability. Since the possible values of the response of a logistic model are restricted to 0 an
12,844
Computing prediction intervals for logistic regression
I agree with @Greg Snow that there should not be a distinction between prediction interval and confidence interval for binary outcome models as in linear models. He noted the difference between a binomial outcome (y successes out of j trials among n groups) and a binary outcome (success or failure of one subject among n subjects). The former may have both a prediction interval for an individual proportion and a confidence interval for the population mean of proportions, while the latter has a confidence interval for the population probability. Additionally, I discovered that @carbocation incorrectly implemented Collett's equation for calculating the variance and standard error of a predicted logit. A correct implementation should lead to identical results to glm() predictions. The equation (3.11) by Collett (2002, p. 98) is given in scalar, which might the reason to cause a confusion and result in the error. Collett, D. (2002). Modelling binary data (2nd ed.). Chapman and Hall/CRC. In the context of @carbocation R scripts, the correct codes to generate the standard error of a predicted logit are # Prediction: this.student.prediction <- sum(this.student.predictors * coef(data.model)) # linear combination of logistic model coefficients var.prediction <- this.student.predictors %*% model.vcov %*% t(this.student.predictors) # matrix multiplication with dimensions (1*p) (p*p) (p*1) where p is the number of predictors including the intercept, which results in a scalar (vector of length 1) se.prediction <- sqrt(var.prediction) # if not a scalar, se = sqrt(diag(vcov)) where vcov is a square matrix of variance-covariance. This procedure of matrix multiplication to generate standard error of a predicted value applies to many other types of models. To address the question in the comment by @Rafael, a standard error is simply the standard deviation of an estimate for a population parameter. When using individual scores to estimate a population mean, the standard error of a population mean estimate is created by dividing the standard deviation of individual scores by sqrt(n) where n is the sample size of individual scores. For an estimated model, however, model estimates, such as coefficients and predicted logits of probabilities according to a logistic regression, are already of the population parameters and are not a sample of individual scores. Thus, the standard deviation of model estimates, such as coefficients and predicted outcomes, are their standard error. Such uncertainty is from sampling errors of population parameters instead of from variability among individual subjects. This is also why a bootstrapped estimate of the standard error of a statistic with an unknown distribution uses the standard deviation of the observed statistics among bootstrapped samples, which does not shrink when taking more bootstrapped samples.
Computing prediction intervals for logistic regression
I agree with @Greg Snow that there should not be a distinction between prediction interval and confidence interval for binary outcome models as in linear models. He noted the difference between a bino
Computing prediction intervals for logistic regression I agree with @Greg Snow that there should not be a distinction between prediction interval and confidence interval for binary outcome models as in linear models. He noted the difference between a binomial outcome (y successes out of j trials among n groups) and a binary outcome (success or failure of one subject among n subjects). The former may have both a prediction interval for an individual proportion and a confidence interval for the population mean of proportions, while the latter has a confidence interval for the population probability. Additionally, I discovered that @carbocation incorrectly implemented Collett's equation for calculating the variance and standard error of a predicted logit. A correct implementation should lead to identical results to glm() predictions. The equation (3.11) by Collett (2002, p. 98) is given in scalar, which might the reason to cause a confusion and result in the error. Collett, D. (2002). Modelling binary data (2nd ed.). Chapman and Hall/CRC. In the context of @carbocation R scripts, the correct codes to generate the standard error of a predicted logit are # Prediction: this.student.prediction <- sum(this.student.predictors * coef(data.model)) # linear combination of logistic model coefficients var.prediction <- this.student.predictors %*% model.vcov %*% t(this.student.predictors) # matrix multiplication with dimensions (1*p) (p*p) (p*1) where p is the number of predictors including the intercept, which results in a scalar (vector of length 1) se.prediction <- sqrt(var.prediction) # if not a scalar, se = sqrt(diag(vcov)) where vcov is a square matrix of variance-covariance. This procedure of matrix multiplication to generate standard error of a predicted value applies to many other types of models. To address the question in the comment by @Rafael, a standard error is simply the standard deviation of an estimate for a population parameter. When using individual scores to estimate a population mean, the standard error of a population mean estimate is created by dividing the standard deviation of individual scores by sqrt(n) where n is the sample size of individual scores. For an estimated model, however, model estimates, such as coefficients and predicted logits of probabilities according to a logistic regression, are already of the population parameters and are not a sample of individual scores. Thus, the standard deviation of model estimates, such as coefficients and predicted outcomes, are their standard error. Such uncertainty is from sampling errors of population parameters instead of from variability among individual subjects. This is also why a bootstrapped estimate of the standard error of a statistic with an unknown distribution uses the standard deviation of the observed statistics among bootstrapped samples, which does not shrink when taking more bootstrapped samples.
Computing prediction intervals for logistic regression I agree with @Greg Snow that there should not be a distinction between prediction interval and confidence interval for binary outcome models as in linear models. He noted the difference between a bino
12,845
Parameters vs latent variables
In the paper, and in general, (random) variables are everything which is drawn from a probability distribution. Latent (random) variables are the ones you don't directly observe ($y$ is observed, $\beta$ is not, but both are r.v). From a latent random variable you can get a posterior distribution, which is its probability distribution conditioned to the observed data. On the other hand, a parameter is fixed, even if you don't know its value. Maximum Likelihood Estimation, for instance, gives you the most likely value of your parameter. But it gives you a point, not a full distribution, because fixed things do not have distributions! (You can put a distribution on how sure you are about this value, or in what range you thing this value is, but this is is not the same as the distribution of the value itself, which only exists if the value is actually a random variable) In a Bayesian setting, you can have all of them. Here, parameters are things like the number of clusters; you give this value to the model, and the model considers it a fixed number. $y$ is a random variable because it is drawn from a distribution, and $\beta$ and $w$ are latent random variables because they are drawn from probability distributions as well. The fact that $y$ depends on $\beta$ and $w$ doesn't make them "parameters", it just makes $y$ dependent on two random variables. In the paper they consider that $\beta$ and $w$ are random variables. In this sentence: These update equations need to be run iteratively until all parameters and the complete log likelihood converge to steady values in theory they talk about the two parameters, not the ones that are random variables, since in EM this is what you do, optimizing over parameters.
Parameters vs latent variables
In the paper, and in general, (random) variables are everything which is drawn from a probability distribution. Latent (random) variables are the ones you don't directly observe ($y$ is observed, $\be
Parameters vs latent variables In the paper, and in general, (random) variables are everything which is drawn from a probability distribution. Latent (random) variables are the ones you don't directly observe ($y$ is observed, $\beta$ is not, but both are r.v). From a latent random variable you can get a posterior distribution, which is its probability distribution conditioned to the observed data. On the other hand, a parameter is fixed, even if you don't know its value. Maximum Likelihood Estimation, for instance, gives you the most likely value of your parameter. But it gives you a point, not a full distribution, because fixed things do not have distributions! (You can put a distribution on how sure you are about this value, or in what range you thing this value is, but this is is not the same as the distribution of the value itself, which only exists if the value is actually a random variable) In a Bayesian setting, you can have all of them. Here, parameters are things like the number of clusters; you give this value to the model, and the model considers it a fixed number. $y$ is a random variable because it is drawn from a distribution, and $\beta$ and $w$ are latent random variables because they are drawn from probability distributions as well. The fact that $y$ depends on $\beta$ and $w$ doesn't make them "parameters", it just makes $y$ dependent on two random variables. In the paper they consider that $\beta$ and $w$ are random variables. In this sentence: These update equations need to be run iteratively until all parameters and the complete log likelihood converge to steady values in theory they talk about the two parameters, not the ones that are random variables, since in EM this is what you do, optimizing over parameters.
Parameters vs latent variables In the paper, and in general, (random) variables are everything which is drawn from a probability distribution. Latent (random) variables are the ones you don't directly observe ($y$ is observed, $\be
12,846
Casting a multivariate linear model as a multiple regression
Basically, can you do everything with the equivalent linear univariate regression model that you could with the multivariate model? I believe the answer is no. If your goal is simply either to estimate the effects (parameters in $\mathbf{B}$) or to further make predictions based on the model, then yes it does not matter to adopt which model formulation between the two. However, to make statistical inferences especially to perform the classical significance testing, the multivariate formulation seems practically irreplaceable. More specifically let me use the typical data analysis in psychology as an example. The data from $n$ subjects are expressed as $$ \underset{n \times t}{\mathbf{Y}} = \underset{n \times k}{\mathbf{X}} \hspace{2mm}\underset{k \times t}{\mathbf{B}} + \underset{n \times t}{\mathbf{R}}, $$ where the $k-1$ between-subjects explanatory variables (factor or/and quantitative covariates) are coded as the columns in $\mathbf{X}$ while the $t$ repeated-measures (or within-subject) factor levels are represented as simultaneous variables or the columns in $\mathbf{Y}$. With the above formulation, any general linear hypothesis can be easily expressed as $$\mathbf{L} \mathbf{B} \mathbf{M} = \mathbf{C},$$ where $\mathbf{L}$ is composed of the weights among the between-subjects explanatory variables while $\mathbf{L}$ contains the weights among levels of the repeated-measures factors, and $\mathbf{C}$ is a constant matrix, usually $\mathbf{0}$. The beauty of the multivariate system lies in its separation between the two types of variables, between- and within-subject. It is this separation that allows for the easy formulation for three types of significance testing under the multivariate framework: the classical multivariate testing, repeated-measures multivariate testing, and repeated-measures univariate testing. Furthermore, Mauchly testing for sphericity violation and the corresponding correction methods (Greenhouse-Geisser and Huynh-Feldt) also become natural for univariate testing in the multivariate system. This is exactly how the statistical packages implemented those tests such as car in R, GLM in IBM SPSS Statistics, and REPEATED statement in PROC GLM of SAS. I'm not so sure whether the formulation matters in Bayesian data analysis, but I doubt the above testing capability could be formulated and implemented under the univariate platform.
Casting a multivariate linear model as a multiple regression
Basically, can you do everything with the equivalent linear univariate regression model that you could with the multivariate model? I believe the answer is no. If your goal is simply either to esti
Casting a multivariate linear model as a multiple regression Basically, can you do everything with the equivalent linear univariate regression model that you could with the multivariate model? I believe the answer is no. If your goal is simply either to estimate the effects (parameters in $\mathbf{B}$) or to further make predictions based on the model, then yes it does not matter to adopt which model formulation between the two. However, to make statistical inferences especially to perform the classical significance testing, the multivariate formulation seems practically irreplaceable. More specifically let me use the typical data analysis in psychology as an example. The data from $n$ subjects are expressed as $$ \underset{n \times t}{\mathbf{Y}} = \underset{n \times k}{\mathbf{X}} \hspace{2mm}\underset{k \times t}{\mathbf{B}} + \underset{n \times t}{\mathbf{R}}, $$ where the $k-1$ between-subjects explanatory variables (factor or/and quantitative covariates) are coded as the columns in $\mathbf{X}$ while the $t$ repeated-measures (or within-subject) factor levels are represented as simultaneous variables or the columns in $\mathbf{Y}$. With the above formulation, any general linear hypothesis can be easily expressed as $$\mathbf{L} \mathbf{B} \mathbf{M} = \mathbf{C},$$ where $\mathbf{L}$ is composed of the weights among the between-subjects explanatory variables while $\mathbf{L}$ contains the weights among levels of the repeated-measures factors, and $\mathbf{C}$ is a constant matrix, usually $\mathbf{0}$. The beauty of the multivariate system lies in its separation between the two types of variables, between- and within-subject. It is this separation that allows for the easy formulation for three types of significance testing under the multivariate framework: the classical multivariate testing, repeated-measures multivariate testing, and repeated-measures univariate testing. Furthermore, Mauchly testing for sphericity violation and the corresponding correction methods (Greenhouse-Geisser and Huynh-Feldt) also become natural for univariate testing in the multivariate system. This is exactly how the statistical packages implemented those tests such as car in R, GLM in IBM SPSS Statistics, and REPEATED statement in PROC GLM of SAS. I'm not so sure whether the formulation matters in Bayesian data analysis, but I doubt the above testing capability could be formulated and implemented under the univariate platform.
Casting a multivariate linear model as a multiple regression Basically, can you do everything with the equivalent linear univariate regression model that you could with the multivariate model? I believe the answer is no. If your goal is simply either to esti
12,847
Casting a multivariate linear model as a multiple regression
Both models are equivalent if you fit appropriate variance-covariance structure. In transformed linear model we need to fit variance-covariance matrix of error component with kronecker product which has limited availability in available computing softwares. Linear Model Theory-Univariate, Multivariate, and Mixed Models is excellent reference for this topic. Edited Here is another nice reference freely available.
Casting a multivariate linear model as a multiple regression
Both models are equivalent if you fit appropriate variance-covariance structure. In transformed linear model we need to fit variance-covariance matrix of error component with kronecker product which
Casting a multivariate linear model as a multiple regression Both models are equivalent if you fit appropriate variance-covariance structure. In transformed linear model we need to fit variance-covariance matrix of error component with kronecker product which has limited availability in available computing softwares. Linear Model Theory-Univariate, Multivariate, and Mixed Models is excellent reference for this topic. Edited Here is another nice reference freely available.
Casting a multivariate linear model as a multiple regression Both models are equivalent if you fit appropriate variance-covariance structure. In transformed linear model we need to fit variance-covariance matrix of error component with kronecker product which
12,848
How to interpret negative ACF (autocorrelation function)?
Negative ACF means that a positive oil return for one observation increases the probability of having a negative oil return for another observation (depending on the lag) and vice-versa. Or you can say (for a stationary time series) if one observation is above the average the other one (depending on the lag) is below average and vice-versa. Have a look at "Interpreting a negative autocorrelation".
How to interpret negative ACF (autocorrelation function)?
Negative ACF means that a positive oil return for one observation increases the probability of having a negative oil return for another observation (depending on the lag) and vice-versa. Or you can sa
How to interpret negative ACF (autocorrelation function)? Negative ACF means that a positive oil return for one observation increases the probability of having a negative oil return for another observation (depending on the lag) and vice-versa. Or you can say (for a stationary time series) if one observation is above the average the other one (depending on the lag) is below average and vice-versa. Have a look at "Interpreting a negative autocorrelation".
How to interpret negative ACF (autocorrelation function)? Negative ACF means that a positive oil return for one observation increases the probability of having a negative oil return for another observation (depending on the lag) and vice-versa. Or you can sa
12,849
Why does the least square solution give poor results in this case?
The particular phenomenon that you see with the least squares solution in Bishops Figure 4.5 is a phenomenon that only occurs when the number of classes is $\geq 3$. In ESL, Figure 4.2 on page 105, the phenomenon is called masking. See also ESL Figure 4.3. The least squares solution results in a predictor for the middel class that is mostly dominated by the predictors for the two other classes. LDA or logistic regression don't suffer from this problem. One can say that it is the rigid structure of the linear model of class probabilities (which is essentially what you get from the least squares fit) that causes the masking. With only two classes the phenomenon does not occur $-$ see also Exercise 4.2 in ESL, page 135, for details on the relation between the LDA solution and the least squares solution in the two class case. Edit: Masking is perhaps most easily visualised for a two-dimensional problem, but it is also a problem in the one-dimensional case, and here the mathematics is particularly simple to understand. Suppose that the one-dimensional input variables are ordered as $$x_1 < \ldots < x_k < y_1 < \ldots y_m < z_1 < \ldots < z_n$$ with the $x$'s from class 1, the $y$'s from class two and the $z$'s from class 3. Together with the coding scheme for the classes as three-dimensional binary vectors we have the data organized as follows $$\begin{array}{c|cccccccc} & 1 & \ldots & 1 & 0 & \ldots & 0 & 0 & \ldots & 0 \\ \mathbf{T}^T & 0 & \ldots & 0 & 1 & \ldots & 1 & 0 & \ldots & 0 \\ & 0 & \ldots & 0 & 0 & \ldots & 0 & 1 & \ldots & 1 \\ \hline \mathbf{x}^T & x_1 & \ldots & x_k & y_1 & \ldots & y_m & z_1 & \ldots & z_n \\ \end{array}$$ The least squares solution is given as three regressions of each of the columns in $\mathbf{T}$ on $\mathbf{x}$. For the first column, the $x$-class, the slope will be negative (all the ones are to the left above) and for the last column, the $z$-class, the slope will be positive. For the middle column, the $y$-class, the linear regression will have to balance the zeroes for the two outer classes with the ones in the middle class resulting in a rather flat regression line and a particularly poor fit of the conditional class probabilities for this class. As it turns out, the max of the regression lines for the two outer classes dominates the regression line for the middle class for most values of the input variable, and the middle class is masked by the outer classes. In fact, if $k = m = n{}$ then one class will always be masked completely, whether or not the input variables are ordered as above. If the class sizes are all equal the three regression lines all pass through the point $(\bar{x}, 1/3)$ where $$\bar{x} = \frac{1}{3k}\left(x_1 + \ldots + x_k + y_1 + \ldots + y_m + z_1 + \ldots + z_n\right).$$ Hence, the three lines all intersect in the same point and the max of two of them dominates the third.
Why does the least square solution give poor results in this case?
The particular phenomenon that you see with the least squares solution in Bishops Figure 4.5 is a phenomenon that only occurs when the number of classes is $\geq 3$. In ESL, Figure 4.2 on page 105, t
Why does the least square solution give poor results in this case? The particular phenomenon that you see with the least squares solution in Bishops Figure 4.5 is a phenomenon that only occurs when the number of classes is $\geq 3$. In ESL, Figure 4.2 on page 105, the phenomenon is called masking. See also ESL Figure 4.3. The least squares solution results in a predictor for the middel class that is mostly dominated by the predictors for the two other classes. LDA or logistic regression don't suffer from this problem. One can say that it is the rigid structure of the linear model of class probabilities (which is essentially what you get from the least squares fit) that causes the masking. With only two classes the phenomenon does not occur $-$ see also Exercise 4.2 in ESL, page 135, for details on the relation between the LDA solution and the least squares solution in the two class case. Edit: Masking is perhaps most easily visualised for a two-dimensional problem, but it is also a problem in the one-dimensional case, and here the mathematics is particularly simple to understand. Suppose that the one-dimensional input variables are ordered as $$x_1 < \ldots < x_k < y_1 < \ldots y_m < z_1 < \ldots < z_n$$ with the $x$'s from class 1, the $y$'s from class two and the $z$'s from class 3. Together with the coding scheme for the classes as three-dimensional binary vectors we have the data organized as follows $$\begin{array}{c|cccccccc} & 1 & \ldots & 1 & 0 & \ldots & 0 & 0 & \ldots & 0 \\ \mathbf{T}^T & 0 & \ldots & 0 & 1 & \ldots & 1 & 0 & \ldots & 0 \\ & 0 & \ldots & 0 & 0 & \ldots & 0 & 1 & \ldots & 1 \\ \hline \mathbf{x}^T & x_1 & \ldots & x_k & y_1 & \ldots & y_m & z_1 & \ldots & z_n \\ \end{array}$$ The least squares solution is given as three regressions of each of the columns in $\mathbf{T}$ on $\mathbf{x}$. For the first column, the $x$-class, the slope will be negative (all the ones are to the left above) and for the last column, the $z$-class, the slope will be positive. For the middle column, the $y$-class, the linear regression will have to balance the zeroes for the two outer classes with the ones in the middle class resulting in a rather flat regression line and a particularly poor fit of the conditional class probabilities for this class. As it turns out, the max of the regression lines for the two outer classes dominates the regression line for the middle class for most values of the input variable, and the middle class is masked by the outer classes. In fact, if $k = m = n{}$ then one class will always be masked completely, whether or not the input variables are ordered as above. If the class sizes are all equal the three regression lines all pass through the point $(\bar{x}, 1/3)$ where $$\bar{x} = \frac{1}{3k}\left(x_1 + \ldots + x_k + y_1 + \ldots + y_m + z_1 + \ldots + z_n\right).$$ Hence, the three lines all intersect in the same point and the max of two of them dominates the third.
Why does the least square solution give poor results in this case? The particular phenomenon that you see with the least squares solution in Bishops Figure 4.5 is a phenomenon that only occurs when the number of classes is $\geq 3$. In ESL, Figure 4.2 on page 105, t
12,850
Why does the least square solution give poor results in this case?
Based on the link provided below, the reasons why LS discriminant is not performing good in the upper left graph are as follow: -Lack of robustness to outliers. - Certain datasets unsuitable for least squares classification. - Decision boundary corresponds to ML solution under Gaussian conditional distribution. But binary target values have a distribution far from Gaussian. Look at page 13 in Disadvantages of Least Squares.
Why does the least square solution give poor results in this case?
Based on the link provided below, the reasons why LS discriminant is not performing good in the upper left graph are as follow: -Lack of robustness to outliers. - Certain datasets unsuitable for least
Why does the least square solution give poor results in this case? Based on the link provided below, the reasons why LS discriminant is not performing good in the upper left graph are as follow: -Lack of robustness to outliers. - Certain datasets unsuitable for least squares classification. - Decision boundary corresponds to ML solution under Gaussian conditional distribution. But binary target values have a distribution far from Gaussian. Look at page 13 in Disadvantages of Least Squares.
Why does the least square solution give poor results in this case? Based on the link provided below, the reasons why LS discriminant is not performing good in the upper left graph are as follow: -Lack of robustness to outliers. - Certain datasets unsuitable for least
12,851
Why does the least square solution give poor results in this case?
I believe the issue in your first graph is called "masking", and it's mentioned in "The Elements of statistical learning: Data mining, inference, and prediction" (Hastie, Tibshirani, Friedman. Springer 2001), pages 83-84. Intuitively (which is the best I can do) I believe this is because predictions of an OLS regression are not constrained to [0,1], so you can end up with a prediction of -0.33 when you really want more like 0..1, which you can finesse in the case of two classes but the more classes you have the more likely this mismatch is to cause a problem. I think.
Why does the least square solution give poor results in this case?
I believe the issue in your first graph is called "masking", and it's mentioned in "The Elements of statistical learning: Data mining, inference, and prediction" (Hastie, Tibshirani, Friedman. Springe
Why does the least square solution give poor results in this case? I believe the issue in your first graph is called "masking", and it's mentioned in "The Elements of statistical learning: Data mining, inference, and prediction" (Hastie, Tibshirani, Friedman. Springer 2001), pages 83-84. Intuitively (which is the best I can do) I believe this is because predictions of an OLS regression are not constrained to [0,1], so you can end up with a prediction of -0.33 when you really want more like 0..1, which you can finesse in the case of two classes but the more classes you have the more likely this mismatch is to cause a problem. I think.
Why does the least square solution give poor results in this case? I believe the issue in your first graph is called "masking", and it's mentioned in "The Elements of statistical learning: Data mining, inference, and prediction" (Hastie, Tibshirani, Friedman. Springe
12,852
Why does the least square solution give poor results in this case?
Least square is sensitive to scale ( because the new data is of different scale, it will skew the decision boundary) , one usually needs either apply weights (means data to enter to the optimization algorithm is of the same scale) or perform a suitable transformation (mean center, log(1+data) ...etc) on data in such cases. It seems Least Square would work perfect if you ask it to do a 3 classification operation in which case and merge two output classes eventually.
Why does the least square solution give poor results in this case?
Least square is sensitive to scale ( because the new data is of different scale, it will skew the decision boundary) , one usually needs either apply weights (means data to enter to the optimization a
Why does the least square solution give poor results in this case? Least square is sensitive to scale ( because the new data is of different scale, it will skew the decision boundary) , one usually needs either apply weights (means data to enter to the optimization algorithm is of the same scale) or perform a suitable transformation (mean center, log(1+data) ...etc) on data in such cases. It seems Least Square would work perfect if you ask it to do a 3 classification operation in which case and merge two output classes eventually.
Why does the least square solution give poor results in this case? Least square is sensitive to scale ( because the new data is of different scale, it will skew the decision boundary) , one usually needs either apply weights (means data to enter to the optimization a
12,853
How exactly does Chi-square feature selection work?
The chi-square test is a statistical test of independence to determine the dependency of two variables. It shares similarities with coefficient of determination, R². However, chi-square test is only applicable to categorical or nominal data while R² is only applicable to numeric data. From the definition, of chi-square we can easily deduce the application of chi-square technique in feature selection. Suppose you have a target variable (i.e., the class label) and some other features (feature variables) that describes each sample of the data. Now, we calculate chi-square statistics between every feature variable and the target variable and observe the existence of a relationship between the variables and the target. If the target variable is independent of the feature variable, we can discard that feature variable. If they are dependent, the feature variable is very important. Mathematical details are described here:http://nlp.stanford.edu/IR-book/html/htmledition/feature-selectionchi2-feature-selection-1.html For continuous variables, chi-square can be applied after "Binning" the variables. An example in R, shamelessly copied from FSelector # Use HouseVotes84 data from mlbench package library(mlbench)# For data library(FSelector)#For method data(HouseVotes84) #Calculate the chi square statistics weights<- chi.squared(Class~., HouseVotes84) # Print the results print(weights) # Select top five variables subset<- cutoff.k(weights, 5) # Print the final formula that can be used in classification f<- as.simple.formula(subset, "Class") print(f) Not related to so much in feature selection but the video below discusses the chisquare in detail https://www.youtube.com/watch?time_continue=5&v=IrZOKSGShC8
How exactly does Chi-square feature selection work?
The chi-square test is a statistical test of independence to determine the dependency of two variables. It shares similarities with coefficient of determination, R². However, chi-square test is only a
How exactly does Chi-square feature selection work? The chi-square test is a statistical test of independence to determine the dependency of two variables. It shares similarities with coefficient of determination, R². However, chi-square test is only applicable to categorical or nominal data while R² is only applicable to numeric data. From the definition, of chi-square we can easily deduce the application of chi-square technique in feature selection. Suppose you have a target variable (i.e., the class label) and some other features (feature variables) that describes each sample of the data. Now, we calculate chi-square statistics between every feature variable and the target variable and observe the existence of a relationship between the variables and the target. If the target variable is independent of the feature variable, we can discard that feature variable. If they are dependent, the feature variable is very important. Mathematical details are described here:http://nlp.stanford.edu/IR-book/html/htmledition/feature-selectionchi2-feature-selection-1.html For continuous variables, chi-square can be applied after "Binning" the variables. An example in R, shamelessly copied from FSelector # Use HouseVotes84 data from mlbench package library(mlbench)# For data library(FSelector)#For method data(HouseVotes84) #Calculate the chi square statistics weights<- chi.squared(Class~., HouseVotes84) # Print the results print(weights) # Select top five variables subset<- cutoff.k(weights, 5) # Print the final formula that can be used in classification f<- as.simple.formula(subset, "Class") print(f) Not related to so much in feature selection but the video below discusses the chisquare in detail https://www.youtube.com/watch?time_continue=5&v=IrZOKSGShC8
How exactly does Chi-square feature selection work? The chi-square test is a statistical test of independence to determine the dependency of two variables. It shares similarities with coefficient of determination, R². However, chi-square test is only a
12,854
Adjusting for covariates in ROC curve analysis
The way that you've envisioned the analysis is really not the way I would suggest you start out thinking about it. First of all it is easy to show that if cutoffs must be used, cutoffs are not applied on individual features but on the overall predicted probability. The optimal cutoff for a single covariate depends on all the levels of the other covariates; it cannot be constant. Secondly, ROC curves play no role in meeting the goal of making optimum decisions for an individual subject. To handle correlated scales there are many data reduction techniques that can help. One of them is a formal redundancy analysis where each predictor is nonlinearly predicted from all the other predictors, in turn. This is implemented in the redun function in the R Hmisc package. Variable clustering, principal component analysis, and factor analysis are other possibilities. But the main part of the analysis, in my view, should be building a good probability model (e.g., binary logistic model).
Adjusting for covariates in ROC curve analysis
The way that you've envisioned the analysis is really not the way I would suggest you start out thinking about it. First of all it is easy to show that if cutoffs must be used, cutoffs are not applie
Adjusting for covariates in ROC curve analysis The way that you've envisioned the analysis is really not the way I would suggest you start out thinking about it. First of all it is easy to show that if cutoffs must be used, cutoffs are not applied on individual features but on the overall predicted probability. The optimal cutoff for a single covariate depends on all the levels of the other covariates; it cannot be constant. Secondly, ROC curves play no role in meeting the goal of making optimum decisions for an individual subject. To handle correlated scales there are many data reduction techniques that can help. One of them is a formal redundancy analysis where each predictor is nonlinearly predicted from all the other predictors, in turn. This is implemented in the redun function in the R Hmisc package. Variable clustering, principal component analysis, and factor analysis are other possibilities. But the main part of the analysis, in my view, should be building a good probability model (e.g., binary logistic model).
Adjusting for covariates in ROC curve analysis The way that you've envisioned the analysis is really not the way I would suggest you start out thinking about it. First of all it is easy to show that if cutoffs must be used, cutoffs are not applie
12,855
Adjusting for covariates in ROC curve analysis
The point of the Janes, Pepe article on covariate adjusted ROC curves is allowing a more flexible interpretation of the estimated ROC curve values. This is a method of stratifying ROC curves among specific groups in the population of interest. The estimated true positive fraction (TPF; eq. sensitivity) and true negative fraction (TNF; eq. specificity) are interpreted as "the probability of a correct screening outcome given the disease status is Y/N among individuals of the same [adjusted variable list]". At a glance, it sounds like what you're trying to do is improve your diagnostic test by incorporating more markers into your panel. A good background to understand these methods a little better would be to read about the Cox proportional hazards model and to look at Pepe's book on "The Statistical Evaluation of Medical Tests for Classification and ...". You'll notice screening reliability measures share many similar properties with a survival curve, thinking of the fitted score as a survival time. Just as the Cox model allows for stratification of the survival curve, they propose giving stratified reliability measures. The reason this matters to us might be justified in the context of a binary mixed effects model: suppose you're interested in predicting the risk of becoming a meth addict. SES has such an obvious dominating effect on this that it seems foolish to evaluate a diagnostic test, which might be based on personal behaviors, without somehow stratifying. This is because [just roll with this], even if a rich person showed manic and depressive symptoms, they'll probably never try meth. However, a poor person would show a much larger increased risk having such psychological symptoms (and higher risk score). The crude analysis of risk would show very poor performance of your predictive model because the same differences in two groups were not reliable. However, if you stratified (rich versus poor), you could have 100% sensitivity and specificity for the same diagnostic marker. The point of covariate adjustment is to consider different groups homogeneous due to lower prevalence and interaction in the risk model between distinct strata.
Adjusting for covariates in ROC curve analysis
The point of the Janes, Pepe article on covariate adjusted ROC curves is allowing a more flexible interpretation of the estimated ROC curve values. This is a method of stratifying ROC curves among spe
Adjusting for covariates in ROC curve analysis The point of the Janes, Pepe article on covariate adjusted ROC curves is allowing a more flexible interpretation of the estimated ROC curve values. This is a method of stratifying ROC curves among specific groups in the population of interest. The estimated true positive fraction (TPF; eq. sensitivity) and true negative fraction (TNF; eq. specificity) are interpreted as "the probability of a correct screening outcome given the disease status is Y/N among individuals of the same [adjusted variable list]". At a glance, it sounds like what you're trying to do is improve your diagnostic test by incorporating more markers into your panel. A good background to understand these methods a little better would be to read about the Cox proportional hazards model and to look at Pepe's book on "The Statistical Evaluation of Medical Tests for Classification and ...". You'll notice screening reliability measures share many similar properties with a survival curve, thinking of the fitted score as a survival time. Just as the Cox model allows for stratification of the survival curve, they propose giving stratified reliability measures. The reason this matters to us might be justified in the context of a binary mixed effects model: suppose you're interested in predicting the risk of becoming a meth addict. SES has such an obvious dominating effect on this that it seems foolish to evaluate a diagnostic test, which might be based on personal behaviors, without somehow stratifying. This is because [just roll with this], even if a rich person showed manic and depressive symptoms, they'll probably never try meth. However, a poor person would show a much larger increased risk having such psychological symptoms (and higher risk score). The crude analysis of risk would show very poor performance of your predictive model because the same differences in two groups were not reliable. However, if you stratified (rich versus poor), you could have 100% sensitivity and specificity for the same diagnostic marker. The point of covariate adjustment is to consider different groups homogeneous due to lower prevalence and interaction in the risk model between distinct strata.
Adjusting for covariates in ROC curve analysis The point of the Janes, Pepe article on covariate adjusted ROC curves is allowing a more flexible interpretation of the estimated ROC curve values. This is a method of stratifying ROC curves among spe
12,856
What is the difference between $R^2$ and variance score in Scikit-learn?
$R^2 = 1- \frac{SSE}{TSS}$ $\text{explained variance score} = 1 - \mathrm{Var}[\hat{y} - y]\, /\, \mathrm{Var}[y]$, where the $\mathrm{Var}$ is biased variance, i.e. $\mathrm{Var}[\hat{y} - y] = \frac{1}{n}\sum(error - mean(error))^2$. Compared with $R^2$, the only difference is from the mean(error). if mean(error)=0, then $R^2$ = explained variance score Also note that in adjusted-$R^2$, unbiased variance estimation is used.
What is the difference between $R^2$ and variance score in Scikit-learn?
$R^2 = 1- \frac{SSE}{TSS}$ $\text{explained variance score} = 1 - \mathrm{Var}[\hat{y} - y]\, /\, \mathrm{Var}[y]$, where the $\mathrm{Var}$ is biased variance, i.e. $\mathrm{Var}[\hat{y} - y] = \fra
What is the difference between $R^2$ and variance score in Scikit-learn? $R^2 = 1- \frac{SSE}{TSS}$ $\text{explained variance score} = 1 - \mathrm{Var}[\hat{y} - y]\, /\, \mathrm{Var}[y]$, where the $\mathrm{Var}$ is biased variance, i.e. $\mathrm{Var}[\hat{y} - y] = \frac{1}{n}\sum(error - mean(error))^2$. Compared with $R^2$, the only difference is from the mean(error). if mean(error)=0, then $R^2$ = explained variance score Also note that in adjusted-$R^2$, unbiased variance estimation is used.
What is the difference between $R^2$ and variance score in Scikit-learn? $R^2 = 1- \frac{SSE}{TSS}$ $\text{explained variance score} = 1 - \mathrm{Var}[\hat{y} - y]\, /\, \mathrm{Var}[y]$, where the $\mathrm{Var}$ is biased variance, i.e. $\mathrm{Var}[\hat{y} - y] = \fra
12,857
What is the difference between $R^2$ and variance score in Scikit-learn?
Dean's answer is right. Only I think there is a minor typo here: $Var[\hat{y}-y]=sum(error^2-mean(error))/n$. I guess it should be $Var[\hat{y}-y]=sum(error-mean(error))^2/n$. My reference is the source code of sklearn here:https://github.com/scikit-learn/scikit-learn/blob/bf24c7e3d/sklearn/metrics/_regression.py#L396
What is the difference between $R^2$ and variance score in Scikit-learn?
Dean's answer is right. Only I think there is a minor typo here: $Var[\hat{y}-y]=sum(error^2-mean(error))/n$. I guess it should be $Var[\hat{y}-y]=sum(error-mean(error))^2/n$. My reference is the sou
What is the difference between $R^2$ and variance score in Scikit-learn? Dean's answer is right. Only I think there is a minor typo here: $Var[\hat{y}-y]=sum(error^2-mean(error))/n$. I guess it should be $Var[\hat{y}-y]=sum(error-mean(error))^2/n$. My reference is the source code of sklearn here:https://github.com/scikit-learn/scikit-learn/blob/bf24c7e3d/sklearn/metrics/_regression.py#L396
What is the difference between $R^2$ and variance score in Scikit-learn? Dean's answer is right. Only I think there is a minor typo here: $Var[\hat{y}-y]=sum(error^2-mean(error))/n$. I guess it should be $Var[\hat{y}-y]=sum(error-mean(error))^2/n$. My reference is the sou
12,858
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function different from Logistic Regression?
Using gradient descent, we optimize (minimize) the cost function $$J(\mathbf{w}) = \sum_{i} \frac{1}{2}(y_i - \hat{y_i})^2 \quad \quad y_i,\hat{y_i} \in \mathbb{R}$$ If you minimize the mean squared error, then it's different from logistic regression. Logistic regression is normally associated with the cross entropy loss, here is an introduction page from the scikit-learn library. (I'll assume multilayer perceptrons are the same thing called neural networks.) If you used the cross entropy loss (with regularization) for a single-layer neural network, then it's going to be the same model (log-linear model) as logistic regression. If you use a multi-layer network instead, it can be thought of as logistic regression with parametric nonlinear basis functions. However, in multilayer perceptrons, the sigmoid activation function is used to return a probability, not an on off signal in contrast to logistic regression and a single-layer perceptron. The output of both logistic regression and neural networks with sigmoid activation function can be interpreted as probabilities. As the cross entropy loss is actually the negative log likelihood defined through the Bernoulli distribution.
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function
Using gradient descent, we optimize (minimize) the cost function $$J(\mathbf{w}) = \sum_{i} \frac{1}{2}(y_i - \hat{y_i})^2 \quad \quad y_i,\hat{y_i} \in \mathbb{R}$$ If you minimize the mean squared
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function different from Logistic Regression? Using gradient descent, we optimize (minimize) the cost function $$J(\mathbf{w}) = \sum_{i} \frac{1}{2}(y_i - \hat{y_i})^2 \quad \quad y_i,\hat{y_i} \in \mathbb{R}$$ If you minimize the mean squared error, then it's different from logistic regression. Logistic regression is normally associated with the cross entropy loss, here is an introduction page from the scikit-learn library. (I'll assume multilayer perceptrons are the same thing called neural networks.) If you used the cross entropy loss (with regularization) for a single-layer neural network, then it's going to be the same model (log-linear model) as logistic regression. If you use a multi-layer network instead, it can be thought of as logistic regression with parametric nonlinear basis functions. However, in multilayer perceptrons, the sigmoid activation function is used to return a probability, not an on off signal in contrast to logistic regression and a single-layer perceptron. The output of both logistic regression and neural networks with sigmoid activation function can be interpreted as probabilities. As the cross entropy loss is actually the negative log likelihood defined through the Bernoulli distribution.
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function Using gradient descent, we optimize (minimize) the cost function $$J(\mathbf{w}) = \sum_{i} \frac{1}{2}(y_i - \hat{y_i})^2 \quad \quad y_i,\hat{y_i} \in \mathbb{R}$$ If you minimize the mean squared
12,859
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function different from Logistic Regression?
Because gradient descent updates each parameter in a way that it reduces output error which must be continues function of all parameters. Threshold based activation is not differentiable that is why sigmoid or tanh activation is used. Here is a single-layer NN $\frac{dJ(w,b)}{d\omega_{kj}} =\frac{dJ(w,b)}{dz_k}\cdot \frac{dz_k}{d\omega_{kj}}$ $\frac{dJ(w,b)}{dz_k} = (a_k -y_k)(a_k(1-a_k))$ $\frac{dz_k}{d\omega_{kj}} = x_k $ $ J(w,b) = \frac{1}{2} (y_k - a_k)^2 $ $ a_k = sigm(z_k) = sigm(W_{kj}*x_k + b_k) $ if activation function were a basic step function (threshold), derivative of $J$ w.r.t $z_k$ would be non-differentiable. here is a link that explain it in general. Edit: Maybe, I misunderstood what you mean by perceptron. If I'm not mistaken, perceptron is threholded weighed sum of inputs. If you change threholding with logistic function it turns into logistic regression. Multi-layer NN with sigmoid (logistic) activation functions is cascaded layers composed of logistic regressions.
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function
Because gradient descent updates each parameter in a way that it reduces output error which must be continues function of all parameters. Threshold based activation is not differentiable that is why s
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function different from Logistic Regression? Because gradient descent updates each parameter in a way that it reduces output error which must be continues function of all parameters. Threshold based activation is not differentiable that is why sigmoid or tanh activation is used. Here is a single-layer NN $\frac{dJ(w,b)}{d\omega_{kj}} =\frac{dJ(w,b)}{dz_k}\cdot \frac{dz_k}{d\omega_{kj}}$ $\frac{dJ(w,b)}{dz_k} = (a_k -y_k)(a_k(1-a_k))$ $\frac{dz_k}{d\omega_{kj}} = x_k $ $ J(w,b) = \frac{1}{2} (y_k - a_k)^2 $ $ a_k = sigm(z_k) = sigm(W_{kj}*x_k + b_k) $ if activation function were a basic step function (threshold), derivative of $J$ w.r.t $z_k$ would be non-differentiable. here is a link that explain it in general. Edit: Maybe, I misunderstood what you mean by perceptron. If I'm not mistaken, perceptron is threholded weighed sum of inputs. If you change threholding with logistic function it turns into logistic regression. Multi-layer NN with sigmoid (logistic) activation functions is cascaded layers composed of logistic regressions.
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function Because gradient descent updates each parameter in a way that it reduces output error which must be continues function of all parameters. Threshold based activation is not differentiable that is why s
12,860
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function different from Logistic Regression?
Intuitively, I think of a multilayer perceptron as computing a nonlinear transformation on my input features, and then feeding these transformed variables into a logistic regression. The multinomial (that is, N > 2 possible labels) case may make this more clear. In traditional logistic regression, for a given data point, you want to compute a "score", $\beta_i X$, for each class, $i$. And the way you convert these to probabilities is just by taking the score for the given class over the sum of scores for all classes, $\frac{\beta_i X}{\sum_j \beta_j X}$. So a class with a large score has a larger share of the combined score and so a higher probability. If forced to predict a single class, you choose the class with the largest probability (which is also the largest score). I don't know about you, but in my modeling courses and research, I tried all kinds of sensible and stupid transformations of the input features to improve their significance and overall model prediction. Squaring things, taking logs, combining two into a rate, etc. I had no shame, but I had limited patience. A multilayer perceptron is like a graduate student with way too much time on her hands. Through the gradient descent training and sigmoid activations, it's going to compute arbitrary nonlinear combinations of your original input variables. In the final layer of the perceptron, these variables effectively become the $X$ in the above equation, and your gradient descent also computes an associated final $\beta_i$. The MLP framework is just an abstraction of this.
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function
Intuitively, I think of a multilayer perceptron as computing a nonlinear transformation on my input features, and then feeding these transformed variables into a logistic regression. The multinomial (
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function different from Logistic Regression? Intuitively, I think of a multilayer perceptron as computing a nonlinear transformation on my input features, and then feeding these transformed variables into a logistic regression. The multinomial (that is, N > 2 possible labels) case may make this more clear. In traditional logistic regression, for a given data point, you want to compute a "score", $\beta_i X$, for each class, $i$. And the way you convert these to probabilities is just by taking the score for the given class over the sum of scores for all classes, $\frac{\beta_i X}{\sum_j \beta_j X}$. So a class with a large score has a larger share of the combined score and so a higher probability. If forced to predict a single class, you choose the class with the largest probability (which is also the largest score). I don't know about you, but in my modeling courses and research, I tried all kinds of sensible and stupid transformations of the input features to improve their significance and overall model prediction. Squaring things, taking logs, combining two into a rate, etc. I had no shame, but I had limited patience. A multilayer perceptron is like a graduate student with way too much time on her hands. Through the gradient descent training and sigmoid activations, it's going to compute arbitrary nonlinear combinations of your original input variables. In the final layer of the perceptron, these variables effectively become the $X$ in the above equation, and your gradient descent also computes an associated final $\beta_i$. The MLP framework is just an abstraction of this.
From the Perceptron rule to Gradient Descent: How are Perceptrons with a sigmoid activation function Intuitively, I think of a multilayer perceptron as computing a nonlinear transformation on my input features, and then feeding these transformed variables into a logistic regression. The multinomial (
12,861
If the LASSO is equivalent to linear regression with a Laplace prior how can there be mass on sets with components at zero?
Like all the comments above, the Bayesian interpretation of LASSO is not taking the expected value of the posterior distribution, which is what you would want to do if you were a purist. If that would be the case, then you would be right that there is very small chance that the posterior would be zero given the data. In reality, the Bayesian interpretation of LASSO is taking the MAP (Maximum A Posteriori) estimator of the posterior. It sounds like you are familiar, but for anyone who is not, this is basically Bayesian Maximum Likelihood, where you use the value that corresponds to the maximum probability of occurrence (or the mode) as your estimator for the parameters in LASSO. Since the distribution increases exponentially until zero from the negative direction and falls off exponentially in the positive direction, unless your data strongly suggests the beta is some other significant value, the maximum value of value of your posterior is likely to be 0. Long story short, your intuition seems to be based on the mean of the posterior, but the Bayesian interpretation of LASSO is based on taking the mode of the posterior.
If the LASSO is equivalent to linear regression with a Laplace prior how can there be mass on sets w
Like all the comments above, the Bayesian interpretation of LASSO is not taking the expected value of the posterior distribution, which is what you would want to do if you were a purist. If that wou
If the LASSO is equivalent to linear regression with a Laplace prior how can there be mass on sets with components at zero? Like all the comments above, the Bayesian interpretation of LASSO is not taking the expected value of the posterior distribution, which is what you would want to do if you were a purist. If that would be the case, then you would be right that there is very small chance that the posterior would be zero given the data. In reality, the Bayesian interpretation of LASSO is taking the MAP (Maximum A Posteriori) estimator of the posterior. It sounds like you are familiar, but for anyone who is not, this is basically Bayesian Maximum Likelihood, where you use the value that corresponds to the maximum probability of occurrence (or the mode) as your estimator for the parameters in LASSO. Since the distribution increases exponentially until zero from the negative direction and falls off exponentially in the positive direction, unless your data strongly suggests the beta is some other significant value, the maximum value of value of your posterior is likely to be 0. Long story short, your intuition seems to be based on the mean of the posterior, but the Bayesian interpretation of LASSO is based on taking the mode of the posterior.
If the LASSO is equivalent to linear regression with a Laplace prior how can there be mass on sets w Like all the comments above, the Bayesian interpretation of LASSO is not taking the expected value of the posterior distribution, which is what you would want to do if you were a purist. If that wou
12,862
How can I pool posterior means and credible intervals after multiple imputation?
With particularly well-behaved posteriors that can be adequately described by a parametric description of a distribution, you might be able to simply take the mean and variance that best describes your posterior and go from there. I suspect this may be adequate in many circumstances where you aren't getting genuinely odd posterior distributions.
How can I pool posterior means and credible intervals after multiple imputation?
With particularly well-behaved posteriors that can be adequately described by a parametric description of a distribution, you might be able to simply take the mean and variance that best describes you
How can I pool posterior means and credible intervals after multiple imputation? With particularly well-behaved posteriors that can be adequately described by a parametric description of a distribution, you might be able to simply take the mean and variance that best describes your posterior and go from there. I suspect this may be adequate in many circumstances where you aren't getting genuinely odd posterior distributions.
How can I pool posterior means and credible intervals after multiple imputation? With particularly well-behaved posteriors that can be adequately described by a parametric description of a distribution, you might be able to simply take the mean and variance that best describes you
12,863
How can I pool posterior means and credible intervals after multiple imputation?
Yes, based on the paper by Zhou et al , you can simply combine the MCMC draws from each imputed dataset and combine them together to approximate the posterior distribution. However, based on their simulations (as noted in the paper), this approach requires a large number of imputed datasets (e.g., 100).
How can I pool posterior means and credible intervals after multiple imputation?
Yes, based on the paper by Zhou et al , you can simply combine the MCMC draws from each imputed dataset and combine them together to approximate the posterior distribution. However, based on their sim
How can I pool posterior means and credible intervals after multiple imputation? Yes, based on the paper by Zhou et al , you can simply combine the MCMC draws from each imputed dataset and combine them together to approximate the posterior distribution. However, based on their simulations (as noted in the paper), this approach requires a large number of imputed datasets (e.g., 100).
How can I pool posterior means and credible intervals after multiple imputation? Yes, based on the paper by Zhou et al , you can simply combine the MCMC draws from each imputed dataset and combine them together to approximate the posterior distribution. However, based on their sim
12,864
How can I pool posterior means and credible intervals after multiple imputation?
If you use stata there is a procedure called "mim" that pooled the data after imputation using for mixed effect models. I don't know if it is available in R.
How can I pool posterior means and credible intervals after multiple imputation?
If you use stata there is a procedure called "mim" that pooled the data after imputation using for mixed effect models. I don't know if it is available in R.
How can I pool posterior means and credible intervals after multiple imputation? If you use stata there is a procedure called "mim" that pooled the data after imputation using for mixed effect models. I don't know if it is available in R.
How can I pool posterior means and credible intervals after multiple imputation? If you use stata there is a procedure called "mim" that pooled the data after imputation using for mixed effect models. I don't know if it is available in R.
12,865
What does it mean to take the expectation with respect to a probability distribution?
The expression $$\mathbb E[g(x;y;\theta;h(x,z),...)]$$ always means "the expected value with respect to the joint distribution of all things having a non-degenerate distribution inside the brackets." Once you start putting subscripts in $\mathbb E$ then you specify perhaps a "narrower" joint distribution for which you want (for your reasons), to average over. For example, if you wrote $$\mathbb E_{\theta, z}[g(x;y;\theta;h(x,z),...)]$$ I would be inclined to believe that you mean only $$\mathbb E_{\theta, z} = \int_{S_z}\int_{S_\theta}f_{\theta,z}(\theta, z)g(x;y;\theta;h(x,z),...) d\theta dz$$ and not $$\int_{S_z}\int_{S_\theta}\int_{S_x}\int_{S_y}f_{\theta,z,x,y}(\theta, z,x,y)g(x;y;\theta;h(x,z),...) d\theta\, dz\,dx \,dy$$ But it could also mean something else, see on the matter also https://stats.stackexchange.com/a/72614/28746
What does it mean to take the expectation with respect to a probability distribution?
The expression $$\mathbb E[g(x;y;\theta;h(x,z),...)]$$ always means "the expected value with respect to the joint distribution of all things having a non-degenerate distribution inside the brackets."
What does it mean to take the expectation with respect to a probability distribution? The expression $$\mathbb E[g(x;y;\theta;h(x,z),...)]$$ always means "the expected value with respect to the joint distribution of all things having a non-degenerate distribution inside the brackets." Once you start putting subscripts in $\mathbb E$ then you specify perhaps a "narrower" joint distribution for which you want (for your reasons), to average over. For example, if you wrote $$\mathbb E_{\theta, z}[g(x;y;\theta;h(x,z),...)]$$ I would be inclined to believe that you mean only $$\mathbb E_{\theta, z} = \int_{S_z}\int_{S_\theta}f_{\theta,z}(\theta, z)g(x;y;\theta;h(x,z),...) d\theta dz$$ and not $$\int_{S_z}\int_{S_\theta}\int_{S_x}\int_{S_y}f_{\theta,z,x,y}(\theta, z,x,y)g(x;y;\theta;h(x,z),...) d\theta\, dz\,dx \,dy$$ But it could also mean something else, see on the matter also https://stats.stackexchange.com/a/72614/28746
What does it mean to take the expectation with respect to a probability distribution? The expression $$\mathbb E[g(x;y;\theta;h(x,z),...)]$$ always means "the expected value with respect to the joint distribution of all things having a non-degenerate distribution inside the brackets."
12,866
Why does XGBoost have a learning rate?
In particular, am I missing something jumping out at me from these two equations? From what I've looked at in Friedman's paper, the 'learning rate' $\epsilon$ (there, called 'shrinkage' and denoted by $\nu$) is applied after choosing those weights $w_j^*$ which minimise the cost function. That is, we determine the boost's optimal weights, $w_j^*$ first, and only then do we consider multiplying by $\epsilon$. What would this mean? This would mean that neither of the equations in the question which feature both $\epsilon$ and $w_j^*$, are used in the XGBoost algorithm. Also, that $\lambda$ is still necessary in order to guarantee the Taylor expansion validity, and has a non-uniform effect on the $w_j$, its effect depending on the partial derivatives of $\ell$ as you wrote before: \begin{align*} w_{j}^{*}= - \frac{\sum_{i \in R_{j}}\frac{\partial \ell}{\partial \hat{y}_{i}}\bigg|_{F_{t}(x_{i})}}{\lambda + \sum_{i \in R_{j}}\frac{\partial^{2} \ell}{\partial \hat{y}_{i}^{2}}\bigg|_{F_{t}(x_{i})}} \end{align*} The learning rate doesn't come in until after this point, when, having determined the optimal weights of the new tree $\lbrace w_j^* \rbrace_{j=1}^T$, we decide that, actually, we don't want to add what we've just deemed to be the 'optimal boost' straight-up, but instead, update our additive predictor $F_t$ by adding a scaled version of $f_{t+1}$: scaling each weight $w_j^*$ uniformly by $\epsilon$, and thus scaling the contribution of the whole of $f_{t+1}$ by $\epsilon$, too. From where I'm sitting, there is some (weak-ish) analogy with the learning rate in gradient descent optimization: gently aggregating the predictors in order to iterate towards what we believe a general and descriptive predictor to be, but maintaining control over how fast we get there. In contrast, a high learning rate will mean that we use up all of our predictive power relatively quickly. If we do so too quickly with too few trees then any subsequent boost might need to make large corrections, causing the loss to remain at a relatively high plateau, after a few steps of which the algorithm terminates. Keeping a lower learning rate, would aid generalisability because we are relying less upon the predictions of the new boosting tree, and instead permitting subsequent boosts to have more predictive power. It will mean that we need more boosts, and that training will take longer to terminate - in line with the empirical results shown in @Sycorax's answer. In summary: My understanding is that: $\lambda$ is used when regularising the weights $\lbrace w_j\rbrace$ and to justify the 2nd order truncation of the loss function's Taylor expansion, enabling us to find the 'optimal' weights $\lbrace w_j^*\rbrace$. This has a non-uniform effect on each of the weights $w_j$. $\epsilon$ is used only after determination of the optimal weights $w_j^*$ and applied by scaling all of the weights uniformly to give $\epsilon\, w_j^*$.
Why does XGBoost have a learning rate?
In particular, am I missing something jumping out at me from these two equations? From what I've looked at in Friedman's paper, the 'learning rate' $\epsilon$ (there, called 'shrinkage' and denoted b
Why does XGBoost have a learning rate? In particular, am I missing something jumping out at me from these two equations? From what I've looked at in Friedman's paper, the 'learning rate' $\epsilon$ (there, called 'shrinkage' and denoted by $\nu$) is applied after choosing those weights $w_j^*$ which minimise the cost function. That is, we determine the boost's optimal weights, $w_j^*$ first, and only then do we consider multiplying by $\epsilon$. What would this mean? This would mean that neither of the equations in the question which feature both $\epsilon$ and $w_j^*$, are used in the XGBoost algorithm. Also, that $\lambda$ is still necessary in order to guarantee the Taylor expansion validity, and has a non-uniform effect on the $w_j$, its effect depending on the partial derivatives of $\ell$ as you wrote before: \begin{align*} w_{j}^{*}= - \frac{\sum_{i \in R_{j}}\frac{\partial \ell}{\partial \hat{y}_{i}}\bigg|_{F_{t}(x_{i})}}{\lambda + \sum_{i \in R_{j}}\frac{\partial^{2} \ell}{\partial \hat{y}_{i}^{2}}\bigg|_{F_{t}(x_{i})}} \end{align*} The learning rate doesn't come in until after this point, when, having determined the optimal weights of the new tree $\lbrace w_j^* \rbrace_{j=1}^T$, we decide that, actually, we don't want to add what we've just deemed to be the 'optimal boost' straight-up, but instead, update our additive predictor $F_t$ by adding a scaled version of $f_{t+1}$: scaling each weight $w_j^*$ uniformly by $\epsilon$, and thus scaling the contribution of the whole of $f_{t+1}$ by $\epsilon$, too. From where I'm sitting, there is some (weak-ish) analogy with the learning rate in gradient descent optimization: gently aggregating the predictors in order to iterate towards what we believe a general and descriptive predictor to be, but maintaining control over how fast we get there. In contrast, a high learning rate will mean that we use up all of our predictive power relatively quickly. If we do so too quickly with too few trees then any subsequent boost might need to make large corrections, causing the loss to remain at a relatively high plateau, after a few steps of which the algorithm terminates. Keeping a lower learning rate, would aid generalisability because we are relying less upon the predictions of the new boosting tree, and instead permitting subsequent boosts to have more predictive power. It will mean that we need more boosts, and that training will take longer to terminate - in line with the empirical results shown in @Sycorax's answer. In summary: My understanding is that: $\lambda$ is used when regularising the weights $\lbrace w_j\rbrace$ and to justify the 2nd order truncation of the loss function's Taylor expansion, enabling us to find the 'optimal' weights $\lbrace w_j^*\rbrace$. This has a non-uniform effect on each of the weights $w_j$. $\epsilon$ is used only after determination of the optimal weights $w_j^*$ and applied by scaling all of the weights uniformly to give $\epsilon\, w_j^*$.
Why does XGBoost have a learning rate? In particular, am I missing something jumping out at me from these two equations? From what I've looked at in Friedman's paper, the 'learning rate' $\epsilon$ (there, called 'shrinkage' and denoted b
12,867
Why does XGBoost have a learning rate?
In my opinion, classical boosting and XGBoost have almost the same grounds for the learning rate. I personally see two three reasons for this. A common approach is to view classical boosting as gradient descent (GD) in the function space ([1], p.3). As for the simplest univariate GD, we need to define a learning rate that guarantees that we make small steps s.t. we don't overshoot the minimum. Then, XGBoost makes use of the 2nd order Taylor approximation and indeed is close to the Newton's method in this sense. While using the learning rate is not a requirement of the Newton's method, the learning rate can sometimes be used to satisfy the Wolfe conditions. Learning rate provides shrinkage. Each weak learner is weak, meaning that it can't perfectly reconstruct the residuals (and it shouldn't: otherwise we would overfit). So, the learning rate reduces the effect of each such erroneous weak learner: we are going in the right direction (opposite to the gradient of the loss) but we are not allowed to have steps as big as we would take with strong learners. This is similar to stochastic gradient descent: we are forced to keep the learning rate small as our gradient estimations are imprecise. The effect is even more pronounced in XGBoost where extra tree randomization is added through row/column sampling. The subsequent weak learners provide small corrections step-by-step. These corrections accumulate with algorithm iterations and if you don't do early stopping at some point, you'll often fit the training set perfectly (i.e. you are likely to overfit). (Added to the original answer). Regularization (I almost forgot the one which is the most relevant to the question). Smaller learning rate allows adding more weak learners until the test error starts increasing([1], p.15). By averaging over more weak learners a potentially lower generalization error can be achieved. Again, the effect is even more evident for XGBoost, where column/row sampling reduces correlation between the weak learners, which adds some "bagging" effect to the boosting model. Then, could you please provide more detailed derivations of the equations in your post? It seems strange that the learning rate ends up in the denominator. [1]Friedman, Jerome H. "Greedy function approximation: a gradient boosting machine." Annals of statistics (2001): 1189-1232.
Why does XGBoost have a learning rate?
In my opinion, classical boosting and XGBoost have almost the same grounds for the learning rate. I personally see two three reasons for this. A common approach is to view classical boosting as grad
Why does XGBoost have a learning rate? In my opinion, classical boosting and XGBoost have almost the same grounds for the learning rate. I personally see two three reasons for this. A common approach is to view classical boosting as gradient descent (GD) in the function space ([1], p.3). As for the simplest univariate GD, we need to define a learning rate that guarantees that we make small steps s.t. we don't overshoot the minimum. Then, XGBoost makes use of the 2nd order Taylor approximation and indeed is close to the Newton's method in this sense. While using the learning rate is not a requirement of the Newton's method, the learning rate can sometimes be used to satisfy the Wolfe conditions. Learning rate provides shrinkage. Each weak learner is weak, meaning that it can't perfectly reconstruct the residuals (and it shouldn't: otherwise we would overfit). So, the learning rate reduces the effect of each such erroneous weak learner: we are going in the right direction (opposite to the gradient of the loss) but we are not allowed to have steps as big as we would take with strong learners. This is similar to stochastic gradient descent: we are forced to keep the learning rate small as our gradient estimations are imprecise. The effect is even more pronounced in XGBoost where extra tree randomization is added through row/column sampling. The subsequent weak learners provide small corrections step-by-step. These corrections accumulate with algorithm iterations and if you don't do early stopping at some point, you'll often fit the training set perfectly (i.e. you are likely to overfit). (Added to the original answer). Regularization (I almost forgot the one which is the most relevant to the question). Smaller learning rate allows adding more weak learners until the test error starts increasing([1], p.15). By averaging over more weak learners a potentially lower generalization error can be achieved. Again, the effect is even more evident for XGBoost, where column/row sampling reduces correlation between the weak learners, which adds some "bagging" effect to the boosting model. Then, could you please provide more detailed derivations of the equations in your post? It seems strange that the learning rate ends up in the denominator. [1]Friedman, Jerome H. "Greedy function approximation: a gradient boosting machine." Annals of statistics (2001): 1189-1232.
Why does XGBoost have a learning rate? In my opinion, classical boosting and XGBoost have almost the same grounds for the learning rate. I personally see two three reasons for this. A common approach is to view classical boosting as grad
12,868
Why does XGBoost have a learning rate?
Parameters for Tree Booster eta [default=0.3, alias: learning_rate] step size shrinkage used in update to prevents overfitting. After each boosting step, we can directly get the weights of new features. and eta actually shrinks the feature weights to make the boosting process more conservative. range: [0,1] From: manual According to this source: math, learning_rate affects the value of the function of gradient calculation that incorporates both first and second order derivatives. I just looked into code, but I am not good at Py, so my answer is really a guide for you to explore more.
Why does XGBoost have a learning rate?
Parameters for Tree Booster eta [default=0.3, alias: learning_rate] step size shrinkage used in update to prevents overfitting. After each boosting step, we can directly get the weights of new fea
Why does XGBoost have a learning rate? Parameters for Tree Booster eta [default=0.3, alias: learning_rate] step size shrinkage used in update to prevents overfitting. After each boosting step, we can directly get the weights of new features. and eta actually shrinks the feature weights to make the boosting process more conservative. range: [0,1] From: manual According to this source: math, learning_rate affects the value of the function of gradient calculation that incorporates both first and second order derivatives. I just looked into code, but I am not good at Py, so my answer is really a guide for you to explore more.
Why does XGBoost have a learning rate? Parameters for Tree Booster eta [default=0.3, alias: learning_rate] step size shrinkage used in update to prevents overfitting. After each boosting step, we can directly get the weights of new fea
12,869
Why does XGBoost have a learning rate?
Adding to montols answer: I think he is right on most points, except that, from my understanding, it is the learning rate 𝜖, not 𝜆, that controls for validity of the Taylor expansion(TE). This is because 𝜖 scales the final step size taken towards the TE-minimum and for small 𝜖 TE clearly becomes a better approximation. Moreover, since the Hessian is diagonal in XGB, we are still guaranteed to monotonically shrink costs when walking towards the minimum, even if it's not the full step (𝜖 = 1) that is taken. So far, the experiments I've made with XGB are absolutely consistent with this interpretation.
Why does XGBoost have a learning rate?
Adding to montols answer: I think he is right on most points, except that, from my understanding, it is the learning rate 𝜖, not 𝜆, that controls for validity of the Taylor expansion(TE). This is beca
Why does XGBoost have a learning rate? Adding to montols answer: I think he is right on most points, except that, from my understanding, it is the learning rate 𝜖, not 𝜆, that controls for validity of the Taylor expansion(TE). This is because 𝜖 scales the final step size taken towards the TE-minimum and for small 𝜖 TE clearly becomes a better approximation. Moreover, since the Hessian is diagonal in XGB, we are still guaranteed to monotonically shrink costs when walking towards the minimum, even if it's not the full step (𝜖 = 1) that is taken. So far, the experiments I've made with XGB are absolutely consistent with this interpretation.
Why does XGBoost have a learning rate? Adding to montols answer: I think he is right on most points, except that, from my understanding, it is the learning rate 𝜖, not 𝜆, that controls for validity of the Taylor expansion(TE). This is beca
12,870
Link between variance and pairwise distances within a variable
Just to provide an "official" answer, to supplement the solutions sketched in the comments, notice None of $\operatorname{Var} ((X_i))$, $\operatorname{Var} ((Y_i))$, $\sum_{i,j}(X_i-X_j)^2$, or $\sum_{i,j} (Y_i-Y_j)^2$ are changed by shifting all $X_i$ uniformly to $X_i-\mu$ for some constant $\mu$ or shifting all $Y_i$ to $Y_i-\nu$ for some constant $\nu$. Thus we may assume such shifts have been performed to make $\sum X_i = \sum Y_i = 0$, whence $\operatorname{Var}((X_i)) = \sum X_i^2$ and $\operatorname{Var}((Y_i)) = \sum Y_i^2$. After clearing common factors from each side and using (1), the question asks to show that $\sum X_i^2 \ge \sum Y_i^2$ implies $\sum_{i,j} (X_i-X_j)^2 \ge \sum_{i,j} (Y_i-Y_j)^2$. Simple expansion of the squares and rearranging the sums give $$\sum_{i,j}(X_i-X_j)^2 = 2\sum X_i^2 - 2\left(\sum X_i\right)\left(\sum X_j\right) = 2\sum X_i^2 = 2\operatorname{Var}((X_i))$$ with a similar result for the $Y$'s. The proof is immediate.
Link between variance and pairwise distances within a variable
Just to provide an "official" answer, to supplement the solutions sketched in the comments, notice None of $\operatorname{Var} ((X_i))$, $\operatorname{Var} ((Y_i))$, $\sum_{i,j}(X_i-X_j)^2$, or $\su
Link between variance and pairwise distances within a variable Just to provide an "official" answer, to supplement the solutions sketched in the comments, notice None of $\operatorname{Var} ((X_i))$, $\operatorname{Var} ((Y_i))$, $\sum_{i,j}(X_i-X_j)^2$, or $\sum_{i,j} (Y_i-Y_j)^2$ are changed by shifting all $X_i$ uniformly to $X_i-\mu$ for some constant $\mu$ or shifting all $Y_i$ to $Y_i-\nu$ for some constant $\nu$. Thus we may assume such shifts have been performed to make $\sum X_i = \sum Y_i = 0$, whence $\operatorname{Var}((X_i)) = \sum X_i^2$ and $\operatorname{Var}((Y_i)) = \sum Y_i^2$. After clearing common factors from each side and using (1), the question asks to show that $\sum X_i^2 \ge \sum Y_i^2$ implies $\sum_{i,j} (X_i-X_j)^2 \ge \sum_{i,j} (Y_i-Y_j)^2$. Simple expansion of the squares and rearranging the sums give $$\sum_{i,j}(X_i-X_j)^2 = 2\sum X_i^2 - 2\left(\sum X_i\right)\left(\sum X_j\right) = 2\sum X_i^2 = 2\operatorname{Var}((X_i))$$ with a similar result for the $Y$'s. The proof is immediate.
Link between variance and pairwise distances within a variable Just to provide an "official" answer, to supplement the solutions sketched in the comments, notice None of $\operatorname{Var} ((X_i))$, $\operatorname{Var} ((Y_i))$, $\sum_{i,j}(X_i-X_j)^2$, or $\su
12,871
Marginal distribution of the diagonal of an inverse Wishart distributed matrix
In general one can decompose a any covariance matrix into a variance-correlation decomposition as $$ \Sigma = \text{diag}(\Sigma) \ Q \ \text{diag}(\Sigma)^\top = D\ Q \ D^\top$$ Here $Q$ is the correlation matrix with unit diagonals $q_{ii} = 1$. Thus, the diagonal entries of $\Sigma$ are now a part of a diagonal matrix of variances $D = [D]_{ii} = [\Sigma]_{ii}$. Since the off diagonal entries of the variance matrix are zero $d_{ij} = 0, \ i \ne j$, the joint distribution you are looking for is just the product of the marginal distributions of each diagonal entry. Now consider the standard inverse-Wishart model for a $d$-dimensional covariance matrix $\Sigma$ $$ \Sigma \sim \mathcal{IW}(\nu +d -1, 2\nu \Lambda), \quad \nu > d-1$$ Diagonal elements of $\sigma_{ii} = [\Sigma]_{ii}$ are marginally distributed as $$\sigma_{ii} \sim \text{inv-$\chi^2$}\left(\nu+d-1,\frac{\lambda_{ii}}{\nu -d + 1}\right)$$ A nice reference with a variety of priors for the covariance matrix that decompose into different variance-correlation distributions is given here
Marginal distribution of the diagonal of an inverse Wishart distributed matrix
In general one can decompose a any covariance matrix into a variance-correlation decomposition as $$ \Sigma = \text{diag}(\Sigma) \ Q \ \text{diag}(\Sigma)^\top = D\ Q \ D^\top$$ Here $Q$ is the co
Marginal distribution of the diagonal of an inverse Wishart distributed matrix In general one can decompose a any covariance matrix into a variance-correlation decomposition as $$ \Sigma = \text{diag}(\Sigma) \ Q \ \text{diag}(\Sigma)^\top = D\ Q \ D^\top$$ Here $Q$ is the correlation matrix with unit diagonals $q_{ii} = 1$. Thus, the diagonal entries of $\Sigma$ are now a part of a diagonal matrix of variances $D = [D]_{ii} = [\Sigma]_{ii}$. Since the off diagonal entries of the variance matrix are zero $d_{ij} = 0, \ i \ne j$, the joint distribution you are looking for is just the product of the marginal distributions of each diagonal entry. Now consider the standard inverse-Wishart model for a $d$-dimensional covariance matrix $\Sigma$ $$ \Sigma \sim \mathcal{IW}(\nu +d -1, 2\nu \Lambda), \quad \nu > d-1$$ Diagonal elements of $\sigma_{ii} = [\Sigma]_{ii}$ are marginally distributed as $$\sigma_{ii} \sim \text{inv-$\chi^2$}\left(\nu+d-1,\frac{\lambda_{ii}}{\nu -d + 1}\right)$$ A nice reference with a variety of priors for the covariance matrix that decompose into different variance-correlation distributions is given here
Marginal distribution of the diagonal of an inverse Wishart distributed matrix In general one can decompose a any covariance matrix into a variance-correlation decomposition as $$ \Sigma = \text{diag}(\Sigma) \ Q \ \text{diag}(\Sigma)^\top = D\ Q \ D^\top$$ Here $Q$ is the co
12,872
Is there such a thing as an adjusted $R^2$ for a quantile regression model?
I think what the reviewers are asking is to take the pseudo-$R^2$-values and "unbias" them for number of samples in the quantile range, $n_Q$, and number of parameters in the model, $p$. In other words, adjusted-$R^2$ in its usual context. That is that the corrected unexplained fraction is larger than the gross unexplained fraction by a factor of $\frac{n_Q-1}{n_Q-p-1}$, i.e., $1-R^{2*}=\frac{n_Q-1}{n_Q-p-1}(1-R^2)$, or, $R^{2*}=1-\frac{n_Q-1}{n_Q-p-1}(1-R^2)$ I agree with you about taking things too far, because this is already a pseudo-$R^2$-value and an adjusted-pseudo-$R^2$-value might leave the reader with an impression of performing a pseudo-adjustment. One alternative is to do the calculations and show the reviewers what the results are and NOT include them in the paper, by explaining that it goes beyond what the published methods are that you are using and you do not want the responsibility for inventing an otherwise unpublished adjusted-pseudo-$R^2$ procedure. However, you should realize that the reason that the reviewers are asking is because they want assurances that they are not seeing gibberish numbers. Now, if you can think of another way of doing exactly that, assuring the reviewer(s) that the results are reliable, then the problem should go away... One alternative is to include more references or information about the pseudo-$R^2$ values you are using, especially if you can show robustness, or precision. For example A Lack-of-Fit Test for Quantile Regression. Are the pseudo-$R^2$ values essential to the paper, or are there other ways to accomplish the same goal? Sometimes, just deleting the problem is the simplest thing to do. Yes, we agree with you, exalted reviewer, your majestic infallibility is worshiped, $<$grovel, grovel$>$ problem deleted.
Is there such a thing as an adjusted $R^2$ for a quantile regression model?
I think what the reviewers are asking is to take the pseudo-$R^2$-values and "unbias" them for number of samples in the quantile range, $n_Q$, and number of parameters in the model, $p$. In other word
Is there such a thing as an adjusted $R^2$ for a quantile regression model? I think what the reviewers are asking is to take the pseudo-$R^2$-values and "unbias" them for number of samples in the quantile range, $n_Q$, and number of parameters in the model, $p$. In other words, adjusted-$R^2$ in its usual context. That is that the corrected unexplained fraction is larger than the gross unexplained fraction by a factor of $\frac{n_Q-1}{n_Q-p-1}$, i.e., $1-R^{2*}=\frac{n_Q-1}{n_Q-p-1}(1-R^2)$, or, $R^{2*}=1-\frac{n_Q-1}{n_Q-p-1}(1-R^2)$ I agree with you about taking things too far, because this is already a pseudo-$R^2$-value and an adjusted-pseudo-$R^2$-value might leave the reader with an impression of performing a pseudo-adjustment. One alternative is to do the calculations and show the reviewers what the results are and NOT include them in the paper, by explaining that it goes beyond what the published methods are that you are using and you do not want the responsibility for inventing an otherwise unpublished adjusted-pseudo-$R^2$ procedure. However, you should realize that the reason that the reviewers are asking is because they want assurances that they are not seeing gibberish numbers. Now, if you can think of another way of doing exactly that, assuring the reviewer(s) that the results are reliable, then the problem should go away... One alternative is to include more references or information about the pseudo-$R^2$ values you are using, especially if you can show robustness, or precision. For example A Lack-of-Fit Test for Quantile Regression. Are the pseudo-$R^2$ values essential to the paper, or are there other ways to accomplish the same goal? Sometimes, just deleting the problem is the simplest thing to do. Yes, we agree with you, exalted reviewer, your majestic infallibility is worshiped, $<$grovel, grovel$>$ problem deleted.
Is there such a thing as an adjusted $R^2$ for a quantile regression model? I think what the reviewers are asking is to take the pseudo-$R^2$-values and "unbias" them for number of samples in the quantile range, $n_Q$, and number of parameters in the model, $p$. In other word
12,873
Is there such a thing as an adjusted $R^2$ for a quantile regression model?
You had better not use $R^2$ to compare two quantile regression models, because the quantile regression model's loss function is not based on MSE. You can try AIC or BIC.
Is there such a thing as an adjusted $R^2$ for a quantile regression model?
You had better not use $R^2$ to compare two quantile regression models, because the quantile regression model's loss function is not based on MSE. You can try AIC or BIC.
Is there such a thing as an adjusted $R^2$ for a quantile regression model? You had better not use $R^2$ to compare two quantile regression models, because the quantile regression model's loss function is not based on MSE. You can try AIC or BIC.
Is there such a thing as an adjusted $R^2$ for a quantile regression model? You had better not use $R^2$ to compare two quantile regression models, because the quantile regression model's loss function is not based on MSE. You can try AIC or BIC.
12,874
Multiple mediation analysis in R
The lavaan package is an R package for SEM. You can use it to test for multiple mediation hypothesis, and there is boostrap.
Multiple mediation analysis in R
The lavaan package is an R package for SEM. You can use it to test for multiple mediation hypothesis, and there is boostrap.
Multiple mediation analysis in R The lavaan package is an R package for SEM. You can use it to test for multiple mediation hypothesis, and there is boostrap.
Multiple mediation analysis in R The lavaan package is an R package for SEM. You can use it to test for multiple mediation hypothesis, and there is boostrap.
12,875
First step for big data ($N = 10^{10}$, $p = 2000$)
You should check out online methods for regression and classification for datasets of this size. These approaches would let you use the whole dataset without having to load it into memory. You might also check out Vowpal Wabbit (VW): https://github.com/JohnLangford/vowpal_wabbit/wiki It uses an out of core online method, so it should be able to handle a dataset of this size. You can do regression and classification and it has support for sparse formats. You can also do penalized versions (e.g. lasso-type regression/classification) in VW, which could improve your model's accuracy.
First step for big data ($N = 10^{10}$, $p = 2000$)
You should check out online methods for regression and classification for datasets of this size. These approaches would let you use the whole dataset without having to load it into memory. You might a
First step for big data ($N = 10^{10}$, $p = 2000$) You should check out online methods for regression and classification for datasets of this size. These approaches would let you use the whole dataset without having to load it into memory. You might also check out Vowpal Wabbit (VW): https://github.com/JohnLangford/vowpal_wabbit/wiki It uses an out of core online method, so it should be able to handle a dataset of this size. You can do regression and classification and it has support for sparse formats. You can also do penalized versions (e.g. lasso-type regression/classification) in VW, which could improve your model's accuracy.
First step for big data ($N = 10^{10}$, $p = 2000$) You should check out online methods for regression and classification for datasets of this size. These approaches would let you use the whole dataset without having to load it into memory. You might a
12,876
First step for big data ($N = 10^{10}$, $p = 2000$)
I would suggest using Hadoop and RMR (a specific package for Map Reduce in R). With this strategy you can run large datasets on comodity computers with an affordable configuration (probably in two hours you come up with both Hadoop and RMR (RHadoop) installed and running). In fact, if you have more than one computer you can create a cluster, reducing the processing time. I give you some links supporting my suggestion: This link will lead you to a tutorial for installing Hadoop on a single-node cluster (one computer). This link and this link will show you how to install RMR on your Hadoop cluster. And finally, here you may find an example of logistic regression by means of RHadoop. So, my advice is to follow these guidelines as it is certainly worthy if your data is huge.
First step for big data ($N = 10^{10}$, $p = 2000$)
I would suggest using Hadoop and RMR (a specific package for Map Reduce in R). With this strategy you can run large datasets on comodity computers with an affordable configuration (probably in two hou
First step for big data ($N = 10^{10}$, $p = 2000$) I would suggest using Hadoop and RMR (a specific package for Map Reduce in R). With this strategy you can run large datasets on comodity computers with an affordable configuration (probably in two hours you come up with both Hadoop and RMR (RHadoop) installed and running). In fact, if you have more than one computer you can create a cluster, reducing the processing time. I give you some links supporting my suggestion: This link will lead you to a tutorial for installing Hadoop on a single-node cluster (one computer). This link and this link will show you how to install RMR on your Hadoop cluster. And finally, here you may find an example of logistic regression by means of RHadoop. So, my advice is to follow these guidelines as it is certainly worthy if your data is huge.
First step for big data ($N = 10^{10}$, $p = 2000$) I would suggest using Hadoop and RMR (a specific package for Map Reduce in R). With this strategy you can run large datasets on comodity computers with an affordable configuration (probably in two hou
12,877
First step for big data ($N = 10^{10}$, $p = 2000$)
This is more a comment than an answer, but I can't post it as a comment (requires 50 rep).. Have you tried to use PCA on your dataset? It can help you to reduce the variable space and find a possible direction on which variable exclude from you regression model. Doing so, the model will be easier to compute. Here you can find an interesting discussion on using PCA with categorical variables: Can principal component analysis be applied to datasets containing a mix of continuous and categorical variables? Also, I imagine you're using R for many reasons (I use R too), but it may be easier to use a software like SAS or STATA. They perform better with big data and you don't have to deal with multi-core and parallel computing. Finally, try to think if it makes sense to use as much rows as possible from your dataset. This is a population dataset, a quasi-population dataset or a sampled dataset? You may obtain better results with a good sampling on your dataset than using the whole data. Take a look at this post: Is sampling relevant in the time of 'big data'? Hope this helps
First step for big data ($N = 10^{10}$, $p = 2000$)
This is more a comment than an answer, but I can't post it as a comment (requires 50 rep).. Have you tried to use PCA on your dataset? It can help you to reduce the variable space and find a possible
First step for big data ($N = 10^{10}$, $p = 2000$) This is more a comment than an answer, but I can't post it as a comment (requires 50 rep).. Have you tried to use PCA on your dataset? It can help you to reduce the variable space and find a possible direction on which variable exclude from you regression model. Doing so, the model will be easier to compute. Here you can find an interesting discussion on using PCA with categorical variables: Can principal component analysis be applied to datasets containing a mix of continuous and categorical variables? Also, I imagine you're using R for many reasons (I use R too), but it may be easier to use a software like SAS or STATA. They perform better with big data and you don't have to deal with multi-core and parallel computing. Finally, try to think if it makes sense to use as much rows as possible from your dataset. This is a population dataset, a quasi-population dataset or a sampled dataset? You may obtain better results with a good sampling on your dataset than using the whole data. Take a look at this post: Is sampling relevant in the time of 'big data'? Hope this helps
First step for big data ($N = 10^{10}$, $p = 2000$) This is more a comment than an answer, but I can't post it as a comment (requires 50 rep).. Have you tried to use PCA on your dataset? It can help you to reduce the variable space and find a possible
12,878
"Interestingness" function for StackExchange questions
One might define an interesting question as one that has received comparatively many votes given the number of views. To this end, you can create a baseline curve that reflects the expected number of votes given the views. Curves that attracted a lot more votes than the baseline were considered particularly interesting. To construct the baseline, you may want to calculate the median number of votes per 100-view bin. In addition, you could calculate the median absolute deviation (MAD) as a robust measure for the standard deviation per bin. Then, "interestingness" can be calculated as interestingness(votes,views) = (votes-baselineVotes(views))/baselineMAD(views)
"Interestingness" function for StackExchange questions
One might define an interesting question as one that has received comparatively many votes given the number of views. To this end, you can create a baseline curve that reflects the expected number of
"Interestingness" function for StackExchange questions One might define an interesting question as one that has received comparatively many votes given the number of views. To this end, you can create a baseline curve that reflects the expected number of votes given the views. Curves that attracted a lot more votes than the baseline were considered particularly interesting. To construct the baseline, you may want to calculate the median number of votes per 100-view bin. In addition, you could calculate the median absolute deviation (MAD) as a robust measure for the standard deviation per bin. Then, "interestingness" can be calculated as interestingness(votes,views) = (votes-baselineVotes(views))/baselineMAD(views)
"Interestingness" function for StackExchange questions One might define an interesting question as one that has received comparatively many votes given the number of views. To this end, you can create a baseline curve that reflects the expected number of
12,879
"Interestingness" function for StackExchange questions
This is my theory. I think there are two kinds of questions: those that remain mostly within SE (which usually have fewer views), and those that are viewed by outsiders because it was linked from somewhere else (usually have more views). For the questions that remain mostly within SE, votes are a good measure of interesting questions. This is the point of votes. When a question is linked to outside the site the votes stop meaning as much. Some linking sites may have very few SE members, others may have more. The variance of the number of votes for these questions is probably high (as evidenced by your score vs view plot, where the right side of the curve blooms out). These questions will have more views, and views MAY be a better indicator of interesting questions. Or questions that a larger community happened to find more interesting. There are many variables in this situation, and I think it would be worth trying to find more information to differentiate these cases. Does SE publicize referral information?
"Interestingness" function for StackExchange questions
This is my theory. I think there are two kinds of questions: those that remain mostly within SE (which usually have fewer views), and those that are viewed by outsiders because it was linked from some
"Interestingness" function for StackExchange questions This is my theory. I think there are two kinds of questions: those that remain mostly within SE (which usually have fewer views), and those that are viewed by outsiders because it was linked from somewhere else (usually have more views). For the questions that remain mostly within SE, votes are a good measure of interesting questions. This is the point of votes. When a question is linked to outside the site the votes stop meaning as much. Some linking sites may have very few SE members, others may have more. The variance of the number of votes for these questions is probably high (as evidenced by your score vs view plot, where the right side of the curve blooms out). These questions will have more views, and views MAY be a better indicator of interesting questions. Or questions that a larger community happened to find more interesting. There are many variables in this situation, and I think it would be worth trying to find more information to differentiate these cases. Does SE publicize referral information?
"Interestingness" function for StackExchange questions This is my theory. I think there are two kinds of questions: those that remain mostly within SE (which usually have fewer views), and those that are viewed by outsiders because it was linked from some
12,880
Model selection with Firth logistic regression
If you want to justify the use of BIC: you can replace the maximum likelihood with the maximum a posteriori (MAP) estimate and the resulting 'BIC'-type criterion remains asymptotically valid (in the limit as the sample size $n \to \infty$). As mentioned by @probabilityislogic, Firth's logistic regression is equivalent to using a Jeffrey's prior (so what you obtain from your regression fit is the MAP). The BIC is a pseudo-Bayesian criterion which is (roughly) derived using a Taylor series expansion of the marginal likelihood $$p_y(y) = \int L(\theta; y)\pi(\theta)\mathrm{d} \theta$$ around the maximum likelihood estimate $\hat{\theta}$. Thus it ignores the prior, but the effect of the latter vanishes as information concentrates in the likelihood. As a side remark, Firth's regression also removes the first-order bias in exponential families.
Model selection with Firth logistic regression
If you want to justify the use of BIC: you can replace the maximum likelihood with the maximum a posteriori (MAP) estimate and the resulting 'BIC'-type criterion remains asymptotically valid (in the l
Model selection with Firth logistic regression If you want to justify the use of BIC: you can replace the maximum likelihood with the maximum a posteriori (MAP) estimate and the resulting 'BIC'-type criterion remains asymptotically valid (in the limit as the sample size $n \to \infty$). As mentioned by @probabilityislogic, Firth's logistic regression is equivalent to using a Jeffrey's prior (so what you obtain from your regression fit is the MAP). The BIC is a pseudo-Bayesian criterion which is (roughly) derived using a Taylor series expansion of the marginal likelihood $$p_y(y) = \int L(\theta; y)\pi(\theta)\mathrm{d} \theta$$ around the maximum likelihood estimate $\hat{\theta}$. Thus it ignores the prior, but the effect of the latter vanishes as information concentrates in the likelihood. As a side remark, Firth's regression also removes the first-order bias in exponential families.
Model selection with Firth logistic regression If you want to justify the use of BIC: you can replace the maximum likelihood with the maximum a posteriori (MAP) estimate and the resulting 'BIC'-type criterion remains asymptotically valid (in the l
12,881
Latent variable interpretation of generalized linear models (GLMs)
For models with more than one discrete outcome, there are several versions of logit models (e.g. conditional logit, multinomial logit, mixed logit, nested logit, ...). See Kenneth Train's book on the subject: For example, in conditional logit, the outcome, $y$, is the car chosen by an individual, and there may be, say $J$ cars to choose from and car $j$ has attributes given by $x_j$. Then suppose that individual $i$ receives utility $u_{ij} = x_j \beta + \varepsilon_{ij}$ from chosing car $j$, where $\varepsilon_{ij}$ is distributed type I extreme value. Then the probability that car $j$ is chosen is given by $$ \Pr(y=j) = \frac{\exp(x_j \beta)}{\sum_{k=1}^J \exp (x_k \beta)}$$ In this model, $u_{ij}$, form a ranking of the alternatives. We are searching for parameters, $\beta$, so that this ranking conforms with the observed choices we see people making. E.g. if more expensive cars have lower market shares all else equals, then the coefficient on price must be negative. Economists interpret $u$ as a latent "utility" of making each choice. In microeconomics, there is a considerable body of work on utility theory. Note that there is no "threshold" parameter here: instead, when one utility becomes greater than the previously greatest, then the consumer will switch to choosing that alternative. Therefore, there cannot be an intercept in $x_j \beta$: if there were, this would just scale up the utility of all the available options, leaving the ranking preserved and the choice unchanged.
Latent variable interpretation of generalized linear models (GLMs)
For models with more than one discrete outcome, there are several versions of logit models (e.g. conditional logit, multinomial logit, mixed logit, nested logit, ...). See Kenneth Train's book on the
Latent variable interpretation of generalized linear models (GLMs) For models with more than one discrete outcome, there are several versions of logit models (e.g. conditional logit, multinomial logit, mixed logit, nested logit, ...). See Kenneth Train's book on the subject: For example, in conditional logit, the outcome, $y$, is the car chosen by an individual, and there may be, say $J$ cars to choose from and car $j$ has attributes given by $x_j$. Then suppose that individual $i$ receives utility $u_{ij} = x_j \beta + \varepsilon_{ij}$ from chosing car $j$, where $\varepsilon_{ij}$ is distributed type I extreme value. Then the probability that car $j$ is chosen is given by $$ \Pr(y=j) = \frac{\exp(x_j \beta)}{\sum_{k=1}^J \exp (x_k \beta)}$$ In this model, $u_{ij}$, form a ranking of the alternatives. We are searching for parameters, $\beta$, so that this ranking conforms with the observed choices we see people making. E.g. if more expensive cars have lower market shares all else equals, then the coefficient on price must be negative. Economists interpret $u$ as a latent "utility" of making each choice. In microeconomics, there is a considerable body of work on utility theory. Note that there is no "threshold" parameter here: instead, when one utility becomes greater than the previously greatest, then the consumer will switch to choosing that alternative. Therefore, there cannot be an intercept in $x_j \beta$: if there were, this would just scale up the utility of all the available options, leaving the ranking preserved and the choice unchanged.
Latent variable interpretation of generalized linear models (GLMs) For models with more than one discrete outcome, there are several versions of logit models (e.g. conditional logit, multinomial logit, mixed logit, nested logit, ...). See Kenneth Train's book on the
12,882
Is there an example where MLE produces a biased estimate of the mean?
Christoph Hanck has not posted the details of his proposed example. I take it he means the uniform distribution on the interval $[0,\theta],$ based on an i.i.d. sample $X_1,\ldots,X_n$ of size more than $n=1.$ The mean is $\theta/2$. The MLE of the mean is $\max\{X_1,\ldots,X_n\}/2.$ That is biased since $\Pr(\max < \theta) = 1,$ so $\operatorname{E}({\max}/2)<\theta/2.$ PS: Perhaps we should note that the best unbiased estimator of the mean $\theta/2$ is not the sample mean, but rather is $$\frac{n+1} {2n} \cdot \max\{X_1,\ldots,X_n\}.$$ The sample mean is a lousy estimator of $\theta/2$ because for some samples, the sample mean is less than $\dfrac 1 2 \max\{X_1,\ldots,X_n\},$ and it is clearly impossible for $\theta/2$ to be less than ${\max}/2.$ end of PS I suspect the Pareto distribution is another such case. Here's the probability measure: $$ \alpha\left( \frac \kappa x \right)^\alpha\ \frac{dx} x \text{ for } x >\kappa. $$ The expected value is $\dfrac \alpha {\alpha -1 } \kappa.$ The MLE of the expected value is $$ \frac n {n - \sum_{i=1}^n \big((\log X_i) - \log(\min)\big)} \cdot \min $$ where $\min = \min\{X_1,\ldots,X_n\}.$ I haven't worked out the expected value of the MLE for the mean, so I don't know what its bias is.
Is there an example where MLE produces a biased estimate of the mean?
Christoph Hanck has not posted the details of his proposed example. I take it he means the uniform distribution on the interval $[0,\theta],$ based on an i.i.d. sample $X_1,\ldots,X_n$ of size more th
Is there an example where MLE produces a biased estimate of the mean? Christoph Hanck has not posted the details of his proposed example. I take it he means the uniform distribution on the interval $[0,\theta],$ based on an i.i.d. sample $X_1,\ldots,X_n$ of size more than $n=1.$ The mean is $\theta/2$. The MLE of the mean is $\max\{X_1,\ldots,X_n\}/2.$ That is biased since $\Pr(\max < \theta) = 1,$ so $\operatorname{E}({\max}/2)<\theta/2.$ PS: Perhaps we should note that the best unbiased estimator of the mean $\theta/2$ is not the sample mean, but rather is $$\frac{n+1} {2n} \cdot \max\{X_1,\ldots,X_n\}.$$ The sample mean is a lousy estimator of $\theta/2$ because for some samples, the sample mean is less than $\dfrac 1 2 \max\{X_1,\ldots,X_n\},$ and it is clearly impossible for $\theta/2$ to be less than ${\max}/2.$ end of PS I suspect the Pareto distribution is another such case. Here's the probability measure: $$ \alpha\left( \frac \kappa x \right)^\alpha\ \frac{dx} x \text{ for } x >\kappa. $$ The expected value is $\dfrac \alpha {\alpha -1 } \kappa.$ The MLE of the expected value is $$ \frac n {n - \sum_{i=1}^n \big((\log X_i) - \log(\min)\big)} \cdot \min $$ where $\min = \min\{X_1,\ldots,X_n\}.$ I haven't worked out the expected value of the MLE for the mean, so I don't know what its bias is.
Is there an example where MLE produces a biased estimate of the mean? Christoph Hanck has not posted the details of his proposed example. I take it he means the uniform distribution on the interval $[0,\theta],$ based on an i.i.d. sample $X_1,\ldots,X_n$ of size more th
12,883
Is there an example where MLE produces a biased estimate of the mean?
Here's an example that I think some may find surprising: In logistic regression, for any finite sample size with non-deterministic outcomes (i.e. $0 < p_{i} < 1$), any estimated regression coefficient is not only biased, the mean of the regression coefficient is actually undefined. This is because for any finite sample size, there is a positive probability (albeit very small if the number of samples is large compared with the number of regression parameters) of getting perfect separation of outcomes. When this happens, estimated regression coefficients will be either $-\infty$ or $\infty$. Having positive probability of being either $-\infty$ or $\infty$ implies the expected value is undefined. For more on this particular issue, see the Hauck-Donner-effect.
Is there an example where MLE produces a biased estimate of the mean?
Here's an example that I think some may find surprising: In logistic regression, for any finite sample size with non-deterministic outcomes (i.e. $0 < p_{i} < 1$), any estimated regression coefficien
Is there an example where MLE produces a biased estimate of the mean? Here's an example that I think some may find surprising: In logistic regression, for any finite sample size with non-deterministic outcomes (i.e. $0 < p_{i} < 1$), any estimated regression coefficient is not only biased, the mean of the regression coefficient is actually undefined. This is because for any finite sample size, there is a positive probability (albeit very small if the number of samples is large compared with the number of regression parameters) of getting perfect separation of outcomes. When this happens, estimated regression coefficients will be either $-\infty$ or $\infty$. Having positive probability of being either $-\infty$ or $\infty$ implies the expected value is undefined. For more on this particular issue, see the Hauck-Donner-effect.
Is there an example where MLE produces a biased estimate of the mean? Here's an example that I think some may find surprising: In logistic regression, for any finite sample size with non-deterministic outcomes (i.e. $0 < p_{i} < 1$), any estimated regression coefficien
12,884
Is there an example where MLE produces a biased estimate of the mean?
Although @MichaelHardy has made the point, here is a more detailed argument as to why the MLE of the maximum (and hence, that of the mean $\theta/2$, by invariance) is not unbiased, although it is in a different model (see the edit below). We estimate the upper bound of the uniform distribution $U[0,\theta]$. Here, $y_{(n)}$ is the MLE, for a random sample $y$. We show that $y_{(n)}$ is not unbiased. Its cdf is \begin{eqnarray*} F_{y_{(n)}}(x)&=&\Pr\{Y_1\leqslant x,\ldots,Y_n\leqslant x\}\\ &=&\Pr\{Y_1\leqslant x\}^n\\ &=&\begin{cases} 0&\qquad\text{for}\quad x<0\\ \left(\frac{x}{\theta}\right)^n&\qquad\text{for}\quad 0\leqslant x\leqslant\theta\\ 1&\qquad\text{for}\quad x>\theta \end{cases} \end{eqnarray*} Thus, its density is $$f_{y_{(n)}}(x)= \begin{cases} \frac{n}{\theta}\left(\frac{x}{\theta}\right)^{n-1}&\qquad\text{for}\quad 0\leqslant x\leqslant\theta\\ 0&\qquad\text{else} \end{cases} $$ Hence, \begin{eqnarray*} E[Y_{(n)}]&=&\int_0^\theta x\frac{n}{\theta}\left(\frac{x}{\theta}\right)^{n-1}dx\\ &=&\int_0^\theta n\left(\frac{x}{\theta}\right)^{n}dx\\ &=&\frac{n}{n+1}\theta \end{eqnarray*} EDIT: It is indeed the case that (see the discussion in the comments) the MLE is unbiased for the mean in the case in which both the lower bound $a$ and upper bound $b$ are unknown. Then, the minimum $Y_{(1)}$ is the MLE for $a$, with (details omitted) expected value $$ E(Y_{(1)})=\frac{na+b}{n+1} $$ while $$ E(Y_{(n)})=\frac{nb+a}{n+1} $$ so that the MLE for $(a+b)/2$ is $$ \frac{Y_{(1)}+Y_{(n)}}{2} $$ with expected value $$ E\left(\frac{Y_{(1)}+Y_{(n)}}{2}\right)=\frac{na+b+nb+a}{2(n+1)}=\frac{a+b}{2} $$ EDIT 2: To elaborate on Henry's point, here is a little simulation for the MSE of the estimators of the mean, showing that while the MLE if we do not know the lower bound is zero is unbiased, the MSEs for the two variants are identical, suggesting that the estimator which incorporates knowledge of the lower bound reduces variability. theta <- 1 mean <- theta/2 reps <- 500000 n <- 5 mse <- bias <- matrix(NA, nrow = reps, ncol = 2) for (i in 1:reps){ x <- runif(n, min = 0, max = theta) mle.knownlowerbound <- max(x)/2 mle.unknownlowerbound <- (max(x)+min(x))/2 mse[i,1] <- (mle.knownlowerbound-mean)^2 mse[i,2] <- (mle.unknownlowerbound-mean)^2 bias[i,1] <- mle.knownlowerbound-mean bias[i,2] <- mle.unknownlowerbound-mean } > colMeans(mse) [1] 0.01194837 0.01194413 > colMeans(bias) [1] -0.083464968 -0.000121968
Is there an example where MLE produces a biased estimate of the mean?
Although @MichaelHardy has made the point, here is a more detailed argument as to why the MLE of the maximum (and hence, that of the mean $\theta/2$, by invariance) is not unbiased, although it is in
Is there an example where MLE produces a biased estimate of the mean? Although @MichaelHardy has made the point, here is a more detailed argument as to why the MLE of the maximum (and hence, that of the mean $\theta/2$, by invariance) is not unbiased, although it is in a different model (see the edit below). We estimate the upper bound of the uniform distribution $U[0,\theta]$. Here, $y_{(n)}$ is the MLE, for a random sample $y$. We show that $y_{(n)}$ is not unbiased. Its cdf is \begin{eqnarray*} F_{y_{(n)}}(x)&=&\Pr\{Y_1\leqslant x,\ldots,Y_n\leqslant x\}\\ &=&\Pr\{Y_1\leqslant x\}^n\\ &=&\begin{cases} 0&\qquad\text{for}\quad x<0\\ \left(\frac{x}{\theta}\right)^n&\qquad\text{for}\quad 0\leqslant x\leqslant\theta\\ 1&\qquad\text{for}\quad x>\theta \end{cases} \end{eqnarray*} Thus, its density is $$f_{y_{(n)}}(x)= \begin{cases} \frac{n}{\theta}\left(\frac{x}{\theta}\right)^{n-1}&\qquad\text{for}\quad 0\leqslant x\leqslant\theta\\ 0&\qquad\text{else} \end{cases} $$ Hence, \begin{eqnarray*} E[Y_{(n)}]&=&\int_0^\theta x\frac{n}{\theta}\left(\frac{x}{\theta}\right)^{n-1}dx\\ &=&\int_0^\theta n\left(\frac{x}{\theta}\right)^{n}dx\\ &=&\frac{n}{n+1}\theta \end{eqnarray*} EDIT: It is indeed the case that (see the discussion in the comments) the MLE is unbiased for the mean in the case in which both the lower bound $a$ and upper bound $b$ are unknown. Then, the minimum $Y_{(1)}$ is the MLE for $a$, with (details omitted) expected value $$ E(Y_{(1)})=\frac{na+b}{n+1} $$ while $$ E(Y_{(n)})=\frac{nb+a}{n+1} $$ so that the MLE for $(a+b)/2$ is $$ \frac{Y_{(1)}+Y_{(n)}}{2} $$ with expected value $$ E\left(\frac{Y_{(1)}+Y_{(n)}}{2}\right)=\frac{na+b+nb+a}{2(n+1)}=\frac{a+b}{2} $$ EDIT 2: To elaborate on Henry's point, here is a little simulation for the MSE of the estimators of the mean, showing that while the MLE if we do not know the lower bound is zero is unbiased, the MSEs for the two variants are identical, suggesting that the estimator which incorporates knowledge of the lower bound reduces variability. theta <- 1 mean <- theta/2 reps <- 500000 n <- 5 mse <- bias <- matrix(NA, nrow = reps, ncol = 2) for (i in 1:reps){ x <- runif(n, min = 0, max = theta) mle.knownlowerbound <- max(x)/2 mle.unknownlowerbound <- (max(x)+min(x))/2 mse[i,1] <- (mle.knownlowerbound-mean)^2 mse[i,2] <- (mle.unknownlowerbound-mean)^2 bias[i,1] <- mle.knownlowerbound-mean bias[i,2] <- mle.unknownlowerbound-mean } > colMeans(mse) [1] 0.01194837 0.01194413 > colMeans(bias) [1] -0.083464968 -0.000121968
Is there an example where MLE produces a biased estimate of the mean? Although @MichaelHardy has made the point, here is a more detailed argument as to why the MLE of the maximum (and hence, that of the mean $\theta/2$, by invariance) is not unbiased, although it is in
12,885
Is there an example where MLE produces a biased estimate of the mean?
Completing here the omission in my answer over at math.se referenced by the OP, assume that we have an i.i.d. sample of size $n$ of random variables following the Half Normal distribution. The density and moments of this distribution are $$f_H(x) = \sqrt{2/\pi}\cdot \frac 1{v^{1/2}}\cdot \exp\big\{-\frac {x^2}{2v} \big\} \\ E(X) = \sqrt{2/\pi}\cdot v^{1/2}\equiv \mu,\;\; \operatorname{Var}(X) = \left(1-\frac 2 \pi \right)v$$ The log-likelihood of the sample is $$L(v\mid \mathbf x) = n\ln\sqrt{2/\pi}-\frac n2\ln v -\frac 1 {2v} \sum_{i=1}^n x_i^2$$ The first derivative with respect to $v$ is $$\frac {\partial}{\partial v}L(v\mid\mathbf x) = -\frac n{2v} + \frac 1 {2v^2} \sum_{i=1}^n x_i^2,\implies \hat v_\text{MLE} = \frac 1n \sum_{i=1}^nx_i^2$$ so it is a method of moments estimator. It is unbiased since, $$E(\hat v_\text{MLE}) = E(X^2) = \operatorname{Var}(X) + [E(X)])^2 = \left(1-\frac 2 \pi \right)v + \frac 2 \pi v = v$$ But, the resulting estimator for the mean is downward biased due to Jensen's inequality \begin{align} \hat \mu_\text{MLE} = \sqrt{2/\pi}\cdot \sqrt {\hat v_\text{MLE}} \implies & E\left(\hat \mu_\text{MLE}\right) = \sqrt{2/\pi}\cdot E\left(\sqrt {\hat v_\text{MLE}}\,\right) \\[6pt] & < \sqrt{2/\pi}\cdot \left[\sqrt {E(\hat v_\text{MLE})}\,\right] = \sqrt{2/\pi}\cdot \sqrt v = \mu \end{align}
Is there an example where MLE produces a biased estimate of the mean?
Completing here the omission in my answer over at math.se referenced by the OP, assume that we have an i.i.d. sample of size $n$ of random variables following the Half Normal distribution. The dens
Is there an example where MLE produces a biased estimate of the mean? Completing here the omission in my answer over at math.se referenced by the OP, assume that we have an i.i.d. sample of size $n$ of random variables following the Half Normal distribution. The density and moments of this distribution are $$f_H(x) = \sqrt{2/\pi}\cdot \frac 1{v^{1/2}}\cdot \exp\big\{-\frac {x^2}{2v} \big\} \\ E(X) = \sqrt{2/\pi}\cdot v^{1/2}\equiv \mu,\;\; \operatorname{Var}(X) = \left(1-\frac 2 \pi \right)v$$ The log-likelihood of the sample is $$L(v\mid \mathbf x) = n\ln\sqrt{2/\pi}-\frac n2\ln v -\frac 1 {2v} \sum_{i=1}^n x_i^2$$ The first derivative with respect to $v$ is $$\frac {\partial}{\partial v}L(v\mid\mathbf x) = -\frac n{2v} + \frac 1 {2v^2} \sum_{i=1}^n x_i^2,\implies \hat v_\text{MLE} = \frac 1n \sum_{i=1}^nx_i^2$$ so it is a method of moments estimator. It is unbiased since, $$E(\hat v_\text{MLE}) = E(X^2) = \operatorname{Var}(X) + [E(X)])^2 = \left(1-\frac 2 \pi \right)v + \frac 2 \pi v = v$$ But, the resulting estimator for the mean is downward biased due to Jensen's inequality \begin{align} \hat \mu_\text{MLE} = \sqrt{2/\pi}\cdot \sqrt {\hat v_\text{MLE}} \implies & E\left(\hat \mu_\text{MLE}\right) = \sqrt{2/\pi}\cdot E\left(\sqrt {\hat v_\text{MLE}}\,\right) \\[6pt] & < \sqrt{2/\pi}\cdot \left[\sqrt {E(\hat v_\text{MLE})}\,\right] = \sqrt{2/\pi}\cdot \sqrt v = \mu \end{align}
Is there an example where MLE produces a biased estimate of the mean? Completing here the omission in my answer over at math.se referenced by the OP, assume that we have an i.i.d. sample of size $n$ of random variables following the Half Normal distribution. The dens
12,886
Is there an example where MLE produces a biased estimate of the mean?
The famous Neyman Scott problem has an inconsistent MLE in that it never even converges to the right thing. Motivates the use of conditional likelihood. Take $(X_i, Y_i) \sim \mathcal{N}\left(\mu_i, \sigma^2 \right)$. The MLE of $\mu_i$ is $(X_i + Y_i)/2$ and of $\sigma^2$ is $\hat{\sigma}^2 = \sum_{i=1}^n \frac{1}{n} s_i^2$ with $s_i^2 = (X_i - \hat{\mu}_i)^2/2 + (Y_i - \hat{\mu}_i)^2/2 = (X_i - Y_i)^2 / 4$ which has expected value $\sigma^2/4$ and so biased by a factor of 2.
Is there an example where MLE produces a biased estimate of the mean?
The famous Neyman Scott problem has an inconsistent MLE in that it never even converges to the right thing. Motivates the use of conditional likelihood. Take $(X_i, Y_i) \sim \mathcal{N}\left(\mu_i, \
Is there an example where MLE produces a biased estimate of the mean? The famous Neyman Scott problem has an inconsistent MLE in that it never even converges to the right thing. Motivates the use of conditional likelihood. Take $(X_i, Y_i) \sim \mathcal{N}\left(\mu_i, \sigma^2 \right)$. The MLE of $\mu_i$ is $(X_i + Y_i)/2$ and of $\sigma^2$ is $\hat{\sigma}^2 = \sum_{i=1}^n \frac{1}{n} s_i^2$ with $s_i^2 = (X_i - \hat{\mu}_i)^2/2 + (Y_i - \hat{\mu}_i)^2/2 = (X_i - Y_i)^2 / 4$ which has expected value $\sigma^2/4$ and so biased by a factor of 2.
Is there an example where MLE produces a biased estimate of the mean? The famous Neyman Scott problem has an inconsistent MLE in that it never even converges to the right thing. Motivates the use of conditional likelihood. Take $(X_i, Y_i) \sim \mathcal{N}\left(\mu_i, \
12,887
Is there an example where MLE produces a biased estimate of the mean?
There is an infinite range of examples for this phenomenon since the maximum likelihood estimator of a bijective transform $\Psi(\theta)$ of a parameter $\theta$ is the bijective transform of the maximum likelihood estimator of $\theta$, $\Psi(\hat{\theta}_\text{MLE})$; the expectation of the bijective transform of the maximum likelihood estimator of $\theta$, $\Psi(\hat{\theta}_\text{MLE})$, $\mathbb{E}[\Psi(\hat{\theta}_\text{MLE})]$ is not the bijective transform of the expectation of the maximum likelihood estimator, $\Psi(\mathbb{E}[\hat{\theta}_\text{MLE}])$; most transforms $\Psi(\theta)$ are expectations of some transform of the data, $\mathfrak{h}(X)$, at least for exponential families, provided an inverse Laplace transform can be applied to them.
Is there an example where MLE produces a biased estimate of the mean?
There is an infinite range of examples for this phenomenon since the maximum likelihood estimator of a bijective transform $\Psi(\theta)$ of a parameter $\theta$ is the bijective transform of the max
Is there an example where MLE produces a biased estimate of the mean? There is an infinite range of examples for this phenomenon since the maximum likelihood estimator of a bijective transform $\Psi(\theta)$ of a parameter $\theta$ is the bijective transform of the maximum likelihood estimator of $\theta$, $\Psi(\hat{\theta}_\text{MLE})$; the expectation of the bijective transform of the maximum likelihood estimator of $\theta$, $\Psi(\hat{\theta}_\text{MLE})$, $\mathbb{E}[\Psi(\hat{\theta}_\text{MLE})]$ is not the bijective transform of the expectation of the maximum likelihood estimator, $\Psi(\mathbb{E}[\hat{\theta}_\text{MLE}])$; most transforms $\Psi(\theta)$ are expectations of some transform of the data, $\mathfrak{h}(X)$, at least for exponential families, provided an inverse Laplace transform can be applied to them.
Is there an example where MLE produces a biased estimate of the mean? There is an infinite range of examples for this phenomenon since the maximum likelihood estimator of a bijective transform $\Psi(\theta)$ of a parameter $\theta$ is the bijective transform of the max
12,888
Example of strong correlation coefficient with a high p value
The Bottom Line The sample correlation coefficient needed to reject the hypothesis that the true (Pearson) correlation coefficient is zero becomes small quite fast as the sample size increases. So, in general, no, you cannot simultaneously have a large (in magnitude) correlation coefficient and a simultaneously large $p$-value. The Top Line (Details) The test used for the Pearson correlation coefficient in the $R$ function cor.test is a very slightly modified version of the method I discuss below. Suppose $(X_1,Y_1), (X_2,Y_2),\ldots,(X_n,Y_n)$ are iid bivariate normal random vectors with correlation $\rho$. We want to test the null hypothesis that $\rho = 0$ versus $\rho \neq 0$. Let $r$ be the sample correlation coefficient. Using standard linear-regression theory, it is not hard to show that the test statistic, $$ T = \frac{r \sqrt{n-2}}{\sqrt{(1-r^2)}} $$ has a $t_{n-2}$ distribution under the null hypothesis. For large $n$, the $t_{n-2}$ distribution approaches the standard normal. Hence $T^2$ is approximately chi-squared distributed with one degree of freedom. (Under the assumptions we've made, $T^2 \sim F_{1,n-2}$ in actuality, but the $\chi^2_1$ approximation makes clearer what is going on, I think.) So, $$ \mathbb P\left(\frac{r^2}{1-r^2} (n-2) \geq q_{1-\alpha} \right) \approx \alpha \>, $$ where $q_{1-\alpha}$ is the $(1-\alpha)$ quantile of a chi-squared distribution with one degree of freedom. Now, note that $r^2/(1-r^2)$ is increasing as $r^2$ increases. Rearranging the quantity in the probability statement, we have that for all $$ |r| \geq \frac{1}{\sqrt{1+(n-2)/q_{1-\alpha}}} $$ we'll get a rejection of the null hypothesis at level $\alpha$. Clearly the right-hand side decreases with $n$. A plot Here is a plot of the rejection region of $|r|$ as a function of the sample size. So, for example, when the sample size exceeds 100, the (absolute) correlation need only be about 0.2 to reject the null at the $\alpha = 0.05$ level. A simulation We can do a simple simulation to generate a pair of zero-mean vectors with an exact correlation coefficient. Below is the code. From this we can look at the output of cor.test. k <- 100 n <- 4*k # Correlation that gives an approximate p-value of 0.05 # Change 0.05 to some other desired p-value to get a different curve pval <- 0.05 qval <- qchisq(pval,1,lower.tail=F) rho <- 1/sqrt(1+(n-2)/qval) # Zero-mean orthogonal basis vectors b1 <- rep(c(1,-1),n/2) b2 <- rep(c(1,1,-1,-1),n/4) # Construct x and y vectors with mean zero and an empirical # correlation of *exactly* rho x <- b1 y <- rho * b1 + sqrt(1-rho^2) * b2 # Do test ctst <- cor.test(x,y) As requested in the comments, here is the code to reproduce the plot, which can be run immediately following the code above (and uses some of the variables defined there). png("cortest.png", height=600, width=600) m <- 3:1000 yy <- 1/sqrt(1+(m-2)/qval) plot(m, yy, type="l", lwd=3, ylim=c(0,1), xlab="sample size", ylab="correlation") polygon( c(m[1],m,rev(m)[1]), c(1,yy,1), col="lightblue2", border=NA) lines(m,yy,lwd=2) text(500, 0.5, "p < 0.05", cex=1.5 ) dev.off()
Example of strong correlation coefficient with a high p value
The Bottom Line The sample correlation coefficient needed to reject the hypothesis that the true (Pearson) correlation coefficient is zero becomes small quite fast as the sample size increases. So, in
Example of strong correlation coefficient with a high p value The Bottom Line The sample correlation coefficient needed to reject the hypothesis that the true (Pearson) correlation coefficient is zero becomes small quite fast as the sample size increases. So, in general, no, you cannot simultaneously have a large (in magnitude) correlation coefficient and a simultaneously large $p$-value. The Top Line (Details) The test used for the Pearson correlation coefficient in the $R$ function cor.test is a very slightly modified version of the method I discuss below. Suppose $(X_1,Y_1), (X_2,Y_2),\ldots,(X_n,Y_n)$ are iid bivariate normal random vectors with correlation $\rho$. We want to test the null hypothesis that $\rho = 0$ versus $\rho \neq 0$. Let $r$ be the sample correlation coefficient. Using standard linear-regression theory, it is not hard to show that the test statistic, $$ T = \frac{r \sqrt{n-2}}{\sqrt{(1-r^2)}} $$ has a $t_{n-2}$ distribution under the null hypothesis. For large $n$, the $t_{n-2}$ distribution approaches the standard normal. Hence $T^2$ is approximately chi-squared distributed with one degree of freedom. (Under the assumptions we've made, $T^2 \sim F_{1,n-2}$ in actuality, but the $\chi^2_1$ approximation makes clearer what is going on, I think.) So, $$ \mathbb P\left(\frac{r^2}{1-r^2} (n-2) \geq q_{1-\alpha} \right) \approx \alpha \>, $$ where $q_{1-\alpha}$ is the $(1-\alpha)$ quantile of a chi-squared distribution with one degree of freedom. Now, note that $r^2/(1-r^2)$ is increasing as $r^2$ increases. Rearranging the quantity in the probability statement, we have that for all $$ |r| \geq \frac{1}{\sqrt{1+(n-2)/q_{1-\alpha}}} $$ we'll get a rejection of the null hypothesis at level $\alpha$. Clearly the right-hand side decreases with $n$. A plot Here is a plot of the rejection region of $|r|$ as a function of the sample size. So, for example, when the sample size exceeds 100, the (absolute) correlation need only be about 0.2 to reject the null at the $\alpha = 0.05$ level. A simulation We can do a simple simulation to generate a pair of zero-mean vectors with an exact correlation coefficient. Below is the code. From this we can look at the output of cor.test. k <- 100 n <- 4*k # Correlation that gives an approximate p-value of 0.05 # Change 0.05 to some other desired p-value to get a different curve pval <- 0.05 qval <- qchisq(pval,1,lower.tail=F) rho <- 1/sqrt(1+(n-2)/qval) # Zero-mean orthogonal basis vectors b1 <- rep(c(1,-1),n/2) b2 <- rep(c(1,1,-1,-1),n/4) # Construct x and y vectors with mean zero and an empirical # correlation of *exactly* rho x <- b1 y <- rho * b1 + sqrt(1-rho^2) * b2 # Do test ctst <- cor.test(x,y) As requested in the comments, here is the code to reproduce the plot, which can be run immediately following the code above (and uses some of the variables defined there). png("cortest.png", height=600, width=600) m <- 3:1000 yy <- 1/sqrt(1+(m-2)/qval) plot(m, yy, type="l", lwd=3, ylim=c(0,1), xlab="sample size", ylab="correlation") polygon( c(m[1],m,rev(m)[1]), c(1,yy,1), col="lightblue2", border=NA) lines(m,yy,lwd=2) text(500, 0.5, "p < 0.05", cex=1.5 ) dev.off()
Example of strong correlation coefficient with a high p value The Bottom Line The sample correlation coefficient needed to reject the hypothesis that the true (Pearson) correlation coefficient is zero becomes small quite fast as the sample size increases. So, in
12,889
Example of strong correlation coefficient with a high p value
cor.test(c(1,2,3),c(1,2,2)) cor = 0.866, p = 0.333
Example of strong correlation coefficient with a high p value
cor.test(c(1,2,3),c(1,2,2)) cor = 0.866, p = 0.333
Example of strong correlation coefficient with a high p value cor.test(c(1,2,3),c(1,2,2)) cor = 0.866, p = 0.333
Example of strong correlation coefficient with a high p value cor.test(c(1,2,3),c(1,2,2)) cor = 0.866, p = 0.333
12,890
Example of strong correlation coefficient with a high p value
A high estimate of the correlation coefficient with a high p-value could only occur with a very small sample size. I was about to provide an illustration, but Aaron has just done that!
Example of strong correlation coefficient with a high p value
A high estimate of the correlation coefficient with a high p-value could only occur with a very small sample size. I was about to provide an illustration, but Aaron has just done that!
Example of strong correlation coefficient with a high p value A high estimate of the correlation coefficient with a high p-value could only occur with a very small sample size. I was about to provide an illustration, but Aaron has just done that!
Example of strong correlation coefficient with a high p value A high estimate of the correlation coefficient with a high p-value could only occur with a very small sample size. I was about to provide an illustration, but Aaron has just done that!
12,891
Example of strong correlation coefficient with a high p value
I believe by the Fisher R-Z transform, the hyperbolic arctan of the sample correlation, under the null, is approximately normal with mean zero and standard error $1 / \sqrt{n-3}$. So to get, for example, a sample correlation $\hat{\rho} > 0$ with a fixed p-value, $p$, you would need $$p = 2 - 2 \Phi\left(\operatorname{atanh}(\hat{\rho})\sqrt{n-3}\right),$$ where $\Phi$ is the CDF of the standard normal, and you are performing a two-sided test for the null $H_0: \rho = 0$. You can turn this into a function which gives the required $n$ for a fixed $\hat{\rho}$ and $p$. In R: #get n for sample correlation and p-value, 2-sided test of 0 correlation n.size <- function(rho.hat,p.val) { n <- 3 + ((qnorm(1 - 0.5 * p.val)) / atanh(rho.hat))^2 } Running this for $\hat{\rho} = 0.5$ and $p = 0.2$ gives: print(n.size(0.5,0.2)) [1] 8.443062 So your sample size should be around 8. Playing around with this function should give you some idea of the relationship between $n, p$ and $\hat{\rho}$.
Example of strong correlation coefficient with a high p value
I believe by the Fisher R-Z transform, the hyperbolic arctan of the sample correlation, under the null, is approximately normal with mean zero and standard error $1 / \sqrt{n-3}$. So to get, for examp
Example of strong correlation coefficient with a high p value I believe by the Fisher R-Z transform, the hyperbolic arctan of the sample correlation, under the null, is approximately normal with mean zero and standard error $1 / \sqrt{n-3}$. So to get, for example, a sample correlation $\hat{\rho} > 0$ with a fixed p-value, $p$, you would need $$p = 2 - 2 \Phi\left(\operatorname{atanh}(\hat{\rho})\sqrt{n-3}\right),$$ where $\Phi$ is the CDF of the standard normal, and you are performing a two-sided test for the null $H_0: \rho = 0$. You can turn this into a function which gives the required $n$ for a fixed $\hat{\rho}$ and $p$. In R: #get n for sample correlation and p-value, 2-sided test of 0 correlation n.size <- function(rho.hat,p.val) { n <- 3 + ((qnorm(1 - 0.5 * p.val)) / atanh(rho.hat))^2 } Running this for $\hat{\rho} = 0.5$ and $p = 0.2$ gives: print(n.size(0.5,0.2)) [1] 8.443062 So your sample size should be around 8. Playing around with this function should give you some idea of the relationship between $n, p$ and $\hat{\rho}$.
Example of strong correlation coefficient with a high p value I believe by the Fisher R-Z transform, the hyperbolic arctan of the sample correlation, under the null, is approximately normal with mean zero and standard error $1 / \sqrt{n-3}$. So to get, for examp
12,892
Example of strong correlation coefficient with a high p value
Yes. A p-value depends on the sample size, so a small sample can give this. Say the true effect size was very small, and you draw a small sample. By luck, you get a few data points with very high correlation. The p-value will be high, as it should be. The correlation is high but it's not a very dependable result. The sample correlation from R's cor() will tell you the best estimate of the correlation (given the sample). The p-value does NOT measure the strength of correlation. It measures how likely it could have arisen in case there actually was no effect, considering the size of the sample. Another way to see this: If you have the same effect size, but get more samples, the p-value always goes to zero. (If you want to more closely integrate the notions of estimated effect size and confidence about the estimate, it may be better to use confidence intervals; or, use Bayesian techniques.)
Example of strong correlation coefficient with a high p value
Yes. A p-value depends on the sample size, so a small sample can give this. Say the true effect size was very small, and you draw a small sample. By luck, you get a few data points with very high co
Example of strong correlation coefficient with a high p value Yes. A p-value depends on the sample size, so a small sample can give this. Say the true effect size was very small, and you draw a small sample. By luck, you get a few data points with very high correlation. The p-value will be high, as it should be. The correlation is high but it's not a very dependable result. The sample correlation from R's cor() will tell you the best estimate of the correlation (given the sample). The p-value does NOT measure the strength of correlation. It measures how likely it could have arisen in case there actually was no effect, considering the size of the sample. Another way to see this: If you have the same effect size, but get more samples, the p-value always goes to zero. (If you want to more closely integrate the notions of estimated effect size and confidence about the estimate, it may be better to use confidence intervals; or, use Bayesian techniques.)
Example of strong correlation coefficient with a high p value Yes. A p-value depends on the sample size, so a small sample can give this. Say the true effect size was very small, and you draw a small sample. By luck, you get a few data points with very high co
12,893
Finding a way to simulate random numbers for this distribution
There is a straightforward (and if I may add, elegant) solution to this exercise: since $1-F(x)$ appears like a product of two survival distributions: $$(1-F(x))=\exp\left\{-ax-\frac{b}{p+1}x^{p+1}\right\}=\underbrace{\exp\left\{-ax\right\}}_{1-F_1(x)}\underbrace{\exp\left\{-\frac{b}{p+1}x^{p+1}\right\}}_{1-F_2(x)}$$ the distribution $F$ is the distribution of $$X=\min\{X_1,X_2\}\qquad X_1\sim F_1\,,X_2\sim F_2$$ In this case $F_1$ is the Exponential $\mathcal{E}(a)$ distribution and $F_2$ is the $1/(p+1)$-th power of an Exponential $\mathcal{E}(b/(p+1))$ distribution. The associated R code is as simple as it gets x=pmin(rexp(n,a),rexp(n,b/(p+1))^(1/(p+1))) #simulating an n-sample and it is definitely much faster than the inverse pdf and accept-reject resolutions: > n=1e6 > system.time(results <- Vectorize(simulate,"prob")(runif(n))) utilisateur système écoulé 89.060 0.072 89.124 > system.time(x <- simuF(n,1,2,3)) utilisateur système écoulé 1.080 0.020 1.103 > system.time(x <- pmin(rexp(n,a),rexp(n,b/(p+1))^(1/(p+1)))) utilisateur système écoulé 0.160 0.000 0.163 with an unsurprisingly perfect fit:
Finding a way to simulate random numbers for this distribution
There is a straightforward (and if I may add, elegant) solution to this exercise: since $1-F(x)$ appears like a product of two survival distributions: $$(1-F(x))=\exp\left\{-ax-\frac{b}{p+1}x^{p+1}\ri
Finding a way to simulate random numbers for this distribution There is a straightforward (and if I may add, elegant) solution to this exercise: since $1-F(x)$ appears like a product of two survival distributions: $$(1-F(x))=\exp\left\{-ax-\frac{b}{p+1}x^{p+1}\right\}=\underbrace{\exp\left\{-ax\right\}}_{1-F_1(x)}\underbrace{\exp\left\{-\frac{b}{p+1}x^{p+1}\right\}}_{1-F_2(x)}$$ the distribution $F$ is the distribution of $$X=\min\{X_1,X_2\}\qquad X_1\sim F_1\,,X_2\sim F_2$$ In this case $F_1$ is the Exponential $\mathcal{E}(a)$ distribution and $F_2$ is the $1/(p+1)$-th power of an Exponential $\mathcal{E}(b/(p+1))$ distribution. The associated R code is as simple as it gets x=pmin(rexp(n,a),rexp(n,b/(p+1))^(1/(p+1))) #simulating an n-sample and it is definitely much faster than the inverse pdf and accept-reject resolutions: > n=1e6 > system.time(results <- Vectorize(simulate,"prob")(runif(n))) utilisateur système écoulé 89.060 0.072 89.124 > system.time(x <- simuF(n,1,2,3)) utilisateur système écoulé 1.080 0.020 1.103 > system.time(x <- pmin(rexp(n,a),rexp(n,b/(p+1))^(1/(p+1)))) utilisateur système écoulé 0.160 0.000 0.163 with an unsurprisingly perfect fit:
Finding a way to simulate random numbers for this distribution There is a straightforward (and if I may add, elegant) solution to this exercise: since $1-F(x)$ appears like a product of two survival distributions: $$(1-F(x))=\exp\left\{-ax-\frac{b}{p+1}x^{p+1}\ri
12,894
Finding a way to simulate random numbers for this distribution
You can always numerically solve the inverse transformation. Below, I do a very simple bisection search. For a given input probability $q$ (I use $q$ since you already have a $p$ in your formula), I start with $x_L=0$ and $x_R=1$. Then I double $x_R$ until $F(x_R)>q$. Finally, I iteratively bisect the interval $[x_L,x_R]$ until its length is shorter than $\epsilon$ and its middle point $x_M$ satisfies $F(x_M)\approx q$. The ECDF fits your $F$ well enough for my choices of $a$ and $b$, and it's reasonably fast. You could probably speed this up by using some Newton-type optimization instead of the simple bisection search. aa <- 2 bb <- 1 pp <- 0.1 cdf <- function(x) 1-exp(-aa*x-bb*x^(pp+1)/(pp+1)) simulate <- function(prob,epsilon=1e-5) { left <- 0 right <- 1 while ( cdf(right) < prob ) right <- 2*right while ( right-left>epsilon ) { middle <- mean(c(left,right)) value_middle <- cdf(middle) if ( value_middle < prob ) left <- middle else right <- middle } mean(c(left,right)) } set.seed(1) results <- Vectorize(simulate,"prob")(runif(10000)) hist(results) xx <- seq(0,max(results),by=.01) plot(ecdf(results)) lines(xx,cdf(xx),col="red")
Finding a way to simulate random numbers for this distribution
You can always numerically solve the inverse transformation. Below, I do a very simple bisection search. For a given input probability $q$ (I use $q$ since you already have a $p$ in your formula), I s
Finding a way to simulate random numbers for this distribution You can always numerically solve the inverse transformation. Below, I do a very simple bisection search. For a given input probability $q$ (I use $q$ since you already have a $p$ in your formula), I start with $x_L=0$ and $x_R=1$. Then I double $x_R$ until $F(x_R)>q$. Finally, I iteratively bisect the interval $[x_L,x_R]$ until its length is shorter than $\epsilon$ and its middle point $x_M$ satisfies $F(x_M)\approx q$. The ECDF fits your $F$ well enough for my choices of $a$ and $b$, and it's reasonably fast. You could probably speed this up by using some Newton-type optimization instead of the simple bisection search. aa <- 2 bb <- 1 pp <- 0.1 cdf <- function(x) 1-exp(-aa*x-bb*x^(pp+1)/(pp+1)) simulate <- function(prob,epsilon=1e-5) { left <- 0 right <- 1 while ( cdf(right) < prob ) right <- 2*right while ( right-left>epsilon ) { middle <- mean(c(left,right)) value_middle <- cdf(middle) if ( value_middle < prob ) left <- middle else right <- middle } mean(c(left,right)) } set.seed(1) results <- Vectorize(simulate,"prob")(runif(10000)) hist(results) xx <- seq(0,max(results),by=.01) plot(ecdf(results)) lines(xx,cdf(xx),col="red")
Finding a way to simulate random numbers for this distribution You can always numerically solve the inverse transformation. Below, I do a very simple bisection search. For a given input probability $q$ (I use $q$ since you already have a $p$ in your formula), I s
12,895
Finding a way to simulate random numbers for this distribution
There is a somewhat convoluted if direct resolution by accept-reject. First, a simple differentiation shows that the pdf of the distribution is $$f(x)=(a+bx^p)\exp\left\{-ax-\frac{b}{p+1}x^{p+1}\right\}$$ Second, since $$f(x)=ae^{-ax}\underbrace{e^{-bx^{p+1}/(p+1)}}_{\le 1}+bx^pe^{-bx^{p+1}/(p+1)}\underbrace{e^{-ax}}_{\le 1}$$ we have the upper bound $$f(x)\le g(x)=ae^{-ax}+bx^pe^{-bx^{p+1}/(p+1)}$$ Third, considering the second term in $g$, take the change of variable $\xi=x^{p+1}$, i.e., $x=\xi^{1/(p+1)}$. Then$$\dfrac{\text{d}x}{\text{d}\xi}=\dfrac{1}{p+1}\xi^{\frac{1}{p+1}-1}=\dfrac{1}{p+1}\xi^{\frac{-p}{p+1}}$$ is the Jacobian of the change of variable. If $X$ has a density of the form $\kappa bx^pe^{-bx^{p+1}/(p+1)}$ where $\kappa$ is the normalising constant, then $\Xi=X^{1/(p+1)}$ has the density $$\kappa b\xi^{\frac{p}{p+1}}e^{-b\xi/(p+1)}\,\dfrac{1}{p+1}\xi^{\frac{-p}{p+1}}=\kappa \dfrac{b}{p+1}e^{-b\xi/(p+1)}$$ which means that (i) $\Xi$ is distributed as an Exponential $\mathcal{E}(b/(p+1))$ variate and (ii) the constant $\kappa$ is equal to one. Therefore, $g(x)$ ends up being equal to the equally weighted mixture of an Exponential $\mathcal{E}(a)$ distribution and the $1/(p+1)$-th power of an Exponential $\mathcal{E}(b/(p+1))$ distribution, modulo a missing multiplicative constant of $2$ to account for the weights: $$f(x)\le g(x)=2\left(\frac{1}{2} ae^{-ax}+\frac{1}{2} bx^pe^{-bx^{p+1}/(p+1)}\right)$$ And $g$ is straightforward to simulate as a mixture. An R rendering of the accept-reject algorithm is thus simuF <- function(a,b,p){ reepeat=TRUE while (reepeat){ if (runif(1)<.5) x=rexp(1,a) else x=rexp(1,b/(p+1))^(1/(p+1)) reepeat=(runif(1)>(a+b*x^p)*exp(-a*x-b*x^(p+1)/(p+1))/ (a*exp(-a*x)+b*x^p*exp(-b*x^(p+1)/(p+1))))} return(x)} and for an n-sample: simuF <- function(n,a,b,p){ sampl=NULL while (length(sampl)<n){ x=u=sample(0:1,n,rep=TRUE) x[u==0]=rexp(sum(u==0),b/(p+1))^(1/(p+1)) x[u==1]=rexp(sum(u==1),a) sampl=c(sampl,x[runif(n)<(a+b*x^p)*exp(-a*x-b*x^(p+1)/(p+1))/ (a*exp(-a*x)+b*x^p*exp(-b*x^(p+1)/(p+1)))]) } return(sampl[1:n])} Here is an illustration for a=1, b=2, p=3:
Finding a way to simulate random numbers for this distribution
There is a somewhat convoluted if direct resolution by accept-reject. First, a simple differentiation shows that the pdf of the distribution is $$f(x)=(a+bx^p)\exp\left\{-ax-\frac{b}{p+1}x^{p+1}\right
Finding a way to simulate random numbers for this distribution There is a somewhat convoluted if direct resolution by accept-reject. First, a simple differentiation shows that the pdf of the distribution is $$f(x)=(a+bx^p)\exp\left\{-ax-\frac{b}{p+1}x^{p+1}\right\}$$ Second, since $$f(x)=ae^{-ax}\underbrace{e^{-bx^{p+1}/(p+1)}}_{\le 1}+bx^pe^{-bx^{p+1}/(p+1)}\underbrace{e^{-ax}}_{\le 1}$$ we have the upper bound $$f(x)\le g(x)=ae^{-ax}+bx^pe^{-bx^{p+1}/(p+1)}$$ Third, considering the second term in $g$, take the change of variable $\xi=x^{p+1}$, i.e., $x=\xi^{1/(p+1)}$. Then$$\dfrac{\text{d}x}{\text{d}\xi}=\dfrac{1}{p+1}\xi^{\frac{1}{p+1}-1}=\dfrac{1}{p+1}\xi^{\frac{-p}{p+1}}$$ is the Jacobian of the change of variable. If $X$ has a density of the form $\kappa bx^pe^{-bx^{p+1}/(p+1)}$ where $\kappa$ is the normalising constant, then $\Xi=X^{1/(p+1)}$ has the density $$\kappa b\xi^{\frac{p}{p+1}}e^{-b\xi/(p+1)}\,\dfrac{1}{p+1}\xi^{\frac{-p}{p+1}}=\kappa \dfrac{b}{p+1}e^{-b\xi/(p+1)}$$ which means that (i) $\Xi$ is distributed as an Exponential $\mathcal{E}(b/(p+1))$ variate and (ii) the constant $\kappa$ is equal to one. Therefore, $g(x)$ ends up being equal to the equally weighted mixture of an Exponential $\mathcal{E}(a)$ distribution and the $1/(p+1)$-th power of an Exponential $\mathcal{E}(b/(p+1))$ distribution, modulo a missing multiplicative constant of $2$ to account for the weights: $$f(x)\le g(x)=2\left(\frac{1}{2} ae^{-ax}+\frac{1}{2} bx^pe^{-bx^{p+1}/(p+1)}\right)$$ And $g$ is straightforward to simulate as a mixture. An R rendering of the accept-reject algorithm is thus simuF <- function(a,b,p){ reepeat=TRUE while (reepeat){ if (runif(1)<.5) x=rexp(1,a) else x=rexp(1,b/(p+1))^(1/(p+1)) reepeat=(runif(1)>(a+b*x^p)*exp(-a*x-b*x^(p+1)/(p+1))/ (a*exp(-a*x)+b*x^p*exp(-b*x^(p+1)/(p+1))))} return(x)} and for an n-sample: simuF <- function(n,a,b,p){ sampl=NULL while (length(sampl)<n){ x=u=sample(0:1,n,rep=TRUE) x[u==0]=rexp(sum(u==0),b/(p+1))^(1/(p+1)) x[u==1]=rexp(sum(u==1),a) sampl=c(sampl,x[runif(n)<(a+b*x^p)*exp(-a*x-b*x^(p+1)/(p+1))/ (a*exp(-a*x)+b*x^p*exp(-b*x^(p+1)/(p+1)))]) } return(sampl[1:n])} Here is an illustration for a=1, b=2, p=3:
Finding a way to simulate random numbers for this distribution There is a somewhat convoluted if direct resolution by accept-reject. First, a simple differentiation shows that the pdf of the distribution is $$f(x)=(a+bx^p)\exp\left\{-ax-\frac{b}{p+1}x^{p+1}\right
12,896
Is median fairer than mean?
The problem is that you haven't really defined what it means to have a good or fair rating. You suggest in a comment on @Kevin's answer that you don't like it if one bad review takes down an item. But comparing two items where one has a "perfect record" and the other has one bad review, maybe that difference should be reflected. There's a whole (high-dimensional) continuum between median and mean. You can order the votes by value, then take a weighted average with the weights depending on the position in that order. The mean corresponds to all weights being equal, the median corresponds to only one or two entries in the middle getting nonzero weight, a trimmed average corresponds to giving all except the first and last couple the same weight, but you could also decide to weight the $k$th out of $n$ samples with weight $\frac{1}{1 + (2 k - 1 - n)^2}$ or $\exp(-\frac{(2k - 1 - n)^2}{n^2})$, to throw something random in there. Maybe such a weighted average where the outliers get less weight, but still a nonzero amount, could combine good properties of median and mean?
Is median fairer than mean?
The problem is that you haven't really defined what it means to have a good or fair rating. You suggest in a comment on @Kevin's answer that you don't like it if one bad review takes down an item. But
Is median fairer than mean? The problem is that you haven't really defined what it means to have a good or fair rating. You suggest in a comment on @Kevin's answer that you don't like it if one bad review takes down an item. But comparing two items where one has a "perfect record" and the other has one bad review, maybe that difference should be reflected. There's a whole (high-dimensional) continuum between median and mean. You can order the votes by value, then take a weighted average with the weights depending on the position in that order. The mean corresponds to all weights being equal, the median corresponds to only one or two entries in the middle getting nonzero weight, a trimmed average corresponds to giving all except the first and last couple the same weight, but you could also decide to weight the $k$th out of $n$ samples with weight $\frac{1}{1 + (2 k - 1 - n)^2}$ or $\exp(-\frac{(2k - 1 - n)^2}{n^2})$, to throw something random in there. Maybe such a weighted average where the outliers get less weight, but still a nonzero amount, could combine good properties of median and mean?
Is median fairer than mean? The problem is that you haven't really defined what it means to have a good or fair rating. You suggest in a comment on @Kevin's answer that you don't like it if one bad review takes down an item. But
12,897
Is median fairer than mean?
The answer you get depends on the question you ask. Mean and median answer different questions. So they give different answers. It's not that one is "fairer" than another. Medians are often used with highly skewed data (such as income). But, even there, sometimes the mean is best. And sometimes you don't want ANY measure of central tendency. In addition, whenever you give a measure of central tendency, you should give some measure of spread. The most common pairings are mean-standard deviation and median-interquartile range. In these data, giving just a median of 5 is, I think, misleading, or, at least, uninformative. The median would also be 5 if every single vote was a 5.
Is median fairer than mean?
The answer you get depends on the question you ask. Mean and median answer different questions. So they give different answers. It's not that one is "fairer" than another. Medians are often used wi
Is median fairer than mean? The answer you get depends on the question you ask. Mean and median answer different questions. So they give different answers. It's not that one is "fairer" than another. Medians are often used with highly skewed data (such as income). But, even there, sometimes the mean is best. And sometimes you don't want ANY measure of central tendency. In addition, whenever you give a measure of central tendency, you should give some measure of spread. The most common pairings are mean-standard deviation and median-interquartile range. In these data, giving just a median of 5 is, I think, misleading, or, at least, uninformative. The median would also be 5 if every single vote was a 5.
Is median fairer than mean? The answer you get depends on the question you ask. Mean and median answer different questions. So they give different answers. It's not that one is "fairer" than another. Medians are often used wi
12,898
Is median fairer than mean?
If the only choices are integers in the range 1 to 5, can any really be considered an outlier? I'm sure that with small sample sizes, popular outlier tests will fail, but that just points out the problems inherent in small samples. Indeed, given a sample of 5, 5, 5, 5, 5, 1, Grubbs' test reports 1 as an outlier at $\alpha = 0.05$. The same test for the data you give above does not identify the 1's as outliers. Grubbs test for one outlier data: review G = 2.0667, U = 0.6963, p-value = 0.2153 alternative hypothesis: lowest value 1 is an outlier
Is median fairer than mean?
If the only choices are integers in the range 1 to 5, can any really be considered an outlier? I'm sure that with small sample sizes, popular outlier tests will fail, but that just points out the pro
Is median fairer than mean? If the only choices are integers in the range 1 to 5, can any really be considered an outlier? I'm sure that with small sample sizes, popular outlier tests will fail, but that just points out the problems inherent in small samples. Indeed, given a sample of 5, 5, 5, 5, 5, 1, Grubbs' test reports 1 as an outlier at $\alpha = 0.05$. The same test for the data you give above does not identify the 1's as outliers. Grubbs test for one outlier data: review G = 2.0667, U = 0.6963, p-value = 0.2153 alternative hypothesis: lowest value 1 is an outlier
Is median fairer than mean? If the only choices are integers in the range 1 to 5, can any really be considered an outlier? I'm sure that with small sample sizes, popular outlier tests will fail, but that just points out the pro
12,899
Is median fairer than mean?
An experiment shows that median's error is always bigger than mean. It depends on cost function you use. MSE is minimized by mean. Therefore if you use MSE median will be always worse than mean. BUT, if you would use absolute error, than the mean would be worse! A nice explanation on this can be found here: http://www.johnmyleswhite.com/notebook/2013/03/22/modes-medians-and-means-an-unifying-perspective/ The choice depends on your problem and preferences. If you don't want outliers to have big impact on the position of the "central point", then you choose median. If you care about outliers, you choose mean.
Is median fairer than mean?
An experiment shows that median's error is always bigger than mean. It depends on cost function you use. MSE is minimized by mean. Therefore if you use MSE median will be always worse than mean. BUT
Is median fairer than mean? An experiment shows that median's error is always bigger than mean. It depends on cost function you use. MSE is minimized by mean. Therefore if you use MSE median will be always worse than mean. BUT, if you would use absolute error, than the mean would be worse! A nice explanation on this can be found here: http://www.johnmyleswhite.com/notebook/2013/03/22/modes-medians-and-means-an-unifying-perspective/ The choice depends on your problem and preferences. If you don't want outliers to have big impact on the position of the "central point", then you choose median. If you care about outliers, you choose mean.
Is median fairer than mean? An experiment shows that median's error is always bigger than mean. It depends on cost function you use. MSE is minimized by mean. Therefore if you use MSE median will be always worse than mean. BUT
12,900
Is median fairer than mean?
Just a quick thought: If you assume that each rating is drawn from a latent continuous variable, then you could define the median of this underlying continuous variable of interest as your value of interest, rather than the mean of this underlying distribution. Where the distribution is symmetric, then the mean and the median would ultimately be estimating the same quantities. Where the distribution is skewed, the median would differ from the mean. In this case, to my mind, the median would correspond more with what we think of as the typical value. This goes some way to understanding why median income and median house prices are typically reported rather than the mean. However, when you have a small number of discrete values, the median performs poorly. Perhaps, you could use some density estimation procedure and then take the median of that, or use some interpolated median.
Is median fairer than mean?
Just a quick thought: If you assume that each rating is drawn from a latent continuous variable, then you could define the median of this underlying continuous variable of interest as your value of in
Is median fairer than mean? Just a quick thought: If you assume that each rating is drawn from a latent continuous variable, then you could define the median of this underlying continuous variable of interest as your value of interest, rather than the mean of this underlying distribution. Where the distribution is symmetric, then the mean and the median would ultimately be estimating the same quantities. Where the distribution is skewed, the median would differ from the mean. In this case, to my mind, the median would correspond more with what we think of as the typical value. This goes some way to understanding why median income and median house prices are typically reported rather than the mean. However, when you have a small number of discrete values, the median performs poorly. Perhaps, you could use some density estimation procedure and then take the median of that, or use some interpolated median.
Is median fairer than mean? Just a quick thought: If you assume that each rating is drawn from a latent continuous variable, then you could define the median of this underlying continuous variable of interest as your value of in