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 |
|---|---|---|---|---|---|---|
21,001 | Why should/does(?) statistical sampling work for politics (e.g. Gallup)? | Perhaps someone can post a more enlightening answer as to why, but judging from the last two US elections, I'm forced to conclude exactly what I had suspected prior to the 2016 elections:
It appears our polling methodologies in fact do not work for elections.
There isn't yet a consensus on why this appears to be the case, but some hypotheses I've found have been the following:
Supporters of some candidates may be more likely to respond due to enthusiasm. [1, 2]
Supporters of some candidates may be less likely to respond due to distrust. [1, 2, 4]
We poll too often and compromise on sample size/quality, mistaking noise for signal. [1, 2]
Weightings that we do to correct for demographics biases may be inadequate. [3]
Links with more discussions on the topic:
(NYMag) Should We Stop Paying Attention to Election Polls?
(NYT) Why Did the Pre-Election Polls Get It So Wrong Again?
(538) Trump Supporters Aren’t ‘Shy,’ But Polls Could Still Be Missing Some Of Them
(Vox) Election results: Why the polls got it wrong | Why should/does(?) statistical sampling work for politics (e.g. Gallup)? | Perhaps someone can post a more enlightening answer as to why, but judging from the last two US elections, I'm forced to conclude exactly what I had suspected prior to the 2016 elections:
It appears o | Why should/does(?) statistical sampling work for politics (e.g. Gallup)?
Perhaps someone can post a more enlightening answer as to why, but judging from the last two US elections, I'm forced to conclude exactly what I had suspected prior to the 2016 elections:
It appears our polling methodologies in fact do not work for elections.
There isn't yet a consensus on why this appears to be the case, but some hypotheses I've found have been the following:
Supporters of some candidates may be more likely to respond due to enthusiasm. [1, 2]
Supporters of some candidates may be less likely to respond due to distrust. [1, 2, 4]
We poll too often and compromise on sample size/quality, mistaking noise for signal. [1, 2]
Weightings that we do to correct for demographics biases may be inadequate. [3]
Links with more discussions on the topic:
(NYMag) Should We Stop Paying Attention to Election Polls?
(NYT) Why Did the Pre-Election Polls Get It So Wrong Again?
(538) Trump Supporters Aren’t ‘Shy,’ But Polls Could Still Be Missing Some Of Them
(Vox) Election results: Why the polls got it wrong | Why should/does(?) statistical sampling work for politics (e.g. Gallup)?
Perhaps someone can post a more enlightening answer as to why, but judging from the last two US elections, I'm forced to conclude exactly what I had suspected prior to the 2016 elections:
It appears o |
21,002 | Durbin Watson test statistic | In R, the function durbinWatsonTest() from car package verifies if the residuals from a linear model are correlated or not:
The null hypothesis ($\text{H}_0$) is that there is no correlation among residuals, i.e., they are independent.
The alternative hypothesis ($\text{H}_a$) is that residuals are autocorrelated.
As the p value was near from zero it means one can reject the null. | Durbin Watson test statistic | In R, the function durbinWatsonTest() from car package verifies if the residuals from a linear model are correlated or not:
The null hypothesis ($\text{H}_0$) is that there is no correlation among re | Durbin Watson test statistic
In R, the function durbinWatsonTest() from car package verifies if the residuals from a linear model are correlated or not:
The null hypothesis ($\text{H}_0$) is that there is no correlation among residuals, i.e., they are independent.
The alternative hypothesis ($\text{H}_a$) is that residuals are autocorrelated.
As the p value was near from zero it means one can reject the null. | Durbin Watson test statistic
In R, the function durbinWatsonTest() from car package verifies if the residuals from a linear model are correlated or not:
The null hypothesis ($\text{H}_0$) is that there is no correlation among re |
21,003 | Durbin Watson test statistic | If you believe the DW test, then yes, it indicates that you have serial correlation. However, remember that language of hypothesis testing you can never accept anything, you can only fail to reject it.
Further the DW test requires the full set of classical linear model assumptions, including normality and unbiasedness in order to have any power. Almost no real life application can reasonable assume this, and therefore you will hard a time convincing others about its validity. There are many much simpler (and more robust) tests to use instead of the DW, you should use these!
Of course the easy solution is to just to compute robust standard errors, for instance newey-west (which is easy to do in R), then you can simply ignore the problem | Durbin Watson test statistic | If you believe the DW test, then yes, it indicates that you have serial correlation. However, remember that language of hypothesis testing you can never accept anything, you can only fail to reject it | Durbin Watson test statistic
If you believe the DW test, then yes, it indicates that you have serial correlation. However, remember that language of hypothesis testing you can never accept anything, you can only fail to reject it.
Further the DW test requires the full set of classical linear model assumptions, including normality and unbiasedness in order to have any power. Almost no real life application can reasonable assume this, and therefore you will hard a time convincing others about its validity. There are many much simpler (and more robust) tests to use instead of the DW, you should use these!
Of course the easy solution is to just to compute robust standard errors, for instance newey-west (which is easy to do in R), then you can simply ignore the problem | Durbin Watson test statistic
If you believe the DW test, then yes, it indicates that you have serial correlation. However, remember that language of hypothesis testing you can never accept anything, you can only fail to reject it |
21,004 | Durbin Watson test statistic | The Durbin Watson test looks to check for both positive and negative autocorrelation but for first order only. It should not be used for data that is autocorrelated beyond the 1st order. The following link shows both the hypothesis as well as inference
https://www.statisticshowto.datasciencecentral.com/durbin-watson-test-coefficient
From this website:
"The Hypotheses for the Durbin Watson test are:
H0 = no first order autocorrelation.
H1 = first order correlation exists.
The Durbin Watson test reports a test statistic, with a value from 0 to 4, where the rule of thumb is:
2 is no autocorrelation.
0 to <2 is positive autocorrelation (common in time series data).
>2 to 4 is negative autocorrelation (less common in time series data).
A rule of thumb is that test statistic values in the range of 1.5 to 2.5 are relatively normal. "
Note that to get a more precise conclusion, we should not just rely on the DW statistic, but rather look at the p-value. Software packages like SAS will give 2 p-values - one for test for positive first order autocorrelation and the second one for the test for negative first order autocorrelation (both p-values add upto 1). If both p-values are more than your selected Alpha (0.05 in most cases), then we can not reject the null hypothesis that "no first order autocorrelation exists.
If any one of the p-values is < 0.05 (or selected Alpha), then we know that the corresponding alternate hypothesis is true (with 1- Alpha certainty).
I hope that helps. | Durbin Watson test statistic | The Durbin Watson test looks to check for both positive and negative autocorrelation but for first order only. It should not be used for data that is autocorrelated beyond the 1st order. The following | Durbin Watson test statistic
The Durbin Watson test looks to check for both positive and negative autocorrelation but for first order only. It should not be used for data that is autocorrelated beyond the 1st order. The following link shows both the hypothesis as well as inference
https://www.statisticshowto.datasciencecentral.com/durbin-watson-test-coefficient
From this website:
"The Hypotheses for the Durbin Watson test are:
H0 = no first order autocorrelation.
H1 = first order correlation exists.
The Durbin Watson test reports a test statistic, with a value from 0 to 4, where the rule of thumb is:
2 is no autocorrelation.
0 to <2 is positive autocorrelation (common in time series data).
>2 to 4 is negative autocorrelation (less common in time series data).
A rule of thumb is that test statistic values in the range of 1.5 to 2.5 are relatively normal. "
Note that to get a more precise conclusion, we should not just rely on the DW statistic, but rather look at the p-value. Software packages like SAS will give 2 p-values - one for test for positive first order autocorrelation and the second one for the test for negative first order autocorrelation (both p-values add upto 1). If both p-values are more than your selected Alpha (0.05 in most cases), then we can not reject the null hypothesis that "no first order autocorrelation exists.
If any one of the p-values is < 0.05 (or selected Alpha), then we know that the corresponding alternate hypothesis is true (with 1- Alpha certainty).
I hope that helps. | Durbin Watson test statistic
The Durbin Watson test looks to check for both positive and negative autocorrelation but for first order only. It should not be used for data that is autocorrelated beyond the 1st order. The following |
21,005 | Durbin Watson test statistic | dwtest tests against the alternative hypothesis instead to the null hypothesis. So if the p-value is bellow the level you say, then it means it accepts the alternative hypothesis and rejects the null hypothesis. | Durbin Watson test statistic | dwtest tests against the alternative hypothesis instead to the null hypothesis. So if the p-value is bellow the level you say, then it means it accepts the alternative hypothesis and rejects the null | Durbin Watson test statistic
dwtest tests against the alternative hypothesis instead to the null hypothesis. So if the p-value is bellow the level you say, then it means it accepts the alternative hypothesis and rejects the null hypothesis. | Durbin Watson test statistic
dwtest tests against the alternative hypothesis instead to the null hypothesis. So if the p-value is bellow the level you say, then it means it accepts the alternative hypothesis and rejects the null |
21,006 | Durbin Watson test statistic | The p-value is the lower α (significance level or alpha level) for which you should reject the null hypothesis.
It's just a red line: if you're ok with α = 0.1, α = 0.05, α = 0.01 or any α > 2.2e-16, well, it doesn't matter. This p-value ensures that the null hypothesis must be rejected and you don't need to test again and again for each level.
The same thing to other tests and p-values. But you may not forget what are the null and the alternative hypothesis. | Durbin Watson test statistic | The p-value is the lower α (significance level or alpha level) for which you should reject the null hypothesis.
It's just a red line: if you're ok with α = 0.1, α = 0.05, α = 0.01 or any α > 2.2e-16, | Durbin Watson test statistic
The p-value is the lower α (significance level or alpha level) for which you should reject the null hypothesis.
It's just a red line: if you're ok with α = 0.1, α = 0.05, α = 0.01 or any α > 2.2e-16, well, it doesn't matter. This p-value ensures that the null hypothesis must be rejected and you don't need to test again and again for each level.
The same thing to other tests and p-values. But you may not forget what are the null and the alternative hypothesis. | Durbin Watson test statistic
The p-value is the lower α (significance level or alpha level) for which you should reject the null hypothesis.
It's just a red line: if you're ok with α = 0.1, α = 0.05, α = 0.01 or any α > 2.2e-16, |
21,007 | Seeking a real illustration of Fisher's quote about DoE | I've run into designs where the experimenter wanted to test between subject effects but the design was more suitable for within subject effects.
For example, one experiment consisted of 8 rats, four on diet A and four on diet B, and the weight of the rat was measured each day for four weeks. This was fine if they were interested in the time effect of each diet but the goal was to investigate differences in the diets.
They thought by measuring each rat 28 times they had lots of data, but the experimental unit for the diet effect was the rat, which they only had 4 for each treatment. They could have measured the rats 10 times a days but it would have made no difference, in the end they needed more rats. | Seeking a real illustration of Fisher's quote about DoE | I've run into designs where the experimenter wanted to test between subject effects but the design was more suitable for within subject effects.
For example, one experiment consisted of 8 rats, four o | Seeking a real illustration of Fisher's quote about DoE
I've run into designs where the experimenter wanted to test between subject effects but the design was more suitable for within subject effects.
For example, one experiment consisted of 8 rats, four on diet A and four on diet B, and the weight of the rat was measured each day for four weeks. This was fine if they were interested in the time effect of each diet but the goal was to investigate differences in the diets.
They thought by measuring each rat 28 times they had lots of data, but the experimental unit for the diet effect was the rat, which they only had 4 for each treatment. They could have measured the rats 10 times a days but it would have made no difference, in the end they needed more rats. | Seeking a real illustration of Fisher's quote about DoE
I've run into designs where the experimenter wanted to test between subject effects but the design was more suitable for within subject effects.
For example, one experiment consisted of 8 rats, four o |
21,008 | Seeking a real illustration of Fisher's quote about DoE | I did some work for a organization called the National Foundation for Celiac Awareness. The organization promotes the public's awareness of Celiac Disease and provides a checklist of symptoms of the disease which involves intolerance to foods containing gluten. They conducted a survey on the internet by just opening it up to anyone who wanted to participate. Over the years they collected thousands of responses from the public. However they were hoping to draw conclusions about the general public based on the survey results. I had to tell them that the respondents were selfselected rather than random and this could create bias. Since the degree of bias is unknown we could not do any inference inspite of the large amount of data.
Now the respondents seemed to be a peculiar group. Many are very serious and answered to express concern that they or a relative might have the disease. But there also were a distnct number of people answering in a wise-guy fashion. This was obvious from the fake names, strange email addresses and postal addresses that they provided with their answers.
I felt that the data was only useful in an exploratory sense and the frequency of responses might be useful for fomrulating hypotheses that could be tested in a well planned future survey. But thus far my advice has not been heeded and they are running another one of these easy to do self selecting surveys on the internet. | Seeking a real illustration of Fisher's quote about DoE | I did some work for a organization called the National Foundation for Celiac Awareness. The organization promotes the public's awareness of Celiac Disease and provides a checklist of symptoms of the | Seeking a real illustration of Fisher's quote about DoE
I did some work for a organization called the National Foundation for Celiac Awareness. The organization promotes the public's awareness of Celiac Disease and provides a checklist of symptoms of the disease which involves intolerance to foods containing gluten. They conducted a survey on the internet by just opening it up to anyone who wanted to participate. Over the years they collected thousands of responses from the public. However they were hoping to draw conclusions about the general public based on the survey results. I had to tell them that the respondents were selfselected rather than random and this could create bias. Since the degree of bias is unknown we could not do any inference inspite of the large amount of data.
Now the respondents seemed to be a peculiar group. Many are very serious and answered to express concern that they or a relative might have the disease. But there also were a distnct number of people answering in a wise-guy fashion. This was obvious from the fake names, strange email addresses and postal addresses that they provided with their answers.
I felt that the data was only useful in an exploratory sense and the frequency of responses might be useful for fomrulating hypotheses that could be tested in a well planned future survey. But thus far my advice has not been heeded and they are running another one of these easy to do self selecting surveys on the internet. | Seeking a real illustration of Fisher's quote about DoE
I did some work for a organization called the National Foundation for Celiac Awareness. The organization promotes the public's awareness of Celiac Disease and provides a checklist of symptoms of the |
21,009 | Seeking a real illustration of Fisher's quote about DoE | Some time ago I was asked to analyze the results of an experiment on how the night storage position of a photovoltaic solar array affected the rate at which soil accumulated on the array. (These large concentrating photovoltaic arrays track the sun all day, but at night they are typically stored pointing straight up, as this is the minimum stress position for the tracker.) Soiling is a big issue, because it significantly reduces energy production, and cleaning is not cheap. The experiment had been run on a field of roughly 120 trackers; the west half had been stowed vertically and the east half horizontally (this aligned with the tracker connections to the two inverters, which would convey an advantage in energy production during the experiment if there is a significant effect and no particular pattern of soiling otherwise, so it's not, by itself, a bad idea.)
Unfortunately, there is a strong prevailing wind pattern across the desert from the south-southwest, and a large building to the south of the western part of the field, "shading" (somewhat) much of the western part of the field from windblown particulates. Additionally, trackers "shade" each other from the wind to some extent. Consequently, the mechanisms by which soil accumulates (e.g., wind-blown or settling) vary in relative magnitude across the field. This in turn implies that arrays accumulate soil at different rates dependent upon location; this is not a small effect.
The end result of the analysis was, essentially, that it wasn't implausible that storage position made a difference, but we could not, by any means, rule out the possibility that the effect was trivial, nor determine with any great confidence (based on the data) the sign of the effect. I then designed a followup experiment, assigning storage positions based on array location with the objective of being able to estimate the soiling "response surface" across the field for both storage positions, estimating "settling" vs "wind-blown" soiling rates, and of course the effect of storage angle on both of these. This experiment was quite successful and we were able to obtain a clear picture of the benefits of vertical stow after just a couple of months. | Seeking a real illustration of Fisher's quote about DoE | Some time ago I was asked to analyze the results of an experiment on how the night storage position of a photovoltaic solar array affected the rate at which soil accumulated on the array. (These larg | Seeking a real illustration of Fisher's quote about DoE
Some time ago I was asked to analyze the results of an experiment on how the night storage position of a photovoltaic solar array affected the rate at which soil accumulated on the array. (These large concentrating photovoltaic arrays track the sun all day, but at night they are typically stored pointing straight up, as this is the minimum stress position for the tracker.) Soiling is a big issue, because it significantly reduces energy production, and cleaning is not cheap. The experiment had been run on a field of roughly 120 trackers; the west half had been stowed vertically and the east half horizontally (this aligned with the tracker connections to the two inverters, which would convey an advantage in energy production during the experiment if there is a significant effect and no particular pattern of soiling otherwise, so it's not, by itself, a bad idea.)
Unfortunately, there is a strong prevailing wind pattern across the desert from the south-southwest, and a large building to the south of the western part of the field, "shading" (somewhat) much of the western part of the field from windblown particulates. Additionally, trackers "shade" each other from the wind to some extent. Consequently, the mechanisms by which soil accumulates (e.g., wind-blown or settling) vary in relative magnitude across the field. This in turn implies that arrays accumulate soil at different rates dependent upon location; this is not a small effect.
The end result of the analysis was, essentially, that it wasn't implausible that storage position made a difference, but we could not, by any means, rule out the possibility that the effect was trivial, nor determine with any great confidence (based on the data) the sign of the effect. I then designed a followup experiment, assigning storage positions based on array location with the objective of being able to estimate the soiling "response surface" across the field for both storage positions, estimating "settling" vs "wind-blown" soiling rates, and of course the effect of storage angle on both of these. This experiment was quite successful and we were able to obtain a clear picture of the benefits of vertical stow after just a couple of months. | Seeking a real illustration of Fisher's quote about DoE
Some time ago I was asked to analyze the results of an experiment on how the night storage position of a photovoltaic solar array affected the rate at which soil accumulated on the array. (These larg |
21,010 | Seeking a real illustration of Fisher's quote about DoE | I was asked by a colleague to 'do the stats' on a study looking at the correlation between a certain type of weather event and failures in a type of infrastructure that are typically attributed to simple wear and tear. The colleague wanted to see if the weather events were actually contributing to the failure or not. A team of people had already spent a lot of time and effort collecting a vast amount of data and the research paper was pretty much finished, they just needed someone to 'do the stats' and fill in the final bit of the results section.
The problem was, they had painstakingly ensured that the data set contained only 'interesting' periods in which the weather event in question had occurred. That meant there was no way to compare the failure rate during events with non-event times. I tried repeatedly to explain the problem, but they were never really convinced, because the simply had so much data that surely I could get something out of it.
Fortunately there was still a range of severity of the weather events and there was a weak correspondence between the severity and failure rate, so we salvaged something from it at least, but the result could have been so much more definitive had they thought about how to 'do the stats' before embarking on the data collection exercise. | Seeking a real illustration of Fisher's quote about DoE | I was asked by a colleague to 'do the stats' on a study looking at the correlation between a certain type of weather event and failures in a type of infrastructure that are typically attributed to sim | Seeking a real illustration of Fisher's quote about DoE
I was asked by a colleague to 'do the stats' on a study looking at the correlation between a certain type of weather event and failures in a type of infrastructure that are typically attributed to simple wear and tear. The colleague wanted to see if the weather events were actually contributing to the failure or not. A team of people had already spent a lot of time and effort collecting a vast amount of data and the research paper was pretty much finished, they just needed someone to 'do the stats' and fill in the final bit of the results section.
The problem was, they had painstakingly ensured that the data set contained only 'interesting' periods in which the weather event in question had occurred. That meant there was no way to compare the failure rate during events with non-event times. I tried repeatedly to explain the problem, but they were never really convinced, because the simply had so much data that surely I could get something out of it.
Fortunately there was still a range of severity of the weather events and there was a weak correspondence between the severity and failure rate, so we salvaged something from it at least, but the result could have been so much more definitive had they thought about how to 'do the stats' before embarking on the data collection exercise. | Seeking a real illustration of Fisher's quote about DoE
I was asked by a colleague to 'do the stats' on a study looking at the correlation between a certain type of weather event and failures in a type of infrastructure that are typically attributed to sim |
21,011 | What to do when the means of two samples are significantly different but the difference seems too small to matter | Let $\mu_1$ denote the mean of the first population and $\mu_2$ denote the mean of the second population. It seems that you've used a two-sample $t$-test to test whether $\mu_1=\mu_2$. The significant result implies that $\mu_1\neq\mu_2$, but the difference seems to be to small to matter for your application.
What've you encountered is the fact that statistically significant often can be something else than significant for the application. While the difference may be statistically significant it may still not be meaningful.
Bayesian testing won't solve that problem - you'll still just conclude that a difference exists.
There might however be a way out. For instance, for a one-sided hypothesis you could decide that if $\mu_1$ is $\Delta$ units greater than $\mu_2$ then that would be a meaningful difference that is large enough to matter for your application.
In that case you would test whether $\mu_1-\mu_2\leq \Delta$ instead of whether $\mu_1-\mu_2=0$. The $t$-statistic (assuming equal variances) would in that case be
$$ T=\frac{\bar{x}_1-\bar{x}_2-\Delta}{s_p\sqrt{1/n_1+1/n_2}}$$
where $s_p$ is the pooled standard deviation estimate. Under the null hypothesis, this statistic is $t$-distributed with $n_1+n_2-2$ degrees of freedom.
An easy way of carrying out this test is to subtract $\Delta$ from your observations from the first population and then carry out a regular one-sided two-sample $t$-test. | What to do when the means of two samples are significantly different but the difference seems too sm | Let $\mu_1$ denote the mean of the first population and $\mu_2$ denote the mean of the second population. It seems that you've used a two-sample $t$-test to test whether $\mu_1=\mu_2$. The significant | What to do when the means of two samples are significantly different but the difference seems too small to matter
Let $\mu_1$ denote the mean of the first population and $\mu_2$ denote the mean of the second population. It seems that you've used a two-sample $t$-test to test whether $\mu_1=\mu_2$. The significant result implies that $\mu_1\neq\mu_2$, but the difference seems to be to small to matter for your application.
What've you encountered is the fact that statistically significant often can be something else than significant for the application. While the difference may be statistically significant it may still not be meaningful.
Bayesian testing won't solve that problem - you'll still just conclude that a difference exists.
There might however be a way out. For instance, for a one-sided hypothesis you could decide that if $\mu_1$ is $\Delta$ units greater than $\mu_2$ then that would be a meaningful difference that is large enough to matter for your application.
In that case you would test whether $\mu_1-\mu_2\leq \Delta$ instead of whether $\mu_1-\mu_2=0$. The $t$-statistic (assuming equal variances) would in that case be
$$ T=\frac{\bar{x}_1-\bar{x}_2-\Delta}{s_p\sqrt{1/n_1+1/n_2}}$$
where $s_p$ is the pooled standard deviation estimate. Under the null hypothesis, this statistic is $t$-distributed with $n_1+n_2-2$ degrees of freedom.
An easy way of carrying out this test is to subtract $\Delta$ from your observations from the first population and then carry out a regular one-sided two-sample $t$-test. | What to do when the means of two samples are significantly different but the difference seems too sm
Let $\mu_1$ denote the mean of the first population and $\mu_2$ denote the mean of the second population. It seems that you've used a two-sample $t$-test to test whether $\mu_1=\mu_2$. The significant |
21,012 | What to do when the means of two samples are significantly different but the difference seems too small to matter | It is valid to compare several approaches, but not with the aim of choosing the one that favours our desires/believes.
My answer to your question is: It is possible that two distributions overlap while they have different means, which seems to be your case (but we would need to see your data and context in order to provide a more precise answer).
I am going illustrate this using a couple of approaches for comparing normal means.
1. $t$-test
Consider two simulated samples of size $70$ from a $N(10,1)$ and $N(12,1)$, then the $t$-value is approximately $10$ as in your case (See the R code below).
rm(list=ls())
# Simulated data
dat1 = rnorm(70,10,1)
dat2 = rnorm(70,12,1)
set.seed(77)
# Smoothed densities
plot(density(dat1),ylim=c(0,0.5),xlim=c(6,16))
points(density(dat2),type="l",col="red")
# Normality tests
shapiro.test(dat1)
shapiro.test(dat2)
# t test
t.test(dat1,dat2)
However the densities show a considerable overlapping. But remember that you are testing a hypothesis about the means, which in this case are clearly different but, due to the value of $\sigma$, there is an overlap of the densities.
2. Profile likelihood of $\mu$
For a definition of the Profile likelihood and likelihood please see 1 and 2.
In this case, the profile likelihood of $\mu$ of a sample of size $n$ and sample mean $\bar{x}$ is simply $R_p(\mu)=\exp\left[-n(\bar{x}-\mu)^2\right]$.
For the simulated data, these can be calculated in R as follows
# Profile likelihood of mu
Rp1 = function(mu){
n = length(dat1)
md = mean(dat1)
return( exp(-n*(md-mu)^2) )
}
Rp2 = function(mu){
n = length(dat2)
md = mean(dat2)
return( exp(-n*(md-mu)^2) )
}
vec=seq(9.5,12.5,0.001)
rvec1 = lapply(vec,Rp1)
rvec2 = lapply(vec,Rp2)
# Plot of the profile likelihood of mu1 and mu2
plot(vec,rvec1,type="l")
points(vec,rvec2,type="l",col="red")
As you can see, the likelihood intervals of $\mu_1$ and $\mu_2$ do not overlap at any reasonable level.
3. Posterior of $\mu$ using Jeffreys prior
Consider the Jeffreys prior of $(\mu,\sigma)$
$$\pi(\mu,\sigma)\propto \dfrac{1}{\sigma^2}$$
The posterior of $\mu$ for each data set can be calculated as follows
# Posterior of mu
library(mcmc)
lp1 = function(par){
n=length(dat1)
if(par[2]>0) return(sum(log(dnorm((dat1-par[1])/par[2])))- (n+2)*log(par[2]))
else return(-Inf)
}
lp2 = function(par){
n=length(dat2)
if(par[2]>0) return(sum(log(dnorm((dat2-par[1])/par[2])))- (n+2)*log(par[2]))
else return(-Inf)
}
NMH = 35000
mup1 = metrop(lp1, scale = 0.25, initial = c(10,1), nbatch = NMH)$batch[,1][seq(5000,NMH,25)]
mup2 = metrop(lp2, scale = 0.25, initial = c(12,1), nbatch = NMH)$batch[,1][seq(5000,NMH,25)]
# Smoothed posterior densities
plot(density(mup1),ylim=c(0,4),xlim=c(9,13))
points(density(mup2),type="l",col="red")
Again, the credibility intervals for the means do not overlap at any reasonable level.
In conclusion, you can see how all these approaches indicate a significant difference of means (which is the main interest), despite the overlapping of the distributions.
$\star$ A different comparison approach
Judging by your concerns about the overlapping of the densities, another quantity of interest might be ${\mathbb P}(X<Y)$, the probability that the first random variable is smaller than the second variable. This quantity can be estimated nonparametrically as in this answer. Note that there are no distributional assumptions here. For the simulated data, this estimator is $0.8823825$, showing some overlap in this sense, while the means are significantly different. Please, have a look to the R code shown below.
# Optimal bandwidth
h = function(x){
n = length(x)
return((4*sqrt(var(x))^5/(3*n))^(1/5))
}
# Kernel estimators of the density and the distribution
kg = function(x,data){
hb = h(data)
k = r = length(x)
for(i in 1:k) r[i] = mean(dnorm((x[i]-data)/hb))/hb
return(r )
}
KG = function(x,data){
hb = h(data)
k = r = length(x)
for(i in 1:k) r[i] = mean(pnorm((x[i]-data)/hb))
return(r )
}
# Baklizi and Eidous (2006) estimator
nonpest = function(dat1B,dat2B){
return( as.numeric(integrate(function(x) KG(x,dat1B)*kg(x,dat2B),-Inf,Inf)$value))
}
nonpest(dat1,dat2)
I hope this helps. | What to do when the means of two samples are significantly different but the difference seems too sm | It is valid to compare several approaches, but not with the aim of choosing the one that favours our desires/believes.
My answer to your question is: It is possible that two distributions overlap whil | What to do when the means of two samples are significantly different but the difference seems too small to matter
It is valid to compare several approaches, but not with the aim of choosing the one that favours our desires/believes.
My answer to your question is: It is possible that two distributions overlap while they have different means, which seems to be your case (but we would need to see your data and context in order to provide a more precise answer).
I am going illustrate this using a couple of approaches for comparing normal means.
1. $t$-test
Consider two simulated samples of size $70$ from a $N(10,1)$ and $N(12,1)$, then the $t$-value is approximately $10$ as in your case (See the R code below).
rm(list=ls())
# Simulated data
dat1 = rnorm(70,10,1)
dat2 = rnorm(70,12,1)
set.seed(77)
# Smoothed densities
plot(density(dat1),ylim=c(0,0.5),xlim=c(6,16))
points(density(dat2),type="l",col="red")
# Normality tests
shapiro.test(dat1)
shapiro.test(dat2)
# t test
t.test(dat1,dat2)
However the densities show a considerable overlapping. But remember that you are testing a hypothesis about the means, which in this case are clearly different but, due to the value of $\sigma$, there is an overlap of the densities.
2. Profile likelihood of $\mu$
For a definition of the Profile likelihood and likelihood please see 1 and 2.
In this case, the profile likelihood of $\mu$ of a sample of size $n$ and sample mean $\bar{x}$ is simply $R_p(\mu)=\exp\left[-n(\bar{x}-\mu)^2\right]$.
For the simulated data, these can be calculated in R as follows
# Profile likelihood of mu
Rp1 = function(mu){
n = length(dat1)
md = mean(dat1)
return( exp(-n*(md-mu)^2) )
}
Rp2 = function(mu){
n = length(dat2)
md = mean(dat2)
return( exp(-n*(md-mu)^2) )
}
vec=seq(9.5,12.5,0.001)
rvec1 = lapply(vec,Rp1)
rvec2 = lapply(vec,Rp2)
# Plot of the profile likelihood of mu1 and mu2
plot(vec,rvec1,type="l")
points(vec,rvec2,type="l",col="red")
As you can see, the likelihood intervals of $\mu_1$ and $\mu_2$ do not overlap at any reasonable level.
3. Posterior of $\mu$ using Jeffreys prior
Consider the Jeffreys prior of $(\mu,\sigma)$
$$\pi(\mu,\sigma)\propto \dfrac{1}{\sigma^2}$$
The posterior of $\mu$ for each data set can be calculated as follows
# Posterior of mu
library(mcmc)
lp1 = function(par){
n=length(dat1)
if(par[2]>0) return(sum(log(dnorm((dat1-par[1])/par[2])))- (n+2)*log(par[2]))
else return(-Inf)
}
lp2 = function(par){
n=length(dat2)
if(par[2]>0) return(sum(log(dnorm((dat2-par[1])/par[2])))- (n+2)*log(par[2]))
else return(-Inf)
}
NMH = 35000
mup1 = metrop(lp1, scale = 0.25, initial = c(10,1), nbatch = NMH)$batch[,1][seq(5000,NMH,25)]
mup2 = metrop(lp2, scale = 0.25, initial = c(12,1), nbatch = NMH)$batch[,1][seq(5000,NMH,25)]
# Smoothed posterior densities
plot(density(mup1),ylim=c(0,4),xlim=c(9,13))
points(density(mup2),type="l",col="red")
Again, the credibility intervals for the means do not overlap at any reasonable level.
In conclusion, you can see how all these approaches indicate a significant difference of means (which is the main interest), despite the overlapping of the distributions.
$\star$ A different comparison approach
Judging by your concerns about the overlapping of the densities, another quantity of interest might be ${\mathbb P}(X<Y)$, the probability that the first random variable is smaller than the second variable. This quantity can be estimated nonparametrically as in this answer. Note that there are no distributional assumptions here. For the simulated data, this estimator is $0.8823825$, showing some overlap in this sense, while the means are significantly different. Please, have a look to the R code shown below.
# Optimal bandwidth
h = function(x){
n = length(x)
return((4*sqrt(var(x))^5/(3*n))^(1/5))
}
# Kernel estimators of the density and the distribution
kg = function(x,data){
hb = h(data)
k = r = length(x)
for(i in 1:k) r[i] = mean(dnorm((x[i]-data)/hb))/hb
return(r )
}
KG = function(x,data){
hb = h(data)
k = r = length(x)
for(i in 1:k) r[i] = mean(pnorm((x[i]-data)/hb))
return(r )
}
# Baklizi and Eidous (2006) estimator
nonpest = function(dat1B,dat2B){
return( as.numeric(integrate(function(x) KG(x,dat1B)*kg(x,dat2B),-Inf,Inf)$value))
}
nonpest(dat1,dat2)
I hope this helps. | What to do when the means of two samples are significantly different but the difference seems too sm
It is valid to compare several approaches, but not with the aim of choosing the one that favours our desires/believes.
My answer to your question is: It is possible that two distributions overlap whil |
21,013 | What to do when the means of two samples are significantly different but the difference seems too small to matter | Answering the Right Question
ok, the means are different but does that really matter as the distributions share a significant overlap?
Any test that asks whether group means are different will, when it works right, tell you whether means are different. It will not tell you that distributions of the data itself are different, since that is a different question. That question certainly depends on the whether the means are different but also on many other things that might be (incompletely) summarised as variance, skew, and kurtosis.
You correctly note that certainty about where the means are depends on the amount of data you have to estimate them, so having more data will allow you spot mean differences in more nearly overlapping distributions. But you wonder whether
such as small p-value is really representative of the data
Indeed it is not, at least not directly. And this is by design. It is representative (approximately speaking) of the certainty you can have that a particular pair of sample statistics of the data (not the data itself) are different.
If you wanted to represent the data itself in a more formal way than simply showing the histograms and testing moments of it, then perhaps a pair of density plots might be helpful. It rather depends really on the argument you are using the test to make.
A Bayesian Version
In all these respects, Bayesian difference 'tests' and T-tests will behave the same way because they are trying to do the same thing. The only advantages I can think of for using a Bayesian approach are: a) that it will be easy to do the test allowing possibly different variances for each group, and b) that it will focus on estimating the probable size of the difference in means rather than finding a p-value for some test of difference. That said, these advantages are pretty minor: e.g. in b) you could always report a confidence interval for the difference.
The quote marks above over 'tests' are deliberate. It is certainly possible to do Bayesian hypothesis testing, and people do. However, I would suggest that the comparative advantage of the approach is in the focus on building a plausible model of the data and communicating its important aspects with appropriate levels of uncertainty. | What to do when the means of two samples are significantly different but the difference seems too sm | Answering the Right Question
ok, the means are different but does that really matter as the distributions share a significant overlap?
Any test that asks whether group means are different will, when | What to do when the means of two samples are significantly different but the difference seems too small to matter
Answering the Right Question
ok, the means are different but does that really matter as the distributions share a significant overlap?
Any test that asks whether group means are different will, when it works right, tell you whether means are different. It will not tell you that distributions of the data itself are different, since that is a different question. That question certainly depends on the whether the means are different but also on many other things that might be (incompletely) summarised as variance, skew, and kurtosis.
You correctly note that certainty about where the means are depends on the amount of data you have to estimate them, so having more data will allow you spot mean differences in more nearly overlapping distributions. But you wonder whether
such as small p-value is really representative of the data
Indeed it is not, at least not directly. And this is by design. It is representative (approximately speaking) of the certainty you can have that a particular pair of sample statistics of the data (not the data itself) are different.
If you wanted to represent the data itself in a more formal way than simply showing the histograms and testing moments of it, then perhaps a pair of density plots might be helpful. It rather depends really on the argument you are using the test to make.
A Bayesian Version
In all these respects, Bayesian difference 'tests' and T-tests will behave the same way because they are trying to do the same thing. The only advantages I can think of for using a Bayesian approach are: a) that it will be easy to do the test allowing possibly different variances for each group, and b) that it will focus on estimating the probable size of the difference in means rather than finding a p-value for some test of difference. That said, these advantages are pretty minor: e.g. in b) you could always report a confidence interval for the difference.
The quote marks above over 'tests' are deliberate. It is certainly possible to do Bayesian hypothesis testing, and people do. However, I would suggest that the comparative advantage of the approach is in the focus on building a plausible model of the data and communicating its important aspects with appropriate levels of uncertainty. | What to do when the means of two samples are significantly different but the difference seems too sm
Answering the Right Question
ok, the means are different but does that really matter as the distributions share a significant overlap?
Any test that asks whether group means are different will, when |
21,014 | What to do when the means of two samples are significantly different but the difference seems too small to matter | First of all, this is not a problem to pin on frequentist testing. The problem lies in the null hypothesis that the means are exactly equal. Therefore if the populations differ in means by any small amount and the sample size is large enough the chance to reject this null hypothesis is very high. Therefore the p-value for your test turned out to be very small. The culprit is the choice of the null hypothesis. Pick d>0 and take the null hypothesis to be that the means differ by less than d in absolute value. You pick d so that the real difference has to be satisfactorily large to reject. Your problem goes away. Bayesian testing does not solve your problem if you insist on a null hypothesis of exact equality of means. | What to do when the means of two samples are significantly different but the difference seems too sm | First of all, this is not a problem to pin on frequentist testing. The problem lies in the null hypothesis that the means are exactly equal. Therefore if the populations differ in means by any small | What to do when the means of two samples are significantly different but the difference seems too small to matter
First of all, this is not a problem to pin on frequentist testing. The problem lies in the null hypothesis that the means are exactly equal. Therefore if the populations differ in means by any small amount and the sample size is large enough the chance to reject this null hypothesis is very high. Therefore the p-value for your test turned out to be very small. The culprit is the choice of the null hypothesis. Pick d>0 and take the null hypothesis to be that the means differ by less than d in absolute value. You pick d so that the real difference has to be satisfactorily large to reject. Your problem goes away. Bayesian testing does not solve your problem if you insist on a null hypothesis of exact equality of means. | What to do when the means of two samples are significantly different but the difference seems too sm
First of all, this is not a problem to pin on frequentist testing. The problem lies in the null hypothesis that the means are exactly equal. Therefore if the populations differ in means by any small |
21,015 | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?) | Or does every simple tool have to fall into exactly one of those two categories?
No. Simple (and not so simple tools) can be studied from many different viewpoints. The likelihood function by itself is a cornerstone in both Bayesian and frequentist statistics, and can be studied from both points of view! If you want, you can study the MLE as an approximate Bayes solution, or you can study its properties with asymptotic theory, in a frequentist way. | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy | Or does every simple tool have to fall into exactly one of those two categories?
No. Simple (and not so simple tools) can be studied from many different viewpoints. The likelihood function by itself | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?)
Or does every simple tool have to fall into exactly one of those two categories?
No. Simple (and not so simple tools) can be studied from many different viewpoints. The likelihood function by itself is a cornerstone in both Bayesian and frequentist statistics, and can be studied from both points of view! If you want, you can study the MLE as an approximate Bayes solution, or you can study its properties with asymptotic theory, in a frequentist way. | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy
Or does every simple tool have to fall into exactly one of those two categories?
No. Simple (and not so simple tools) can be studied from many different viewpoints. The likelihood function by itself |
21,016 | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?) | When you're doing Maximum Likelihood Estimation you consider the value of the estimate and the sampling properties of the estimator in order to establish the uncertainty of your estimate expressed as a confidence interval. I think this is important regarding your question because a confidence interval will in general depend on sample points that were not observed, which is seem by some as an essentially unbayesian property.
P.S. This is related to the more general fact that Maximum Likelihood Estimation (Point + Interval) fails to satisfy the Likelihood Principle, while a full ("Savage style") Bayesian analysis does. | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy | When you're doing Maximum Likelihood Estimation you consider the value of the estimate and the sampling properties of the estimator in order to establish the uncertainty of your estimate expressed as | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?)
When you're doing Maximum Likelihood Estimation you consider the value of the estimate and the sampling properties of the estimator in order to establish the uncertainty of your estimate expressed as a confidence interval. I think this is important regarding your question because a confidence interval will in general depend on sample points that were not observed, which is seem by some as an essentially unbayesian property.
P.S. This is related to the more general fact that Maximum Likelihood Estimation (Point + Interval) fails to satisfy the Likelihood Principle, while a full ("Savage style") Bayesian analysis does. | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy
When you're doing Maximum Likelihood Estimation you consider the value of the estimate and the sampling properties of the estimator in order to establish the uncertainty of your estimate expressed as |
21,017 | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?) | Locked. Comments on this answer have been disabled, but it is still accepting other interactions. Learn more.
The likelihood function is a function that involves the data and the unknown parameter(s). It can be viewed as the probability density for the observed data given the value(s) of the parameter(s). The parameters are fixed. So by itself the likelihood is a frequentist notion. Maximizing the likelihood is just to find the specific value(s) of the parameter(s) that makes the likelihood take on its maximum value. So maximum likelihood estimation is a frequentist method based solely on the data and the form of the model that is assumed to generate it. Bayesian estimation only enters in when a prior distribution is placed on the parameter(s) and Bayes' formula is used to obtain an aposteriori distribution for the parameter(s) by combining the prior with the likelihood. | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy | Locked. Comments on this answer have been disabled, but it is still accepting other interactions. Learn more.
The likelihood funct | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?)
Locked. Comments on this answer have been disabled, but it is still accepting other interactions. Learn more.
The likelihood function is a function that involves the data and the unknown parameter(s). It can be viewed as the probability density for the observed data given the value(s) of the parameter(s). The parameters are fixed. So by itself the likelihood is a frequentist notion. Maximizing the likelihood is just to find the specific value(s) of the parameter(s) that makes the likelihood take on its maximum value. So maximum likelihood estimation is a frequentist method based solely on the data and the form of the model that is assumed to generate it. Bayesian estimation only enters in when a prior distribution is placed on the parameter(s) and Bayes' formula is used to obtain an aposteriori distribution for the parameter(s) by combining the prior with the likelihood. | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy
Locked. Comments on this answer have been disabled, but it is still accepting other interactions. Learn more.
The likelihood funct |
21,018 | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?) | Assuming that by "Bayesian" you refer to subjective Bayes (a.k.a. epistemic Bayes, De-Finetti Bayes) and not the current empirical Bayes meaning-- it is far from trivial.
On the one hand, you infer based on your data alone. There are no subjective beliefs at hand. This seems frequentist enough...
But the critique, expressed even at Fisher himself (a strict non (subjective) Bayesian), is that in the choice of the sampling distribution of the data subjectivity has crawled in. A parameter is only defined given our beliefs of the data generating process.
In conclusion-- I believe the MLE is typically considered a frequentist concept, albeit it is a mere matter of how you define "frequentist" and "Bayesian". | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy | Assuming that by "Bayesian" you refer to subjective Bayes (a.k.a. epistemic Bayes, De-Finetti Bayes) and not the current empirical Bayes meaning-- it is far from trivial.
On the one hand, you infer b | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?)
Assuming that by "Bayesian" you refer to subjective Bayes (a.k.a. epistemic Bayes, De-Finetti Bayes) and not the current empirical Bayes meaning-- it is far from trivial.
On the one hand, you infer based on your data alone. There are no subjective beliefs at hand. This seems frequentist enough...
But the critique, expressed even at Fisher himself (a strict non (subjective) Bayesian), is that in the choice of the sampling distribution of the data subjectivity has crawled in. A parameter is only defined given our beliefs of the data generating process.
In conclusion-- I believe the MLE is typically considered a frequentist concept, albeit it is a mere matter of how you define "frequentist" and "Bayesian". | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy
Assuming that by "Bayesian" you refer to subjective Bayes (a.k.a. epistemic Bayes, De-Finetti Bayes) and not the current empirical Bayes meaning-- it is far from trivial.
On the one hand, you infer b |
21,019 | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?) | (answering own question)
An estimator is a function that takes some data and produces a number (or range of numbers). An estimator, by itself, isn't really 'Bayesian' or 'frequentist' - you can think of it as a black box where numbers go in and numbers come out. You can present the same estimator to a frequentist and to a Bayesian and they will have different things to say about the estimator.
(I'm not happy with my simplistic distinction between frequentist and Bayesian - there are other issues to consider. But for simplicity, let's pretend that are just two well-defined philosophical camps.)
You cannot tell whether a researcher is frequentist of Bayesian just by which estimator they choose. The important thing is to listen to what analyses they do on the estimator and what reasons they give for choosing that estimator.
Imagine you create a piece of software that finds that value of $\theta$ which maximizes $\mathrm{P}(\mathbf{x}|\theta)$. You present this software to a frequentist and ask them to make a presentation about it. They will probably proceed by analyzing the sampling distribution and testing whether the estimator is biased. And maybe they'll check if it is consistent. They will either approve of, or disapprove of, the estimator based on properties such as this. These are the types of properties that a frequentist is interested in.
When the same software is presented to a Bayesian, the Bayesian might well be happy with much of the frequentist's analysis. Yes, all other things being equal, bias isn't good and consistency is good. But the Bayesian will be more interested in other things. The Bayesian will want to see if the estimator takes the shape of some function of posterior distribution; and if so, what prior was used? If the estimator is based on a posterior, the Bayesian will wonder whether the prior is good one. If they are happy with the prior, and if the estimator is reporting the mode of the posterior (as opposed to, say, the mean of the posterior) then they are happy to apply this interpretation to the estimate: "This estimate is the point estimate which has the best chance of being correct."
I often hear is said that frequentists and Bayesian "interpret" things differently, even when the numbers involved are the same. This can be a little confusing, and I don't think it's really true. Their interpretations don't conflict with each other; they simply make statements about different aspects of the system. Let's put aside point estimates for the moment and consider intervals instead. In particular, there are frequentist confidence intervals and Bayesian credible intervals. They will usually give different answers. But in certain models, with certain priors, the two types of interval will give the same numerical answer.
When the intervals are the same, how can we interpret them differently? A frequentist will say of an interval estimator:
Before I see the data or the corresponding interval, I can say there is at least a 95% probability that the true parameter will be contained within the interval.
whereas a Bayesian will say of an interval estimator:
After I see the data or the corresponding interval, I can say there is at least a 95% probability that the true parameter is contained within the interval.
These two statements are identical, apart from the words 'Before' and 'After'. The Bayesian will understand and agree with the former statement and also will acknowledge that its truth is independent of any prior, thereby making it 'stronger'. But speaking as a Bayesian myself, I would worry that the former statement mightn't be very useful. The frequentist won't like the latter statement, but I don't understand it well enough to give a fair description of the frequentist's objections.
After seeing the data, will the frequentist still be optimistic that the true value is contained within the interval? Maybe not. This is a bit counterintuitive but it is important for truly understanding confidence intervals and other concepts based on the sampling distribution. You might presume that the frequentist would still say "Given the data, I still think there is a 95% probability that the true value is in this interval". A frequentist would not only question whether that statement is true, they would also question whether it is meaningful to attribute probabilities in this way. If you have more questions on this, don't ask me, this issue is too much for me!
The Bayesian is happy to make that statement: "Conditioning on the data I have just seen, the probability is 95% that the true value is in this range."
I must admit I'm a little confused on one final point. I understand, and agree with, the statement made by the frequentist before the data is seen. I understand, and agree with, with the statement made by the Bayesian after the data is seen. However, I'm not so sure what the frequentist will say after the data is seen; will their beliefs about the world have changed? I'm not in a position to understand the frequentist philosophy here. | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy | (answering own question)
An estimator is a function that takes some data and produces a number (or range of numbers). An estimator, by itself, isn't really 'Bayesian' or 'frequentist' - you can think | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?)
(answering own question)
An estimator is a function that takes some data and produces a number (or range of numbers). An estimator, by itself, isn't really 'Bayesian' or 'frequentist' - you can think of it as a black box where numbers go in and numbers come out. You can present the same estimator to a frequentist and to a Bayesian and they will have different things to say about the estimator.
(I'm not happy with my simplistic distinction between frequentist and Bayesian - there are other issues to consider. But for simplicity, let's pretend that are just two well-defined philosophical camps.)
You cannot tell whether a researcher is frequentist of Bayesian just by which estimator they choose. The important thing is to listen to what analyses they do on the estimator and what reasons they give for choosing that estimator.
Imagine you create a piece of software that finds that value of $\theta$ which maximizes $\mathrm{P}(\mathbf{x}|\theta)$. You present this software to a frequentist and ask them to make a presentation about it. They will probably proceed by analyzing the sampling distribution and testing whether the estimator is biased. And maybe they'll check if it is consistent. They will either approve of, or disapprove of, the estimator based on properties such as this. These are the types of properties that a frequentist is interested in.
When the same software is presented to a Bayesian, the Bayesian might well be happy with much of the frequentist's analysis. Yes, all other things being equal, bias isn't good and consistency is good. But the Bayesian will be more interested in other things. The Bayesian will want to see if the estimator takes the shape of some function of posterior distribution; and if so, what prior was used? If the estimator is based on a posterior, the Bayesian will wonder whether the prior is good one. If they are happy with the prior, and if the estimator is reporting the mode of the posterior (as opposed to, say, the mean of the posterior) then they are happy to apply this interpretation to the estimate: "This estimate is the point estimate which has the best chance of being correct."
I often hear is said that frequentists and Bayesian "interpret" things differently, even when the numbers involved are the same. This can be a little confusing, and I don't think it's really true. Their interpretations don't conflict with each other; they simply make statements about different aspects of the system. Let's put aside point estimates for the moment and consider intervals instead. In particular, there are frequentist confidence intervals and Bayesian credible intervals. They will usually give different answers. But in certain models, with certain priors, the two types of interval will give the same numerical answer.
When the intervals are the same, how can we interpret them differently? A frequentist will say of an interval estimator:
Before I see the data or the corresponding interval, I can say there is at least a 95% probability that the true parameter will be contained within the interval.
whereas a Bayesian will say of an interval estimator:
After I see the data or the corresponding interval, I can say there is at least a 95% probability that the true parameter is contained within the interval.
These two statements are identical, apart from the words 'Before' and 'After'. The Bayesian will understand and agree with the former statement and also will acknowledge that its truth is independent of any prior, thereby making it 'stronger'. But speaking as a Bayesian myself, I would worry that the former statement mightn't be very useful. The frequentist won't like the latter statement, but I don't understand it well enough to give a fair description of the frequentist's objections.
After seeing the data, will the frequentist still be optimistic that the true value is contained within the interval? Maybe not. This is a bit counterintuitive but it is important for truly understanding confidence intervals and other concepts based on the sampling distribution. You might presume that the frequentist would still say "Given the data, I still think there is a 95% probability that the true value is in this interval". A frequentist would not only question whether that statement is true, they would also question whether it is meaningful to attribute probabilities in this way. If you have more questions on this, don't ask me, this issue is too much for me!
The Bayesian is happy to make that statement: "Conditioning on the data I have just seen, the probability is 95% that the true value is in this range."
I must admit I'm a little confused on one final point. I understand, and agree with, the statement made by the frequentist before the data is seen. I understand, and agree with, with the statement made by the Bayesian after the data is seen. However, I'm not so sure what the frequentist will say after the data is seen; will their beliefs about the world have changed? I'm not in a position to understand the frequentist philosophy here. | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy
(answering own question)
An estimator is a function that takes some data and produces a number (or range of numbers). An estimator, by itself, isn't really 'Bayesian' or 'frequentist' - you can think |
21,020 | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?) | The point estimator that maximises $P(x|\theta)$ is the MLE. This is a commonly used point estimator in frequentist statistics, but it is less commonly used in Bayesian statistics. In Bayesian statistics it is usual to use a point estimator which is either the posterior expected value, or the value minimising the expected-loss (risk) in a decision problem. There are certainly some cases where the Bayesian estimator will correspond with the MLE (e.g., if we have a uniform prior, or in some special cases of minimising loss), but this is not a common occurrence. Hence, as a general rule, the MLE is usually a frequentist estimator. | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy | The point estimator that maximises $P(x|\theta)$ is the MLE. This is a commonly used point estimator in frequentist statistics, but it is less commonly used in Bayesian statistics. In Bayesian stati | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy? (frequentist or Bayesian or something else?)
The point estimator that maximises $P(x|\theta)$ is the MLE. This is a commonly used point estimator in frequentist statistics, but it is less commonly used in Bayesian statistics. In Bayesian statistics it is usual to use a point estimator which is either the posterior expected value, or the value minimising the expected-loss (risk) in a decision problem. There are certainly some cases where the Bayesian estimator will correspond with the MLE (e.g., if we have a uniform prior, or in some special cases of minimising loss), but this is not a common occurrence. Hence, as a general rule, the MLE is usually a frequentist estimator. | If you use a point estimate that maximizes $P(x | \theta)$, what does that say about your philosophy
The point estimator that maximises $P(x|\theta)$ is the MLE. This is a commonly used point estimator in frequentist statistics, but it is less commonly used in Bayesian statistics. In Bayesian stati |
21,021 | Why is it claimed that a sample is often more accurate than a census? | A sample could be more accurate than a (attempted) census if the fact of the exercise being a census increases the bias from non-sampling error. This could come about, for example, if the census generates an adverse political campaign advocating non-response (something less likely to happen to a sample). Unless this happens, I can't see why a sample would be expected to have less nonsampling error than a census; and by definition it will have more sampling error. So apart from quite unusual circumstances I would say a census is going to be more accurate than a sample.
Consider a common source of nonsampling error - systematic non-response eg by a particular socio demographic group. If people from group X are likely to refuse the census, they are just as likely to refuse the sample. Even with poststratification sampling to weight up the responses of those people from group X who you do persuade to answer your questions, you still have a problem because those might be the very segment of X that are pro-surveys. There is no real way around this problem other than to be as careful as possible with your design of instrument and delivery method.
In passing, this does draw attention to one possible issue that could make an attempted census less accurate than a sample. Samples routinely have poststratification weighting to population, which mitigates bias problems from issues such as that in my paragraph above. An attempted census that doesn't get 100% return is just a large sample, and should in principle be subject to the same processing; but because it is seen as a "census" (rather than an attempted census) this may be neglected. So that census might be less accurate than the appropriately weighted sample. But in this case the problem is the analytical processing technique (or omission of), not something intrinsic to it being an attempted census.
Efficient is another matter - as Michelle says, a well conducted sample will be more efficient than a census, and it may well have sufficient accuracy for practical purposes. | Why is it claimed that a sample is often more accurate than a census? | A sample could be more accurate than a (attempted) census if the fact of the exercise being a census increases the bias from non-sampling error. This could come about, for example, if the census gene | Why is it claimed that a sample is often more accurate than a census?
A sample could be more accurate than a (attempted) census if the fact of the exercise being a census increases the bias from non-sampling error. This could come about, for example, if the census generates an adverse political campaign advocating non-response (something less likely to happen to a sample). Unless this happens, I can't see why a sample would be expected to have less nonsampling error than a census; and by definition it will have more sampling error. So apart from quite unusual circumstances I would say a census is going to be more accurate than a sample.
Consider a common source of nonsampling error - systematic non-response eg by a particular socio demographic group. If people from group X are likely to refuse the census, they are just as likely to refuse the sample. Even with poststratification sampling to weight up the responses of those people from group X who you do persuade to answer your questions, you still have a problem because those might be the very segment of X that are pro-surveys. There is no real way around this problem other than to be as careful as possible with your design of instrument and delivery method.
In passing, this does draw attention to one possible issue that could make an attempted census less accurate than a sample. Samples routinely have poststratification weighting to population, which mitigates bias problems from issues such as that in my paragraph above. An attempted census that doesn't get 100% return is just a large sample, and should in principle be subject to the same processing; but because it is seen as a "census" (rather than an attempted census) this may be neglected. So that census might be less accurate than the appropriately weighted sample. But in this case the problem is the analytical processing technique (or omission of), not something intrinsic to it being an attempted census.
Efficient is another matter - as Michelle says, a well conducted sample will be more efficient than a census, and it may well have sufficient accuracy for practical purposes. | Why is it claimed that a sample is often more accurate than a census?
A sample could be more accurate than a (attempted) census if the fact of the exercise being a census increases the bias from non-sampling error. This could come about, for example, if the census gene |
21,022 | Why is it claimed that a sample is often more accurate than a census? | I think there are practical situations where a sample can be more accurate. For example, we did a study in a city in a developing country with a lot of people living in unregistered places and people constantly coming and going and being shy about responding. Trying to actually do a census would have required a Herculean effort, and given our resources it would have to have been done over the course of a couple months, when people would be coming and going. With a sample, we could spend more time making sure we got as close to full response as possible -- because we could explain what we were doing -- and we could do it over a much shorter time frame which would get rid of the problem of people entering and leaving the city.
SO I think the answer depends more on the logistics of what you are doing, and the various sources of non-sampling error.
In fact, another source was that our survey was complex and we had to train the interviewers, and finding and funding enough trainable interviewers in that country would be very difficult. | Why is it claimed that a sample is often more accurate than a census? | I think there are practical situations where a sample can be more accurate. For example, we did a study in a city in a developing country with a lot of people living in unregistered places and people | Why is it claimed that a sample is often more accurate than a census?
I think there are practical situations where a sample can be more accurate. For example, we did a study in a city in a developing country with a lot of people living in unregistered places and people constantly coming and going and being shy about responding. Trying to actually do a census would have required a Herculean effort, and given our resources it would have to have been done over the course of a couple months, when people would be coming and going. With a sample, we could spend more time making sure we got as close to full response as possible -- because we could explain what we were doing -- and we could do it over a much shorter time frame which would get rid of the problem of people entering and leaving the city.
SO I think the answer depends more on the logistics of what you are doing, and the various sources of non-sampling error.
In fact, another source was that our survey was complex and we had to train the interviewers, and finding and funding enough trainable interviewers in that country would be very difficult. | Why is it claimed that a sample is often more accurate than a census?
I think there are practical situations where a sample can be more accurate. For example, we did a study in a city in a developing country with a lot of people living in unregistered places and people |
21,023 | Why is it claimed that a sample is often more accurate than a census? | When sampling humans for surveys, samples often suffer from both sampling error (we're only getting estimates) and nonsampling error (e.g. people refusing to answer one's survey, not sampling to the sample frame one needs due to practical considerations such as cost, or inability to identify the population accurately in order to draw the sample). Done correctly, with high response rates, a sample is more efficient than a census. But it is incorrect to assume that no samples contain nonsampling error. | Why is it claimed that a sample is often more accurate than a census? | When sampling humans for surveys, samples often suffer from both sampling error (we're only getting estimates) and nonsampling error (e.g. people refusing to answer one's survey, not sampling to the s | Why is it claimed that a sample is often more accurate than a census?
When sampling humans for surveys, samples often suffer from both sampling error (we're only getting estimates) and nonsampling error (e.g. people refusing to answer one's survey, not sampling to the sample frame one needs due to practical considerations such as cost, or inability to identify the population accurately in order to draw the sample). Done correctly, with high response rates, a sample is more efficient than a census. But it is incorrect to assume that no samples contain nonsampling error. | Why is it claimed that a sample is often more accurate than a census?
When sampling humans for surveys, samples often suffer from both sampling error (we're only getting estimates) and nonsampling error (e.g. people refusing to answer one's survey, not sampling to the s |
21,024 | Why is it claimed that a sample is often more accurate than a census? | I think they key is in Peter Ellis' answer: "attempted". When you do sampling properly, you sweat the details of non-response, figure out strata and seek them out, etc. When you decide to do a census, it's easy to ignore those issues, since you're getting "everyone". Problem is, you're probably not getting everyone, but you're not thinking about who you're not actually getting.
There are also statistical issues with extremely large samples (as a proportion of the sampled population). I'm not sophisticated enough to understand them, but at a minimum you have problems with variance calculations. (Packages like R's survey compensate for such things in large subpopulations of a survey, and that's where I first learned about this.)
As a secondary issue, if non-sample error includes issues due to quality control at various steps in the process, having enormously more data (census) would make it much harder to have the level of quality control that you would have (with the same resources) on a smaller set of data (sample).
Imagine if you had the resources (financial and personnel) that the US Census Bureau used for a census, but you were only doing a survey of 1,000 random adults. I think you'd have much better quality control and much better analysis of the issues involved and of the data itself. | Why is it claimed that a sample is often more accurate than a census? | I think they key is in Peter Ellis' answer: "attempted". When you do sampling properly, you sweat the details of non-response, figure out strata and seek them out, etc. When you decide to do a census, | Why is it claimed that a sample is often more accurate than a census?
I think they key is in Peter Ellis' answer: "attempted". When you do sampling properly, you sweat the details of non-response, figure out strata and seek them out, etc. When you decide to do a census, it's easy to ignore those issues, since you're getting "everyone". Problem is, you're probably not getting everyone, but you're not thinking about who you're not actually getting.
There are also statistical issues with extremely large samples (as a proportion of the sampled population). I'm not sophisticated enough to understand them, but at a minimum you have problems with variance calculations. (Packages like R's survey compensate for such things in large subpopulations of a survey, and that's where I first learned about this.)
As a secondary issue, if non-sample error includes issues due to quality control at various steps in the process, having enormously more data (census) would make it much harder to have the level of quality control that you would have (with the same resources) on a smaller set of data (sample).
Imagine if you had the resources (financial and personnel) that the US Census Bureau used for a census, but you were only doing a survey of 1,000 random adults. I think you'd have much better quality control and much better analysis of the issues involved and of the data itself. | Why is it claimed that a sample is often more accurate than a census?
I think they key is in Peter Ellis' answer: "attempted". When you do sampling properly, you sweat the details of non-response, figure out strata and seek them out, etc. When you decide to do a census, |
21,025 | Why is it claimed that a sample is often more accurate than a census? | I thought the reason sampling can be (not is) more accurate than census actually did have one component that is attributable to the nature of a census versus a sample, and which can be attributed as the cause for a census potentially having greater bias (obviously non-sampling, by definition): in a census, the population number is generally unknown. So minimizing or controlling for non-response bias is a good deal more difficult than doing so with a sample of known size. | Why is it claimed that a sample is often more accurate than a census? | I thought the reason sampling can be (not is) more accurate than census actually did have one component that is attributable to the nature of a census versus a sample, and which can be attributed as t | Why is it claimed that a sample is often more accurate than a census?
I thought the reason sampling can be (not is) more accurate than census actually did have one component that is attributable to the nature of a census versus a sample, and which can be attributed as the cause for a census potentially having greater bias (obviously non-sampling, by definition): in a census, the population number is generally unknown. So minimizing or controlling for non-response bias is a good deal more difficult than doing so with a sample of known size. | Why is it claimed that a sample is often more accurate than a census?
I thought the reason sampling can be (not is) more accurate than census actually did have one component that is attributable to the nature of a census versus a sample, and which can be attributed as t |
21,026 | Short online videos that could assist a lecture on statistics | Link:
https://yihui.name/animation/
A big list of animation "clips" (gif's or other formats), through the use of the "animation" package (R). Including the following topics:
Topics(in each of them there are 1 or more animation, by topic)
Theory of Probability
Mathematical Statistics
Sampling Survey
Linear Models
Multivariate Statistics
Nonparametric Statistics (no videos yet)
Computational Statistics
Time Series Analysis
Data Mining, Machine Learning
Statistical Data Analysis
R Graphics
Package ''animation''
Dynamic Graphics
Through the use of the package, the animations can be reproduced in various formats (such as gif, aws, and others) | Short online videos that could assist a lecture on statistics | Link:
https://yihui.name/animation/
A big list of animation "clips" (gif's or other formats), through the use of the "animation" package (R). Including the following topics:
Topics(in each of them th | Short online videos that could assist a lecture on statistics
Link:
https://yihui.name/animation/
A big list of animation "clips" (gif's or other formats), through the use of the "animation" package (R). Including the following topics:
Topics(in each of them there are 1 or more animation, by topic)
Theory of Probability
Mathematical Statistics
Sampling Survey
Linear Models
Multivariate Statistics
Nonparametric Statistics (no videos yet)
Computational Statistics
Time Series Analysis
Data Mining, Machine Learning
Statistical Data Analysis
R Graphics
Package ''animation''
Dynamic Graphics
Through the use of the package, the animations can be reproduced in various formats (such as gif, aws, and others) | Short online videos that could assist a lecture on statistics
Link:
https://yihui.name/animation/
A big list of animation "clips" (gif's or other formats), through the use of the "animation" package (R). Including the following topics:
Topics(in each of them th |
21,027 | Short online videos that could assist a lecture on statistics | ASA Sections on: Statistical Computing Statistical Graphics has a video library:
http://stat-graphics.org/movies/
It contains a large number of interesting videos relevant to statistical computing and graphics. The videos go back as far as the 1960s. | Short online videos that could assist a lecture on statistics | ASA Sections on: Statistical Computing Statistical Graphics has a video library:
http://stat-graphics.org/movies/
It contains a large number of interesting videos relevant to statistical computing a | Short online videos that could assist a lecture on statistics
ASA Sections on: Statistical Computing Statistical Graphics has a video library:
http://stat-graphics.org/movies/
It contains a large number of interesting videos relevant to statistical computing and graphics. The videos go back as far as the 1960s. | Short online videos that could assist a lecture on statistics
ASA Sections on: Statistical Computing Statistical Graphics has a video library:
http://stat-graphics.org/movies/
It contains a large number of interesting videos relevant to statistical computing a |
21,028 | Short online videos that could assist a lecture on statistics | BIOSTATISTICS VS. LAB RESEARCH:
A funny/sad video on statistics consulting. | Short online videos that could assist a lecture on statistics | BIOSTATISTICS VS. LAB RESEARCH:
A funny/sad video on statistics consulting. | Short online videos that could assist a lecture on statistics
BIOSTATISTICS VS. LAB RESEARCH:
A funny/sad video on statistics consulting. | Short online videos that could assist a lecture on statistics
BIOSTATISTICS VS. LAB RESEARCH:
A funny/sad video on statistics consulting. |
21,029 | Short online videos that could assist a lecture on statistics | This is a great short video about trend VS the variation around it:
http://www.youtube.com/watch?v=e0vj-0imOLw | Short online videos that could assist a lecture on statistics | This is a great short video about trend VS the variation around it:
http://www.youtube.com/watch?v=e0vj-0imOLw | Short online videos that could assist a lecture on statistics
This is a great short video about trend VS the variation around it:
http://www.youtube.com/watch?v=e0vj-0imOLw | Short online videos that could assist a lecture on statistics
This is a great short video about trend VS the variation around it:
http://www.youtube.com/watch?v=e0vj-0imOLw |
21,030 | Short online videos that could assist a lecture on statistics | In the category (3) of humorous videos, check out 'Statz rappers'; general interest. (Pretty funny even to older people ;-).) | Short online videos that could assist a lecture on statistics | In the category (3) of humorous videos, check out 'Statz rappers'; general interest. (Pretty funny even to older people ;-).) | Short online videos that could assist a lecture on statistics
In the category (3) of humorous videos, check out 'Statz rappers'; general interest. (Pretty funny even to older people ;-).) | Short online videos that could assist a lecture on statistics
In the category (3) of humorous videos, check out 'Statz rappers'; general interest. (Pretty funny even to older people ;-).) |
21,031 | Short online videos that could assist a lecture on statistics | http://datajournalism.stanford.edu/ : Video on visualisation | Short online videos that could assist a lecture on statistics | http://datajournalism.stanford.edu/ : Video on visualisation | Short online videos that could assist a lecture on statistics
http://datajournalism.stanford.edu/ : Video on visualisation | Short online videos that could assist a lecture on statistics
http://datajournalism.stanford.edu/ : Video on visualisation |
21,032 | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't it be the same with i.i.d? | I think i can give a more mathematical answer then the two already provided.
You are fitting a linear model $Y = X\beta + \epsilon$. $X$ being a design matrix $\epsilon \sim N(0, \sigma_\epsilon)$.
The estimators of your model parameters $\hat\beta$ have an estimated covariance matrix $\hat{\Sigma}_\beta$, from which the standard error of $ \hat E(Y|X=x) = \hat y(x) = x^T\hat\beta$(with $X$ now being a general stand in for the independent variables) can be calculated with
$$
SE(\hat y(x)) = \sqrt{x^T\hat{\Sigma}_\beta x}
$$
This will almost never be a constant, so the width of your confidence interval will vary.
Now for the predictive interval you assumed that $(Y|X=x) \sim N(\hat y(x), \hat\sigma_\epsilon)$, but you should have included the uncertainty about $\hat y(x)$, so $(Y|X=x) \sim \text{Student_t}\left(\mu = \hat y(x), \sigma =\sqrt{\hat\sigma_\epsilon^2 + SE(\hat y(x))^2}, \nu = \text{model residual df} \right)$
Here is some R code to illustrate the point:
n <- 50
x <- rnorm(n)
y <- 0.5*x + rnorm(n, sd = 1)
m <- lm(y ~x)
x_help <- seq(-4, 4, length.out = 1000)
sum_m <- summary(m)
res.sig <-sum_m$sigma
df_conf <- as.data.frame(predict(m, newdata = data.frame(x = x_help), interval = "conf", se.fit = T))
df_pred <- as.data.frame(predict(m, newdata = data.frame(x = x_help), interval = "predict"))
plot(x_help, df_pred$upr - df_pred$lwr,
ylim = c(2*qnorm(0.975)*res.sig, max( df_pred$upr - df_pred$lwr)),
ylab = "Width of 95%-prediction intervall")
abline(v = mean(x))
# naive straight
abline(h = 2*qnorm(0.975)*res.sig)
# adding variances, but normal distribution is wrong
lines(x_help, 2*qnorm(0.975)*sqrt(res.sig^2 + df_conf$se.fit^2))
# using t-distribution
lines(x_help, 2*qt(0.975, df = n - 2)*sqrt(res.sig^2 + df_conf$se.fit^2), col = 2)
and here is the resulting figure: | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't i | I think i can give a more mathematical answer then the two already provided.
You are fitting a linear model $Y = X\beta + \epsilon$. $X$ being a design matrix $\epsilon \sim N(0, \sigma_\epsilon)$.
T | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't it be the same with i.i.d?
I think i can give a more mathematical answer then the two already provided.
You are fitting a linear model $Y = X\beta + \epsilon$. $X$ being a design matrix $\epsilon \sim N(0, \sigma_\epsilon)$.
The estimators of your model parameters $\hat\beta$ have an estimated covariance matrix $\hat{\Sigma}_\beta$, from which the standard error of $ \hat E(Y|X=x) = \hat y(x) = x^T\hat\beta$(with $X$ now being a general stand in for the independent variables) can be calculated with
$$
SE(\hat y(x)) = \sqrt{x^T\hat{\Sigma}_\beta x}
$$
This will almost never be a constant, so the width of your confidence interval will vary.
Now for the predictive interval you assumed that $(Y|X=x) \sim N(\hat y(x), \hat\sigma_\epsilon)$, but you should have included the uncertainty about $\hat y(x)$, so $(Y|X=x) \sim \text{Student_t}\left(\mu = \hat y(x), \sigma =\sqrt{\hat\sigma_\epsilon^2 + SE(\hat y(x))^2}, \nu = \text{model residual df} \right)$
Here is some R code to illustrate the point:
n <- 50
x <- rnorm(n)
y <- 0.5*x + rnorm(n, sd = 1)
m <- lm(y ~x)
x_help <- seq(-4, 4, length.out = 1000)
sum_m <- summary(m)
res.sig <-sum_m$sigma
df_conf <- as.data.frame(predict(m, newdata = data.frame(x = x_help), interval = "conf", se.fit = T))
df_pred <- as.data.frame(predict(m, newdata = data.frame(x = x_help), interval = "predict"))
plot(x_help, df_pred$upr - df_pred$lwr,
ylim = c(2*qnorm(0.975)*res.sig, max( df_pred$upr - df_pred$lwr)),
ylab = "Width of 95%-prediction intervall")
abline(v = mean(x))
# naive straight
abline(h = 2*qnorm(0.975)*res.sig)
# adding variances, but normal distribution is wrong
lines(x_help, 2*qnorm(0.975)*sqrt(res.sig^2 + df_conf$se.fit^2))
# using t-distribution
lines(x_help, 2*qt(0.975, df = n - 2)*sqrt(res.sig^2 + df_conf$se.fit^2), col = 2)
and here is the resulting figure: | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't i
I think i can give a more mathematical answer then the two already provided.
You are fitting a linear model $Y = X\beta + \epsilon$. $X$ being a design matrix $\epsilon \sim N(0, \sigma_\epsilon)$.
T |
21,033 | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't it be the same with i.i.d? | Both bands are created by uncertainty in both intercept and slope.
If the intercept were a bit higher (or lower), the entire line would move up (or down).
If the slope were a bit steeper (or shallower), the line wouldn't move much in the middle of the graph, but would move a lot at the ends.
Sum those together and you get the fourth graph you included in your question. That graph shows linear regression fitting both slope and intercept. Your first graph is nonlinear regression. Your second and third are linear regression fitting only the slope but constraining the intercept to a fixed value (origin). | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't i | Both bands are created by uncertainty in both intercept and slope.
If the intercept were a bit higher (or lower), the entire line would move up (or down).
If the slope were a bit steeper (or shallower | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't it be the same with i.i.d?
Both bands are created by uncertainty in both intercept and slope.
If the intercept were a bit higher (or lower), the entire line would move up (or down).
If the slope were a bit steeper (or shallower), the line wouldn't move much in the middle of the graph, but would move a lot at the ends.
Sum those together and you get the fourth graph you included in your question. That graph shows linear regression fitting both slope and intercept. Your first graph is nonlinear regression. Your second and third are linear regression fitting only the slope but constraining the intercept to a fixed value (origin). | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't i
Both bands are created by uncertainty in both intercept and slope.
If the intercept were a bit higher (or lower), the entire line would move up (or down).
If the slope were a bit steeper (or shallower |
21,034 | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't it be the same with i.i.d? | The intervals are informed by precision of estimates of $y|x$, so for OLS regression the estimates near the lowest and highest $x$ values are farthest away on average from all the $x$ points, and thus less precise. In the GAM case, this is somewhat ameliorated by estimation weighted towards values of $x$ local to the point being estimated, so the narrowness of the intervals follow the tightest clustering of $x$ values. | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't i | The intervals are informed by precision of estimates of $y|x$, so for OLS regression the estimates near the lowest and highest $x$ values are farthest away on average from all the $x$ points, and thus | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't it be the same with i.i.d?
The intervals are informed by precision of estimates of $y|x$, so for OLS regression the estimates near the lowest and highest $x$ values are farthest away on average from all the $x$ points, and thus less precise. In the GAM case, this is somewhat ameliorated by estimation weighted towards values of $x$ local to the point being estimated, so the narrowness of the intervals follow the tightest clustering of $x$ values. | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't i
The intervals are informed by precision of estimates of $y|x$, so for OLS regression the estimates near the lowest and highest $x$ values are farthest away on average from all the $x$ points, and thus |
21,035 | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't it be the same with i.i.d? | Lukas has already given a very comprehensive mathematical explanation. I just want to add a quick note about a misunderstanding in your question.
The linear regression model assumes IID errors on the dependent variable $y$, for a given model $\beta$, i.e. $p(y|x,\beta)$. The prediction intervals you are looking at are most likely representative of something like the posterior predictive distribution, which provides a distribution of possible unobserved values conditional on the observed values. In other words, given some training data $(X_t,Y_t)$, the posterior predictive is the distribution of new observations, given the training data, marginalised over all possible models: $$p(y|x,X_t,Y_t) = \int_{\beta} p(y|x,\beta)\,p(\beta|X_t,Y_t)\,d\beta.$$ So, the reason the intervals are wider in some places than others is not due to the observation error (which is constant, according to the IID assumption) but rather to the larger uncertainty about the position of the regression line in those regions. | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't i | Lukas has already given a very comprehensive mathematical explanation. I just want to add a quick note about a misunderstanding in your question.
The linear regression model assumes IID errors on the | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't it be the same with i.i.d?
Lukas has already given a very comprehensive mathematical explanation. I just want to add a quick note about a misunderstanding in your question.
The linear regression model assumes IID errors on the dependent variable $y$, for a given model $\beta$, i.e. $p(y|x,\beta)$. The prediction intervals you are looking at are most likely representative of something like the posterior predictive distribution, which provides a distribution of possible unobserved values conditional on the observed values. In other words, given some training data $(X_t,Y_t)$, the posterior predictive is the distribution of new observations, given the training data, marginalised over all possible models: $$p(y|x,X_t,Y_t) = \int_{\beta} p(y|x,\beta)\,p(\beta|X_t,Y_t)\,d\beta.$$ So, the reason the intervals are wider in some places than others is not due to the observation error (which is constant, according to the IID assumption) but rather to the larger uncertainty about the position of the regression line in those regions. | Why do the widths of confidence & prediction intervals change across a regression line - shouldn't i
Lukas has already given a very comprehensive mathematical explanation. I just want to add a quick note about a misunderstanding in your question.
The linear regression model assumes IID errors on the |
21,036 | Difference/relationship between power and significance | Significance (p-value) is the probability that we reject the null hypothesis while it is true. Power is the probability of rejecting the null hypothesis while it is false. Significance is thus the probability of Type I error, whereas $1 -power$ is the probability of Type II error. Mathematically these are not complementary probabilities: p-value is calculated using the probability distribution for the null hypothesis, while the power with the probability distribution for the alternative hypothesis.
The frequently used, joking but correct illustration is the use of a pregnancy test, which from time to time may turn to be negative for a visibly pregnant woman (Type I error) and return a positive result for a man. | Difference/relationship between power and significance | Significance (p-value) is the probability that we reject the null hypothesis while it is true. Power is the probability of rejecting the null hypothesis while it is false. Significance is thus the pro | Difference/relationship between power and significance
Significance (p-value) is the probability that we reject the null hypothesis while it is true. Power is the probability of rejecting the null hypothesis while it is false. Significance is thus the probability of Type I error, whereas $1 -power$ is the probability of Type II error. Mathematically these are not complementary probabilities: p-value is calculated using the probability distribution for the null hypothesis, while the power with the probability distribution for the alternative hypothesis.
The frequently used, joking but correct illustration is the use of a pregnancy test, which from time to time may turn to be negative for a visibly pregnant woman (Type I error) and return a positive result for a man. | Difference/relationship between power and significance
Significance (p-value) is the probability that we reject the null hypothesis while it is true. Power is the probability of rejecting the null hypothesis while it is false. Significance is thus the pro |
21,037 | Difference/relationship between power and significance | Both concepts are unified in the form of the risk function.
Generally, a statistical procedure $t$ can be considered a principled way of determining some action to take upon observing data governed by some probability distribution $F$ (aka "model" or "state of nature") that is not completely determined (some of its properties are unknown). When the action can be quantitatively compared to the action that would be performed if the distribution were known, it becomes possible to compare procedures quantitatively, too.
The comparison requires us to consider--hypothetically--every possible $F$ that might occur. For a given $F$, the data $X$ are considered a random sample of $F.$ The procedure $t$ determines the action $t(X)$ to take upon observing $X.$ Let $a(F)$ be the best possible action to take if $F$ were known. The value of the loss function $\mathcal L$ is zero when $t(X)=a(F)$ and otherwise is some positive number representing the "cost" or "loss" associated with taking the possibly inferior action $t(X).$ Usually the loss is directly expressed as a cost of doing $t(X)$ when $F$ is the true state of nature, written
$$\mathcal{L}(a, F).$$
The risk associated with $F$ for the procedure $t$ is the expected loss,
$$r_{\mathcal{L}; t}(F) = E[\mathcal{L}(t(X), F)].$$
Notice how (given $\mathcal L$ and $t$) this is a function of $F.$ This fact complicates the comparison of statistical procedures, because typically one procedure may have lower risk for some $F$ and the other procedure may have lower risk for other $F.$
In its most basic form, hull hypothesis testing (NHT) concerns just two possible actions: "accept" or "reject." The "null hypothesis" is a set $\Theta_0$ of models, while the "alternative hypothesis" is a complementary set $\Theta_A.$ People doing null hypothesis testing are concerned about getting the correct answer: that is, there is no loss whenever $t(X)$ is "accept" when $F\in\Theta_0$ or $t(X)$ is "reject" when $F\in\Theta_A.$ Otherwise, an "error" is made: a false positive occurs when $t(X)$ is "reject" and $F\in\Theta_0$ and a false negative occurs when $t(X)$ is "accept" and $F\in\Theta_A.$ All errors are considered to have the same loss.
We might as well choose units in which this common value is $1.$ Mathematically, this binary loss function can be expressed as
$$\eqalign{
\mathcal{L}(\text{accept}, F) &= \left\{\matrix{0 & \text{if } F\in\Theta_0 \\ 1 & \text{if }F\in\Theta_A}\right. \\
\mathcal{L}(\text{reject}, F) &= \left\{\matrix{1 & \text{if } F\in\Theta_0 \\ 0 & \text{if }F\in\Theta_A}\right.
}$$
From this we may easily compute that the risk function is
$$r_t(F) = \left\{\matrix{{\Pr}_F(t(X)=\text{ reject}) & \text{if }F\in\Theta_0 \\
{\Pr}_F(t(X)=\text{ accept}) & \text{if }F\in\Theta_A
}\right.$$
(Since we will be discussing the binary loss function from now on, I have dropped all references to it in the notation.)
So far, there has been no essential difference between $\Theta_0$ and $\Theta_A,$ nor need there be. However, null hypothesis testing is usually conducted in an asymmetrical way: one chooses procedures that limit the risk when the null is true. This limiting risk is the "size" of the test, or its "alpha," given by
$$\alpha = \sup\left\{r_t(F)\mid F\in \Theta_0\right\}.$$
One selects a test that tends to make the values of the risk function for the alternative hypothesis as small as possible. Which values, exactly? It depends on your objectives and assumptions. Thus, it's common for the statistician to ask her client for (a) an acceptably small value of $\alpha$ and (b) some indication of the largest risks the client can endure for some key models in the alternative hypothesis. Let's look at an illustrative example.
Figure 1 shows a textbook case where $\Theta_0$ is the set of Normal$(\mu,\sigma^2/n)$ distributions with $\mu \le 0$ and $\Theta_A$ is the set of Normal$(\mu,\sigma^2/n)$ distributions with $\mu\gt 0;$ both $\sigma^2$ and $n$ are fixed. The procedure is the usual "Z test." ($n$ is a potential sample size; varying $n$ causes the risk to change, enabling one to determine a sample size that makes the risk function acceptably low.)
The red curve graphs $r_t(F)$ (where $F$ can be identified with a multiple of the parameter $\mu,$ termed the "effect"). $\Theta_0$ therefore corresponds to the points on the horizontal ($F$) axis at or to the left of $0.$ The test has been chosen so that the highest point on the graph for $\Theta_0$ is $\alpha=0.10.$
The backgrounds summarize the conversation between statistician and client:
The black rectangle at the left is the region where the risk does not exceed $\alpha=0.10$ for the null hypothesis.
The black rectangle at the right is a region within the alternative hypothesis where the risk does not exceed a value $\beta=0.20.$
The gray rectangle is a "gray area" between these regions where no restrictions are placed on the risk.
The client has selected $\alpha,$ $\beta,$ and the left hand limit $\Delta$ of the right black rectangle. This value $\Delta$ is an "effect size." We may characterize the states of nature with $\mu \ge \Delta$ as being "extreme" because they differ most substantially from any state in the null hypothesis. By limiting the risk in the extreme states we are, in a way, modifying (or weighting) the loss function to reflect a sense that false positive errors made for extreme states are worse than false positive errors made for states in the intermediate gray area.
What this test accomplishes, then, can be stated as follows:
The test $t$ is a procedure that limits the risk to $\alpha$ for the null hypothesis and limits it to $\beta$ for the "more extreme" parts of the alternative hypothesis.
It is conceptually very useful to keep Figure 1 in mind when thinking about NHTs, for it shows clearly that although the error rates are controlled, they nevertheless depend on the true (but still unknown!) state of nature.
This figure is usually drawn by flipping the risk upside-down in the alternative hypothesis, as in Figure 2:
This "power curve" is simply the chance of making a "reject" decision. By comparing this figure to the previous one, you can see that where the power is high, the chance of making a false negative error is low. Because the test is constructed to assure the chance of a "reject" is low throughout $\Theta_0,$ often the power curve isn't even plotted for the null hypothesis: it simply is summarized by the test size $\alpha.$ The "significance level" of the test is just $1-\alpha,$ or $90\%$ in this example.
References
Kiefer, J.C. (1987), Introduction to Statistical Inference.
US EPA (2006), Guidance on Systematic Planning Using the Data Quality Objectives Process.
NUREG-1575, Rev. 1 (2000), Multi-Agency Radiation Survey and Site Investigation Manual.
Kiefer is a decision-theoretic account of statistics. I have used his language and notation. US EPA uses graphical explanations (similar to the second figure here) to help people develop appropriate quantitative criteria and statistical procedures for environmental decision making. This guidance has been adopted by many other US agencies, such as the Nuclear Regulatory Commission and Department of Energy: see NUREG-1575 for one example out of many. The term "gray area" or "gray region" is taken from these guidance documents. | Difference/relationship between power and significance | Both concepts are unified in the form of the risk function.
Generally, a statistical procedure $t$ can be considered a principled way of determining some action to take upon observing data governed by | Difference/relationship between power and significance
Both concepts are unified in the form of the risk function.
Generally, a statistical procedure $t$ can be considered a principled way of determining some action to take upon observing data governed by some probability distribution $F$ (aka "model" or "state of nature") that is not completely determined (some of its properties are unknown). When the action can be quantitatively compared to the action that would be performed if the distribution were known, it becomes possible to compare procedures quantitatively, too.
The comparison requires us to consider--hypothetically--every possible $F$ that might occur. For a given $F$, the data $X$ are considered a random sample of $F.$ The procedure $t$ determines the action $t(X)$ to take upon observing $X.$ Let $a(F)$ be the best possible action to take if $F$ were known. The value of the loss function $\mathcal L$ is zero when $t(X)=a(F)$ and otherwise is some positive number representing the "cost" or "loss" associated with taking the possibly inferior action $t(X).$ Usually the loss is directly expressed as a cost of doing $t(X)$ when $F$ is the true state of nature, written
$$\mathcal{L}(a, F).$$
The risk associated with $F$ for the procedure $t$ is the expected loss,
$$r_{\mathcal{L}; t}(F) = E[\mathcal{L}(t(X), F)].$$
Notice how (given $\mathcal L$ and $t$) this is a function of $F.$ This fact complicates the comparison of statistical procedures, because typically one procedure may have lower risk for some $F$ and the other procedure may have lower risk for other $F.$
In its most basic form, hull hypothesis testing (NHT) concerns just two possible actions: "accept" or "reject." The "null hypothesis" is a set $\Theta_0$ of models, while the "alternative hypothesis" is a complementary set $\Theta_A.$ People doing null hypothesis testing are concerned about getting the correct answer: that is, there is no loss whenever $t(X)$ is "accept" when $F\in\Theta_0$ or $t(X)$ is "reject" when $F\in\Theta_A.$ Otherwise, an "error" is made: a false positive occurs when $t(X)$ is "reject" and $F\in\Theta_0$ and a false negative occurs when $t(X)$ is "accept" and $F\in\Theta_A.$ All errors are considered to have the same loss.
We might as well choose units in which this common value is $1.$ Mathematically, this binary loss function can be expressed as
$$\eqalign{
\mathcal{L}(\text{accept}, F) &= \left\{\matrix{0 & \text{if } F\in\Theta_0 \\ 1 & \text{if }F\in\Theta_A}\right. \\
\mathcal{L}(\text{reject}, F) &= \left\{\matrix{1 & \text{if } F\in\Theta_0 \\ 0 & \text{if }F\in\Theta_A}\right.
}$$
From this we may easily compute that the risk function is
$$r_t(F) = \left\{\matrix{{\Pr}_F(t(X)=\text{ reject}) & \text{if }F\in\Theta_0 \\
{\Pr}_F(t(X)=\text{ accept}) & \text{if }F\in\Theta_A
}\right.$$
(Since we will be discussing the binary loss function from now on, I have dropped all references to it in the notation.)
So far, there has been no essential difference between $\Theta_0$ and $\Theta_A,$ nor need there be. However, null hypothesis testing is usually conducted in an asymmetrical way: one chooses procedures that limit the risk when the null is true. This limiting risk is the "size" of the test, or its "alpha," given by
$$\alpha = \sup\left\{r_t(F)\mid F\in \Theta_0\right\}.$$
One selects a test that tends to make the values of the risk function for the alternative hypothesis as small as possible. Which values, exactly? It depends on your objectives and assumptions. Thus, it's common for the statistician to ask her client for (a) an acceptably small value of $\alpha$ and (b) some indication of the largest risks the client can endure for some key models in the alternative hypothesis. Let's look at an illustrative example.
Figure 1 shows a textbook case where $\Theta_0$ is the set of Normal$(\mu,\sigma^2/n)$ distributions with $\mu \le 0$ and $\Theta_A$ is the set of Normal$(\mu,\sigma^2/n)$ distributions with $\mu\gt 0;$ both $\sigma^2$ and $n$ are fixed. The procedure is the usual "Z test." ($n$ is a potential sample size; varying $n$ causes the risk to change, enabling one to determine a sample size that makes the risk function acceptably low.)
The red curve graphs $r_t(F)$ (where $F$ can be identified with a multiple of the parameter $\mu,$ termed the "effect"). $\Theta_0$ therefore corresponds to the points on the horizontal ($F$) axis at or to the left of $0.$ The test has been chosen so that the highest point on the graph for $\Theta_0$ is $\alpha=0.10.$
The backgrounds summarize the conversation between statistician and client:
The black rectangle at the left is the region where the risk does not exceed $\alpha=0.10$ for the null hypothesis.
The black rectangle at the right is a region within the alternative hypothesis where the risk does not exceed a value $\beta=0.20.$
The gray rectangle is a "gray area" between these regions where no restrictions are placed on the risk.
The client has selected $\alpha,$ $\beta,$ and the left hand limit $\Delta$ of the right black rectangle. This value $\Delta$ is an "effect size." We may characterize the states of nature with $\mu \ge \Delta$ as being "extreme" because they differ most substantially from any state in the null hypothesis. By limiting the risk in the extreme states we are, in a way, modifying (or weighting) the loss function to reflect a sense that false positive errors made for extreme states are worse than false positive errors made for states in the intermediate gray area.
What this test accomplishes, then, can be stated as follows:
The test $t$ is a procedure that limits the risk to $\alpha$ for the null hypothesis and limits it to $\beta$ for the "more extreme" parts of the alternative hypothesis.
It is conceptually very useful to keep Figure 1 in mind when thinking about NHTs, for it shows clearly that although the error rates are controlled, they nevertheless depend on the true (but still unknown!) state of nature.
This figure is usually drawn by flipping the risk upside-down in the alternative hypothesis, as in Figure 2:
This "power curve" is simply the chance of making a "reject" decision. By comparing this figure to the previous one, you can see that where the power is high, the chance of making a false negative error is low. Because the test is constructed to assure the chance of a "reject" is low throughout $\Theta_0,$ often the power curve isn't even plotted for the null hypothesis: it simply is summarized by the test size $\alpha.$ The "significance level" of the test is just $1-\alpha,$ or $90\%$ in this example.
References
Kiefer, J.C. (1987), Introduction to Statistical Inference.
US EPA (2006), Guidance on Systematic Planning Using the Data Quality Objectives Process.
NUREG-1575, Rev. 1 (2000), Multi-Agency Radiation Survey and Site Investigation Manual.
Kiefer is a decision-theoretic account of statistics. I have used his language and notation. US EPA uses graphical explanations (similar to the second figure here) to help people develop appropriate quantitative criteria and statistical procedures for environmental decision making. This guidance has been adopted by many other US agencies, such as the Nuclear Regulatory Commission and Department of Energy: see NUREG-1575 for one example out of many. The term "gray area" or "gray region" is taken from these guidance documents. | Difference/relationship between power and significance
Both concepts are unified in the form of the risk function.
Generally, a statistical procedure $t$ can be considered a principled way of determining some action to take upon observing data governed by |
21,038 | Difference/relationship between power and significance | No, it is not the same. The fact that both terms have separate Wikipedia entries is a first hint. In Null Hypothesis Significance Tests (NHST)
statistical significance is a criterion to decide if a null hypothesis should be rejected. We say there is significant evidence to reject H0 if the p-value is below a given significance level
power is the rate at which H0 is rejected in a fixed setting, characterised e.g. by the test, sample size, effect size etc. | Difference/relationship between power and significance | No, it is not the same. The fact that both terms have separate Wikipedia entries is a first hint. In Null Hypothesis Significance Tests (NHST)
statistical significance is a criterion to decide if a n | Difference/relationship between power and significance
No, it is not the same. The fact that both terms have separate Wikipedia entries is a first hint. In Null Hypothesis Significance Tests (NHST)
statistical significance is a criterion to decide if a null hypothesis should be rejected. We say there is significant evidence to reject H0 if the p-value is below a given significance level
power is the rate at which H0 is rejected in a fixed setting, characterised e.g. by the test, sample size, effect size etc. | Difference/relationship between power and significance
No, it is not the same. The fact that both terms have separate Wikipedia entries is a first hint. In Null Hypothesis Significance Tests (NHST)
statistical significance is a criterion to decide if a n |
21,039 | Difference/relationship between power and significance | Power is a design concept: it is the probability of making a per-specified decision conditional on a posited true state of nature, i.e. your alternative hypothesis. It therefore only ever makes sense to talk about power before you've embarked on your experiment: sampling, data collection, intervention, etc.
Statistical significance is an analysis concept: it is a subjective decision based upon the probability of observing the data you've already collected (or more 'extreme') conditional on what you would consider the null setting.
To summarize, there are three main differences:
Power is a design concept; statistical significance is an analysis concept
Power conditions on a specified alternative hypothesis; statistical significance conditions on a null hypothesis
Power is a calculation of the probability of making a decision (assuming it's being used appropriately); statistical significance is a subjective claim | Difference/relationship between power and significance | Power is a design concept: it is the probability of making a per-specified decision conditional on a posited true state of nature, i.e. your alternative hypothesis. It therefore only ever makes sense | Difference/relationship between power and significance
Power is a design concept: it is the probability of making a per-specified decision conditional on a posited true state of nature, i.e. your alternative hypothesis. It therefore only ever makes sense to talk about power before you've embarked on your experiment: sampling, data collection, intervention, etc.
Statistical significance is an analysis concept: it is a subjective decision based upon the probability of observing the data you've already collected (or more 'extreme') conditional on what you would consider the null setting.
To summarize, there are three main differences:
Power is a design concept; statistical significance is an analysis concept
Power conditions on a specified alternative hypothesis; statistical significance conditions on a null hypothesis
Power is a calculation of the probability of making a decision (assuming it's being used appropriately); statistical significance is a subjective claim | Difference/relationship between power and significance
Power is a design concept: it is the probability of making a per-specified decision conditional on a posited true state of nature, i.e. your alternative hypothesis. It therefore only ever makes sense |
21,040 | What is an intuitive interpretation of the leaf values in XGBoost base learners? | A gradient boosting machine (GBM), like XGBoost, is an ensemble learning technique where the results of the each base-learner are combined to generate the final estimate. That said, when performing a binary classification task, by default, XGBoost treats it as a logistic regression problem.
As such the raw leaf estimates seen here are log-odds and can be negative.
Refresher: Within the context of logistic regression, the mean of the binary response is of the form $\mu(X) = Pr(Y = 1|X)$ and relates to the predictors $X_1, ..., X_p$ through the logit function: $\log( \frac{\mu(X)}{1-\mu(X)})$ $=$ $\beta_0 +$ $\beta_1 X_1 +$ $... +$ $\beta_p X_p$. As a consequence, to get probability estimates we need to use the inverse logit (i.e. the logistic) link $\frac{1}{1 +e^{-(\beta_0 + \beta_1 X_1 + ... + \beta_p X_p)}}$.
In addition to that, we need to remember that boosting can be presented as a generalised additive model (GAM).
In the case of a simple GAM our final estimates are of the form: $g[\mu(X)]$ $=$ $\alpha +$ $f_1(X_1) +$ $... +$ $f_p(X_p)$, where $g$ is our link function and $f$ is a set of elementary basis functions (usually cubic splines). When boosting through, we change $f$ and instead of some particular basis function family, we use the individual base-learners we mentioned originally!
(See Hastie et al. 2009, Elements of Statistical Learning Chapt. 4.4 "Logistic Regression" and Chapt. 10.2 "Boosting Fits an Additive Model" for more details.)
In the case of a GBM therefore, the result from each individual tree are indeed combined together, but they are not probabilities (yet) but rather the estimates of the score before performing the logistic transformation done when performing logistic regression. For that reason the individual as well as the combined estimates show can naturally be negative; the negative sign simply implies "less" chance. OK, talk is cheap, show me the code.
Let's assume we have only two base-learners, that are simple stumps:
our_params = {
'eta' : 0.1, # aka. learning_rate
'seed' : 0,
'subsample' : 0.8,
'colsample_bytree': 0.8,
'objective' : 'binary:logistic',
'max_depth' : 1, # Stumps
'min_child_weight': 1}
# create XGBoost object using the parameters
final_gb = xgb.train(our_params, xgdmat, num_boost_round = 2)
And that we aim to predict the first four entries of our test-set.
xgdmat4 = xgb.DMatrix(final_test.iloc[0:4,:], y_test[0:4])
mypreds4 = final_gb.predict(data = xgdmat4)
# array([0.43447325, 0.46945405, 0.46945405, 0.5424156 ], dtype=float32)
Plotting the two (sole) trees used:
graph_to_save = xgb.to_graphviz(final_gb, num_trees = 0)
graph_to_save.format = 'png'
graph_to_save.render('tree_0_saved')
graph_to_save = xgb.to_graphviz(final_gb, num_trees = 1)
graph_to_save.format = 'png'
graph_to_save.render('tree_1_saved')
Gives us the following two tree diagrams:
Based on these diagrams and we can check that based on our initial sample:
final_test.iloc[0:4,:][['capital_gain','relationship']]
# capital_gain relationship
#0 0 3
#1 0 0
#2 0 0
#3 7688 0
We can directly calculate our own estimates manually based on the logistic function:
1/(1+ np.exp(-(-0.115036212 + -0.148587108))) # First entry
# 0.4344732254087043
1/(1+ np.exp(-(-0.115036212 + -0.007299904))) # Second entry
# 0.4694540577007751
1/(1+ np.exp(-(-0.115036212 + -0.007299904))) # Third entry
# 0.4694540577007751
1/(1+ np.exp(-(+0.177371055 + -0.007299904))) # Fourth entry
# 0.5424156005710725
It can be easily seen that our manual estimates match (up to 7 digits) the ones we got directly from predict.
So to recap, the leaves contain the estimates from their respective base-learner on the domain of the function where the gradient boosting procedure takes place.
For the presented binary classification task, the link used is the logit so these estimates represent log-odds; in terms of log-odds, negative values are perfectly normal. To get probability estimates we simply use the logistic function, which is the inverse of the logit function. Finally, please note that we need to first compute our final estimate in the gradient boosting domain and then transform it back. Tranforming the output of each base-learner individually and then combining these outputs is wrong because the linearity relation shown does not (necessarily) hold in the domain of the response variable.
For more information about the logit I would suggest reading the excellent CV.SE thread on Interpretation of simple predictions to odds ratios in logistic regression. | What is an intuitive interpretation of the leaf values in XGBoost base learners? | A gradient boosting machine (GBM), like XGBoost, is an ensemble learning technique where the results of the each base-learner are combined to generate the final estimate. That said, when performing a | What is an intuitive interpretation of the leaf values in XGBoost base learners?
A gradient boosting machine (GBM), like XGBoost, is an ensemble learning technique where the results of the each base-learner are combined to generate the final estimate. That said, when performing a binary classification task, by default, XGBoost treats it as a logistic regression problem.
As such the raw leaf estimates seen here are log-odds and can be negative.
Refresher: Within the context of logistic regression, the mean of the binary response is of the form $\mu(X) = Pr(Y = 1|X)$ and relates to the predictors $X_1, ..., X_p$ through the logit function: $\log( \frac{\mu(X)}{1-\mu(X)})$ $=$ $\beta_0 +$ $\beta_1 X_1 +$ $... +$ $\beta_p X_p$. As a consequence, to get probability estimates we need to use the inverse logit (i.e. the logistic) link $\frac{1}{1 +e^{-(\beta_0 + \beta_1 X_1 + ... + \beta_p X_p)}}$.
In addition to that, we need to remember that boosting can be presented as a generalised additive model (GAM).
In the case of a simple GAM our final estimates are of the form: $g[\mu(X)]$ $=$ $\alpha +$ $f_1(X_1) +$ $... +$ $f_p(X_p)$, where $g$ is our link function and $f$ is a set of elementary basis functions (usually cubic splines). When boosting through, we change $f$ and instead of some particular basis function family, we use the individual base-learners we mentioned originally!
(See Hastie et al. 2009, Elements of Statistical Learning Chapt. 4.4 "Logistic Regression" and Chapt. 10.2 "Boosting Fits an Additive Model" for more details.)
In the case of a GBM therefore, the result from each individual tree are indeed combined together, but they are not probabilities (yet) but rather the estimates of the score before performing the logistic transformation done when performing logistic regression. For that reason the individual as well as the combined estimates show can naturally be negative; the negative sign simply implies "less" chance. OK, talk is cheap, show me the code.
Let's assume we have only two base-learners, that are simple stumps:
our_params = {
'eta' : 0.1, # aka. learning_rate
'seed' : 0,
'subsample' : 0.8,
'colsample_bytree': 0.8,
'objective' : 'binary:logistic',
'max_depth' : 1, # Stumps
'min_child_weight': 1}
# create XGBoost object using the parameters
final_gb = xgb.train(our_params, xgdmat, num_boost_round = 2)
And that we aim to predict the first four entries of our test-set.
xgdmat4 = xgb.DMatrix(final_test.iloc[0:4,:], y_test[0:4])
mypreds4 = final_gb.predict(data = xgdmat4)
# array([0.43447325, 0.46945405, 0.46945405, 0.5424156 ], dtype=float32)
Plotting the two (sole) trees used:
graph_to_save = xgb.to_graphviz(final_gb, num_trees = 0)
graph_to_save.format = 'png'
graph_to_save.render('tree_0_saved')
graph_to_save = xgb.to_graphviz(final_gb, num_trees = 1)
graph_to_save.format = 'png'
graph_to_save.render('tree_1_saved')
Gives us the following two tree diagrams:
Based on these diagrams and we can check that based on our initial sample:
final_test.iloc[0:4,:][['capital_gain','relationship']]
# capital_gain relationship
#0 0 3
#1 0 0
#2 0 0
#3 7688 0
We can directly calculate our own estimates manually based on the logistic function:
1/(1+ np.exp(-(-0.115036212 + -0.148587108))) # First entry
# 0.4344732254087043
1/(1+ np.exp(-(-0.115036212 + -0.007299904))) # Second entry
# 0.4694540577007751
1/(1+ np.exp(-(-0.115036212 + -0.007299904))) # Third entry
# 0.4694540577007751
1/(1+ np.exp(-(+0.177371055 + -0.007299904))) # Fourth entry
# 0.5424156005710725
It can be easily seen that our manual estimates match (up to 7 digits) the ones we got directly from predict.
So to recap, the leaves contain the estimates from their respective base-learner on the domain of the function where the gradient boosting procedure takes place.
For the presented binary classification task, the link used is the logit so these estimates represent log-odds; in terms of log-odds, negative values are perfectly normal. To get probability estimates we simply use the logistic function, which is the inverse of the logit function. Finally, please note that we need to first compute our final estimate in the gradient boosting domain and then transform it back. Tranforming the output of each base-learner individually and then combining these outputs is wrong because the linearity relation shown does not (necessarily) hold in the domain of the response variable.
For more information about the logit I would suggest reading the excellent CV.SE thread on Interpretation of simple predictions to odds ratios in logistic regression. | What is an intuitive interpretation of the leaf values in XGBoost base learners?
A gradient boosting machine (GBM), like XGBoost, is an ensemble learning technique where the results of the each base-learner are combined to generate the final estimate. That said, when performing a |
21,041 | What is an intuitive interpretation of the leaf values in XGBoost base learners? | If it is a regression model (objective can be reg:squarederror), then the leaf value is the prediction of that tree for the given data point. The leaf value can be negative based on your target variable. The final prediction for that data point will be sum of leaf values in all the trees for that point.
If it is a classification model (objective can be binary:logistic), then the leaf value is representative (like raw score) for the probability of the data point belonging to the positive class. The final probability prediction is obtained by taking sum of leaf values (raw scores) in all the trees and then transforming it between 0 and 1 using a sigmoid function. The leaf value (raw score) can be negative, the value 0 actually represents probability being 1/2.
Please find more details about the parameters and outputs at - https://xgboost.readthedocs.io/en/latest/parameter.html | What is an intuitive interpretation of the leaf values in XGBoost base learners? | If it is a regression model (objective can be reg:squarederror), then the leaf value is the prediction of that tree for the given data point. The leaf value can be negative based on your target variab | What is an intuitive interpretation of the leaf values in XGBoost base learners?
If it is a regression model (objective can be reg:squarederror), then the leaf value is the prediction of that tree for the given data point. The leaf value can be negative based on your target variable. The final prediction for that data point will be sum of leaf values in all the trees for that point.
If it is a classification model (objective can be binary:logistic), then the leaf value is representative (like raw score) for the probability of the data point belonging to the positive class. The final probability prediction is obtained by taking sum of leaf values (raw scores) in all the trees and then transforming it between 0 and 1 using a sigmoid function. The leaf value (raw score) can be negative, the value 0 actually represents probability being 1/2.
Please find more details about the parameters and outputs at - https://xgboost.readthedocs.io/en/latest/parameter.html | What is an intuitive interpretation of the leaf values in XGBoost base learners?
If it is a regression model (objective can be reg:squarederror), then the leaf value is the prediction of that tree for the given data point. The leaf value can be negative based on your target variab |
21,042 | Using Decibels in Statistics | Whether to transform depends on what scale you want your inference at.
Generally, the variance of a function of $x$ does not equal the function of the variance of $x$. Because $\sigma^{2}_{f(x)} \ne f(\sigma^{2}_{x})$ transforming $x$ with $f$, then performing statistical inference (hypothesis tests or confidence intervals) on $f(x)$, then back-transforming—$f^{-1}$—the results of that inference to apply to $x$ is invalid (since both test statistics and CIs require an estimate of the variance).
Basing CIs on transformed variables + back-transformation produces intervals without the nominal coverage probabilities, so back-transformed confidence about an estimate based on $f(x)$ is not confidence on an estimate based on $x$.
Likewise, inferences about untransformed variables based on hypothesis tests
on transformed variables means that any of the following can be true, for
example, when making inferences about $x$ based on some grouping variable $y$:
$x$ differs significantly across $y$, but $f(x)$ does not differ
significantly across $y$.
$x$ differs significantly across $y$, and $f(x)$ differs significantly
across $y$.
$x$ does not differ significantly across $y$, and $f(x)$ does not
differ significantly across $y$.
$x$ does not differ significantly across $y$, but $f(x)$ differs
significantly across $y$.
In short, knowing whether $f(x)$ differs significantly across groups of $y$ does not tell you
whether $x$ differs across $y$.
So the question of whether to transform those dBs is answered by whether you care about dB or exponentiated dB. | Using Decibels in Statistics | Whether to transform depends on what scale you want your inference at.
Generally, the variance of a function of $x$ does not equal the function of the variance of $x$. Because $\sigma^{2}_{f(x)} \ne f | Using Decibels in Statistics
Whether to transform depends on what scale you want your inference at.
Generally, the variance of a function of $x$ does not equal the function of the variance of $x$. Because $\sigma^{2}_{f(x)} \ne f(\sigma^{2}_{x})$ transforming $x$ with $f$, then performing statistical inference (hypothesis tests or confidence intervals) on $f(x)$, then back-transforming—$f^{-1}$—the results of that inference to apply to $x$ is invalid (since both test statistics and CIs require an estimate of the variance).
Basing CIs on transformed variables + back-transformation produces intervals without the nominal coverage probabilities, so back-transformed confidence about an estimate based on $f(x)$ is not confidence on an estimate based on $x$.
Likewise, inferences about untransformed variables based on hypothesis tests
on transformed variables means that any of the following can be true, for
example, when making inferences about $x$ based on some grouping variable $y$:
$x$ differs significantly across $y$, but $f(x)$ does not differ
significantly across $y$.
$x$ differs significantly across $y$, and $f(x)$ differs significantly
across $y$.
$x$ does not differ significantly across $y$, and $f(x)$ does not
differ significantly across $y$.
$x$ does not differ significantly across $y$, but $f(x)$ differs
significantly across $y$.
In short, knowing whether $f(x)$ differs significantly across groups of $y$ does not tell you
whether $x$ differs across $y$.
So the question of whether to transform those dBs is answered by whether you care about dB or exponentiated dB. | Using Decibels in Statistics
Whether to transform depends on what scale you want your inference at.
Generally, the variance of a function of $x$ does not equal the function of the variance of $x$. Because $\sigma^{2}_{f(x)} \ne f |
21,043 | Using Decibels in Statistics | Strictly we need to see your data to have any chance of giving definitive advice, but it is possible to guess.
As you say, decibels are already on a logarithmic scale. That is likely to mean, for a variety of physical and statistical reasons, that they are quite likely to behave well by being approximately additive, homoscedastic and symmetrically distributed conditional on predictors. But you may be able to give a physical or engineering argument of how the response should vary as you change your design variables.
I know no possible principle or theory that means that you are obliged to exponentiate them before applying a $t$ test or ANOVA. I would expect that to make statistical behaviour worse, not better.
The same kind of reasoning usually applies to other "pre-transformed" logarithmic scales such as pH or the Richter scale.
PS: No idea what RFID tags are. | Using Decibels in Statistics | Strictly we need to see your data to have any chance of giving definitive advice, but it is possible to guess.
As you say, decibels are already on a logarithmic scale. That is likely to mean, for a v | Using Decibels in Statistics
Strictly we need to see your data to have any chance of giving definitive advice, but it is possible to guess.
As you say, decibels are already on a logarithmic scale. That is likely to mean, for a variety of physical and statistical reasons, that they are quite likely to behave well by being approximately additive, homoscedastic and symmetrically distributed conditional on predictors. But you may be able to give a physical or engineering argument of how the response should vary as you change your design variables.
I know no possible principle or theory that means that you are obliged to exponentiate them before applying a $t$ test or ANOVA. I would expect that to make statistical behaviour worse, not better.
The same kind of reasoning usually applies to other "pre-transformed" logarithmic scales such as pH or the Richter scale.
PS: No idea what RFID tags are. | Using Decibels in Statistics
Strictly we need to see your data to have any chance of giving definitive advice, but it is possible to guess.
As you say, decibels are already on a logarithmic scale. That is likely to mean, for a v |
21,044 | Using Decibels in Statistics | Well, the only way to definitively answer this question is to look at some decibel data -- is there a simple distribution (e.g. Gaussian distribution) which is a good model for that? Or is the exponential of the data a better candidate? My guess is that the non-exponentialized data is more nearly Gaussian and therefore to make any ensuing analysis more straightforward, you should use that, but I'll let you be the judge of it.
I take issue with your proposed analysis, which is to apply a significance test to observed data from different experiments (namely different antenna positions). From considering the physics of this, there must be some difference, perhaps minuscule, perhaps substantial. But a priori there is some difference, therefore with a large enough data set, you must reject the null hypothesis of no difference. Thus the effect of a significance test is only to conclude "you have / you don't have a large data set". That doesn't seem very useful.
More useful would be to quantify the difference between different antenna positions, and perhaps also take into account costs and benefits to decide which position is to be selected. Quantified differences are sometimes called "effect size analysis"; a web search for that should turn up some resources. Costs and benefits come under the heading of utility theory and decision theory; again a search will find some resources. | Using Decibels in Statistics | Well, the only way to definitively answer this question is to look at some decibel data -- is there a simple distribution (e.g. Gaussian distribution) which is a good model for that? Or is the exponen | Using Decibels in Statistics
Well, the only way to definitively answer this question is to look at some decibel data -- is there a simple distribution (e.g. Gaussian distribution) which is a good model for that? Or is the exponential of the data a better candidate? My guess is that the non-exponentialized data is more nearly Gaussian and therefore to make any ensuing analysis more straightforward, you should use that, but I'll let you be the judge of it.
I take issue with your proposed analysis, which is to apply a significance test to observed data from different experiments (namely different antenna positions). From considering the physics of this, there must be some difference, perhaps minuscule, perhaps substantial. But a priori there is some difference, therefore with a large enough data set, you must reject the null hypothesis of no difference. Thus the effect of a significance test is only to conclude "you have / you don't have a large data set". That doesn't seem very useful.
More useful would be to quantify the difference between different antenna positions, and perhaps also take into account costs and benefits to decide which position is to be selected. Quantified differences are sometimes called "effect size analysis"; a web search for that should turn up some resources. Costs and benefits come under the heading of utility theory and decision theory; again a search will find some resources. | Using Decibels in Statistics
Well, the only way to definitively answer this question is to look at some decibel data -- is there a simple distribution (e.g. Gaussian distribution) which is a good model for that? Or is the exponen |
21,045 | Using Decibels in Statistics | The (logarithmic) Decibel scale is useful because the power of a signal can often be described by a (variable) series (or fluid range) of multiplications.
E.g. if a 1cm thick wall reduces the signal to $\frac{1}{10}$ power (10 Decibel reduction).
then a 2 cm thick wall reduces the signal to $\frac{1}{100}$ power (20 Decibel redution).
and a 3cm thick wall reduces the signal to $\frac{1}{1000}$ power (30 Decibel reduction)
etc.
More generally, if you make the wall thickness non-discrete then
the signal (if you express it in untransformed units) could be expressed by an exponential function
$$P[\textrm{mW}] = P_0 \left( \frac{1}{10} \right)^{L[\textrm{cm}]}$$
This is more simple, if you express the logarithm of the signal power, as a linear function (which, if you wish, requires some definition about the absolute scale, in this case 0dB relates to 1 mW)
$$P[\textrm{dB}] = 10 \left(\log(P_0[\textrm{mW}])-L[\textrm{cm}]\right)$$
Whenever you have a process that is multiplicative like:
$$X \propto e^Y $$
with the parameter $Y$ normal distributed: $$Y \sim N(\mu,\sigma^2)$$
then $X$ has a log-normal distribution and $\log(X)$ (or X expressed in any other logarithmic scale, such as the dB scale) has a normal distribution.
I expect that your error term will be multiplicative like that. That is: the signal strength will be a sum of many normal distributed error terms (e.g. amplifier temperature fluctuations, atmospheric conditions, etc.) that occur in the exponent of the expression for the signal strength.
$$y_{i} = e^{x_i+\epsilon_i}$$ | Using Decibels in Statistics | The (logarithmic) Decibel scale is useful because the power of a signal can often be described by a (variable) series (or fluid range) of multiplications.
E.g. if a 1cm thick wall reduces the signal | Using Decibels in Statistics
The (logarithmic) Decibel scale is useful because the power of a signal can often be described by a (variable) series (or fluid range) of multiplications.
E.g. if a 1cm thick wall reduces the signal to $\frac{1}{10}$ power (10 Decibel reduction).
then a 2 cm thick wall reduces the signal to $\frac{1}{100}$ power (20 Decibel redution).
and a 3cm thick wall reduces the signal to $\frac{1}{1000}$ power (30 Decibel reduction)
etc.
More generally, if you make the wall thickness non-discrete then
the signal (if you express it in untransformed units) could be expressed by an exponential function
$$P[\textrm{mW}] = P_0 \left( \frac{1}{10} \right)^{L[\textrm{cm}]}$$
This is more simple, if you express the logarithm of the signal power, as a linear function (which, if you wish, requires some definition about the absolute scale, in this case 0dB relates to 1 mW)
$$P[\textrm{dB}] = 10 \left(\log(P_0[\textrm{mW}])-L[\textrm{cm}]\right)$$
Whenever you have a process that is multiplicative like:
$$X \propto e^Y $$
with the parameter $Y$ normal distributed: $$Y \sim N(\mu,\sigma^2)$$
then $X$ has a log-normal distribution and $\log(X)$ (or X expressed in any other logarithmic scale, such as the dB scale) has a normal distribution.
I expect that your error term will be multiplicative like that. That is: the signal strength will be a sum of many normal distributed error terms (e.g. amplifier temperature fluctuations, atmospheric conditions, etc.) that occur in the exponent of the expression for the signal strength.
$$y_{i} = e^{x_i+\epsilon_i}$$ | Using Decibels in Statistics
The (logarithmic) Decibel scale is useful because the power of a signal can often be described by a (variable) series (or fluid range) of multiplications.
E.g. if a 1cm thick wall reduces the signal |
21,046 | Using Decibels in Statistics | An example supporting the use of decibels as-is:
For process capability (AKA accuracy ratio) Cp = the tolerance range (upper limit - lower limit) divided by 6 x Standard Deviation. When there is only one limit Cpk* is the difference between the mean and the limit (commonly called "margin") divided by 3 x StdDev.
If decibel values are converted to their linear equivalents, then the differences are found using division because a decibel value (dB) is a ratio (P1/P2). The difference in the decibel values is calculated with subtraction.
The test:
The Cpk result for A) a test with a positive lower limit (LL) and test values greater than the limit should be exactly the same as B) using a negative upper limit (UL = -LL) and the same test values x -1.
This is true when unconverted decibel test values are used but not when their linear equivalents are used. When the values are converted, the results are similar for test values close to zero but diverge significantly the "larger" they are (farther from zero). In the latter case the Cpk analysis produces false failures for tests with large positive test values and false positives for "large" negative test values.
*I'm not sure this is the correct term associated with a single-limit test but it's easier to reference in the following description. | Using Decibels in Statistics | An example supporting the use of decibels as-is:
For process capability (AKA accuracy ratio) Cp = the tolerance range (upper limit - lower limit) divided by 6 x Standard Deviation. When there is only | Using Decibels in Statistics
An example supporting the use of decibels as-is:
For process capability (AKA accuracy ratio) Cp = the tolerance range (upper limit - lower limit) divided by 6 x Standard Deviation. When there is only one limit Cpk* is the difference between the mean and the limit (commonly called "margin") divided by 3 x StdDev.
If decibel values are converted to their linear equivalents, then the differences are found using division because a decibel value (dB) is a ratio (P1/P2). The difference in the decibel values is calculated with subtraction.
The test:
The Cpk result for A) a test with a positive lower limit (LL) and test values greater than the limit should be exactly the same as B) using a negative upper limit (UL = -LL) and the same test values x -1.
This is true when unconverted decibel test values are used but not when their linear equivalents are used. When the values are converted, the results are similar for test values close to zero but diverge significantly the "larger" they are (farther from zero). In the latter case the Cpk analysis produces false failures for tests with large positive test values and false positives for "large" negative test values.
*I'm not sure this is the correct term associated with a single-limit test but it's easier to reference in the following description. | Using Decibels in Statistics
An example supporting the use of decibels as-is:
For process capability (AKA accuracy ratio) Cp = the tolerance range (upper limit - lower limit) divided by 6 x Standard Deviation. When there is only |
21,047 | Using Decibels in Statistics | More experiments and research indicate that a better method would be to do the statistical calculations (like standard deviation and mean) with the decibel values, then convert them to percentage values for comparison using the following formula.
% = (10^(dBm/10))-1
for the dB/dBc/dBm (power) group. Use /20 for dBV/dBrc values. (And there are others for acoustics, etc.)
This yields a value in the range of -100% to +$\infty$%.
0 dB = 1 = 0%
3 dB = 2 = 100%, -3 dB = 1/2 = -50%
6 dB = 4 = 300%, -6 dB = 1/4 = -75%
10 dB = 10 = 900%, -10 = 1/10 = -90%
The rationale for this is:
The linear and decibel scales are almost the same from 1 to 10 (0 dB = 1, 10 dB = 10). The farther from the 0:1 'center point' the more the two diverge. (30 dB = 1,000; -30 dB = 0.001)
Decibel values are ratios as are % values. dB is 10(log(P1/P2)). dBm is 10(log(P1/1 mW)). Converting a group of data values that are far removed from the 0:1 'center' but local to each other, to percentage values allows them to be used with/compared to other groups as if they are all in the same -1 to +1 range.
It also creates unitless values. | Using Decibels in Statistics | More experiments and research indicate that a better method would be to do the statistical calculations (like standard deviation and mean) with the decibel values, then convert them to percentage valu | Using Decibels in Statistics
More experiments and research indicate that a better method would be to do the statistical calculations (like standard deviation and mean) with the decibel values, then convert them to percentage values for comparison using the following formula.
% = (10^(dBm/10))-1
for the dB/dBc/dBm (power) group. Use /20 for dBV/dBrc values. (And there are others for acoustics, etc.)
This yields a value in the range of -100% to +$\infty$%.
0 dB = 1 = 0%
3 dB = 2 = 100%, -3 dB = 1/2 = -50%
6 dB = 4 = 300%, -6 dB = 1/4 = -75%
10 dB = 10 = 900%, -10 = 1/10 = -90%
The rationale for this is:
The linear and decibel scales are almost the same from 1 to 10 (0 dB = 1, 10 dB = 10). The farther from the 0:1 'center point' the more the two diverge. (30 dB = 1,000; -30 dB = 0.001)
Decibel values are ratios as are % values. dB is 10(log(P1/P2)). dBm is 10(log(P1/1 mW)). Converting a group of data values that are far removed from the 0:1 'center' but local to each other, to percentage values allows them to be used with/compared to other groups as if they are all in the same -1 to +1 range.
It also creates unitless values. | Using Decibels in Statistics
More experiments and research indicate that a better method would be to do the statistical calculations (like standard deviation and mean) with the decibel values, then convert them to percentage valu |
21,048 | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1,\frac{n}{2}-1\right)$ independently | Here's an algebraic proof. I'm going to instead let $X \sim \chi_{n-1}$ (not squared) so that we need to find $Z := (2Y - 1)X$. These are all guaranteed to be valid densities so I'm not going to track normalization constants. We have
$$
f_{X,Y}(x,y) \propto x^{n-2}e^{-x^2/2}\left[y(1-y)\right]^{n/2-2} \mathbf 1_{\{0 < x, \, 0 < y < 1\}}.
$$
Let $Z = (2y-1)X$ and $W=X$ so the inverse transforms are $x(z,w) = w$ and $y(z,w) = \frac{z+w}{2w} = \frac{z}{2w} + \frac 12$. This gives us $|J| = \frac 1{2w}$. This leads us to
$$
f_{Z,W}(z,w) \propto w^{n-1}e^{-w^2/2} \left[\frac{z+w}{2w} \left( 1 - \frac{z+w}{2w}\right)\right]^{n/2-2} \mathbf 1_{\{0 < w, \, -1 < \frac zw < 1\}}
$$
$$
\propto w e^{-w^2/2} \left(w^2-z^2\right)^{n/2-2} \mathbf 1_{\{|z| < w\}}.
$$
Thus
$$
f_Z(z) \propto \int_{w > |z|} w e^{-w^2/2} \left(w^2-z^2\right)^{n/2-2} \,\text dw.
$$
For convenience let $m = n/2-2$. Multiply both sides by $e^{z^2/2}$ to get
$$
e^{z^2/2} f_Z(z) \propto \int_{|z|}^\infty w e^{-(w^2-z^2)/2}(w^2-z^2)^m \,\text dw.
$$
Now let $2u = w^2 - z^2$ so $\text du = w\,\text dw$. This gives us
$$
e^{z^2/2} f_Z(z) \propto 2^m \int_0^\infty u^m e^{-u} \,\text du = 2^m \Gamma(m+1).
$$
Because this final integral doesn't depend on $z$, we have shown that $e^{z^2/2} f_Z(z) \propto 1$, therefore
$$
Z \sim \mathcal N(0, 1).
$$ | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1 | Here's an algebraic proof. I'm going to instead let $X \sim \chi_{n-1}$ (not squared) so that we need to find $Z := (2Y - 1)X$. These are all guaranteed to be valid densities so I'm not going to track | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1,\frac{n}{2}-1\right)$ independently
Here's an algebraic proof. I'm going to instead let $X \sim \chi_{n-1}$ (not squared) so that we need to find $Z := (2Y - 1)X$. These are all guaranteed to be valid densities so I'm not going to track normalization constants. We have
$$
f_{X,Y}(x,y) \propto x^{n-2}e^{-x^2/2}\left[y(1-y)\right]^{n/2-2} \mathbf 1_{\{0 < x, \, 0 < y < 1\}}.
$$
Let $Z = (2y-1)X$ and $W=X$ so the inverse transforms are $x(z,w) = w$ and $y(z,w) = \frac{z+w}{2w} = \frac{z}{2w} + \frac 12$. This gives us $|J| = \frac 1{2w}$. This leads us to
$$
f_{Z,W}(z,w) \propto w^{n-1}e^{-w^2/2} \left[\frac{z+w}{2w} \left( 1 - \frac{z+w}{2w}\right)\right]^{n/2-2} \mathbf 1_{\{0 < w, \, -1 < \frac zw < 1\}}
$$
$$
\propto w e^{-w^2/2} \left(w^2-z^2\right)^{n/2-2} \mathbf 1_{\{|z| < w\}}.
$$
Thus
$$
f_Z(z) \propto \int_{w > |z|} w e^{-w^2/2} \left(w^2-z^2\right)^{n/2-2} \,\text dw.
$$
For convenience let $m = n/2-2$. Multiply both sides by $e^{z^2/2}$ to get
$$
e^{z^2/2} f_Z(z) \propto \int_{|z|}^\infty w e^{-(w^2-z^2)/2}(w^2-z^2)^m \,\text dw.
$$
Now let $2u = w^2 - z^2$ so $\text du = w\,\text dw$. This gives us
$$
e^{z^2/2} f_Z(z) \propto 2^m \int_0^\infty u^m e^{-u} \,\text du = 2^m \Gamma(m+1).
$$
Because this final integral doesn't depend on $z$, we have shown that $e^{z^2/2} f_Z(z) \propto 1$, therefore
$$
Z \sim \mathcal N(0, 1).
$$ | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1
Here's an algebraic proof. I'm going to instead let $X \sim \chi_{n-1}$ (not squared) so that we need to find $Z := (2Y - 1)X$. These are all guaranteed to be valid densities so I'm not going to track |
21,049 | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1,\frac{n}{2}-1\right)$ independently | $2Y-1$ is distributed like one coordinate of a uniform distribution on the $n-1$ sphere; $X$ has the distribution of the sum of squares of $n-1$ iid standard Normal variates; and these two quantities are independent. Geometrically $(2Y-1)\sqrt{X}$ has the distribution of one coordinate: that is, it must have a standard Normal distribution.
(This argument applies to integral $n=2,3,4,\ldots$.)
If you need some numerical convincing (which is always wise, because it can uncover errors in reasoning and calculation), simulate:
The agreement between the simulated results and the claimed standard Normal distribution is excellent across this range of values of $n$.
Experiment further with the R code that produced these plots if you wish.
n.sim <- 1e5
n <- 2:5
X <- data.frame(Z = c(sapply(n, function(n){
y <- rbeta(n.sim, n/2-1, n/2-1) # Generate values of Y
x <- rchisq(n.sim, n-1) # Generate values of X
(2*y - 1) * sqrt(x) # Return the values of Z
})), n=factor(rep(n, each=n.sim)))
library(ggplot2)
#--Create points along the graph of a standard Normal density
i <- seq(min(z), max(z), length.out=501)
U <- data.frame(X=i, Z=dnorm(i))
#--Plot histograms on top of the density graphs
ggplot(X, aes(Z, ..density..)) +
geom_path(aes(X,Z), data=U, size=1) +
geom_histogram(aes(fill=n), bins=50, alpha=0.5) +
facet_wrap(~ n) +
ggtitle("Histograms of Simulated Values of Z",
paste0("Sample size ", n.sim)) | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1 | $2Y-1$ is distributed like one coordinate of a uniform distribution on the $n-1$ sphere; $X$ has the distribution of the sum of squares of $n-1$ iid standard Normal variates; and these two quantities | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1,\frac{n}{2}-1\right)$ independently
$2Y-1$ is distributed like one coordinate of a uniform distribution on the $n-1$ sphere; $X$ has the distribution of the sum of squares of $n-1$ iid standard Normal variates; and these two quantities are independent. Geometrically $(2Y-1)\sqrt{X}$ has the distribution of one coordinate: that is, it must have a standard Normal distribution.
(This argument applies to integral $n=2,3,4,\ldots$.)
If you need some numerical convincing (which is always wise, because it can uncover errors in reasoning and calculation), simulate:
The agreement between the simulated results and the claimed standard Normal distribution is excellent across this range of values of $n$.
Experiment further with the R code that produced these plots if you wish.
n.sim <- 1e5
n <- 2:5
X <- data.frame(Z = c(sapply(n, function(n){
y <- rbeta(n.sim, n/2-1, n/2-1) # Generate values of Y
x <- rchisq(n.sim, n-1) # Generate values of X
(2*y - 1) * sqrt(x) # Return the values of Z
})), n=factor(rep(n, each=n.sim)))
library(ggplot2)
#--Create points along the graph of a standard Normal density
i <- seq(min(z), max(z), length.out=501)
U <- data.frame(X=i, Z=dnorm(i))
#--Plot histograms on top of the density graphs
ggplot(X, aes(Z, ..density..)) +
geom_path(aes(X,Z), data=U, size=1) +
geom_histogram(aes(fill=n), bins=50, alpha=0.5) +
facet_wrap(~ n) +
ggtitle("Histograms of Simulated Values of Z",
paste0("Sample size ", n.sim)) | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1
$2Y-1$ is distributed like one coordinate of a uniform distribution on the $n-1$ sphere; $X$ has the distribution of the sum of squares of $n-1$ iid standard Normal variates; and these two quantities |
21,050 | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1,\frac{n}{2}-1\right)$ independently | As user @Chaconne has already done, I was able to provide an algebraic proof with this particular transformation. I have not skipped any details.
(We already have $n>2$ for the density of $Y$ to be valid).
Let us consider the transformation $(X,Y)\mapsto (U,V)$ such that $U=(2Y-1)\sqrt{X}$ and $V=X$.
This implies $x=v$ and $y=\frac{1}{2}\left(\frac{u}{\sqrt{v}}+1\right)$.
Now, $x>0\implies v>0$ and $0<y<1\implies-\sqrt{v}<u<\sqrt{v}$,
so that the bivariate support of $(U,V)$ is simply $S=\{(u,v):0<u^2<v<\infty,\,u\in\mathbb{R}\}$.
Absolute value of the Jacobian of transformation is $|J|=\frac{1}{2\sqrt{v}}$.
Joint density of $(U,V)$ is thus
$$f_{U,V}(u,v)=\frac{e^{-\frac{v}{2}}v^{\frac{n-1}{2}-1}\left(\frac{u}{\sqrt{v}}+1\right)^{\frac{n}{2}-2}\left(\frac{1}{2}-\frac{u}{2\sqrt{v}}\right)^{\frac{n}{2}-2}\Gamma(n-2)}{(2\sqrt{v})\,2^{\frac{n-1}{2}+\frac{n}{2}-2}\,\Gamma\left(\frac{n-1}{2}\right)\left(\Gamma\left(\frac{n}{2}-1\right)\right)^2}\mathbf1_{S}$$
$$=\frac{e^{-\frac{v}{2}}v^{\frac{n-4}{2}}(\sqrt{v}+u)^{\frac{n}{2}-2}(\sqrt{v}-u)^{\frac{n}{2}-2}\,\Gamma(n-2)}{2^{\frac{2n-3}{2}+\frac{n}{2}-2}\,(\sqrt{v})^{n-4}\,\Gamma\left(\frac{n-1}{2}\right)\left(\Gamma\left(\frac{n-2}{2}\right)\right)^2}\mathbf1_{S}$$
Now, using Legendre's duplication formula,
$\Gamma(n-2)=\frac{2^{n-3}}{\sqrt \pi}\Gamma\left(\frac{n-2}{2}\right)\Gamma\left(\frac{n-2}{2}+\frac{1}{2}\right)=\frac{2^{n-3}}{\sqrt \pi}\Gamma\left(\frac{n-2}{2}\right)\Gamma\left(\frac{n-1}{2}\right)$ where $n>2$.
So for $n>2$, $$f_{U,V}(u,v)=\frac{2^{n-3}\,e^{-\frac{v}{2}}(v-u^2)^{\frac{n}{2}-2}}{\sqrt \pi\,2^{\frac{3n-7}{2}}\,\Gamma\left(\frac{n}{2}-1\right)}\mathbf1_{S}$$
Marginal pdf of $U$ is then given by
$$f_U(u)=\frac{1}{2^{\frac{n-1}{2}}\sqrt \pi\,\Gamma\left(\frac{n}{2}-1\right)}\int_{u^2}^\infty e^{-\frac{v}{2}}(v-u^2)^{\frac{n}{2}-2}\,\mathrm{d}v$$
$$=\frac{e^{-\frac{u^2}{2}}}{2^{\frac{n-1}{2}}\sqrt \pi\,\Gamma\left(\frac{n}{2}-1\right)}\int_0^\infty e^{-\frac{t}{2}}\,t^{(\frac{n}{2}-1-1)}\,\mathrm{d}t$$
$$=\frac{1}{2^{\frac{n-1}{2}}\sqrt \pi\,\left(\frac{1}{2}\right)^{\frac{n}{2}-1}}e^{-\frac{u^2}{2}}$$
$$=\frac{1}{\sqrt{2\pi}}e^{-u^2/2}\,,u\in\mathbb{R}$$ | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1 | As user @Chaconne has already done, I was able to provide an algebraic proof with this particular transformation. I have not skipped any details.
(We already have $n>2$ for the density of $Y$ to be v | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1,\frac{n}{2}-1\right)$ independently
As user @Chaconne has already done, I was able to provide an algebraic proof with this particular transformation. I have not skipped any details.
(We already have $n>2$ for the density of $Y$ to be valid).
Let us consider the transformation $(X,Y)\mapsto (U,V)$ such that $U=(2Y-1)\sqrt{X}$ and $V=X$.
This implies $x=v$ and $y=\frac{1}{2}\left(\frac{u}{\sqrt{v}}+1\right)$.
Now, $x>0\implies v>0$ and $0<y<1\implies-\sqrt{v}<u<\sqrt{v}$,
so that the bivariate support of $(U,V)$ is simply $S=\{(u,v):0<u^2<v<\infty,\,u\in\mathbb{R}\}$.
Absolute value of the Jacobian of transformation is $|J|=\frac{1}{2\sqrt{v}}$.
Joint density of $(U,V)$ is thus
$$f_{U,V}(u,v)=\frac{e^{-\frac{v}{2}}v^{\frac{n-1}{2}-1}\left(\frac{u}{\sqrt{v}}+1\right)^{\frac{n}{2}-2}\left(\frac{1}{2}-\frac{u}{2\sqrt{v}}\right)^{\frac{n}{2}-2}\Gamma(n-2)}{(2\sqrt{v})\,2^{\frac{n-1}{2}+\frac{n}{2}-2}\,\Gamma\left(\frac{n-1}{2}\right)\left(\Gamma\left(\frac{n}{2}-1\right)\right)^2}\mathbf1_{S}$$
$$=\frac{e^{-\frac{v}{2}}v^{\frac{n-4}{2}}(\sqrt{v}+u)^{\frac{n}{2}-2}(\sqrt{v}-u)^{\frac{n}{2}-2}\,\Gamma(n-2)}{2^{\frac{2n-3}{2}+\frac{n}{2}-2}\,(\sqrt{v})^{n-4}\,\Gamma\left(\frac{n-1}{2}\right)\left(\Gamma\left(\frac{n-2}{2}\right)\right)^2}\mathbf1_{S}$$
Now, using Legendre's duplication formula,
$\Gamma(n-2)=\frac{2^{n-3}}{\sqrt \pi}\Gamma\left(\frac{n-2}{2}\right)\Gamma\left(\frac{n-2}{2}+\frac{1}{2}\right)=\frac{2^{n-3}}{\sqrt \pi}\Gamma\left(\frac{n-2}{2}\right)\Gamma\left(\frac{n-1}{2}\right)$ where $n>2$.
So for $n>2$, $$f_{U,V}(u,v)=\frac{2^{n-3}\,e^{-\frac{v}{2}}(v-u^2)^{\frac{n}{2}-2}}{\sqrt \pi\,2^{\frac{3n-7}{2}}\,\Gamma\left(\frac{n}{2}-1\right)}\mathbf1_{S}$$
Marginal pdf of $U$ is then given by
$$f_U(u)=\frac{1}{2^{\frac{n-1}{2}}\sqrt \pi\,\Gamma\left(\frac{n}{2}-1\right)}\int_{u^2}^\infty e^{-\frac{v}{2}}(v-u^2)^{\frac{n}{2}-2}\,\mathrm{d}v$$
$$=\frac{e^{-\frac{u^2}{2}}}{2^{\frac{n-1}{2}}\sqrt \pi\,\Gamma\left(\frac{n}{2}-1\right)}\int_0^\infty e^{-\frac{t}{2}}\,t^{(\frac{n}{2}-1-1)}\,\mathrm{d}t$$
$$=\frac{1}{2^{\frac{n-1}{2}}\sqrt \pi\,\left(\frac{1}{2}\right)^{\frac{n}{2}-1}}e^{-\frac{u^2}{2}}$$
$$=\frac{1}{\sqrt{2\pi}}e^{-u^2/2}\,,u\in\mathbb{R}$$ | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1
As user @Chaconne has already done, I was able to provide an algebraic proof with this particular transformation. I have not skipped any details.
(We already have $n>2$ for the density of $Y$ to be v |
21,051 | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1,\frac{n}{2}-1\right)$ independently | This is more of a black box answer (i.e., the algebraic details are missing) using Mathematica. In short as @whuber states the answer is that the distribution of $Z$ is a standard normal distribution.
(* Transformation *)
f = {(2 y - 1) Sqrt[x], Sqrt[x]};
sol = Solve[{z == (2 y - 1) Sqrt[x], w == Sqrt[x]}, {x, y}][[1]]
(*{x -> w^2,y -> (w+z)/(2 w)} *)
(* Jacobian *)
J = D[f, {{x, y}}]
(* Joint pdf of Z and W *)
{jointpdf, conditions} = FullSimplify[PDF[BetaDistribution[n/2 - 1, n/2 - 1], y]
PDF[ChiSquareDistribution[n - 1], x] Abs[Det[J]] /. sol,
Assumptions -> {w >= 0, 0 <= y <= 1}][[1, 1]]
(* Integrate over W *)
Integrate[jointpdf Boole[conditions], {w, 0, \[Infinity]}, Assumptions -> {n > 2, z == 0}]
(* 1/Sqrt[2 \[Pi]] *)
Integrate[jointpdf Boole[conditions], {w, 0, \[Infinity]}, Assumptions -> {n > 2, z > 0}]
(* Exp[-(z^2/2)]/Sqrt[2 \[Pi]] *)
Integrate[jointpdf Boole[conditions], {w, 0, \[Infinity]}, Assumptions -> {n > 2, z < 0}]
(* Exp[-(z^2/2)]/Sqrt[2 \[Pi]] *) | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1 | This is more of a black box answer (i.e., the algebraic details are missing) using Mathematica. In short as @whuber states the answer is that the distribution of $Z$ is a standard normal distribution | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1,\frac{n}{2}-1\right)$ independently
This is more of a black box answer (i.e., the algebraic details are missing) using Mathematica. In short as @whuber states the answer is that the distribution of $Z$ is a standard normal distribution.
(* Transformation *)
f = {(2 y - 1) Sqrt[x], Sqrt[x]};
sol = Solve[{z == (2 y - 1) Sqrt[x], w == Sqrt[x]}, {x, y}][[1]]
(*{x -> w^2,y -> (w+z)/(2 w)} *)
(* Jacobian *)
J = D[f, {{x, y}}]
(* Joint pdf of Z and W *)
{jointpdf, conditions} = FullSimplify[PDF[BetaDistribution[n/2 - 1, n/2 - 1], y]
PDF[ChiSquareDistribution[n - 1], x] Abs[Det[J]] /. sol,
Assumptions -> {w >= 0, 0 <= y <= 1}][[1, 1]]
(* Integrate over W *)
Integrate[jointpdf Boole[conditions], {w, 0, \[Infinity]}, Assumptions -> {n > 2, z == 0}]
(* 1/Sqrt[2 \[Pi]] *)
Integrate[jointpdf Boole[conditions], {w, 0, \[Infinity]}, Assumptions -> {n > 2, z > 0}]
(* Exp[-(z^2/2)]/Sqrt[2 \[Pi]] *)
Integrate[jointpdf Boole[conditions], {w, 0, \[Infinity]}, Assumptions -> {n > 2, z < 0}]
(* Exp[-(z^2/2)]/Sqrt[2 \[Pi]] *) | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1
This is more of a black box answer (i.e., the algebraic details are missing) using Mathematica. In short as @whuber states the answer is that the distribution of $Z$ is a standard normal distribution |
21,052 | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1,\frac{n}{2}-1\right)$ independently | Not an answer per se, but it may be worthwhile to point out the connection to Box-Muller transformation.
Consider the Box-Muller transformation $Z=\sqrt{-2\ln U}\sin(2\pi V)$, where $U,V\sim U(0,1)$. We can show that $-\ln U\sim\operatorname{Exp}(1)$, i.e. $-2\ln U\sim\chi^2_2$. On the other hand, we can show that $\sin(2\pi V)$ has the location-scale arcsine distribution, which agrees with the distribution of $2\operatorname{B}(1/2,1/2)-1$. This means Box-Muller transformation is a special case of $(2Y-1)\sqrt{X}$ when $n=3$.
Related:
How to use Box-Muller transform to generate n-dimensional normal
random variables
How to generate uniformly distributed points on the surface of the
3-d unit sphere? | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1 | Not an answer per se, but it may be worthwhile to point out the connection to Box-Muller transformation.
Consider the Box-Muller transformation $Z=\sqrt{-2\ln U}\sin(2\pi V)$, where $U,V\sim U(0,1)$. | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1,\frac{n}{2}-1\right)$ independently
Not an answer per se, but it may be worthwhile to point out the connection to Box-Muller transformation.
Consider the Box-Muller transformation $Z=\sqrt{-2\ln U}\sin(2\pi V)$, where $U,V\sim U(0,1)$. We can show that $-\ln U\sim\operatorname{Exp}(1)$, i.e. $-2\ln U\sim\chi^2_2$. On the other hand, we can show that $\sin(2\pi V)$ has the location-scale arcsine distribution, which agrees with the distribution of $2\operatorname{B}(1/2,1/2)-1$. This means Box-Muller transformation is a special case of $(2Y-1)\sqrt{X}$ when $n=3$.
Related:
How to use Box-Muller transform to generate n-dimensional normal
random variables
How to generate uniformly distributed points on the surface of the
3-d unit sphere? | $(2Y-1)\sqrt X\sim\mathcal N(0,1)$ when $X\sim\chi^2_{n-1}$ and $Y\sim\text{Beta}\left(\frac{n}{2}-1
Not an answer per se, but it may be worthwhile to point out the connection to Box-Muller transformation.
Consider the Box-Muller transformation $Z=\sqrt{-2\ln U}\sin(2\pi V)$, where $U,V\sim U(0,1)$. |
21,053 | Understanding MCMC: what would the alternative be? | You are describing a grid approximation to the posterior, and that is a valid approach, allthough not the most popular. There are quite a few cases in which the posterior distribution can be computed analytically. Monte Carlo Markov Chains, or other approximate methods, are methods to obtain samples of the posterior distribution, that sometimes work when the analytical solution cannot be found.
The analytical solutions that can be found are typically cases of "conjugate" families, and you can find more about that by googling, see for example https://en.wikipedia.org/wiki/Conjugate_prior.
As a first example, if your prior on p is uniform on [0, 1], where p is a success parameter in a simple binomial experiment, the posterior is equal to a Beta distribution. Integration, or summation, can be done explicitly in this case.
If you have finitely many parameter choices, or you use a grid approximation as in your example, a simple summation may be all you need. The number of computations can explode quickly however, if you have a couple of variables and want to use a dense grid.
There are several algorithms for sampling from the posterior. Hamiltonian Monte Carlo, specifically the NUTS sampler, is now popular and used in stan and PyMC3, Metropolis Hastings is the classic. Variational Inference is a relative newcomer, not a sampling method actually but a different way of obtaining an approximation. At the moment, none of the methods, including analytical solutions, are the best, they all work well in specific cases. | Understanding MCMC: what would the alternative be? | You are describing a grid approximation to the posterior, and that is a valid approach, allthough not the most popular. There are quite a few cases in which the posterior distribution can be computed | Understanding MCMC: what would the alternative be?
You are describing a grid approximation to the posterior, and that is a valid approach, allthough not the most popular. There are quite a few cases in which the posterior distribution can be computed analytically. Monte Carlo Markov Chains, or other approximate methods, are methods to obtain samples of the posterior distribution, that sometimes work when the analytical solution cannot be found.
The analytical solutions that can be found are typically cases of "conjugate" families, and you can find more about that by googling, see for example https://en.wikipedia.org/wiki/Conjugate_prior.
As a first example, if your prior on p is uniform on [0, 1], where p is a success parameter in a simple binomial experiment, the posterior is equal to a Beta distribution. Integration, or summation, can be done explicitly in this case.
If you have finitely many parameter choices, or you use a grid approximation as in your example, a simple summation may be all you need. The number of computations can explode quickly however, if you have a couple of variables and want to use a dense grid.
There are several algorithms for sampling from the posterior. Hamiltonian Monte Carlo, specifically the NUTS sampler, is now popular and used in stan and PyMC3, Metropolis Hastings is the classic. Variational Inference is a relative newcomer, not a sampling method actually but a different way of obtaining an approximation. At the moment, none of the methods, including analytical solutions, are the best, they all work well in specific cases. | Understanding MCMC: what would the alternative be?
You are describing a grid approximation to the posterior, and that is a valid approach, allthough not the most popular. There are quite a few cases in which the posterior distribution can be computed |
21,054 | Understanding MCMC: what would the alternative be? | Calculating the denominator does not help in understanding the nature of the posterior distribution (or of any distribution). As discussed in a recent question, to know that the density of a d-dimensional vector $\theta$ is
$$π(θ|x)∝\exp\{−||θ−x||^2−||θ+x||^4−||θ−2x||^6\},\qquad x,θ∈ℝ^d,$$
does not tell me where are the regions of interest for this posterior distribution. | Understanding MCMC: what would the alternative be? | Calculating the denominator does not help in understanding the nature of the posterior distribution (or of any distribution). As discussed in a recent question, to know that the density of a d-dimensi | Understanding MCMC: what would the alternative be?
Calculating the denominator does not help in understanding the nature of the posterior distribution (or of any distribution). As discussed in a recent question, to know that the density of a d-dimensional vector $\theta$ is
$$π(θ|x)∝\exp\{−||θ−x||^2−||θ+x||^4−||θ−2x||^6\},\qquad x,θ∈ℝ^d,$$
does not tell me where are the regions of interest for this posterior distribution. | Understanding MCMC: what would the alternative be?
Calculating the denominator does not help in understanding the nature of the posterior distribution (or of any distribution). As discussed in a recent question, to know that the density of a d-dimensi |
21,055 | Understanding MCMC: what would the alternative be? | Monte Carlo methods are techniques that make use of random numbers. The goal is to find samples $x$ that are distributed according $P(x)$ and it is assumed that $P(x)$ is complex. This means that we cannot evaluate it directly. If this is not the case, you can just compute it analytically. As in your example this would be $P(D)$.
What you propose is essentially a grid search through the space of $x$ and $y$. This can be very exhaustive if $x$ and $y$ are high dimensional and infeasible if they are continuous. Another problem is that you have to compute the cdf in each step.
MCMC methods try to solve this by proposing candidate samples $c_i$ and then accepting or rejecting them depending on some measure. This can in theory be faster then going through all possible combinations. so basically you find samples that are drawn from the prior $P(D)$. A theoretical problem here is that this is only the case in the limit number of samples drawn, i.e. after $\infty$ samples. So you don't know when to stop the Markov Chain. | Understanding MCMC: what would the alternative be? | Monte Carlo methods are techniques that make use of random numbers. The goal is to find samples $x$ that are distributed according $P(x)$ and it is assumed that $P(x)$ is complex. This means that we c | Understanding MCMC: what would the alternative be?
Monte Carlo methods are techniques that make use of random numbers. The goal is to find samples $x$ that are distributed according $P(x)$ and it is assumed that $P(x)$ is complex. This means that we cannot evaluate it directly. If this is not the case, you can just compute it analytically. As in your example this would be $P(D)$.
What you propose is essentially a grid search through the space of $x$ and $y$. This can be very exhaustive if $x$ and $y$ are high dimensional and infeasible if they are continuous. Another problem is that you have to compute the cdf in each step.
MCMC methods try to solve this by proposing candidate samples $c_i$ and then accepting or rejecting them depending on some measure. This can in theory be faster then going through all possible combinations. so basically you find samples that are drawn from the prior $P(D)$. A theoretical problem here is that this is only the case in the limit number of samples drawn, i.e. after $\infty$ samples. So you don't know when to stop the Markov Chain. | Understanding MCMC: what would the alternative be?
Monte Carlo methods are techniques that make use of random numbers. The goal is to find samples $x$ that are distributed according $P(x)$ and it is assumed that $P(x)$ is complex. This means that we c |
21,056 | In linear regression why does the response variable have to be continuous? | There's nothing stopping you using linear regression on any two columns of numbers you like. There are times when it might even be a quite sensible choice.
However, the properties of what you get out won't necessarily be useful (e.g. won't necessarily be all you might want them to be).
Generally with regression you're trying to fit some relationship between the conditional mean of Y and the predictor -- i.e. fit relationships of some form $E(Y|x) = g(x)$; arguably modelling the behavior of the conditional expectation is what 'regression' is. [Linear regression is when you take one particular form for $g$]
For example, consider an extreme cases of discreteness, a response variable whose distribution is at either 0 or 1 and which takes the value 1 with probability that changes as some predictor ($x$) changes. That is $E(Y|x) = P(Y=1|X=x)$.
If you fit that sort of relationship with a linear regression model, then aside from a narrow interval, it will predict values for $E(Y)$ that are impossible -- either below $0$ or above $1$:
Indeed, it's also possible to see that as the expectation approaches the boundaries, the values must more and more frequently take the value at that boundary, so its variance gets smaller than if the expectation were near the middle -- the variance must decrease to 0. So an ordinary regression gets the weights wrong, underweighting the data in the region where the conditional expectation is near 0 or 1. SImilar effects occur if you have a variable bounded between a and b, say (such as each observation being a discrete count out of a known total possible count for that observation)
In addition, we normally expect the conditional mean to asymptote toward the upper and lower limits, which means the relationship would normally be curved, not straight, so our linear regression likely gets it wrong within the range of the data as well.
Similar issues occur with data that's only bounded on one side (e.g. counts that don't have an upper boundary) when you're near that one boundary.
It's possible (if rare) to have discrete data that's not bounded on either end; if the variable takes a lot of different values the discreteness may be of relatively little consequence as long as the model's description of the mean and the variance are reasonable.
Here's an example that it would be completely reasonable to use linear regression on:
Even though in any thin strip of x-values there's only a few different y-values that are likely to be observed (perhaps around 10 for intervals of width 1), the expectation can be well-estimated, and even standard errors and p-values and confidence intervals will all be more or less reasonable in this particular case. Prediction intervals will tend to work somewhat less well (because the non-normality will tend to have a more direct impact in that case)
--
If you want to perform hypothesis tests or calculate confidence or prediction intervals, the usual procedures make an assumption of normality. In some circumstances, that can matter. However, it's possible to inference without making that particular assumption. | In linear regression why does the response variable have to be continuous? | There's nothing stopping you using linear regression on any two columns of numbers you like. There are times when it might even be a quite sensible choice.
However, the properties of what you get out | In linear regression why does the response variable have to be continuous?
There's nothing stopping you using linear regression on any two columns of numbers you like. There are times when it might even be a quite sensible choice.
However, the properties of what you get out won't necessarily be useful (e.g. won't necessarily be all you might want them to be).
Generally with regression you're trying to fit some relationship between the conditional mean of Y and the predictor -- i.e. fit relationships of some form $E(Y|x) = g(x)$; arguably modelling the behavior of the conditional expectation is what 'regression' is. [Linear regression is when you take one particular form for $g$]
For example, consider an extreme cases of discreteness, a response variable whose distribution is at either 0 or 1 and which takes the value 1 with probability that changes as some predictor ($x$) changes. That is $E(Y|x) = P(Y=1|X=x)$.
If you fit that sort of relationship with a linear regression model, then aside from a narrow interval, it will predict values for $E(Y)$ that are impossible -- either below $0$ or above $1$:
Indeed, it's also possible to see that as the expectation approaches the boundaries, the values must more and more frequently take the value at that boundary, so its variance gets smaller than if the expectation were near the middle -- the variance must decrease to 0. So an ordinary regression gets the weights wrong, underweighting the data in the region where the conditional expectation is near 0 or 1. SImilar effects occur if you have a variable bounded between a and b, say (such as each observation being a discrete count out of a known total possible count for that observation)
In addition, we normally expect the conditional mean to asymptote toward the upper and lower limits, which means the relationship would normally be curved, not straight, so our linear regression likely gets it wrong within the range of the data as well.
Similar issues occur with data that's only bounded on one side (e.g. counts that don't have an upper boundary) when you're near that one boundary.
It's possible (if rare) to have discrete data that's not bounded on either end; if the variable takes a lot of different values the discreteness may be of relatively little consequence as long as the model's description of the mean and the variance are reasonable.
Here's an example that it would be completely reasonable to use linear regression on:
Even though in any thin strip of x-values there's only a few different y-values that are likely to be observed (perhaps around 10 for intervals of width 1), the expectation can be well-estimated, and even standard errors and p-values and confidence intervals will all be more or less reasonable in this particular case. Prediction intervals will tend to work somewhat less well (because the non-normality will tend to have a more direct impact in that case)
--
If you want to perform hypothesis tests or calculate confidence or prediction intervals, the usual procedures make an assumption of normality. In some circumstances, that can matter. However, it's possible to inference without making that particular assumption. | In linear regression why does the response variable have to be continuous?
There's nothing stopping you using linear regression on any two columns of numbers you like. There are times when it might even be a quite sensible choice.
However, the properties of what you get out |
21,057 | In linear regression why does the response variable have to be continuous? | I can't comment, so I'll answer: in ordinary linear regression the response variable need not to be continuous, your assumption is not:
$$
y = β_0 + β_1x
$$
but is:
$$
E[y] = β_0 + β_1x.
$$
Ordinary linear regression derives from the minimization of the squared residuals, which is a method believed to be appropriate for continuous and discrete variables (see Gauss-Markof theorem). Of course generally used confidence or prediction intervals and hypothesis tests lay on normal distribution assumption, like Glen_b correctly pointed out, but OLS estimates of parameters does not. | In linear regression why does the response variable have to be continuous? | I can't comment, so I'll answer: in ordinary linear regression the response variable need not to be continuous, your assumption is not:
$$
y = β_0 + β_1x
$$
but is:
$$
E[y] = β_0 + β_1x.
$$
Ordinary l | In linear regression why does the response variable have to be continuous?
I can't comment, so I'll answer: in ordinary linear regression the response variable need not to be continuous, your assumption is not:
$$
y = β_0 + β_1x
$$
but is:
$$
E[y] = β_0 + β_1x.
$$
Ordinary linear regression derives from the minimization of the squared residuals, which is a method believed to be appropriate for continuous and discrete variables (see Gauss-Markof theorem). Of course generally used confidence or prediction intervals and hypothesis tests lay on normal distribution assumption, like Glen_b correctly pointed out, but OLS estimates of parameters does not. | In linear regression why does the response variable have to be continuous?
I can't comment, so I'll answer: in ordinary linear regression the response variable need not to be continuous, your assumption is not:
$$
y = β_0 + β_1x
$$
but is:
$$
E[y] = β_0 + β_1x.
$$
Ordinary l |
21,058 | In linear regression why does the response variable have to be continuous? | In linear regression, the reason we need response to be continuous is combing from the assumptions we made. If the independent variable $x$ is continuous, then we assume the linear relationship between $x$ and $y$ is
$$y=\beta_0+\beta_1 x+\epsilon$$
where, the residual $\epsilon$ are normal. And form the formula we know $y$ is continuous.
On the other hand, in generalized linear model, the response variable can be discrete / categorical (logistic regression). Or count (Poisson regression).
Edit to address mark999 and remapt's comments.
Linear regression is a general term that may people use it differently. There is nothing to prevent us to use it on discrete variable OR the independent variable and dependent variable are not linear.
If we assume nothing and run linear regression, we still can get results. And if the results satisfy our needs, then the whole process is OK. However, As Glan_b said
If you want to perform hypothesis tests or calculate confidence or prediction intervals, the usual procedures make an assumption of normality.
I have this answer is because I assume OP is asking the linear regression from classical statistics book where we usually has this assumption when teach linear regression. | In linear regression why does the response variable have to be continuous? | In linear regression, the reason we need response to be continuous is combing from the assumptions we made. If the independent variable $x$ is continuous, then we assume the linear relationship betwee | In linear regression why does the response variable have to be continuous?
In linear regression, the reason we need response to be continuous is combing from the assumptions we made. If the independent variable $x$ is continuous, then we assume the linear relationship between $x$ and $y$ is
$$y=\beta_0+\beta_1 x+\epsilon$$
where, the residual $\epsilon$ are normal. And form the formula we know $y$ is continuous.
On the other hand, in generalized linear model, the response variable can be discrete / categorical (logistic regression). Or count (Poisson regression).
Edit to address mark999 and remapt's comments.
Linear regression is a general term that may people use it differently. There is nothing to prevent us to use it on discrete variable OR the independent variable and dependent variable are not linear.
If we assume nothing and run linear regression, we still can get results. And if the results satisfy our needs, then the whole process is OK. However, As Glan_b said
If you want to perform hypothesis tests or calculate confidence or prediction intervals, the usual procedures make an assumption of normality.
I have this answer is because I assume OP is asking the linear regression from classical statistics book where we usually has this assumption when teach linear regression. | In linear regression why does the response variable have to be continuous?
In linear regression, the reason we need response to be continuous is combing from the assumptions we made. If the independent variable $x$ is continuous, then we assume the linear relationship betwee |
21,059 | In linear regression why does the response variable have to be continuous? | It doesn't. If the model works, who cares?
From a theoretic perspective the answers above are correct. However, in practical terms, it all depends on the domain of your data and the predictive power of your model.
One real-life example is the old MDS Bankruptcy Model. This was one of the early risk scores used by consumer credit lenders to predict the likelihood that a borrower would declare bankruptcy. This model used detailed data from the borrower's credit report and and a binary 0/1 flag to indicate bankruptcy over the prediction period. Then then fed that data into... yep.. you guessed it.
A Plain Old Linear Regression
I once got the opportunity to talk to one of the people who built this model. I asked him about the violation of assumptions. He explained that even though it completely violated the assumptions about residuals, etc. he didn't care.
Turns out...
This 0/1 linear regression model (when standardized/scaled to an easy-to-read score and paired with an appropriate cutoff) validated cleanly against holdout samples of data & performed very well as a Good/Bad discriminator for Bankruptcy.
The model was used for years as a 2nd credit score to guard against bankruptcy side by side with FICO's risk score (which was designed to predict 60+ days credit delinquency). | In linear regression why does the response variable have to be continuous? | It doesn't. If the model works, who cares?
From a theoretic perspective the answers above are correct. However, in practical terms, it all depends on the domain of your data and the predictive power | In linear regression why does the response variable have to be continuous?
It doesn't. If the model works, who cares?
From a theoretic perspective the answers above are correct. However, in practical terms, it all depends on the domain of your data and the predictive power of your model.
One real-life example is the old MDS Bankruptcy Model. This was one of the early risk scores used by consumer credit lenders to predict the likelihood that a borrower would declare bankruptcy. This model used detailed data from the borrower's credit report and and a binary 0/1 flag to indicate bankruptcy over the prediction period. Then then fed that data into... yep.. you guessed it.
A Plain Old Linear Regression
I once got the opportunity to talk to one of the people who built this model. I asked him about the violation of assumptions. He explained that even though it completely violated the assumptions about residuals, etc. he didn't care.
Turns out...
This 0/1 linear regression model (when standardized/scaled to an easy-to-read score and paired with an appropriate cutoff) validated cleanly against holdout samples of data & performed very well as a Good/Bad discriminator for Bankruptcy.
The model was used for years as a 2nd credit score to guard against bankruptcy side by side with FICO's risk score (which was designed to predict 60+ days credit delinquency). | In linear regression why does the response variable have to be continuous?
It doesn't. If the model works, who cares?
From a theoretic perspective the answers above are correct. However, in practical terms, it all depends on the domain of your data and the predictive power |
21,060 | what does one mean by numerical integration is too expensive? | In the context of computational problems, including numerical methods for Bayesian inference, the phrase "too expensive" generally could refer to two issues
a particular problem is too "large" to compute for a particular "budget"
a general approach scales badly, i.e. has high computational complexity
For either case, the computational resources comprising the "budget" may consist of things like CPU cycles (time complexity), memory (space complexity), or communication bandwidth (within or between compute nodes). In the second instance, "too expensive" would mean intractable.
In the context of Bayesian computation, the quote is likely referring to issues with marginalization over a large number of variables.
For example, the abstract of this recent paper begins
Integration is affected by the curse of dimensionality and quickly becomes intractable as the dimensionality of the problem grows.
and goes on to say
We propose a randomized algorithm that ... can in turn be used, for instance, for marginal computation or model selection.
(For comparison, this recent book chapter discusses methods considered "not too expensive".) | what does one mean by numerical integration is too expensive? | In the context of computational problems, including numerical methods for Bayesian inference, the phrase "too expensive" generally could refer to two issues
a particular problem is too "large" to com | what does one mean by numerical integration is too expensive?
In the context of computational problems, including numerical methods for Bayesian inference, the phrase "too expensive" generally could refer to two issues
a particular problem is too "large" to compute for a particular "budget"
a general approach scales badly, i.e. has high computational complexity
For either case, the computational resources comprising the "budget" may consist of things like CPU cycles (time complexity), memory (space complexity), or communication bandwidth (within or between compute nodes). In the second instance, "too expensive" would mean intractable.
In the context of Bayesian computation, the quote is likely referring to issues with marginalization over a large number of variables.
For example, the abstract of this recent paper begins
Integration is affected by the curse of dimensionality and quickly becomes intractable as the dimensionality of the problem grows.
and goes on to say
We propose a randomized algorithm that ... can in turn be used, for instance, for marginal computation or model selection.
(For comparison, this recent book chapter discusses methods considered "not too expensive".) | what does one mean by numerical integration is too expensive?
In the context of computational problems, including numerical methods for Bayesian inference, the phrase "too expensive" generally could refer to two issues
a particular problem is too "large" to com |
21,061 | what does one mean by numerical integration is too expensive? | I will give you an example on discrete case to show why integration / sum over is very expensive.
Suppose we have $100$ binary random variables, and we have the joint distribution $P(X_1, X_2, \cdots, X_{100})$. (In fact, it is impossible to store the joint distribution in a table, because there are $2^{100}$ values. Let us assume we have the it in table and in RAM now.)
To get a marginal distribution on $P(X_1)$, we need to sum over other random variables. (In continuous case, it is integrate over.)
$$P(X_1)=\sum_{X_2}\sum_{X_3}\cdots \sum_{X_{100}}P(X_1, X_2, \cdots, X_{100})$$
We are summing over $99$ variables, Therefore, there are exponentiation number of operations, in this case, it is $2^{99}$, which is a huge number that all the computers in earth will not able to do.
In probabilistic graphical models literature, such way of calculating marginal distribution is called "brute force" approach to perform "inference". By name, we may know it is expensive. And people use many other ways to perform the inference, e.g., getting the marginal distribution effectively. "Other ways" including approximate inference, etc. | what does one mean by numerical integration is too expensive? | I will give you an example on discrete case to show why integration / sum over is very expensive.
Suppose we have $100$ binary random variables, and we have the joint distribution $P(X_1, X_2, \cdots, | what does one mean by numerical integration is too expensive?
I will give you an example on discrete case to show why integration / sum over is very expensive.
Suppose we have $100$ binary random variables, and we have the joint distribution $P(X_1, X_2, \cdots, X_{100})$. (In fact, it is impossible to store the joint distribution in a table, because there are $2^{100}$ values. Let us assume we have the it in table and in RAM now.)
To get a marginal distribution on $P(X_1)$, we need to sum over other random variables. (In continuous case, it is integrate over.)
$$P(X_1)=\sum_{X_2}\sum_{X_3}\cdots \sum_{X_{100}}P(X_1, X_2, \cdots, X_{100})$$
We are summing over $99$ variables, Therefore, there are exponentiation number of operations, in this case, it is $2^{99}$, which is a huge number that all the computers in earth will not able to do.
In probabilistic graphical models literature, such way of calculating marginal distribution is called "brute force" approach to perform "inference". By name, we may know it is expensive. And people use many other ways to perform the inference, e.g., getting the marginal distribution effectively. "Other ways" including approximate inference, etc. | what does one mean by numerical integration is too expensive?
I will give you an example on discrete case to show why integration / sum over is very expensive.
Suppose we have $100$ binary random variables, and we have the joint distribution $P(X_1, X_2, \cdots, |
21,062 | what does one mean by numerical integration is too expensive? | Usually when performing Bayesian inference it's easy to encounter heavy integration over nuisance variables for instance. Another example can be a numerical sampling as in this case from a likelihood function, meaning to perform a random sampling from a given distribution. As the number of model parameters increases, this sampling becomes extremely heavy and various computational methods have been developed to speed up the procedure and allow very fast implementations, keeping of course a high level of accuracy. These tecniques are for instance MC, MCMC, Metropolis ecc. Take a look in Bayesian data analysis by Gelman et. al it should give you a broad introduction! good luck | what does one mean by numerical integration is too expensive? | Usually when performing Bayesian inference it's easy to encounter heavy integration over nuisance variables for instance. Another example can be a numerical sampling as in this case from a likelihood | what does one mean by numerical integration is too expensive?
Usually when performing Bayesian inference it's easy to encounter heavy integration over nuisance variables for instance. Another example can be a numerical sampling as in this case from a likelihood function, meaning to perform a random sampling from a given distribution. As the number of model parameters increases, this sampling becomes extremely heavy and various computational methods have been developed to speed up the procedure and allow very fast implementations, keeping of course a high level of accuracy. These tecniques are for instance MC, MCMC, Metropolis ecc. Take a look in Bayesian data analysis by Gelman et. al it should give you a broad introduction! good luck | what does one mean by numerical integration is too expensive?
Usually when performing Bayesian inference it's easy to encounter heavy integration over nuisance variables for instance. Another example can be a numerical sampling as in this case from a likelihood |
21,063 | distribution of the ratio of two gamma random variables [duplicate] | $\beta_1X \sim Gamma(\alpha_1, 1)$ and $\beta_2 Y \sim Gamma(\alpha_2, 1)$, then according to Wikipedia
$$\dfrac{\beta_1X}{\beta_2Y} \sim \text{Beta Prime distribution}(\alpha_1, \alpha_2). $$
In addition, short hand you write $\beta'(\alpha_1, \alpha_2)$. Now the Wiki page also describes the density of the general Beta-prime distribution $\beta'(\alpha_1, \alpha_2, p, q)$, as
$$ f(x) = \dfrac{p \left( \frac{x}{q}\right)^{\alpha_1 p-1} \left(1 + \left(\frac{x}{q} \right)^p \right)^{-\alpha_1 -\alpha_2} }{q B(\alpha_1, \alpha_2)}.$$
The Beta-prime distribution is the special case of the general Beta-prime distribution when $p = q = 1$. In addition the wiki page says for a constant $k$
$$k\beta'(\alpha_1, \alpha_2, p, q) = \beta'(\alpha_1, \alpha_2, p, kq). $$
Thus,
$$\dfrac{X}{Y} \sim \beta'\left(\alpha_1, \alpha_2, 1, \frac{\beta_2}{\beta_1} \right).$$ | distribution of the ratio of two gamma random variables [duplicate] | $\beta_1X \sim Gamma(\alpha_1, 1)$ and $\beta_2 Y \sim Gamma(\alpha_2, 1)$, then according to Wikipedia
$$\dfrac{\beta_1X}{\beta_2Y} \sim \text{Beta Prime distribution}(\alpha_1, \alpha_2). $$
In addi | distribution of the ratio of two gamma random variables [duplicate]
$\beta_1X \sim Gamma(\alpha_1, 1)$ and $\beta_2 Y \sim Gamma(\alpha_2, 1)$, then according to Wikipedia
$$\dfrac{\beta_1X}{\beta_2Y} \sim \text{Beta Prime distribution}(\alpha_1, \alpha_2). $$
In addition, short hand you write $\beta'(\alpha_1, \alpha_2)$. Now the Wiki page also describes the density of the general Beta-prime distribution $\beta'(\alpha_1, \alpha_2, p, q)$, as
$$ f(x) = \dfrac{p \left( \frac{x}{q}\right)^{\alpha_1 p-1} \left(1 + \left(\frac{x}{q} \right)^p \right)^{-\alpha_1 -\alpha_2} }{q B(\alpha_1, \alpha_2)}.$$
The Beta-prime distribution is the special case of the general Beta-prime distribution when $p = q = 1$. In addition the wiki page says for a constant $k$
$$k\beta'(\alpha_1, \alpha_2, p, q) = \beta'(\alpha_1, \alpha_2, p, kq). $$
Thus,
$$\dfrac{X}{Y} \sim \beta'\left(\alpha_1, \alpha_2, 1, \frac{\beta_2}{\beta_1} \right).$$ | distribution of the ratio of two gamma random variables [duplicate]
$\beta_1X \sim Gamma(\alpha_1, 1)$ and $\beta_2 Y \sim Gamma(\alpha_2, 1)$, then according to Wikipedia
$$\dfrac{\beta_1X}{\beta_2Y} \sim \text{Beta Prime distribution}(\alpha_1, \alpha_2). $$
In addi |
21,064 | distribution of the ratio of two gamma random variables [duplicate] | Greenparker's reply says it all, but you can also note that $\Gamma$ distributions can be expressed as scaled $\chi^2$ distributions, and that the properly scaled ratio of two $\chi^2$ random variables follows an $F$ distribution.
Following the parametrization and scaling rule above, if $X\sim\Gamma_{(\alpha,\beta)}$, then $2\beta X\sim\chi^2_{2\alpha}$
This means that for your two Gamma-distributed variables $X$ and $Y$,
$$\frac{\alpha_2\beta_1 X}{\alpha_1\beta_2 Y}\sim F_{(2\alpha_1,2\alpha_2)}$$
where $F$ is the $F$ distribution. You could also say that X/Y follows a scaled $F$ distribution. | distribution of the ratio of two gamma random variables [duplicate] | Greenparker's reply says it all, but you can also note that $\Gamma$ distributions can be expressed as scaled $\chi^2$ distributions, and that the properly scaled ratio of two $\chi^2$ random variable | distribution of the ratio of two gamma random variables [duplicate]
Greenparker's reply says it all, but you can also note that $\Gamma$ distributions can be expressed as scaled $\chi^2$ distributions, and that the properly scaled ratio of two $\chi^2$ random variables follows an $F$ distribution.
Following the parametrization and scaling rule above, if $X\sim\Gamma_{(\alpha,\beta)}$, then $2\beta X\sim\chi^2_{2\alpha}$
This means that for your two Gamma-distributed variables $X$ and $Y$,
$$\frac{\alpha_2\beta_1 X}{\alpha_1\beta_2 Y}\sim F_{(2\alpha_1,2\alpha_2)}$$
where $F$ is the $F$ distribution. You could also say that X/Y follows a scaled $F$ distribution. | distribution of the ratio of two gamma random variables [duplicate]
Greenparker's reply says it all, but you can also note that $\Gamma$ distributions can be expressed as scaled $\chi^2$ distributions, and that the properly scaled ratio of two $\chi^2$ random variable |
21,065 | How to transform leptokurtic distribution to normality? | I use heavy tail Lambert W x F distributions to describe and transform leptokurtic data. See (my) following posts for more details and references:
Transformation to increase kurtosis and skewness of normal r.v: this shows some illustrations of how the densities vary when varying $\delta$.
What's the distribution of these data?: an application example of how to use this to estimate model parameters and Gaussianize your data.
Here is a reproducible example using the LambertW R package.
library(LambertW)
set.seed(1)
theta.tmp <- list(beta = c(2000, 400), delta = 0.2)
yy <- rLambertW(n = 100, distname = "normal",
theta = theta.tmp)
test_norm(yy)
## $seed
## [1] 267509
##
## $shapiro.wilk
##
## Shapiro-Wilk normality test
##
## data: data.test
## W = 1, p-value = 0.008
##
##
## $shapiro.francia
##
## Shapiro-Francia normality test
##
## data: data.test
## W = 1, p-value = 0.003
##
##
## $anderson.darling
##
## Anderson-Darling normality test
##
## data: data
## A = 1, p-value = 0.01
The qqplot of yy is very close to your qqplot in the original post and the data is indeed slightly leptokurtic with a kurtosis of 5. Hence your data can be well described by a Lambert W $\times$ Gaussian distribution with input $X \sim N (2000, 400)$ and a tail parameter of $\delta = 0.2$ (which implies that only moments up to order $\leq 5$ exist).
Now back to your question: how to make this leptokurtic data normal again? Well, we can estimate the parameters of the distribution using MLE (or for methods of moments use IGMM()),
mod.Lh <- MLE_LambertW(yy, distname = "normal", type = "h")
summary(mod.Lh)
## Call: MLE_LambertW(y = yy, distname = "normal", type = "h")
## Estimation method: MLE
## Input distribution: normal
##
## Parameter estimates:
## Estimate Std. Error t value Pr(>|t|)
## mu 2.05e+03 4.03e+01 50.88 <2e-16 ***
## sigma 3.64e+02 4.36e+01 8.37 <2e-16 ***
## delta 1.64e-01 7.84e-02 2.09 0.037 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## --------------------------------------------------------------
##
## Given these input parameter estimates the moments of the output random variable are
## (assuming Gaussian input):
## mu_y = 2052; sigma_y = 491; skewness = 0; kurtosis = 13.
and then use the bijective inverse transformation (based on W_delta()) to backtransform the data to the input $X$, which -- by design -- should be very close to a normal.
# get_input() handles does the right transformations automatically based on
# estimates in mod.Lh
xx <- get_input(mod.Lh)
test_norm(xx)
## $seed
## [1] 218646
##
## $shapiro.wilk
##
## Shapiro-Wilk normality test
##
## data: data.test
## W = 1, p-value = 1
##
##
## $shapiro.francia
##
## Shapiro-Francia normality test
##
## data: data.test
## W = 1, p-value = 1
##
##
## $anderson.darling
##
## Anderson-Darling normality test
##
## data: data
## A = 0.1, p-value = 1
Voila! | How to transform leptokurtic distribution to normality? | I use heavy tail Lambert W x F distributions to describe and transform leptokurtic data. See (my) following posts for more details and references:
Transformation to increase kurtosis and skewness of | How to transform leptokurtic distribution to normality?
I use heavy tail Lambert W x F distributions to describe and transform leptokurtic data. See (my) following posts for more details and references:
Transformation to increase kurtosis and skewness of normal r.v: this shows some illustrations of how the densities vary when varying $\delta$.
What's the distribution of these data?: an application example of how to use this to estimate model parameters and Gaussianize your data.
Here is a reproducible example using the LambertW R package.
library(LambertW)
set.seed(1)
theta.tmp <- list(beta = c(2000, 400), delta = 0.2)
yy <- rLambertW(n = 100, distname = "normal",
theta = theta.tmp)
test_norm(yy)
## $seed
## [1] 267509
##
## $shapiro.wilk
##
## Shapiro-Wilk normality test
##
## data: data.test
## W = 1, p-value = 0.008
##
##
## $shapiro.francia
##
## Shapiro-Francia normality test
##
## data: data.test
## W = 1, p-value = 0.003
##
##
## $anderson.darling
##
## Anderson-Darling normality test
##
## data: data
## A = 1, p-value = 0.01
The qqplot of yy is very close to your qqplot in the original post and the data is indeed slightly leptokurtic with a kurtosis of 5. Hence your data can be well described by a Lambert W $\times$ Gaussian distribution with input $X \sim N (2000, 400)$ and a tail parameter of $\delta = 0.2$ (which implies that only moments up to order $\leq 5$ exist).
Now back to your question: how to make this leptokurtic data normal again? Well, we can estimate the parameters of the distribution using MLE (or for methods of moments use IGMM()),
mod.Lh <- MLE_LambertW(yy, distname = "normal", type = "h")
summary(mod.Lh)
## Call: MLE_LambertW(y = yy, distname = "normal", type = "h")
## Estimation method: MLE
## Input distribution: normal
##
## Parameter estimates:
## Estimate Std. Error t value Pr(>|t|)
## mu 2.05e+03 4.03e+01 50.88 <2e-16 ***
## sigma 3.64e+02 4.36e+01 8.37 <2e-16 ***
## delta 1.64e-01 7.84e-02 2.09 0.037 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## --------------------------------------------------------------
##
## Given these input parameter estimates the moments of the output random variable are
## (assuming Gaussian input):
## mu_y = 2052; sigma_y = 491; skewness = 0; kurtosis = 13.
and then use the bijective inverse transformation (based on W_delta()) to backtransform the data to the input $X$, which -- by design -- should be very close to a normal.
# get_input() handles does the right transformations automatically based on
# estimates in mod.Lh
xx <- get_input(mod.Lh)
test_norm(xx)
## $seed
## [1] 218646
##
## $shapiro.wilk
##
## Shapiro-Wilk normality test
##
## data: data.test
## W = 1, p-value = 1
##
##
## $shapiro.francia
##
## Shapiro-Francia normality test
##
## data: data.test
## W = 1, p-value = 1
##
##
## $anderson.darling
##
## Anderson-Darling normality test
##
## data: data
## A = 0.1, p-value = 1
Voila! | How to transform leptokurtic distribution to normality?
I use heavy tail Lambert W x F distributions to describe and transform leptokurtic data. See (my) following posts for more details and references:
Transformation to increase kurtosis and skewness of |
21,066 | How to transform leptokurtic distribution to normality? | Credit for this answer goes to @NickCox's suggestion in the comments section of the original question. He suggested I subtract the median of the data and apply the transformation to the deviations. For instance, $\text{sign(.)}\cdot\text{abs(.)}^{\frac 1 3}$, with $Y-\text{median}(Y)$ as the argument.
Although the cube root transformation didn't work out well, it turns out the square root and the more obscure three-quarters root work well.
Here was the original kernel density plot corresponding to the Q-Q plot of the leptokurtic variable in the original question:
After applying the square root transformation to the deviations, the Q-Q plot looks like this:
Better, but it can be closer.
Hammering some more, applying the three-quarters root transformation to the deviations gives:
And the final kernel density of this transformed variable looks like this:
Looks close to me. | How to transform leptokurtic distribution to normality? | Credit for this answer goes to @NickCox's suggestion in the comments section of the original question. He suggested I subtract the median of the data and apply the transformation to the deviations. | How to transform leptokurtic distribution to normality?
Credit for this answer goes to @NickCox's suggestion in the comments section of the original question. He suggested I subtract the median of the data and apply the transformation to the deviations. For instance, $\text{sign(.)}\cdot\text{abs(.)}^{\frac 1 3}$, with $Y-\text{median}(Y)$ as the argument.
Although the cube root transformation didn't work out well, it turns out the square root and the more obscure three-quarters root work well.
Here was the original kernel density plot corresponding to the Q-Q plot of the leptokurtic variable in the original question:
After applying the square root transformation to the deviations, the Q-Q plot looks like this:
Better, but it can be closer.
Hammering some more, applying the three-quarters root transformation to the deviations gives:
And the final kernel density of this transformed variable looks like this:
Looks close to me. | How to transform leptokurtic distribution to normality?
Credit for this answer goes to @NickCox's suggestion in the comments section of the original question. He suggested I subtract the median of the data and apply the transformation to the deviations. |
21,067 | How to transform leptokurtic distribution to normality? | In many cases, there may simply be no simple-form monotonic transformation that will produce a close-to-normal result.
For example, imagine that we have a distribution which is a finite mixture of lognormal distributions of various parameters. A log transform would transform any of the components of the mixture to normality, but the mixture of normals in the transformed data leaves you with something that's not normal.
Or there may be relatively nice transform, but not of one of the forms you'd think to try -- if you don't know the distribution of the data, you may not find it. For example, if the data were gamma-distributed, you won't even find the exact transform to normality (which certainly exists) unless I tell you exactly what the distribution is (though you might stumble upon the cube-root transformation that in this case would make it pretty close to normal as long as the shape parameter isn't too small).
There are myriad ways in which the data can look reasonably amenable to being transformed but which doesn't look great on any of a list of obvious transformations.
If you can give us access to the data, it may well be that we can either spot a transformation that does okay -- or that we can show you why you won't find one.
Just from the visual impression there, it looks rather like a mixture of two normals with different scales. There's only a slight hint of asymmetry, which you could easily observe by chance. Here's an example of a sample from a mixture of two normals with common mean - as you see it looks quite a bit like your plot (but other samples may look heavier or lighter tailed - at this sample size there's a lot of variation in the order statistics outside 1 sd either side of the mean).
In fact here are yours and mine superimposed:
$\quad\quad\quad $ | How to transform leptokurtic distribution to normality? | In many cases, there may simply be no simple-form monotonic transformation that will produce a close-to-normal result.
For example, imagine that we have a distribution which is a finite mixture of lo | How to transform leptokurtic distribution to normality?
In many cases, there may simply be no simple-form monotonic transformation that will produce a close-to-normal result.
For example, imagine that we have a distribution which is a finite mixture of lognormal distributions of various parameters. A log transform would transform any of the components of the mixture to normality, but the mixture of normals in the transformed data leaves you with something that's not normal.
Or there may be relatively nice transform, but not of one of the forms you'd think to try -- if you don't know the distribution of the data, you may not find it. For example, if the data were gamma-distributed, you won't even find the exact transform to normality (which certainly exists) unless I tell you exactly what the distribution is (though you might stumble upon the cube-root transformation that in this case would make it pretty close to normal as long as the shape parameter isn't too small).
There are myriad ways in which the data can look reasonably amenable to being transformed but which doesn't look great on any of a list of obvious transformations.
If you can give us access to the data, it may well be that we can either spot a transformation that does okay -- or that we can show you why you won't find one.
Just from the visual impression there, it looks rather like a mixture of two normals with different scales. There's only a slight hint of asymmetry, which you could easily observe by chance. Here's an example of a sample from a mixture of two normals with common mean - as you see it looks quite a bit like your plot (but other samples may look heavier or lighter tailed - at this sample size there's a lot of variation in the order statistics outside 1 sd either side of the mean).
In fact here are yours and mine superimposed:
$\quad\quad\quad $ | How to transform leptokurtic distribution to normality?
In many cases, there may simply be no simple-form monotonic transformation that will produce a close-to-normal result.
For example, imagine that we have a distribution which is a finite mixture of lo |
21,068 | Term frequency/inverse document frequency (TF/IDF): weighting | Wikipedia has a good article on the topic, complete with formulas. The values in your matrix are the term frequencies. You just need to find the idf: (log((total documents)/(number of docs with the term)) and multiple the 2 values.
In R, you could do so as follows:
set.seed(42)
d <- data.frame(w=sample(LETTERS, 50, replace=TRUE))
d <- model.matrix(~0+w, data=d)
tf <- d
idf <- log(nrow(d)/colSums(d))
tfidf <- d
for(word in names(idf)){
tfidf[,word] <- tf[,word] * idf[word]
}
Here's the datasets:
> colSums(d)
wA wC wD wF wG wH wJ wK wL wM wN wO wP wQ wR wS wT wV wX wY wZ
3 1 3 1 1 1 1 2 4 2 2 1 1 3 2 2 2 4 5 5 4
> head(d)
wA wC wD wF wG wH wJ wK wL wM wN wO wP wQ wR wS wT wV wX wY wZ
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
3 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
5 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
6 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
> head(round(tfidf, 2))
wA wC wD wF wG wH wJ wK wL wM wN wO wP wQ wR wS wT wV wX wY wZ
1 0 0 0 0 0 0.00 0 0 0 0 0.00 0 0 0.00 0 0 0 0.00 2.3 0.0 0
2 0 0 0 0 0 0.00 0 0 0 0 0.00 0 0 0.00 0 0 0 0.00 0.0 2.3 0
3 0 0 0 0 0 3.91 0 0 0 0 0.00 0 0 0.00 0 0 0 0.00 0.0 0.0 0
4 0 0 0 0 0 0.00 0 0 0 0 0.00 0 0 0.00 0 0 0 2.53 0.0 0.0 0
5 0 0 0 0 0 0.00 0 0 0 0 0.00 0 0 2.81 0 0 0 0.00 0.0 0.0 0
6 0 0 0 0 0 0.00 0 0 0 0 3.22 0 0 0.00 0 0 0 0.00 0.0 0.0 0
You can also look at the idf of each term:
> log(nrow(d)/colSums(d))
wA wC wD wF wG wH wJ wK wL wM wN wO wP wQ wR wS wT wV wX wY wZ
2.813411 3.912023 2.813411 3.912023 3.912023 3.912023 3.912023 3.218876 2.525729 3.218876 3.218876 3.912023 3.912023 2.813411 3.218876 3.218876 3.218876 2.525729 2.302585 2.302585 2.525729 | Term frequency/inverse document frequency (TF/IDF): weighting | Wikipedia has a good article on the topic, complete with formulas. The values in your matrix are the term frequencies. You just need to find the idf: (log((total documents)/(number of docs with the | Term frequency/inverse document frequency (TF/IDF): weighting
Wikipedia has a good article on the topic, complete with formulas. The values in your matrix are the term frequencies. You just need to find the idf: (log((total documents)/(number of docs with the term)) and multiple the 2 values.
In R, you could do so as follows:
set.seed(42)
d <- data.frame(w=sample(LETTERS, 50, replace=TRUE))
d <- model.matrix(~0+w, data=d)
tf <- d
idf <- log(nrow(d)/colSums(d))
tfidf <- d
for(word in names(idf)){
tfidf[,word] <- tf[,word] * idf[word]
}
Here's the datasets:
> colSums(d)
wA wC wD wF wG wH wJ wK wL wM wN wO wP wQ wR wS wT wV wX wY wZ
3 1 3 1 1 1 1 2 4 2 2 1 1 3 2 2 2 4 5 5 4
> head(d)
wA wC wD wF wG wH wJ wK wL wM wN wO wP wQ wR wS wT wV wX wY wZ
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
3 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
5 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
6 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
> head(round(tfidf, 2))
wA wC wD wF wG wH wJ wK wL wM wN wO wP wQ wR wS wT wV wX wY wZ
1 0 0 0 0 0 0.00 0 0 0 0 0.00 0 0 0.00 0 0 0 0.00 2.3 0.0 0
2 0 0 0 0 0 0.00 0 0 0 0 0.00 0 0 0.00 0 0 0 0.00 0.0 2.3 0
3 0 0 0 0 0 3.91 0 0 0 0 0.00 0 0 0.00 0 0 0 0.00 0.0 0.0 0
4 0 0 0 0 0 0.00 0 0 0 0 0.00 0 0 0.00 0 0 0 2.53 0.0 0.0 0
5 0 0 0 0 0 0.00 0 0 0 0 0.00 0 0 2.81 0 0 0 0.00 0.0 0.0 0
6 0 0 0 0 0 0.00 0 0 0 0 3.22 0 0 0.00 0 0 0 0.00 0.0 0.0 0
You can also look at the idf of each term:
> log(nrow(d)/colSums(d))
wA wC wD wF wG wH wJ wK wL wM wN wO wP wQ wR wS wT wV wX wY wZ
2.813411 3.912023 2.813411 3.912023 3.912023 3.912023 3.912023 3.218876 2.525729 3.218876 3.218876 3.912023 3.912023 2.813411 3.218876 3.218876 3.218876 2.525729 2.302585 2.302585 2.525729 | Term frequency/inverse document frequency (TF/IDF): weighting
Wikipedia has a good article on the topic, complete with formulas. The values in your matrix are the term frequencies. You just need to find the idf: (log((total documents)/(number of docs with the |
21,069 | Term frequency/inverse document frequency (TF/IDF): weighting | there is package tm (text mining) http://cran.r-project.org/web/packages/tm/index.html which should do exactly you need:
#read 1000 txt articles from directory data/txt
corpus <-Corpus(DirSource("data/txt"), readerControl = list(blank.lines.skip=TRUE));
#some preprocessing
corpus <- tm_map(corpus, removeWords, stopwords("english"))
corpus <- tm_map(corpus, stripWhitespace)
corpus <- tm_map(corpus, stemDocument, language="english")
#creating term matrix with TF-IDF weighting
terms <-DocumentTermMatrix(corpus,control = list(weighting = function(x) weightTfIdf(x, normalize = FALSE)))
#or compute cosine distance among documents
dissimilarity(tdm, method = "cosine")
R is a functional language so reading code can be tricky (e.g. x in terms) | Term frequency/inverse document frequency (TF/IDF): weighting | there is package tm (text mining) http://cran.r-project.org/web/packages/tm/index.html which should do exactly you need:
#read 1000 txt articles from directory data/txt
corpus <-Corpus(DirSource("dat | Term frequency/inverse document frequency (TF/IDF): weighting
there is package tm (text mining) http://cran.r-project.org/web/packages/tm/index.html which should do exactly you need:
#read 1000 txt articles from directory data/txt
corpus <-Corpus(DirSource("data/txt"), readerControl = list(blank.lines.skip=TRUE));
#some preprocessing
corpus <- tm_map(corpus, removeWords, stopwords("english"))
corpus <- tm_map(corpus, stripWhitespace)
corpus <- tm_map(corpus, stemDocument, language="english")
#creating term matrix with TF-IDF weighting
terms <-DocumentTermMatrix(corpus,control = list(weighting = function(x) weightTfIdf(x, normalize = FALSE)))
#or compute cosine distance among documents
dissimilarity(tdm, method = "cosine")
R is a functional language so reading code can be tricky (e.g. x in terms) | Term frequency/inverse document frequency (TF/IDF): weighting
there is package tm (text mining) http://cran.r-project.org/web/packages/tm/index.html which should do exactly you need:
#read 1000 txt articles from directory data/txt
corpus <-Corpus(DirSource("dat |
21,070 | Term frequency/inverse document frequency (TF/IDF): weighting | Your code has an error: colSums computes the number of occurence in the corpus, not the number of texts with the word.
A version computing such would be:
tfidf=function(mat){
tf <- mat
id=function(col){sum(!col==0)}
idf <- log(nrow(mat)/apply(mat, 2, id))
tfidf <- mat
for(word in names(idf)){tfidf[,word] <- tf[,word] * idf[word]}
return(tfidf)
} | Term frequency/inverse document frequency (TF/IDF): weighting | Your code has an error: colSums computes the number of occurence in the corpus, not the number of texts with the word.
A version computing such would be:
tfidf=function(mat){
tf <- mat
id=function | Term frequency/inverse document frequency (TF/IDF): weighting
Your code has an error: colSums computes the number of occurence in the corpus, not the number of texts with the word.
A version computing such would be:
tfidf=function(mat){
tf <- mat
id=function(col){sum(!col==0)}
idf <- log(nrow(mat)/apply(mat, 2, id))
tfidf <- mat
for(word in names(idf)){tfidf[,word] <- tf[,word] * idf[word]}
return(tfidf)
} | Term frequency/inverse document frequency (TF/IDF): weighting
Your code has an error: colSums computes the number of occurence in the corpus, not the number of texts with the word.
A version computing such would be:
tfidf=function(mat){
tf <- mat
id=function |
21,071 | Term frequency/inverse document frequency (TF/IDF): weighting | There is a new R package which can do this: textir: Inverse Regression for Text Analysis
The relevant command is tfidf, the example from the manual:
data(we8there)
## 20 high-variance tf-idf terms
colnames(we8thereCounts)[
order(-sdev(tfidf(we8thereCounts)))[1:20]] | Term frequency/inverse document frequency (TF/IDF): weighting | There is a new R package which can do this: textir: Inverse Regression for Text Analysis
The relevant command is tfidf, the example from the manual:
data(we8there)
## 20 high-variance tf-idf terms
col | Term frequency/inverse document frequency (TF/IDF): weighting
There is a new R package which can do this: textir: Inverse Regression for Text Analysis
The relevant command is tfidf, the example from the manual:
data(we8there)
## 20 high-variance tf-idf terms
colnames(we8thereCounts)[
order(-sdev(tfidf(we8thereCounts)))[1:20]] | Term frequency/inverse document frequency (TF/IDF): weighting
There is a new R package which can do this: textir: Inverse Regression for Text Analysis
The relevant command is tfidf, the example from the manual:
data(we8there)
## 20 high-variance tf-idf terms
col |
21,072 | Term frequency/inverse document frequency (TF/IDF): weighting | I am late to this party, but I was playing with the concepts of tc-idf (I want to emphasize the word 'concept' because I didn't follow any books for the actual calculations; so they may be somewhat off, and definitely more easily carried out with packages such as {tm: Text Mining Package}, as mentioned), and I think what I got may be related to this question, or, in any event, this may be a good place to post it.
SET-UP: I have a corpus of 5 long paragraphs taken from printed media, text 1 through 5 such as The New York Times. Allegedly, it is a very small "body", a tiny library, so to speak, but the entries in this "digital" library are not random: The first and fifth entries deal with football (or 'soccer' for 'social club' (?) around here), and more specifically about the greatest team today. So, for instance, text 1 begins as...
"Over the past nine years, Messi has led F.C. Barcelona to national
and international titles while breaking individual records in
ways that seem otherworldly..."
Very nice! On the other hand you would definitely want to skip the contents in the three entries in between. Here's an example (text 2):
"In the span of a few hours across Texas, Mr. Rubio suggested that Mr.
Trump had urinated in his trousers and used illegal immigrants to tap
out his unceasing Twitter messages..."
So what to do to avoid at all cost "surfing" from the text 1 to text 2, while continuing to rejoice in the literature about almighty Barcelona F.C. in text 5?
TC-IDF: I isolated the words in every text into long vectors. Then counted the frequency of each word, creating five vectors (one for each text) in which only the words encountered in the corresponding text were counted - all the other words, belonging to other texts, were valued at zero. In the first snippet of text 1, for instance, its vector would have a count of 1 for the word "Messi", while "Trump" would have 0. This was the tc part.
The idf part was also calculated separately for each text, and resulted in 5 "vectors" (I think I treated them as data frames), containing the logarithmic transformations of the counts of documents (sadly, just from zero to five, given our small library) containing a given word as in:
$\log\left(\frac{\text{No. documents}}{1\, +\, \text{No. docs containing a word}}\right)$. The number of documents is 5. Here comes the part that may answer the OP: for each idf calculation, the text under consideration was excluded from the tally. But if a word appeared in all documents, its idf was still $0$ thanks to the $1$ in the denominator - e.g. the word "the" had importance 0, because it was present in all texts.
The entry-wise multiplication of $\text{tc} \times \text{idf}$ for every text was the importance of every word for each one of the library items - locally prevalent, globally rare words.
COMPARISONS: Now it was just a matter of performing dot products among these "vectors of word importance".
Predictably, the dot product of text 1 with text 5 was 13.42645, while text 1 v. text2 was only 2.511799.
The clunky R code (nothing to imitate) is here.
Again, this is a very rudimentary simulation, but I think it is very graphic. | Term frequency/inverse document frequency (TF/IDF): weighting | I am late to this party, but I was playing with the concepts of tc-idf (I want to emphasize the word 'concept' because I didn't follow any books for the actual calculations; so they may be somewhat of | Term frequency/inverse document frequency (TF/IDF): weighting
I am late to this party, but I was playing with the concepts of tc-idf (I want to emphasize the word 'concept' because I didn't follow any books for the actual calculations; so they may be somewhat off, and definitely more easily carried out with packages such as {tm: Text Mining Package}, as mentioned), and I think what I got may be related to this question, or, in any event, this may be a good place to post it.
SET-UP: I have a corpus of 5 long paragraphs taken from printed media, text 1 through 5 such as The New York Times. Allegedly, it is a very small "body", a tiny library, so to speak, but the entries in this "digital" library are not random: The first and fifth entries deal with football (or 'soccer' for 'social club' (?) around here), and more specifically about the greatest team today. So, for instance, text 1 begins as...
"Over the past nine years, Messi has led F.C. Barcelona to national
and international titles while breaking individual records in
ways that seem otherworldly..."
Very nice! On the other hand you would definitely want to skip the contents in the three entries in between. Here's an example (text 2):
"In the span of a few hours across Texas, Mr. Rubio suggested that Mr.
Trump had urinated in his trousers and used illegal immigrants to tap
out his unceasing Twitter messages..."
So what to do to avoid at all cost "surfing" from the text 1 to text 2, while continuing to rejoice in the literature about almighty Barcelona F.C. in text 5?
TC-IDF: I isolated the words in every text into long vectors. Then counted the frequency of each word, creating five vectors (one for each text) in which only the words encountered in the corresponding text were counted - all the other words, belonging to other texts, were valued at zero. In the first snippet of text 1, for instance, its vector would have a count of 1 for the word "Messi", while "Trump" would have 0. This was the tc part.
The idf part was also calculated separately for each text, and resulted in 5 "vectors" (I think I treated them as data frames), containing the logarithmic transformations of the counts of documents (sadly, just from zero to five, given our small library) containing a given word as in:
$\log\left(\frac{\text{No. documents}}{1\, +\, \text{No. docs containing a word}}\right)$. The number of documents is 5. Here comes the part that may answer the OP: for each idf calculation, the text under consideration was excluded from the tally. But if a word appeared in all documents, its idf was still $0$ thanks to the $1$ in the denominator - e.g. the word "the" had importance 0, because it was present in all texts.
The entry-wise multiplication of $\text{tc} \times \text{idf}$ for every text was the importance of every word for each one of the library items - locally prevalent, globally rare words.
COMPARISONS: Now it was just a matter of performing dot products among these "vectors of word importance".
Predictably, the dot product of text 1 with text 5 was 13.42645, while text 1 v. text2 was only 2.511799.
The clunky R code (nothing to imitate) is here.
Again, this is a very rudimentary simulation, but I think it is very graphic. | Term frequency/inverse document frequency (TF/IDF): weighting
I am late to this party, but I was playing with the concepts of tc-idf (I want to emphasize the word 'concept' because I didn't follow any books for the actual calculations; so they may be somewhat of |
21,073 | Understanding output of MatchIt in R | library(MatchIt)
# I used mahalanobis distance here for nearest neighborhood matching and
# data nuclear plants
zz <- matchit(pr ~ t1 + t2, data=nuclearplants, method="nearest",
distance="mahalanobis", replace=TRUE)
> zz
Call: matchit(formula = pr ~ t1 + t2, data = nuclearplants, method = "nearest",
distance = "mahalanobis", replace = TRUE)
Sample sizes:
Control Treated
All 22 10
Matched 6 10
Unmatched 16 0
Discarded 0 0
zz.out <- zz$match.matrix # This gives us the matched matrix
> zz.out
1
A "I"
B "N"
C "M"
D "V"
E "X"
F "Z"
G "Z"
a "N"
b "N"
c "I"
Note: The first column are treated subjects and second column are control subjects. As you can see from zz there are only 6 matched controls and 10 matched treated.For instance,B,a,and b treated are matched to control N, and so on. To obtain the matched data use match.data(zz). | Understanding output of MatchIt in R | library(MatchIt)
# I used mahalanobis distance here for nearest neighborhood matching and
# data nuclear plants
zz <- matchit(pr ~ t1 + t2, data=nuclearplants, method="nearest",
| Understanding output of MatchIt in R
library(MatchIt)
# I used mahalanobis distance here for nearest neighborhood matching and
# data nuclear plants
zz <- matchit(pr ~ t1 + t2, data=nuclearplants, method="nearest",
distance="mahalanobis", replace=TRUE)
> zz
Call: matchit(formula = pr ~ t1 + t2, data = nuclearplants, method = "nearest",
distance = "mahalanobis", replace = TRUE)
Sample sizes:
Control Treated
All 22 10
Matched 6 10
Unmatched 16 0
Discarded 0 0
zz.out <- zz$match.matrix # This gives us the matched matrix
> zz.out
1
A "I"
B "N"
C "M"
D "V"
E "X"
F "Z"
G "Z"
a "N"
b "N"
c "I"
Note: The first column are treated subjects and second column are control subjects. As you can see from zz there are only 6 matched controls and 10 matched treated.For instance,B,a,and b treated are matched to control N, and so on. To obtain the matched data use match.data(zz). | Understanding output of MatchIt in R
library(MatchIt)
# I used mahalanobis distance here for nearest neighborhood matching and
# data nuclear plants
zz <- matchit(pr ~ t1 + t2, data=nuclearplants, method="nearest",
|
21,074 | Understanding output of MatchIt in R | One important detail that may not be clear from the answer above is that the default form of matching in the matchit package (and in much of the scholarly literature in any field) is to use a propensity score that estimates, for each observation, the probability of assignment to treatment given some set of pre-treatment covariates using logistic regression.
While the default one-to-one nearest neighbor propensity score matching method in matchit will select the control observation with the smallest distance to a given treated observation, the resulting matched data is not paired in the way that the questioner imagines. The logit-based propensity score method collapses the multidimensional pre-treatment data to a unidimensional zero to one scale and identifies the appropriate control(s) for the treated observations. The end result is generally treated and control groups with greater overlap in their propensity scores but it is possible for a treated and a control unit to have propensity scores that are relatively far apart if, at that stage of the matching, a far away control has the shortest distance to the treated observation in question (this assumes matching without replacement or replace=FALSE in matchit syntax).
As a result, there is no guarantee with the default settings of matchit(method="nearest", distance="logit") that a matched cohort will be produced in which each treated unit is closely paired with a specific control unit. If one uses the caliper feature of matchit (e.g., caliper=.1), then the matched treated and control units will always be within the caliper's distance of each other, more closely approximating a paired cohort.
When matchit has distance set to 'mahalanobis', not only is the distance calculation different but it operates with something like the caliper so that pairs of treated and control units are plausibly proximate. Hence the use of distance='mahalanobis' above works to create a matched cohort of treated and control observations.
To see a visual representation of how nearest neighbor matching differs when distance calculated via logit vs via mahalanobis distance, see these slides from Gary King, one of the co-authors of the matchit package:
http://gking.harvard.edu/presentations/simplifying-matching-methods-causal-inference-1 | Understanding output of MatchIt in R | One important detail that may not be clear from the answer above is that the default form of matching in the matchit package (and in much of the scholarly literature in any field) is to use a propensi | Understanding output of MatchIt in R
One important detail that may not be clear from the answer above is that the default form of matching in the matchit package (and in much of the scholarly literature in any field) is to use a propensity score that estimates, for each observation, the probability of assignment to treatment given some set of pre-treatment covariates using logistic regression.
While the default one-to-one nearest neighbor propensity score matching method in matchit will select the control observation with the smallest distance to a given treated observation, the resulting matched data is not paired in the way that the questioner imagines. The logit-based propensity score method collapses the multidimensional pre-treatment data to a unidimensional zero to one scale and identifies the appropriate control(s) for the treated observations. The end result is generally treated and control groups with greater overlap in their propensity scores but it is possible for a treated and a control unit to have propensity scores that are relatively far apart if, at that stage of the matching, a far away control has the shortest distance to the treated observation in question (this assumes matching without replacement or replace=FALSE in matchit syntax).
As a result, there is no guarantee with the default settings of matchit(method="nearest", distance="logit") that a matched cohort will be produced in which each treated unit is closely paired with a specific control unit. If one uses the caliper feature of matchit (e.g., caliper=.1), then the matched treated and control units will always be within the caliper's distance of each other, more closely approximating a paired cohort.
When matchit has distance set to 'mahalanobis', not only is the distance calculation different but it operates with something like the caliper so that pairs of treated and control units are plausibly proximate. Hence the use of distance='mahalanobis' above works to create a matched cohort of treated and control observations.
To see a visual representation of how nearest neighbor matching differs when distance calculated via logit vs via mahalanobis distance, see these slides from Gary King, one of the co-authors of the matchit package:
http://gking.harvard.edu/presentations/simplifying-matching-methods-causal-inference-1 | Understanding output of MatchIt in R
One important detail that may not be clear from the answer above is that the default form of matching in the matchit package (and in much of the scholarly literature in any field) is to use a propensi |
21,075 | Understanding output of MatchIt in R | It is also important to note that PS matching is not a paired matching, hence, there is no need to use such as conditional logistic regression/clustering in an attempt to take in to account the "paired nature" of the data unlike pair-wise matching. It is distributional assumption that in expectation the distribution a of covariates included in the PS model are balanced between treated and untreated groups.
However, when matching was done with replacement, the weights for subjects would be different from 1 and hence the weights should be accounted for as in inverse probability of treatment weighting - matching is a special case of weighting. | Understanding output of MatchIt in R | It is also important to note that PS matching is not a paired matching, hence, there is no need to use such as conditional logistic regression/clustering in an attempt to take in to account the "paire | Understanding output of MatchIt in R
It is also important to note that PS matching is not a paired matching, hence, there is no need to use such as conditional logistic regression/clustering in an attempt to take in to account the "paired nature" of the data unlike pair-wise matching. It is distributional assumption that in expectation the distribution a of covariates included in the PS model are balanced between treated and untreated groups.
However, when matching was done with replacement, the weights for subjects would be different from 1 and hence the weights should be accounted for as in inverse probability of treatment weighting - matching is a special case of weighting. | Understanding output of MatchIt in R
It is also important to note that PS matching is not a paired matching, hence, there is no need to use such as conditional logistic regression/clustering in an attempt to take in to account the "paire |
21,076 | Log Linear Models | Log linear models, like crosstabs and chi-square, are usually used when none of the variables can be classed as dependent or independent but, rather, the goal is to look at association among sets of variables. In particular, log linear models are useful for association among sets of categorical variables. | Log Linear Models | Log linear models, like crosstabs and chi-square, are usually used when none of the variables can be classed as dependent or independent but, rather, the goal is to look at association among sets of v | Log Linear Models
Log linear models, like crosstabs and chi-square, are usually used when none of the variables can be classed as dependent or independent but, rather, the goal is to look at association among sets of variables. In particular, log linear models are useful for association among sets of categorical variables. | Log Linear Models
Log linear models, like crosstabs and chi-square, are usually used when none of the variables can be classed as dependent or independent but, rather, the goal is to look at association among sets of v |
21,077 | Log Linear Models | Log-linear models are often used for proportions because independent effects on probability will act multiplicatively. After taking logs, this leads to linear effects.
In fact there are other reasons why you might use loglinear models (such as the fact that the log-link being the canonical link function for the Poisson), but I think the first reason probably suffices from a general modelling point of view. | Log Linear Models | Log-linear models are often used for proportions because independent effects on probability will act multiplicatively. After taking logs, this leads to linear effects.
In fact there are other reasons | Log Linear Models
Log-linear models are often used for proportions because independent effects on probability will act multiplicatively. After taking logs, this leads to linear effects.
In fact there are other reasons why you might use loglinear models (such as the fact that the log-link being the canonical link function for the Poisson), but I think the first reason probably suffices from a general modelling point of view. | Log Linear Models
Log-linear models are often used for proportions because independent effects on probability will act multiplicatively. After taking logs, this leads to linear effects.
In fact there are other reasons |
21,078 | Log Linear Models | A common interpretation, and way of seeing the difference, between a normal linear model and a log linear model is if your problem is multiplicative or additive.
A normal linear model has the following form $Y=\sum_{i=1}^M \beta_i X_i+\beta_0$
A log linear model has a log transformation on the response variable which gives the following equation
$\ln Y=\sum_{i=1}^M \beta_i X_i+\beta_0$
which turns into
$Y=e^{\beta_0}\prod_{i=1}^M e^{\beta_i X_i}$
Thus the effects are multiplied instead of added together. | Log Linear Models | A common interpretation, and way of seeing the difference, between a normal linear model and a log linear model is if your problem is multiplicative or additive.
A normal linear model has the followin | Log Linear Models
A common interpretation, and way of seeing the difference, between a normal linear model and a log linear model is if your problem is multiplicative or additive.
A normal linear model has the following form $Y=\sum_{i=1}^M \beta_i X_i+\beta_0$
A log linear model has a log transformation on the response variable which gives the following equation
$\ln Y=\sum_{i=1}^M \beta_i X_i+\beta_0$
which turns into
$Y=e^{\beta_0}\prod_{i=1}^M e^{\beta_i X_i}$
Thus the effects are multiplied instead of added together. | Log Linear Models
A common interpretation, and way of seeing the difference, between a normal linear model and a log linear model is if your problem is multiplicative or additive.
A normal linear model has the followin |
21,079 | Log Linear Models | Here's a list of related reasons why $\ln$ (aka $\log_e$) transformation may be used. Since all logarithms are proportional to each other, many people tend to use base $e$, since it has some nice properties. To quote John D. Cook,
I don't always use logs, but when I do, they're natural logarithms.
This list is taken from Nick Cox's Intro To Transformations (with some added commentary):
Reduce skewness - Gaussian distribution is regarded as ideal or
necessary for many statistical methods (sometimes mistakenly). Taking logs helps.
Equalize spreads - induce homoskedasticity when there's lots of variation in levels.
Linearize relationships - For example, a plot of logarithms of a series against time has the property that periods with constant rates of change are straight lines
The coefficients$\cdot$100 have a semi-elasticity interpretation: for a 1 unit change in $x$, you get b*100% change in $y$. For binary $x$ going from 0 to 1 effect, the effect is $100 \cdot(\exp\{\beta\}-1)$%. Some people find exponentiated coefficients easier to think about than elasticities. That gives a ratio of Y-values per unit change in X, assuming an exponential relationship (a kind of multiplier).
"Additivize" relationships - Trying to get the parameters of a Cobb-Douglas production function is a whole lot easier without non-linear methods. Analysis of variance also requires additivity.
Convenience/Theory - log scale may more natural for some phenomena.
Finally, logs aren't the only way to accomplish some of these goals. | Log Linear Models | Here's a list of related reasons why $\ln$ (aka $\log_e$) transformation may be used. Since all logarithms are proportional to each other, many people tend to use base $e$, since it has some nice prop | Log Linear Models
Here's a list of related reasons why $\ln$ (aka $\log_e$) transformation may be used. Since all logarithms are proportional to each other, many people tend to use base $e$, since it has some nice properties. To quote John D. Cook,
I don't always use logs, but when I do, they're natural logarithms.
This list is taken from Nick Cox's Intro To Transformations (with some added commentary):
Reduce skewness - Gaussian distribution is regarded as ideal or
necessary for many statistical methods (sometimes mistakenly). Taking logs helps.
Equalize spreads - induce homoskedasticity when there's lots of variation in levels.
Linearize relationships - For example, a plot of logarithms of a series against time has the property that periods with constant rates of change are straight lines
The coefficients$\cdot$100 have a semi-elasticity interpretation: for a 1 unit change in $x$, you get b*100% change in $y$. For binary $x$ going from 0 to 1 effect, the effect is $100 \cdot(\exp\{\beta\}-1)$%. Some people find exponentiated coefficients easier to think about than elasticities. That gives a ratio of Y-values per unit change in X, assuming an exponential relationship (a kind of multiplier).
"Additivize" relationships - Trying to get the parameters of a Cobb-Douglas production function is a whole lot easier without non-linear methods. Analysis of variance also requires additivity.
Convenience/Theory - log scale may more natural for some phenomena.
Finally, logs aren't the only way to accomplish some of these goals. | Log Linear Models
Here's a list of related reasons why $\ln$ (aka $\log_e$) transformation may be used. Since all logarithms are proportional to each other, many people tend to use base $e$, since it has some nice prop |
21,080 | What are good, freely available journals for keeping track of the latest developments in machine learning? | New developments in ML are almost always presented in conferences first, and sometimes later refined into journal papers.
If you only follow two conferences, they should be:
NIPS (Neural Information Processing Systems); December. Conference site, proceedings. (Despite the name, most papers are unrelated to neuroscience or neural networks.)
ICML (International Conference on Machine Learning); July. Site (including proceedings links).
These conferences also include workshops that publish less-polished work, which can often be a good way to find about ongoing and not-yet-published research.
The following ML conferences also contain many excellent papers, though they are not as "first-tier" as NIPS and ICML and may be more focused in scope:
AISTATS (Artificial Intelligence and Statistics); May. Conference site; proceedings published in JMLR and available here. Sometimes more theoretical, especially from a statistics viewpoint.
COLT (Conference on Learning Theory); July. 2015 site, proceedings also published in JMLR. Very theoretical.
UAI (Uncertainty in Artificial Intelligence); July. Conference site, proceedings. Typically more focused on graphical models and/or Bayesian techniques.
ICLR (International Conference on Learning Representations); May. Conference site. (Focused on deep learning, relatively new; all submissions appear on arXiv.)
ECML PKDD (European Conference on Machine Learning and Principles and Practice of Knowledge Discovery in Databases); September. Conference site.
ACML (Asian Conference on Machine Learning); November. Conference site.
Some AI conferences also include good machine learning papers or specific tracks on machine learning, especially:
IJCAI (International Joint Conference on Artificial Intelligence); July. Conference site, somewhat out-of-date proceedings.
AAAI (Association for the Advancement of Artificial Intelligence); February. Conference site, proceedings.
Conferences in related fields are also often relevant, especially:
KDD (Knowledge Discovery and Data Mining); August. Conference site, links to individual conferences here.
CVPR (Computer Vision and Pattern Recognition); June. 2016 site, overview. | What are good, freely available journals for keeping track of the latest developments in machine lea | New developments in ML are almost always presented in conferences first, and sometimes later refined into journal papers.
If you only follow two conferences, they should be:
NIPS (Neural Information | What are good, freely available journals for keeping track of the latest developments in machine learning?
New developments in ML are almost always presented in conferences first, and sometimes later refined into journal papers.
If you only follow two conferences, they should be:
NIPS (Neural Information Processing Systems); December. Conference site, proceedings. (Despite the name, most papers are unrelated to neuroscience or neural networks.)
ICML (International Conference on Machine Learning); July. Site (including proceedings links).
These conferences also include workshops that publish less-polished work, which can often be a good way to find about ongoing and not-yet-published research.
The following ML conferences also contain many excellent papers, though they are not as "first-tier" as NIPS and ICML and may be more focused in scope:
AISTATS (Artificial Intelligence and Statistics); May. Conference site; proceedings published in JMLR and available here. Sometimes more theoretical, especially from a statistics viewpoint.
COLT (Conference on Learning Theory); July. 2015 site, proceedings also published in JMLR. Very theoretical.
UAI (Uncertainty in Artificial Intelligence); July. Conference site, proceedings. Typically more focused on graphical models and/or Bayesian techniques.
ICLR (International Conference on Learning Representations); May. Conference site. (Focused on deep learning, relatively new; all submissions appear on arXiv.)
ECML PKDD (European Conference on Machine Learning and Principles and Practice of Knowledge Discovery in Databases); September. Conference site.
ACML (Asian Conference on Machine Learning); November. Conference site.
Some AI conferences also include good machine learning papers or specific tracks on machine learning, especially:
IJCAI (International Joint Conference on Artificial Intelligence); July. Conference site, somewhat out-of-date proceedings.
AAAI (Association for the Advancement of Artificial Intelligence); February. Conference site, proceedings.
Conferences in related fields are also often relevant, especially:
KDD (Knowledge Discovery and Data Mining); August. Conference site, links to individual conferences here.
CVPR (Computer Vision and Pattern Recognition); June. 2016 site, overview. | What are good, freely available journals for keeping track of the latest developments in machine lea
New developments in ML are almost always presented in conferences first, and sometimes later refined into journal papers.
If you only follow two conferences, they should be:
NIPS (Neural Information |
21,081 | What are good, freely available journals for keeping track of the latest developments in machine learning? | The Journal of Machine Learning is freely-available online and on the cutting edge, but it is pretty heavy. | What are good, freely available journals for keeping track of the latest developments in machine lea | The Journal of Machine Learning is freely-available online and on the cutting edge, but it is pretty heavy. | What are good, freely available journals for keeping track of the latest developments in machine learning?
The Journal of Machine Learning is freely-available online and on the cutting edge, but it is pretty heavy. | What are good, freely available journals for keeping track of the latest developments in machine lea
The Journal of Machine Learning is freely-available online and on the cutting edge, but it is pretty heavy. |
21,082 | What are good, freely available journals for keeping track of the latest developments in machine learning? | I think that the best way to keep track of the latest developments in Machine Learning is to follow the Reddit feed:
https://www.reddit.com/r/MachineLearning/
Many researchers post some comments about the papers they recently submitted to different venues.
You might also follow what is submitted to Arxiv here:
http://arxiv.org/list/stat.ML/recent
Most researchers submit pre-print versions of their papers to Arxiv before publication.
Also, you might want to have a Twitter account and follow particular researchers/professors who work in machine learning. However, the people you might want to follow really depend on your area of interest. A good starting point might be following the hashtag #machinelearning
Also remember that the terms machine learning, data mining, knowledge discovery in data bases, data science are sometimes used interchangeably. In order to find some interesting developments in machine learning you might look at news in those other areas as well. | What are good, freely available journals for keeping track of the latest developments in machine lea | I think that the best way to keep track of the latest developments in Machine Learning is to follow the Reddit feed:
https://www.reddit.com/r/MachineLearning/
Many researchers post some comments abou | What are good, freely available journals for keeping track of the latest developments in machine learning?
I think that the best way to keep track of the latest developments in Machine Learning is to follow the Reddit feed:
https://www.reddit.com/r/MachineLearning/
Many researchers post some comments about the papers they recently submitted to different venues.
You might also follow what is submitted to Arxiv here:
http://arxiv.org/list/stat.ML/recent
Most researchers submit pre-print versions of their papers to Arxiv before publication.
Also, you might want to have a Twitter account and follow particular researchers/professors who work in machine learning. However, the people you might want to follow really depend on your area of interest. A good starting point might be following the hashtag #machinelearning
Also remember that the terms machine learning, data mining, knowledge discovery in data bases, data science are sometimes used interchangeably. In order to find some interesting developments in machine learning you might look at news in those other areas as well. | What are good, freely available journals for keeping track of the latest developments in machine lea
I think that the best way to keep track of the latest developments in Machine Learning is to follow the Reddit feed:
https://www.reddit.com/r/MachineLearning/
Many researchers post some comments abou |
21,083 | Fitting sine wave with lm in R for circadian activity- frequencies? | You are using the wrong frequency $\omega$, or wavelength $\lambda$. The period ("wavelength") of a sine function is defined by $\sin(\omega(t+\lambda)) = \sin(\omega t)$, and thus
$$\omega(t+\lambda) = 2\pi \iff \omega=\frac{2\pi}{\lambda}$$
A rough (visual) guess of the wavelength in the data you have posted is 25. Note that this is not the range for b\$zt shown in your first plot! If I fit the model as follows, I obtain a decent result:
lmfit <- lm(walking ~ sin(2*pi/25*zt) + cos(2*pi/25*zt), data=b)
plot(b$zt, b$walking)
x <- sort(b$zt)
lines(x, predict(lmfit, data.frame(zt=x)), col="red")
You can automatically estimate the period ("wavelength") from the data with a least-squares-fit. Although $\lambda$ is a non-linear parameter and thus cannot be computed directly by lm, you can use the residuals returned by lm to compute the sum of squares and minimize it over $\lambda$:
# function to be minimized
sum_squares <- function(lambda) {
lmfit <- lm(walking ~ sin(2*pi/lambda*zt) + cos(2*pi/lambda*zt), data=b)
return(sum(lmfit$residuals^2))
}
lambda <- optimize(sum_squares,c(1,50))$minimum
This computes $\lambda\approx 26.05$, so the guess 25 was not so bad. | Fitting sine wave with lm in R for circadian activity- frequencies? | You are using the wrong frequency $\omega$, or wavelength $\lambda$. The period ("wavelength") of a sine function is defined by $\sin(\omega(t+\lambda)) = \sin(\omega t)$, and thus
$$\omega(t+\lambda) | Fitting sine wave with lm in R for circadian activity- frequencies?
You are using the wrong frequency $\omega$, or wavelength $\lambda$. The period ("wavelength") of a sine function is defined by $\sin(\omega(t+\lambda)) = \sin(\omega t)$, and thus
$$\omega(t+\lambda) = 2\pi \iff \omega=\frac{2\pi}{\lambda}$$
A rough (visual) guess of the wavelength in the data you have posted is 25. Note that this is not the range for b\$zt shown in your first plot! If I fit the model as follows, I obtain a decent result:
lmfit <- lm(walking ~ sin(2*pi/25*zt) + cos(2*pi/25*zt), data=b)
plot(b$zt, b$walking)
x <- sort(b$zt)
lines(x, predict(lmfit, data.frame(zt=x)), col="red")
You can automatically estimate the period ("wavelength") from the data with a least-squares-fit. Although $\lambda$ is a non-linear parameter and thus cannot be computed directly by lm, you can use the residuals returned by lm to compute the sum of squares and minimize it over $\lambda$:
# function to be minimized
sum_squares <- function(lambda) {
lmfit <- lm(walking ~ sin(2*pi/lambda*zt) + cos(2*pi/lambda*zt), data=b)
return(sum(lmfit$residuals^2))
}
lambda <- optimize(sum_squares,c(1,50))$minimum
This computes $\lambda\approx 26.05$, so the guess 25 was not so bad. | Fitting sine wave with lm in R for circadian activity- frequencies?
You are using the wrong frequency $\omega$, or wavelength $\lambda$. The period ("wavelength") of a sine function is defined by $\sin(\omega(t+\lambda)) = \sin(\omega t)$, and thus
$$\omega(t+\lambda) |
21,084 | Fitting sine wave with lm in R for circadian activity- frequencies? | You might want to do something more flexible and exploratory than fitting sine waves, because biology isn't physics.
Here is a Generalized Additive Model (GAM) fit using a circular spline with three knots (that is, comparable in complexity to a sine wave). We shouldn't use a least squares model due to the strong violation of its assumptions: during each day there are long periods with almost no activity and other periods with a huge (skewed) distribution of activities.
For a more detailed fit, increase the number of knots. Here it is with 12 knots:
You might learn more about these data from this approach. Even if your best fit happens to look sinusoidal, you will have developed the evidence demonstrating it should be so.
I used the R package mgcv to create this fit, employing its built-in circular splines (type "cc"). Ignore its wornings about "non-integer x": this model works well for non-count data, too.
library(mgcv)
# Assemble the data. Notice the computation of `Time` as hour of the day.
X <- data.frame(zt = zt, Time=zt %% 24, Value=walking)
# Fit the model. `k` is the number of knots.
fit <- gam(Value ~ s(Time, bs="cc", k=12), X, family="poisson", knots=list(Time=c(0,24)))
# Compute the predicted values for plotting.
Y <- data.frame(zt = seq(0, max(X$zt), length.out=201)[-1])
Y$Time <- Y$zt %% 24
Y$Prediction <- predict(fit, newdata=Y, type="response")
# Plot the data and the fitted values.
with(X, plot(zt, Value, main="Data with Detailed Fit"))
with(Y, lines(zt, Prediction, lwd=2, col="Blue")) | Fitting sine wave with lm in R for circadian activity- frequencies? | You might want to do something more flexible and exploratory than fitting sine waves, because biology isn't physics.
Here is a Generalized Additive Model (GAM) fit using a circular spline with three k | Fitting sine wave with lm in R for circadian activity- frequencies?
You might want to do something more flexible and exploratory than fitting sine waves, because biology isn't physics.
Here is a Generalized Additive Model (GAM) fit using a circular spline with three knots (that is, comparable in complexity to a sine wave). We shouldn't use a least squares model due to the strong violation of its assumptions: during each day there are long periods with almost no activity and other periods with a huge (skewed) distribution of activities.
For a more detailed fit, increase the number of knots. Here it is with 12 knots:
You might learn more about these data from this approach. Even if your best fit happens to look sinusoidal, you will have developed the evidence demonstrating it should be so.
I used the R package mgcv to create this fit, employing its built-in circular splines (type "cc"). Ignore its wornings about "non-integer x": this model works well for non-count data, too.
library(mgcv)
# Assemble the data. Notice the computation of `Time` as hour of the day.
X <- data.frame(zt = zt, Time=zt %% 24, Value=walking)
# Fit the model. `k` is the number of knots.
fit <- gam(Value ~ s(Time, bs="cc", k=12), X, family="poisson", knots=list(Time=c(0,24)))
# Compute the predicted values for plotting.
Y <- data.frame(zt = seq(0, max(X$zt), length.out=201)[-1])
Y$Time <- Y$zt %% 24
Y$Prediction <- predict(fit, newdata=Y, type="response")
# Plot the data and the fitted values.
with(X, plot(zt, Value, main="Data with Detailed Fit"))
with(Y, lines(zt, Prediction, lwd=2, col="Blue")) | Fitting sine wave with lm in R for circadian activity- frequencies?
You might want to do something more flexible and exploratory than fitting sine waves, because biology isn't physics.
Here is a Generalized Additive Model (GAM) fit using a circular spline with three k |
21,085 | Is there a formal name for this statistical fallacy? | The universe and mankind
The fact that we observe the unlikely event of a universe, solar system and planet that is able generate intelligent life, is a type of survival bias.
(and as Mehmet mentions in the comments, this could be seen as a cherry picking fallacy)
We see the unlikely event because without it we wouldn't have lived to see the absence of the event.
In relationship with the existence of life this phenomenon relates to the anthropic principle. This has different forms. From Barrow and Tipler's book:
Weak anthropic principle (WAP): The observed values of all physical and cosmological quantities are not equally probable but they take on values restricted by the requirement that there exist sites where carbon-based life can evolve and by the requirements that the Universe be old enough for it to have already done so.
The world and universe are not very probable, but it is the way it is because there is a selection effect.
Strong anthropic principle (SAP): The Universe must have those properties which allow life to develop within it at some stage in its history.
In this case, the properties of the universe are not regarded as probability but as some sort of intelligent design (this is also more like a philosophical argument, involving teleological ideas, and may not be so much of a fallacy). But it can be even adapted further. With interpretations of quantum dynamics, it is not just that the special unlikely conditions for the universe are necessary for humans/observes, but also the other way around observers are necessary for the universe to exist.
The zero probability
Suppose I threw randomly a dart in a circle and it hit exactly at the point (3, 4), if one says for me: "There infinity many points you could hit, so, if you threw it randomly, the probability (using the limit definition) of you hitting that point is 0, therefore you didn't throw it randomly and must have something external being that rationally made this dart hit (3,4)".
This argument is slightly different from the survival bias. The argument is that events with zero probability are not supposed to happen.
This is misrepresenting 'probability' (which we could see as an equivocation fallacy).
While the result/outcome 'the dart hits (3,4)' is part of the sample space, the set of all possible outcomes (often denoted as $\Omega$), it is not in the event space. The result/outcome 'the dart hits (3,4)' is not an event in event space to which we can formally assign a probability.
The situation is a little bit similar to Zeno's paradox. In a similar sense as Zeno's argument for motion not being able to occur, we could argue that the arrow can't hit any part of the dartboard because the probability to hit it is zero everywhere. | Is there a formal name for this statistical fallacy? | The universe and mankind
The fact that we observe the unlikely event of a universe, solar system and planet that is able generate intelligent life, is a type of survival bias.
(and as Mehmet mentions | Is there a formal name for this statistical fallacy?
The universe and mankind
The fact that we observe the unlikely event of a universe, solar system and planet that is able generate intelligent life, is a type of survival bias.
(and as Mehmet mentions in the comments, this could be seen as a cherry picking fallacy)
We see the unlikely event because without it we wouldn't have lived to see the absence of the event.
In relationship with the existence of life this phenomenon relates to the anthropic principle. This has different forms. From Barrow and Tipler's book:
Weak anthropic principle (WAP): The observed values of all physical and cosmological quantities are not equally probable but they take on values restricted by the requirement that there exist sites where carbon-based life can evolve and by the requirements that the Universe be old enough for it to have already done so.
The world and universe are not very probable, but it is the way it is because there is a selection effect.
Strong anthropic principle (SAP): The Universe must have those properties which allow life to develop within it at some stage in its history.
In this case, the properties of the universe are not regarded as probability but as some sort of intelligent design (this is also more like a philosophical argument, involving teleological ideas, and may not be so much of a fallacy). But it can be even adapted further. With interpretations of quantum dynamics, it is not just that the special unlikely conditions for the universe are necessary for humans/observes, but also the other way around observers are necessary for the universe to exist.
The zero probability
Suppose I threw randomly a dart in a circle and it hit exactly at the point (3, 4), if one says for me: "There infinity many points you could hit, so, if you threw it randomly, the probability (using the limit definition) of you hitting that point is 0, therefore you didn't throw it randomly and must have something external being that rationally made this dart hit (3,4)".
This argument is slightly different from the survival bias. The argument is that events with zero probability are not supposed to happen.
This is misrepresenting 'probability' (which we could see as an equivocation fallacy).
While the result/outcome 'the dart hits (3,4)' is part of the sample space, the set of all possible outcomes (often denoted as $\Omega$), it is not in the event space. The result/outcome 'the dart hits (3,4)' is not an event in event space to which we can formally assign a probability.
The situation is a little bit similar to Zeno's paradox. In a similar sense as Zeno's argument for motion not being able to occur, we could argue that the arrow can't hit any part of the dartboard because the probability to hit it is zero everywhere. | Is there a formal name for this statistical fallacy?
The universe and mankind
The fact that we observe the unlikely event of a universe, solar system and planet that is able generate intelligent life, is a type of survival bias.
(and as Mehmet mentions |
21,086 | Is there a formal name for this statistical fallacy? | I think the fallacies in this argument tend to be different than what you're calling out. After all, $(3,4)$ is an arbitrary point on the dartboard, but some (if not all) of the aspects of the universe called out in fine-tuning arguments (particular masses, coupling constants, etc.) are genuinely non-arbitrary, perhaps even special properties. So the counter is that the dart is closer to hitting a "bulls-eye" (edit: and very often this is an arguable point, but I think it's generally arguable on scientific grounds more than statistical grounds, though the cherry-picking fallacy and survivor bias mentioned in other answers is certainly relevant in some cases).
Where I would say that the fallacy often lies in arguments like this -- and I'd be remiss if I didn't say that sometimes anthropomorphic/fine-tuning arguments can be made rigorously -- is the assumption of an a priori uniform distribution of "how the universe could have been." We have no scientific basis on which to assume that the universe could have been some other way, let alone posit reasonable relative likelihoods for different configurations. Going deeper into why would make this more of a physics discussion than a statistics discussion, but a Bayesian perspective is the appropriate statistical framework in which to view this question (obviously we just have the one universe to look at!).
I should note that some of the above argument is influenced Sabine Hossenfelder's blog, and so her book "Lost in Math" may be relevant here. One of the comments made me go back and re-read the question to see that the argument being referenced in the question is one for intelligent design. I think the above "a priori fallacy" is still present in this case, but so is the survivor bias pointed out in another answer -- there are a lot of fallacies to go around. The assumption that humans take a special place in the universe ignores the fact that other types of universe could have led to other types of self-aware entities. But arguments of similar nature are made even within physics and cosmology, at a level of technical subtlety that may escape accusations of the survivor bias -- e.g. a claim that if such and such parameter were ever so slightly different, no stable atoms could form and the universe would be a featureless bath of radiation. There are a number of underlying parameters that get referenced in these arguments, and since it is beyond my expertise I'll note that the "hierarchy problem" and curiously small dark energy values are two frequent subjects of scrutiny, with conclusions of the arguments frequently being "we need a more natural theory that makes this seem less improbable" or, failing that, "we are part of a multiverse." It's interesting to note that the logic for the second argument is explicitly acknowledging survivor bias as part of its reasoning.
Addendum
To add one last bit of detail regarding why it's a fallacy to assume a uniform prior: I think a lot of people are used to uniform priors being common assumptions in Bayesian inferences, because it seems like the "least biased" thing to do. And a lot of time there's good justification for it, or in any rate the effect of the a priori assumption washes out when evaluating the posterior due to a moderate number of observations. But, especially when there's only one observation to update the posterior, any a priori assumption is a bias. So, that assumption has to be evaluated on its own terms. In the case of a priori assumptions about possible alternate universes, there are a lot of stumbling blocks. For one, the space of possibilities is continuous, without a canonical parametrization, so there's no unique "uniform" prior -- is any value of $X$ equally likely, or any value of $\ln(X)$? We could even learn next year that some "alternative universes" are inconsistent and impossible, i.e. having a probability of strictly zero (one pertinent example in physics, particularly string theory and arguments about its "landscape" or "multiverse", comes from the "swampland conjecture"). For all we know, we'll eventually discover that our universe is in fact unique, in some sense, with all the seemingly random parameters actually the consequence of some deeper structure (a possibly forlorn hope of most physicists), with no leftover free parameters. We lack a complete "theory of everything" that could justify some of these assumptions, and even if we did there would be a philosophical critique: such a theory would be a mathematical extrapolation from empirical evidence, but by definition we cannot collect empirical evidence about universes that don't exist or aren't observable to us. | Is there a formal name for this statistical fallacy? | I think the fallacies in this argument tend to be different than what you're calling out. After all, $(3,4)$ is an arbitrary point on the dartboard, but some (if not all) of the aspects of the univers | Is there a formal name for this statistical fallacy?
I think the fallacies in this argument tend to be different than what you're calling out. After all, $(3,4)$ is an arbitrary point on the dartboard, but some (if not all) of the aspects of the universe called out in fine-tuning arguments (particular masses, coupling constants, etc.) are genuinely non-arbitrary, perhaps even special properties. So the counter is that the dart is closer to hitting a "bulls-eye" (edit: and very often this is an arguable point, but I think it's generally arguable on scientific grounds more than statistical grounds, though the cherry-picking fallacy and survivor bias mentioned in other answers is certainly relevant in some cases).
Where I would say that the fallacy often lies in arguments like this -- and I'd be remiss if I didn't say that sometimes anthropomorphic/fine-tuning arguments can be made rigorously -- is the assumption of an a priori uniform distribution of "how the universe could have been." We have no scientific basis on which to assume that the universe could have been some other way, let alone posit reasonable relative likelihoods for different configurations. Going deeper into why would make this more of a physics discussion than a statistics discussion, but a Bayesian perspective is the appropriate statistical framework in which to view this question (obviously we just have the one universe to look at!).
I should note that some of the above argument is influenced Sabine Hossenfelder's blog, and so her book "Lost in Math" may be relevant here. One of the comments made me go back and re-read the question to see that the argument being referenced in the question is one for intelligent design. I think the above "a priori fallacy" is still present in this case, but so is the survivor bias pointed out in another answer -- there are a lot of fallacies to go around. The assumption that humans take a special place in the universe ignores the fact that other types of universe could have led to other types of self-aware entities. But arguments of similar nature are made even within physics and cosmology, at a level of technical subtlety that may escape accusations of the survivor bias -- e.g. a claim that if such and such parameter were ever so slightly different, no stable atoms could form and the universe would be a featureless bath of radiation. There are a number of underlying parameters that get referenced in these arguments, and since it is beyond my expertise I'll note that the "hierarchy problem" and curiously small dark energy values are two frequent subjects of scrutiny, with conclusions of the arguments frequently being "we need a more natural theory that makes this seem less improbable" or, failing that, "we are part of a multiverse." It's interesting to note that the logic for the second argument is explicitly acknowledging survivor bias as part of its reasoning.
Addendum
To add one last bit of detail regarding why it's a fallacy to assume a uniform prior: I think a lot of people are used to uniform priors being common assumptions in Bayesian inferences, because it seems like the "least biased" thing to do. And a lot of time there's good justification for it, or in any rate the effect of the a priori assumption washes out when evaluating the posterior due to a moderate number of observations. But, especially when there's only one observation to update the posterior, any a priori assumption is a bias. So, that assumption has to be evaluated on its own terms. In the case of a priori assumptions about possible alternate universes, there are a lot of stumbling blocks. For one, the space of possibilities is continuous, without a canonical parametrization, so there's no unique "uniform" prior -- is any value of $X$ equally likely, or any value of $\ln(X)$? We could even learn next year that some "alternative universes" are inconsistent and impossible, i.e. having a probability of strictly zero (one pertinent example in physics, particularly string theory and arguments about its "landscape" or "multiverse", comes from the "swampland conjecture"). For all we know, we'll eventually discover that our universe is in fact unique, in some sense, with all the seemingly random parameters actually the consequence of some deeper structure (a possibly forlorn hope of most physicists), with no leftover free parameters. We lack a complete "theory of everything" that could justify some of these assumptions, and even if we did there would be a philosophical critique: such a theory would be a mathematical extrapolation from empirical evidence, but by definition we cannot collect empirical evidence about universes that don't exist or aren't observable to us. | Is there a formal name for this statistical fallacy?
I think the fallacies in this argument tend to be different than what you're calling out. After all, $(3,4)$ is an arbitrary point on the dartboard, but some (if not all) of the aspects of the univers |
21,087 | Is there a formal name for this statistical fallacy? | Statistics: Texas sharpshooter fallacy
The fallacy you describe resembles the Texas sharpshooter fallacy, in which one reverses the order of sampling data and fitting one's hypothesis so that the observation confirms it. From the linked Wikipedia article:
The name comes from a joke about a Texan who fires some gunshots at the side of a barn, then paints a shooting target centered on the tightest cluster of hits and claims to be a sharpshooter.
Beyond: Anthropic principle
On a deeper level, a response to the reasoning from finetuning comes with the Anthropic principle, whose core idea could be summarized like:
The observed values of all physical and cosmological quantities are not equally probable but they take on values restricted by the requirement that there exist sites where carbon-based life can evolve and by the requirements that the universe be old enough for it to have already done so.
In other words: we should not be surprised to find ourselves within an apparently fine-tuned universe, because otherwise we just could not have come into existence. Several variants, loosely grouped into "weak" and "strong" anthropic principle, exist, as Sextus Empiricus' answer nicely summarises. | Is there a formal name for this statistical fallacy? | Statistics: Texas sharpshooter fallacy
The fallacy you describe resembles the Texas sharpshooter fallacy, in which one reverses the order of sampling data and fitting one's hypothesis so that the obse | Is there a formal name for this statistical fallacy?
Statistics: Texas sharpshooter fallacy
The fallacy you describe resembles the Texas sharpshooter fallacy, in which one reverses the order of sampling data and fitting one's hypothesis so that the observation confirms it. From the linked Wikipedia article:
The name comes from a joke about a Texan who fires some gunshots at the side of a barn, then paints a shooting target centered on the tightest cluster of hits and claims to be a sharpshooter.
Beyond: Anthropic principle
On a deeper level, a response to the reasoning from finetuning comes with the Anthropic principle, whose core idea could be summarized like:
The observed values of all physical and cosmological quantities are not equally probable but they take on values restricted by the requirement that there exist sites where carbon-based life can evolve and by the requirements that the universe be old enough for it to have already done so.
In other words: we should not be surprised to find ourselves within an apparently fine-tuned universe, because otherwise we just could not have come into existence. Several variants, loosely grouped into "weak" and "strong" anthropic principle, exist, as Sextus Empiricus' answer nicely summarises. | Is there a formal name for this statistical fallacy?
Statistics: Texas sharpshooter fallacy
The fallacy you describe resembles the Texas sharpshooter fallacy, in which one reverses the order of sampling data and fitting one's hypothesis so that the obse |
21,088 | Is there a formal name for this statistical fallacy? | The Fallacy is not statistical. It is related to determinism. old science was deterministic and also stiff . So the butterfly effect was a logical consequence: you change something just a little bit and the future is completely different as a result.
This is not how science is understood today. Determinism is gone, and even In stiff systems we are finding attractors. In other words, today we should easily envision that small changes do not matter. You step on a butterfly in the past, come back to today and see the world is indistinguishable the same. OR you go back to past , don’t kill a butterfly but when you come back the world is completely different because it is not deterministic. Every time you run it, you get a different result.
The world is robust to disturbances, at least to some of them, because it is also non deterministic | Is there a formal name for this statistical fallacy? | The Fallacy is not statistical. It is related to determinism. old science was deterministic and also stiff . So the butterfly effect was a logical consequence: you change something just a little bit a | Is there a formal name for this statistical fallacy?
The Fallacy is not statistical. It is related to determinism. old science was deterministic and also stiff . So the butterfly effect was a logical consequence: you change something just a little bit and the future is completely different as a result.
This is not how science is understood today. Determinism is gone, and even In stiff systems we are finding attractors. In other words, today we should easily envision that small changes do not matter. You step on a butterfly in the past, come back to today and see the world is indistinguishable the same. OR you go back to past , don’t kill a butterfly but when you come back the world is completely different because it is not deterministic. Every time you run it, you get a different result.
The world is robust to disturbances, at least to some of them, because it is also non deterministic | Is there a formal name for this statistical fallacy?
The Fallacy is not statistical. It is related to determinism. old science was deterministic and also stiff . So the butterfly effect was a logical consequence: you change something just a little bit a |
21,089 | Analysed non-linear data with GAM regression, but reviewer has suggested fitting exponential or logarithmic curves instead. Which to use? | In addition to Demetri's answer (+1):
The use of GAM is well-established in the field of Ecology so I would add certain books/influential articles. Show you are not reinventing the wheel rather that you are abreast with modern modelling approaches.
You do not describe your sample size but you might want to try a validation schema to show that through the use of GAMs you get better goodness-of-fit. While hand-wavy if something like an AIC/BIC shows a clear preference for a particular model this can pacify some (not too sophisticated) criticism...
I would emphasise how the GAM fitting procedure looks into shrinkage. It is plausible that someone oversimplified GAMs in his/her head as "a polynomial basis of sorts" and therefore prone to overfit.
Take their view-point for a moment: are there any established studies suggesting logarithmic, or exponential decay curves already? The reviewer might be satisfied that you acknowledge them as a possibility. Maybe you can make a critical assessment of that prior work and show how your work is a step forward.
As Dimitri mentioned, specifying a functional form without prior knowledge can induce strong bias. You can politely double-down on the fact you are using a non-parametric approach. Maybe even try a different basis functions (e.g. cubic regression splines and thin-plate splines) and show how the results are (hopefully) very similar and thus not dependant on the choice of basis functions.
Just to be clear: In my opinion, using GAMs is the correct approach here; the criticism of "why not X-functional form" is weak. Such criticism might be warranted if prior research suggested robust evidence for a particular modelling assumption but even then it would not be a particularly strong position to take. That said, try to see where they are come from too, criticism can be helpful strength your manuscript and/or alleviate worries of future readers too. | Analysed non-linear data with GAM regression, but reviewer has suggested fitting exponential or loga | In addition to Demetri's answer (+1):
The use of GAM is well-established in the field of Ecology so I would add certain books/influential articles. Show you are not reinventing the wheel rather that | Analysed non-linear data with GAM regression, but reviewer has suggested fitting exponential or logarithmic curves instead. Which to use?
In addition to Demetri's answer (+1):
The use of GAM is well-established in the field of Ecology so I would add certain books/influential articles. Show you are not reinventing the wheel rather that you are abreast with modern modelling approaches.
You do not describe your sample size but you might want to try a validation schema to show that through the use of GAMs you get better goodness-of-fit. While hand-wavy if something like an AIC/BIC shows a clear preference for a particular model this can pacify some (not too sophisticated) criticism...
I would emphasise how the GAM fitting procedure looks into shrinkage. It is plausible that someone oversimplified GAMs in his/her head as "a polynomial basis of sorts" and therefore prone to overfit.
Take their view-point for a moment: are there any established studies suggesting logarithmic, or exponential decay curves already? The reviewer might be satisfied that you acknowledge them as a possibility. Maybe you can make a critical assessment of that prior work and show how your work is a step forward.
As Dimitri mentioned, specifying a functional form without prior knowledge can induce strong bias. You can politely double-down on the fact you are using a non-parametric approach. Maybe even try a different basis functions (e.g. cubic regression splines and thin-plate splines) and show how the results are (hopefully) very similar and thus not dependant on the choice of basis functions.
Just to be clear: In my opinion, using GAMs is the correct approach here; the criticism of "why not X-functional form" is weak. Such criticism might be warranted if prior research suggested robust evidence for a particular modelling assumption but even then it would not be a particularly strong position to take. That said, try to see where they are come from too, criticism can be helpful strength your manuscript and/or alleviate worries of future readers too. | Analysed non-linear data with GAM regression, but reviewer has suggested fitting exponential or loga
In addition to Demetri's answer (+1):
The use of GAM is well-established in the field of Ecology so I would add certain books/influential articles. Show you are not reinventing the wheel rather that |
21,090 | Analysed non-linear data with GAM regression, but reviewer has suggested fitting exponential or logarithmic curves instead. Which to use? | That GAMs are somehow “statistical overkill” and simpler functions are “more generalizable” is a contentious claims. A priori, if you had no idea about the functional relationship between your inputs and outputs, a GAM is a sensible approach which subsumes exponential and logarithmic shapes as a special case. To fit a model and decide post facto that “hey this looks like this other function, I’m going to fit that instead” is not a proper inferential procedure anyway. Besides, the first plot is clearly non-monotonic so I don’t see why a log would be suggested.
Assuming you fit the models appropriately (looks like these are count or ratio data e.g. something per unit something meaning you should use an offset of some sort) I would probably politely respond to the reviewer to say that GAMs would be more generalizable because they freely estimate the effect as compared to specifying the functional form to be exponential or logarithmic. Specifying the functional form is a higher bias model than estimating the functional form with penalized basis functions. This means however that GAMs are more variable, which may or may not be an issue. You can at least be honest with the uncertainty by bootstrapping. | Analysed non-linear data with GAM regression, but reviewer has suggested fitting exponential or loga | That GAMs are somehow “statistical overkill” and simpler functions are “more generalizable” is a contentious claims. A priori, if you had no idea about the functional relationship between your inputs | Analysed non-linear data with GAM regression, but reviewer has suggested fitting exponential or logarithmic curves instead. Which to use?
That GAMs are somehow “statistical overkill” and simpler functions are “more generalizable” is a contentious claims. A priori, if you had no idea about the functional relationship between your inputs and outputs, a GAM is a sensible approach which subsumes exponential and logarithmic shapes as a special case. To fit a model and decide post facto that “hey this looks like this other function, I’m going to fit that instead” is not a proper inferential procedure anyway. Besides, the first plot is clearly non-monotonic so I don’t see why a log would be suggested.
Assuming you fit the models appropriately (looks like these are count or ratio data e.g. something per unit something meaning you should use an offset of some sort) I would probably politely respond to the reviewer to say that GAMs would be more generalizable because they freely estimate the effect as compared to specifying the functional form to be exponential or logarithmic. Specifying the functional form is a higher bias model than estimating the functional form with penalized basis functions. This means however that GAMs are more variable, which may or may not be an issue. You can at least be honest with the uncertainty by bootstrapping. | Analysed non-linear data with GAM regression, but reviewer has suggested fitting exponential or loga
That GAMs are somehow “statistical overkill” and simpler functions are “more generalizable” is a contentious claims. A priori, if you had no idea about the functional relationship between your inputs |
21,091 | Can a trend stationary series be modeled with ARIMA? | Looking at the comments it seems that we didn't address the question about how to choose between a deterministic or stochastic trend. That is, how to proceed in practice rather than the consequences or properties of each case.
One way to proceed is the following: Start by applying the ADF test.
If the null of a unit root is rejected we are done. The trend (if any) can be represented by a deterministic linear trend.
If the null of the ADF test is not rejected then we apply the KPSS test
(where the null hypothesis is the opposite, stationarity or stationarity around a linear trend).
o If the null of the KPSS test is rejected then we conclude that there is a unit root and work with the first differences of the data. Upon the first differences of the series we can test the significance of other regressors
or choose an ARMA model.
o If the null of the KPSS test is not rejected then we would have to say that the data are not much informative because we weren't able to reject none the of the null hypotheses. In this case it may be safer to work with the first differences of the series.
As mentioned in a previous answer, remember that these tests may be affected by the presence of outliers (e.g. an outlier at a single time point due to an error when recording the data or a level shift due for example to a policy change that affects the series from a given time point on). Thus, it is advisable to check these issues as well and repeat the previous analysis after including regressors for some potential outliers. | Can a trend stationary series be modeled with ARIMA? | Looking at the comments it seems that we didn't address the question about how to choose between a deterministic or stochastic trend. That is, how to proceed in practice rather than the consequences o | Can a trend stationary series be modeled with ARIMA?
Looking at the comments it seems that we didn't address the question about how to choose between a deterministic or stochastic trend. That is, how to proceed in practice rather than the consequences or properties of each case.
One way to proceed is the following: Start by applying the ADF test.
If the null of a unit root is rejected we are done. The trend (if any) can be represented by a deterministic linear trend.
If the null of the ADF test is not rejected then we apply the KPSS test
(where the null hypothesis is the opposite, stationarity or stationarity around a linear trend).
o If the null of the KPSS test is rejected then we conclude that there is a unit root and work with the first differences of the data. Upon the first differences of the series we can test the significance of other regressors
or choose an ARMA model.
o If the null of the KPSS test is not rejected then we would have to say that the data are not much informative because we weren't able to reject none the of the null hypotheses. In this case it may be safer to work with the first differences of the series.
As mentioned in a previous answer, remember that these tests may be affected by the presence of outliers (e.g. an outlier at a single time point due to an error when recording the data or a level shift due for example to a policy change that affects the series from a given time point on). Thus, it is advisable to check these issues as well and repeat the previous analysis after including regressors for some potential outliers. | Can a trend stationary series be modeled with ARIMA?
Looking at the comments it seems that we didn't address the question about how to choose between a deterministic or stochastic trend. That is, how to proceed in practice rather than the consequences o |
21,092 | Can a trend stationary series be modeled with ARIMA? | Remember that there are different kinds of non-stationarity and different ways on how to deal with them. Four common ones are:
1) Deterministic trends or trend stationarity. If your series is of this kind de-trend it or include a time trend in the regression/model. You might want to check out the Frisch–Waugh–Lovell theorem on this one.
2) Level shifts and structural breaks. If this is the case you should include a dummy variable for each break or if your sample is long enough model each regimé separately.
3) Changing variance. Either model the samples separately or model the changing variance using the ARCH or GARCH modelling class.
4) If your series contain a unit root. In general you should then check for cointegrating relationships between the variables but since you are concerned with univariate forecasting you shoud difference it once or twice depending on the order of integration.
In order to model a time series using the ARIMA modelling class the following steps should be appropriate:
1) Look at the ACF and PACF together with a time series plot to see wheter or not the series is stationary or non-stationary.
2) Test the series for a unit root. This can be done with a wide range of tests, some of the most common being the ADF test, the Phillips-Perron (PP) test, the KPSS test which has the null of stationarity or the DF-GLS test which is the most efficient of the aforementioned tests. NOTE! That in case your series contain a structural break these tests are biased towards not rejecting the null of a unit root. In case you want to test the robustness of these tests and if you suspect one or more structural breaks you should use endogenous structural break tests. Two common ones are the Zivot-Andrews test which allows for one endogenous structural break and the Clemente-Montañés-Reyes which allows for two structural breaks. The latter allows for two different models. An additive outlier model which accounts for sudden changes in the slope of the series and an innovative outlier model which takes gradual changes into account and allows a break in the intercept and slope.
3) If there is a unit root in the series then you should difference the series. Afterwards you should run look at the ACF, PACF and the time series plot and probably check for a second unit root to be on the safe side. The ACF and PACF will help you decide on how many AR and MA terms you should be including.
4) If the series does not contain a unit root but the time series plot and the ACF show that the series has a deterministic trend you should add a trend when fitting the model. Some people argue that it is completely valid to just difference the series when it contains a deterministic trend although information may be lost in the process. Never the less its a good idea to difference it in order to see have many AR and/or MA terms you will need to include. But a time trend is valid.
5) Fit the different models and do the usual diagnostic checking, you might want to use an information criterion or the MSE in order to select the best model given the sample you fit it on.
6) Do in sample forecasting on the best fitted models and calculate loss functions such as MSE, MAPE, MAD to see which of them actually perform best when using them to forecast because that is what we want to do!
7) Do your out of sample forecasting like a boss and be pleased with your results! | Can a trend stationary series be modeled with ARIMA? | Remember that there are different kinds of non-stationarity and different ways on how to deal with them. Four common ones are:
1) Deterministic trends or trend stationarity. If your series is of this | Can a trend stationary series be modeled with ARIMA?
Remember that there are different kinds of non-stationarity and different ways on how to deal with them. Four common ones are:
1) Deterministic trends or trend stationarity. If your series is of this kind de-trend it or include a time trend in the regression/model. You might want to check out the Frisch–Waugh–Lovell theorem on this one.
2) Level shifts and structural breaks. If this is the case you should include a dummy variable for each break or if your sample is long enough model each regimé separately.
3) Changing variance. Either model the samples separately or model the changing variance using the ARCH or GARCH modelling class.
4) If your series contain a unit root. In general you should then check for cointegrating relationships between the variables but since you are concerned with univariate forecasting you shoud difference it once or twice depending on the order of integration.
In order to model a time series using the ARIMA modelling class the following steps should be appropriate:
1) Look at the ACF and PACF together with a time series plot to see wheter or not the series is stationary or non-stationary.
2) Test the series for a unit root. This can be done with a wide range of tests, some of the most common being the ADF test, the Phillips-Perron (PP) test, the KPSS test which has the null of stationarity or the DF-GLS test which is the most efficient of the aforementioned tests. NOTE! That in case your series contain a structural break these tests are biased towards not rejecting the null of a unit root. In case you want to test the robustness of these tests and if you suspect one or more structural breaks you should use endogenous structural break tests. Two common ones are the Zivot-Andrews test which allows for one endogenous structural break and the Clemente-Montañés-Reyes which allows for two structural breaks. The latter allows for two different models. An additive outlier model which accounts for sudden changes in the slope of the series and an innovative outlier model which takes gradual changes into account and allows a break in the intercept and slope.
3) If there is a unit root in the series then you should difference the series. Afterwards you should run look at the ACF, PACF and the time series plot and probably check for a second unit root to be on the safe side. The ACF and PACF will help you decide on how many AR and MA terms you should be including.
4) If the series does not contain a unit root but the time series plot and the ACF show that the series has a deterministic trend you should add a trend when fitting the model. Some people argue that it is completely valid to just difference the series when it contains a deterministic trend although information may be lost in the process. Never the less its a good idea to difference it in order to see have many AR and/or MA terms you will need to include. But a time trend is valid.
5) Fit the different models and do the usual diagnostic checking, you might want to use an information criterion or the MSE in order to select the best model given the sample you fit it on.
6) Do in sample forecasting on the best fitted models and calculate loss functions such as MSE, MAPE, MAD to see which of them actually perform best when using them to forecast because that is what we want to do!
7) Do your out of sample forecasting like a boss and be pleased with your results! | Can a trend stationary series be modeled with ARIMA?
Remember that there are different kinds of non-stationarity and different ways on how to deal with them. Four common ones are:
1) Deterministic trends or trend stationarity. If your series is of this |
21,093 | Can a trend stationary series be modeled with ARIMA? | Determining whether the trend (or other component such as seasonality) is deterministic or stochastic is part of the puzzle in time series analysis. I will add a couple of points to what has been said.
1) The distinction between deterministic and stochastic trendsis important because if a unit root is present in the data (e.g. a random walk) then test statistics used for inference do not follow the traditional distribution. See this post for some details and references.
We can simulate a random walk (stochastic trend where first differences should be taken), test for the significance of deterministic trend and see the percentage of cases in which the null of deterministic trend is rejected. In R, we can do:
require(lmtest)
iter <- 10000
cval <- 0.05
n <- 120
rejections <- 0
set.seed(123)
for (i in seq.int(iter))
{
x <- cumsum(rnorm(n)) # random walk
fit <- lm(x ~ seq(n))
if (coeftest(fit)[2,"Pr(>|t|)"] < cval)
rejections <- rejections + 1
}
100 * rejections / iter
#[1] 88.67
At the 5% significance level, we would expect to reject the null in the 95% of cases, however, in this experiment it was rejected only in ~89% of cases out of 10,000 simulated random walks.
We can apply unit root tests to test whether a unit root is present. But we must be aware that a linear trend may in turn lead to failure to reject the null of a unit root. In order to deal with this, the KPSS test considers the null of stationarity around a linear trend.
2) Another issue is the interpretation of the deterministic components in a process in levels or first differences. The effect of an intercept is not the same in a model with a linear trend as in a random walk. See this post for illustration.
Analytically, let's take a random walk with drift:
$$
y_t = \mu + y_{t-1} + \epsilon_t \,,\quad \epsilon_t \sim NID(0, \sigma^2) \,.
$$
If we substitute repeatedly $y_{t-i}$ by lagged versions of $y_t$:
\begin{eqnarray*}
y_t &=& \mu + \underbrace{y_{t-1}}_{\mu + y_{t-2} + \epsilon_{t-1}} + \epsilon_t \\
&=& 2\mu + \underbrace{y_{t-2}}_{\mu + y_{t-3} + \epsilon_{t-2}} + \epsilon_{t-1} + \epsilon_t \\
&=& 3\mu + y_{t-3} + \epsilon_{t-2} + \epsilon_{t-1} + \epsilon_t \\
&...&
\end{eqnarray*}
We arrive to:
$$
y_t = y_0 + \mu t + \sum_{i=1}^t \epsilon_i
$$
where $y_0$ is some arbitrary initial value. Thus, we see that the accumulation of shocks and the long memory of the random walk makes the intercept $\mu$ to have the effect of a linear trend with slope $\mu$ (in this case the constant term $\mu$ is called a drift).
If the graphical representation of a series shows a relatively clear linear trend, we cannot be sure whether it is due to the presence of a deterministic linear trend or to a drift in a random walk process. Complementary graphics and tests statistics should be applied.
There are some caveats to bear in mind since an analysis based on unit root
and other test statistics is not foolproof. Some of these tests may be affected by the presence of outlying observations or level shifts and require the selection of a lag order which is not always straightforward.
As a workaround to this puzzle, I think that the common practice is to take differences of the data until the series looks stationary (for example looking at the autocorrelation function, which should go to zero fast) and then choose an ARMA model. | Can a trend stationary series be modeled with ARIMA? | Determining whether the trend (or other component such as seasonality) is deterministic or stochastic is part of the puzzle in time series analysis. I will add a couple of points to what has been said | Can a trend stationary series be modeled with ARIMA?
Determining whether the trend (or other component such as seasonality) is deterministic or stochastic is part of the puzzle in time series analysis. I will add a couple of points to what has been said.
1) The distinction between deterministic and stochastic trendsis important because if a unit root is present in the data (e.g. a random walk) then test statistics used for inference do not follow the traditional distribution. See this post for some details and references.
We can simulate a random walk (stochastic trend where first differences should be taken), test for the significance of deterministic trend and see the percentage of cases in which the null of deterministic trend is rejected. In R, we can do:
require(lmtest)
iter <- 10000
cval <- 0.05
n <- 120
rejections <- 0
set.seed(123)
for (i in seq.int(iter))
{
x <- cumsum(rnorm(n)) # random walk
fit <- lm(x ~ seq(n))
if (coeftest(fit)[2,"Pr(>|t|)"] < cval)
rejections <- rejections + 1
}
100 * rejections / iter
#[1] 88.67
At the 5% significance level, we would expect to reject the null in the 95% of cases, however, in this experiment it was rejected only in ~89% of cases out of 10,000 simulated random walks.
We can apply unit root tests to test whether a unit root is present. But we must be aware that a linear trend may in turn lead to failure to reject the null of a unit root. In order to deal with this, the KPSS test considers the null of stationarity around a linear trend.
2) Another issue is the interpretation of the deterministic components in a process in levels or first differences. The effect of an intercept is not the same in a model with a linear trend as in a random walk. See this post for illustration.
Analytically, let's take a random walk with drift:
$$
y_t = \mu + y_{t-1} + \epsilon_t \,,\quad \epsilon_t \sim NID(0, \sigma^2) \,.
$$
If we substitute repeatedly $y_{t-i}$ by lagged versions of $y_t$:
\begin{eqnarray*}
y_t &=& \mu + \underbrace{y_{t-1}}_{\mu + y_{t-2} + \epsilon_{t-1}} + \epsilon_t \\
&=& 2\mu + \underbrace{y_{t-2}}_{\mu + y_{t-3} + \epsilon_{t-2}} + \epsilon_{t-1} + \epsilon_t \\
&=& 3\mu + y_{t-3} + \epsilon_{t-2} + \epsilon_{t-1} + \epsilon_t \\
&...&
\end{eqnarray*}
We arrive to:
$$
y_t = y_0 + \mu t + \sum_{i=1}^t \epsilon_i
$$
where $y_0$ is some arbitrary initial value. Thus, we see that the accumulation of shocks and the long memory of the random walk makes the intercept $\mu$ to have the effect of a linear trend with slope $\mu$ (in this case the constant term $\mu$ is called a drift).
If the graphical representation of a series shows a relatively clear linear trend, we cannot be sure whether it is due to the presence of a deterministic linear trend or to a drift in a random walk process. Complementary graphics and tests statistics should be applied.
There are some caveats to bear in mind since an analysis based on unit root
and other test statistics is not foolproof. Some of these tests may be affected by the presence of outlying observations or level shifts and require the selection of a lag order which is not always straightforward.
As a workaround to this puzzle, I think that the common practice is to take differences of the data until the series looks stationary (for example looking at the autocorrelation function, which should go to zero fast) and then choose an ARMA model. | Can a trend stationary series be modeled with ARIMA?
Determining whether the trend (or other component such as seasonality) is deterministic or stochastic is part of the puzzle in time series analysis. I will add a couple of points to what has been said |
21,094 | Can a trend stationary series be modeled with ARIMA? | As empirically shown below, using a trend variable in ARIMAX negated the need for differencing and makes the series trend stationary. Here is the logic I used to verify.
Simulated an AR process
Added a deterministic trend
Using ARIMAX modeled with trend as exogenous variable the above series without differencing.
Checked the residuals for white noise and it is purely random
Below is the R code and plots:
set.seed(3215)
##Simulate an AR process
x <- arima.sim(n = 63, list(ar = c(0.7)));
plot(x)
## Add Deterministic Trend to AR
t <- seq(1, 63)
beta <- 0.8
t_beta <- ts(t*beta, frequency=1)
ar_det <- x+t_beta
plot(ar_det)
## Check with arima
ar_model <- arima(ar_det, order=c(1, 0, 0), xreg=t, include.mean=FALSE)
## Check whether residuals of fitted model is random
pacf(ar_model$residuals)
AR(1) Simulated Plot
AR(1) with deterministic trend
ARIMAX Residual PACF with trend as exogenous. Residuals are random, with no pattern left
As can be seen above, modeling deterministic trend as an exogenous variable in the ARIMAX model negates the need for differencing. At least in the deterministic case it worked. I wonder how this would behave with stochastic trend which is very hard to predict or model.
To answer your second question, YES all ARIMA including ARIMAX have to be made stationary. At least that's what text books say.
In addition, as commented, see this article. Very clear explanation on Deterministic Trend vs. Stochastic trend and how to remove them to make it trend stationary and also very nice literature survey on this topic. They use it in the neural network context, but it is useful for general time series problem. Their final recommendation is when it is clearly identified as deterministic trend, the do linear detrending, else apply differencing to make the time series stationary. The jury is still out there, but most researchers cited in this article recommend differencing as opposed to linear detrending.
Edit:
Below is random walk with drift stochastic process, using exogenous variable and difference arima. Both appear to give same answer and in essence they are same.
library(Hmisc)
set.seed(3215)
## ADD Stochastic Trend to simulated Arima this is AR(1) with unit root with non zero mean
y = rep(NA, 63)
y[[1]] <- 2
for (i in 2:63) {
y[i] <- 3+1*y[i-1] + rnorm(1, mean = 0, sd = 1)
}
plot(y, type="l")
y_ts <- ts(y, frequency=1)
## Lag to create Xreg
y_1 <- Lag(y, shift=1)
## Start from 2 value to avoid NA and make it equal length with xreg
y <- window(y_ts, start =2, end=63)
xreg1 <- y_1[-1]
## Check the values with ARIMA and xreg
g <- arima(y, order=c(0, 0, 0), xreg=xreg1)
pacf(g$residuals)
## Check the values with ARIM
g1 <- arima(y, order=c(0, 1, 0))
pacf(g1$residuals)
##
ARIMA(0, 0, 0) with non-zero mean
Coefficients:
intercept xreg1
3.1304 0.9976
s.e. 0.2664 0.0025 | Can a trend stationary series be modeled with ARIMA? | As empirically shown below, using a trend variable in ARIMAX negated the need for differencing and makes the series trend stationary. Here is the logic I used to verify.
Simulated an AR process
Adde | Can a trend stationary series be modeled with ARIMA?
As empirically shown below, using a trend variable in ARIMAX negated the need for differencing and makes the series trend stationary. Here is the logic I used to verify.
Simulated an AR process
Added a deterministic trend
Using ARIMAX modeled with trend as exogenous variable the above series without differencing.
Checked the residuals for white noise and it is purely random
Below is the R code and plots:
set.seed(3215)
##Simulate an AR process
x <- arima.sim(n = 63, list(ar = c(0.7)));
plot(x)
## Add Deterministic Trend to AR
t <- seq(1, 63)
beta <- 0.8
t_beta <- ts(t*beta, frequency=1)
ar_det <- x+t_beta
plot(ar_det)
## Check with arima
ar_model <- arima(ar_det, order=c(1, 0, 0), xreg=t, include.mean=FALSE)
## Check whether residuals of fitted model is random
pacf(ar_model$residuals)
AR(1) Simulated Plot
AR(1) with deterministic trend
ARIMAX Residual PACF with trend as exogenous. Residuals are random, with no pattern left
As can be seen above, modeling deterministic trend as an exogenous variable in the ARIMAX model negates the need for differencing. At least in the deterministic case it worked. I wonder how this would behave with stochastic trend which is very hard to predict or model.
To answer your second question, YES all ARIMA including ARIMAX have to be made stationary. At least that's what text books say.
In addition, as commented, see this article. Very clear explanation on Deterministic Trend vs. Stochastic trend and how to remove them to make it trend stationary and also very nice literature survey on this topic. They use it in the neural network context, but it is useful for general time series problem. Their final recommendation is when it is clearly identified as deterministic trend, the do linear detrending, else apply differencing to make the time series stationary. The jury is still out there, but most researchers cited in this article recommend differencing as opposed to linear detrending.
Edit:
Below is random walk with drift stochastic process, using exogenous variable and difference arima. Both appear to give same answer and in essence they are same.
library(Hmisc)
set.seed(3215)
## ADD Stochastic Trend to simulated Arima this is AR(1) with unit root with non zero mean
y = rep(NA, 63)
y[[1]] <- 2
for (i in 2:63) {
y[i] <- 3+1*y[i-1] + rnorm(1, mean = 0, sd = 1)
}
plot(y, type="l")
y_ts <- ts(y, frequency=1)
## Lag to create Xreg
y_1 <- Lag(y, shift=1)
## Start from 2 value to avoid NA and make it equal length with xreg
y <- window(y_ts, start =2, end=63)
xreg1 <- y_1[-1]
## Check the values with ARIMA and xreg
g <- arima(y, order=c(0, 0, 0), xreg=xreg1)
pacf(g$residuals)
## Check the values with ARIM
g1 <- arima(y, order=c(0, 1, 0))
pacf(g1$residuals)
##
ARIMA(0, 0, 0) with non-zero mean
Coefficients:
intercept xreg1
3.1304 0.9976
s.e. 0.2664 0.0025 | Can a trend stationary series be modeled with ARIMA?
As empirically shown below, using a trend variable in ARIMAX negated the need for differencing and makes the series trend stationary. Here is the logic I used to verify.
Simulated an AR process
Adde |
21,095 | Interpreting a logistic regression model with multiple predictors | I would suggest that you use Frank Harrell's excellent rms package. It contains many useful functions to validate and calibrate your model. As far as I know, you cannot assess predictive performance solely based on the coefficients. Further, I would suggest that you use the bootstrap to validate the model. The AUC or concordance-index (c-index) is a useful measure of predictive performance. A c-index of $0.8$ is quite high but as in many predictive models, the fit of your model is likely overoptimistic (overfitting). This overoptimism can be assessed using bootstrap. But let me give an example:
#-----------------------------------------------------------------------------
# Load packages
#-----------------------------------------------------------------------------
library(rms)
#-----------------------------------------------------------------------------
# Load data
#-----------------------------------------------------------------------------
mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv")
mydata$rank <- factor(mydata$rank)
#-----------------------------------------------------------------------------
# Fit logistic regression model
#-----------------------------------------------------------------------------
mylogit <- lrm(admit ~ gre + gpa + rank, x=TRUE, y=TRUE, data = mydata)
mylogit
Model Likelihood Discrimination Rank Discrim.
Ratio Test Indexes Indexes
Obs 400 LR chi2 41.46 R2 0.138 C 0.693
0 273 d.f. 5 g 0.838 Dxy 0.386
1 127 Pr(> chi2) <0.0001 gr 2.311 gamma 0.387
max |deriv| 2e-06 gp 0.167 tau-a 0.168
Brier 0.195
Coef S.E. Wald Z Pr(>|Z|)
Intercept -3.9900 1.1400 -3.50 0.0005
gre 0.0023 0.0011 2.07 0.0385
gpa 0.8040 0.3318 2.42 0.0154
rank=2 -0.6754 0.3165 -2.13 0.0328
rank=3 -1.3402 0.3453 -3.88 0.0001
rank=4 -1.5515 0.4178 -3.71 0.0002
On the bottom you see the usual regression coefficients with corresponding $p$-values. On the top right, you see several discrimination indices. The C denotes the c-index (AUC), and a c-index of $0.5$ denotes random splitting whereas a c-index of $1$ denotes perfect prediction. Dxy is Somers' $D_{xy}$ rank correlation between the predicted probabilities and the observed responses. $D_{xy}$ has simple relationship with the c-index: $D_{xy}=2(c-0.5)$. A $D_{xy}$ of $0$ occurs when the model's predictions are random and when $D_{xy}=1$, the model is perfectly discriminating. In this case, the c-index is $0.693$ which is slightly better than chance but a c-index of $>0.8$ is good enough for predicting the outcomes of individuals.
As said above, the model is likely overoptimistic. We now use bootstrap to quantify the optimism:
#-----------------------------------------------------------------------------
# Validate model using bootstrap
#-----------------------------------------------------------------------------
my.valid <- validate(mylogit, method="boot", B=1000)
my.valid
index.orig training test optimism index.corrected n
Dxy 0.3857 0.4033 0.3674 0.0358 0.3498 1000
R2 0.1380 0.1554 0.1264 0.0290 0.1090 1000
Intercept 0.0000 0.0000 -0.0629 0.0629 -0.0629 1000
Slope 1.0000 1.0000 0.9034 0.0966 0.9034 1000
Emax 0.0000 0.0000 0.0334 0.0334 0.0334 1000
D 0.1011 0.1154 0.0920 0.0234 0.0778 1000
U -0.0050 -0.0050 0.0015 -0.0065 0.0015 1000
Q 0.1061 0.1204 0.0905 0.0299 0.0762 1000
B 0.1947 0.1915 0.1977 -0.0062 0.2009 1000
g 0.8378 0.9011 0.7963 0.1048 0.7331 1000
gp 0.1673 0.1757 0.1596 0.0161 0.1511 1000
Let's concentrate on the $D_{xy}$ which is at the top. The first column denotes the original index, which was $0.3857$. The column called optimism denotes the amount of estimated overestimation by the model. The column index.corrected is the original estimate minus the optimism. In this case, the bias-corrected $D_{xy}$ is a bit smaller than the original. The bias-corrected c-index (AUC) is $c=\frac{1+ D_{xy}}{2}=0.6749$.
We can also calculate a calibration curve using resampling:
#-----------------------------------------------------------------------------
# Calibration curve using bootstrap
#-----------------------------------------------------------------------------
my.calib <- calibrate(mylogit, method="boot", B=1000)
par(bg="white", las=1)
plot(my.calib, las=1)
n=400 Mean absolute error=0.016 Mean squared error=0.00034
0.9 Quantile of absolute error=0.025
The plot provides some evidence that our models is overfitting: the model underestimates low probabilities and overestimates high probabilities. There is also a systematic overestimation around $0.3$.
Predictive model building is a big topic and I suggest reading Frank Harrell's course notes. | Interpreting a logistic regression model with multiple predictors | I would suggest that you use Frank Harrell's excellent rms package. It contains many useful functions to validate and calibrate your model. As far as I know, you cannot assess predictive performance s | Interpreting a logistic regression model with multiple predictors
I would suggest that you use Frank Harrell's excellent rms package. It contains many useful functions to validate and calibrate your model. As far as I know, you cannot assess predictive performance solely based on the coefficients. Further, I would suggest that you use the bootstrap to validate the model. The AUC or concordance-index (c-index) is a useful measure of predictive performance. A c-index of $0.8$ is quite high but as in many predictive models, the fit of your model is likely overoptimistic (overfitting). This overoptimism can be assessed using bootstrap. But let me give an example:
#-----------------------------------------------------------------------------
# Load packages
#-----------------------------------------------------------------------------
library(rms)
#-----------------------------------------------------------------------------
# Load data
#-----------------------------------------------------------------------------
mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv")
mydata$rank <- factor(mydata$rank)
#-----------------------------------------------------------------------------
# Fit logistic regression model
#-----------------------------------------------------------------------------
mylogit <- lrm(admit ~ gre + gpa + rank, x=TRUE, y=TRUE, data = mydata)
mylogit
Model Likelihood Discrimination Rank Discrim.
Ratio Test Indexes Indexes
Obs 400 LR chi2 41.46 R2 0.138 C 0.693
0 273 d.f. 5 g 0.838 Dxy 0.386
1 127 Pr(> chi2) <0.0001 gr 2.311 gamma 0.387
max |deriv| 2e-06 gp 0.167 tau-a 0.168
Brier 0.195
Coef S.E. Wald Z Pr(>|Z|)
Intercept -3.9900 1.1400 -3.50 0.0005
gre 0.0023 0.0011 2.07 0.0385
gpa 0.8040 0.3318 2.42 0.0154
rank=2 -0.6754 0.3165 -2.13 0.0328
rank=3 -1.3402 0.3453 -3.88 0.0001
rank=4 -1.5515 0.4178 -3.71 0.0002
On the bottom you see the usual regression coefficients with corresponding $p$-values. On the top right, you see several discrimination indices. The C denotes the c-index (AUC), and a c-index of $0.5$ denotes random splitting whereas a c-index of $1$ denotes perfect prediction. Dxy is Somers' $D_{xy}$ rank correlation between the predicted probabilities and the observed responses. $D_{xy}$ has simple relationship with the c-index: $D_{xy}=2(c-0.5)$. A $D_{xy}$ of $0$ occurs when the model's predictions are random and when $D_{xy}=1$, the model is perfectly discriminating. In this case, the c-index is $0.693$ which is slightly better than chance but a c-index of $>0.8$ is good enough for predicting the outcomes of individuals.
As said above, the model is likely overoptimistic. We now use bootstrap to quantify the optimism:
#-----------------------------------------------------------------------------
# Validate model using bootstrap
#-----------------------------------------------------------------------------
my.valid <- validate(mylogit, method="boot", B=1000)
my.valid
index.orig training test optimism index.corrected n
Dxy 0.3857 0.4033 0.3674 0.0358 0.3498 1000
R2 0.1380 0.1554 0.1264 0.0290 0.1090 1000
Intercept 0.0000 0.0000 -0.0629 0.0629 -0.0629 1000
Slope 1.0000 1.0000 0.9034 0.0966 0.9034 1000
Emax 0.0000 0.0000 0.0334 0.0334 0.0334 1000
D 0.1011 0.1154 0.0920 0.0234 0.0778 1000
U -0.0050 -0.0050 0.0015 -0.0065 0.0015 1000
Q 0.1061 0.1204 0.0905 0.0299 0.0762 1000
B 0.1947 0.1915 0.1977 -0.0062 0.2009 1000
g 0.8378 0.9011 0.7963 0.1048 0.7331 1000
gp 0.1673 0.1757 0.1596 0.0161 0.1511 1000
Let's concentrate on the $D_{xy}$ which is at the top. The first column denotes the original index, which was $0.3857$. The column called optimism denotes the amount of estimated overestimation by the model. The column index.corrected is the original estimate minus the optimism. In this case, the bias-corrected $D_{xy}$ is a bit smaller than the original. The bias-corrected c-index (AUC) is $c=\frac{1+ D_{xy}}{2}=0.6749$.
We can also calculate a calibration curve using resampling:
#-----------------------------------------------------------------------------
# Calibration curve using bootstrap
#-----------------------------------------------------------------------------
my.calib <- calibrate(mylogit, method="boot", B=1000)
par(bg="white", las=1)
plot(my.calib, las=1)
n=400 Mean absolute error=0.016 Mean squared error=0.00034
0.9 Quantile of absolute error=0.025
The plot provides some evidence that our models is overfitting: the model underestimates low probabilities and overestimates high probabilities. There is also a systematic overestimation around $0.3$.
Predictive model building is a big topic and I suggest reading Frank Harrell's course notes. | Interpreting a logistic regression model with multiple predictors
I would suggest that you use Frank Harrell's excellent rms package. It contains many useful functions to validate and calibrate your model. As far as I know, you cannot assess predictive performance s |
21,096 | Interpreting a logistic regression model with multiple predictors | A note on interpretation of coefficients: do recall they depend on how the predictors are written as numbers. So for continuous variables they depend on the units in which they are measured; for categorical predictors, the coding scheme. Don't be tempted to think that, say, A9 is 'unimportant' just because its coefficient of 0.003453 is small—A9 might range over several orders of magnitude in some population of interest while the other predictors vary only slightly, or it may be easy to set to very high or low values while the others are hard to change much. | Interpreting a logistic regression model with multiple predictors | A note on interpretation of coefficients: do recall they depend on how the predictors are written as numbers. So for continuous variables they depend on the units in which they are measured; for categ | Interpreting a logistic regression model with multiple predictors
A note on interpretation of coefficients: do recall they depend on how the predictors are written as numbers. So for continuous variables they depend on the units in which they are measured; for categorical predictors, the coding scheme. Don't be tempted to think that, say, A9 is 'unimportant' just because its coefficient of 0.003453 is small—A9 might range over several orders of magnitude in some population of interest while the other predictors vary only slightly, or it may be easy to set to very high or low values while the others are hard to change much. | Interpreting a logistic regression model with multiple predictors
A note on interpretation of coefficients: do recall they depend on how the predictors are written as numbers. So for continuous variables they depend on the units in which they are measured; for categ |
21,097 | How can kernelization improve the K Nearest Neighbour algorithm? | Cover's Theorem: Roughly stated, it says given any random set of finite points (with arbitrary labels), then with high probability these points can be made linearly separable [1] by mapping them to a higher dimension [2].
Implication: Great, what this theorem tells me is that if I take my dataset and map these points to a higher dimension, then I can easily find a linear classifier. However, most classifiers need to compute some kind of similarity like dot product and this means that the time complexity of a classification algorithm is proportional to the dimension of the data point. So, higher dimension means larger time complexity (not to mention space complexity to store those large dimensional points).
Kernel Trick: Let $n$ be the original dimension of data points and $f$ be the map which maps these points to a space of dimension $N (>> n)$. Now, if there is a function $K$ which takes inputs $x$ and $y$ from the original space and computes $K(x, y) = \langle f(x), f(y) \rangle$, then I am able to compute the dot product in higher dimensional space but in complexity $O(n)$ instead of $O(N)$.
Implication: So, if the classification algorithm is only dependent on the dot product and has no dependency on the actual map $f$, I can use the kernel trick to run the algorithm in high dimensional space with almost no additional cost.
Does Linear separability imply that points from the same class will get closer than the points from different classes?
No, there is no such guarantee as such. Linear separability doesn't really imply that the point from same class has gotten closer or that the points from two different classes have gotten any further.
So why would kNN work?
It need not! However, if it does, then it is purely because of the kernel.
What does that mean?
Consider the boolean feature vector $x = (x_1, x_2)$. When you use degree two polynomial kernel, the feature vector $x$ is mapped to the vector $(x_1^2, \sqrt{2} x_1x_2, x_2^2)$. From a vector of boolean features, just by using degree two polynomial, we have obtained a feature vector of "conjunctions". Thus, the kernels themselves produce some brilliant feature maps. If your data has good original features and if your data could benefit from the feature maps created by these kernels. By benefit, I mean that the features produced by these feature maps can bring the points from the same class closer to each other and push points from different classes away, then kNN stands to benefit from using kernels. Otherwise, the results won't be any different than what you get from running kNN on the original data.
Then why use kernel kNN?
We showed that the computation complexity of using kernels is just slightly more than the usual kNN and if data benefits from using kernels then why not use them anyway?
Is there any paper that has studied which class of data that can benefit from kernels in kNN?
As far as I know, No.
[1] http://en.wikipedia.org/wiki/Linear_separability
[2] http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4038449&tag=1 | How can kernelization improve the K Nearest Neighbour algorithm? | Cover's Theorem: Roughly stated, it says given any random set of finite points (with arbitrary labels), then with high probability these points can be made linearly separable [1] by mapping them to a | How can kernelization improve the K Nearest Neighbour algorithm?
Cover's Theorem: Roughly stated, it says given any random set of finite points (with arbitrary labels), then with high probability these points can be made linearly separable [1] by mapping them to a higher dimension [2].
Implication: Great, what this theorem tells me is that if I take my dataset and map these points to a higher dimension, then I can easily find a linear classifier. However, most classifiers need to compute some kind of similarity like dot product and this means that the time complexity of a classification algorithm is proportional to the dimension of the data point. So, higher dimension means larger time complexity (not to mention space complexity to store those large dimensional points).
Kernel Trick: Let $n$ be the original dimension of data points and $f$ be the map which maps these points to a space of dimension $N (>> n)$. Now, if there is a function $K$ which takes inputs $x$ and $y$ from the original space and computes $K(x, y) = \langle f(x), f(y) \rangle$, then I am able to compute the dot product in higher dimensional space but in complexity $O(n)$ instead of $O(N)$.
Implication: So, if the classification algorithm is only dependent on the dot product and has no dependency on the actual map $f$, I can use the kernel trick to run the algorithm in high dimensional space with almost no additional cost.
Does Linear separability imply that points from the same class will get closer than the points from different classes?
No, there is no such guarantee as such. Linear separability doesn't really imply that the point from same class has gotten closer or that the points from two different classes have gotten any further.
So why would kNN work?
It need not! However, if it does, then it is purely because of the kernel.
What does that mean?
Consider the boolean feature vector $x = (x_1, x_2)$. When you use degree two polynomial kernel, the feature vector $x$ is mapped to the vector $(x_1^2, \sqrt{2} x_1x_2, x_2^2)$. From a vector of boolean features, just by using degree two polynomial, we have obtained a feature vector of "conjunctions". Thus, the kernels themselves produce some brilliant feature maps. If your data has good original features and if your data could benefit from the feature maps created by these kernels. By benefit, I mean that the features produced by these feature maps can bring the points from the same class closer to each other and push points from different classes away, then kNN stands to benefit from using kernels. Otherwise, the results won't be any different than what you get from running kNN on the original data.
Then why use kernel kNN?
We showed that the computation complexity of using kernels is just slightly more than the usual kNN and if data benefits from using kernels then why not use them anyway?
Is there any paper that has studied which class of data that can benefit from kernels in kNN?
As far as I know, No.
[1] http://en.wikipedia.org/wiki/Linear_separability
[2] http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=4038449&tag=1 | How can kernelization improve the K Nearest Neighbour algorithm?
Cover's Theorem: Roughly stated, it says given any random set of finite points (with arbitrary labels), then with high probability these points can be made linearly separable [1] by mapping them to a |
21,098 | Initializing K-means centers by the means of random subsamples of the dataset? | If you randomly split the sample into 5 subsamples your 5 means will almost coincide. What is the sense of making such close points the initial cluster centres?
In many K-means implementations, the default selection of initial cluster centres is based on the opposite idea: to find the 5 points which are most far apart and make them the initial centres. You may ask what may be the way to find those far apart points? Here's what SPSS' K-means is doing for that:
Take any k cases (points) of the dataset as the initial centres. All the rest cases are being checked for the ability to substitute those as the initial centres, by the following conditions:
a) If the case is farther from the centre closest to it than the
distance between two most close to each other centres, the case
substitutes that centre of the latter two to which it is
closer.
b) If the case is farther from the centre 2nd closest to it than the
distance between the centre closest to it and the centre closest to
this latter one, the case substitutes the centre closest to
it.
If condition (a) is not satisfied, condition (b) is checked; if it is not satisfied either the case does not become a centre. As the result of such run through cases we obtain k utmost cases in the cloud which become the initial centres. The result of this algo, although robust enough, is not fully insensitive to the starting choice of "any k cases" and to the sort order of cases in the dataset; so, several random starting attempts are still welcome, as it is always the case with K-means.
See my answer with a list of popular initializing methods for k-means. Method of splitting into random subsamples (critisized here by me and others) as well as the described method used by SPSS - are on the list too. | Initializing K-means centers by the means of random subsamples of the dataset? | If you randomly split the sample into 5 subsamples your 5 means will almost coincide. What is the sense of making such close points the initial cluster centres?
In many K-means implementations, the de | Initializing K-means centers by the means of random subsamples of the dataset?
If you randomly split the sample into 5 subsamples your 5 means will almost coincide. What is the sense of making such close points the initial cluster centres?
In many K-means implementations, the default selection of initial cluster centres is based on the opposite idea: to find the 5 points which are most far apart and make them the initial centres. You may ask what may be the way to find those far apart points? Here's what SPSS' K-means is doing for that:
Take any k cases (points) of the dataset as the initial centres. All the rest cases are being checked for the ability to substitute those as the initial centres, by the following conditions:
a) If the case is farther from the centre closest to it than the
distance between two most close to each other centres, the case
substitutes that centre of the latter two to which it is
closer.
b) If the case is farther from the centre 2nd closest to it than the
distance between the centre closest to it and the centre closest to
this latter one, the case substitutes the centre closest to
it.
If condition (a) is not satisfied, condition (b) is checked; if it is not satisfied either the case does not become a centre. As the result of such run through cases we obtain k utmost cases in the cloud which become the initial centres. The result of this algo, although robust enough, is not fully insensitive to the starting choice of "any k cases" and to the sort order of cases in the dataset; so, several random starting attempts are still welcome, as it is always the case with K-means.
See my answer with a list of popular initializing methods for k-means. Method of splitting into random subsamples (critisized here by me and others) as well as the described method used by SPSS - are on the list too. | Initializing K-means centers by the means of random subsamples of the dataset?
If you randomly split the sample into 5 subsamples your 5 means will almost coincide. What is the sense of making such close points the initial cluster centres?
In many K-means implementations, the de |
21,099 | Initializing K-means centers by the means of random subsamples of the dataset? | The means will be much too similar. You could just as well find the data set mean, and then place the initial centroids in a small circle/sphere around this mean.
If you want to see some more sound initialization scheme for k-means, have a look at k-means++. They have devised a quite clever method for seeding k-means.
Arthur, D. and Vassilvitskii, S. (2007).
k-means++: the advantages of careful seeding".
Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms
Author slides:
http://www.ima.umn.edu/~iwen/REU/BATS-Means.pdf | Initializing K-means centers by the means of random subsamples of the dataset? | The means will be much too similar. You could just as well find the data set mean, and then place the initial centroids in a small circle/sphere around this mean.
If you want to see some more sound in | Initializing K-means centers by the means of random subsamples of the dataset?
The means will be much too similar. You could just as well find the data set mean, and then place the initial centroids in a small circle/sphere around this mean.
If you want to see some more sound initialization scheme for k-means, have a look at k-means++. They have devised a quite clever method for seeding k-means.
Arthur, D. and Vassilvitskii, S. (2007).
k-means++: the advantages of careful seeding".
Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms
Author slides:
http://www.ima.umn.edu/~iwen/REU/BATS-Means.pdf | Initializing K-means centers by the means of random subsamples of the dataset?
The means will be much too similar. You could just as well find the data set mean, and then place the initial centroids in a small circle/sphere around this mean.
If you want to see some more sound in |
21,100 | Initializing K-means centers by the means of random subsamples of the dataset? | Using the means of random samples will give you the opposite of what you need, as ttnphns pointed out in his comment. What we would need is a way to find data points that are fairly far from each other.
Ideally, you could iterate over all points, find the distances between them, determine where the distances are the largest ...
Not to sidestep the OP's intention, but I think the "solution" is built into the k-means algorithm. We perform multiple iterations and recalculate cluster centroids based on the previous iterations. We also usually run the kmeans algorithm several times (with random initial values), and compare the results.
If one has a priori knowledge, domain knowledge, then that could lead to a superior method of identify where initial cluster centers should be. Otherwise, it's probably a matter of selecting random data points as initial values and then utilizing multiple runs and multiple iterations per run. | Initializing K-means centers by the means of random subsamples of the dataset? | Using the means of random samples will give you the opposite of what you need, as ttnphns pointed out in his comment. What we would need is a way to find data points that are fairly far from each othe | Initializing K-means centers by the means of random subsamples of the dataset?
Using the means of random samples will give you the opposite of what you need, as ttnphns pointed out in his comment. What we would need is a way to find data points that are fairly far from each other.
Ideally, you could iterate over all points, find the distances between them, determine where the distances are the largest ...
Not to sidestep the OP's intention, but I think the "solution" is built into the k-means algorithm. We perform multiple iterations and recalculate cluster centroids based on the previous iterations. We also usually run the kmeans algorithm several times (with random initial values), and compare the results.
If one has a priori knowledge, domain knowledge, then that could lead to a superior method of identify where initial cluster centers should be. Otherwise, it's probably a matter of selecting random data points as initial values and then utilizing multiple runs and multiple iterations per run. | Initializing K-means centers by the means of random subsamples of the dataset?
Using the means of random samples will give you the opposite of what you need, as ttnphns pointed out in his comment. What we would need is a way to find data points that are fairly far from each othe |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.