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
43,201
Conditional/normalized multiple imputation
Here's what Ian White, one of the contributors to Stata's original multiple imputation ice package, suggested: I assume you believe that the distribution of Y|X "if Z were 1" is equal to the distribution of Y|X in the subgroup with observed Z equal to 1. I think you can do this as follows. Impute in the usual way e.g. using ice x y, by(z) m(5) clear In the imputed dataset, delete all imputed values of y and all observed values of y for which z<>1. Impute y e.g. using uvis y x, gen(yimp) by(_mj)
Conditional/normalized multiple imputation
Here's what Ian White, one of the contributors to Stata's original multiple imputation ice package, suggested: I assume you believe that the distribution of Y|X "if Z were 1" is equal to the distribu
Conditional/normalized multiple imputation Here's what Ian White, one of the contributors to Stata's original multiple imputation ice package, suggested: I assume you believe that the distribution of Y|X "if Z were 1" is equal to the distribution of Y|X in the subgroup with observed Z equal to 1. I think you can do this as follows. Impute in the usual way e.g. using ice x y, by(z) m(5) clear In the imputed dataset, delete all imputed values of y and all observed values of y for which z<>1. Impute y e.g. using uvis y x, gen(yimp) by(_mj)
Conditional/normalized multiple imputation Here's what Ian White, one of the contributors to Stata's original multiple imputation ice package, suggested: I assume you believe that the distribution of Y|X "if Z were 1" is equal to the distribu
43,202
Conditional/normalized multiple imputation
I think one option would follow by analogy of predict on newdata in R. This supposes using mice to single-impute and then access the final regression model after burn in and convergence. This model is then used to make a one-time prediction as in predict.glm where newdata is a data set in which $Z=1$ has been replaced for all units and $x$ and $y$ are copies from the imputed data. Alternatively you may be also able to create multiple imputed data sets, giving you sets of parameters which you can use on the new data frame, where again $Z=1$ throughout, giving you multiply imputed data sets for variance control. This way you get predictions for all units of course, even those units without missing data, but you can replace those predictions again by the originally observed information. The only difficulty with this approach is how to access the final model in mice. Quick eyeballing of the documentation (p.77) shows the model parameters are not default output in mids objects. This perhaps requires contacting the authors or programming the imputation by chained equations yourself following van Buuren (2012) or perhaps Raghunathan (2001). Raghunathan, T. E., Lepkowski, J., van Hoewyk, J., & Solenberger, P. (2001). A multivariate technique for multiply imputing missing values using a sequence of regression models. Survey Methodology, 27(1), 85–95. van Buuren, S. (2012). Flexible Imputation of Missing Data. Boca Raton: CRC Press.
Conditional/normalized multiple imputation
I think one option would follow by analogy of predict on newdata in R. This supposes using mice to single-impute and then access the final regression model after burn in and convergence. This model is
Conditional/normalized multiple imputation I think one option would follow by analogy of predict on newdata in R. This supposes using mice to single-impute and then access the final regression model after burn in and convergence. This model is then used to make a one-time prediction as in predict.glm where newdata is a data set in which $Z=1$ has been replaced for all units and $x$ and $y$ are copies from the imputed data. Alternatively you may be also able to create multiple imputed data sets, giving you sets of parameters which you can use on the new data frame, where again $Z=1$ throughout, giving you multiply imputed data sets for variance control. This way you get predictions for all units of course, even those units without missing data, but you can replace those predictions again by the originally observed information. The only difficulty with this approach is how to access the final model in mice. Quick eyeballing of the documentation (p.77) shows the model parameters are not default output in mids objects. This perhaps requires contacting the authors or programming the imputation by chained equations yourself following van Buuren (2012) or perhaps Raghunathan (2001). Raghunathan, T. E., Lepkowski, J., van Hoewyk, J., & Solenberger, P. (2001). A multivariate technique for multiply imputing missing values using a sequence of regression models. Survey Methodology, 27(1), 85–95. van Buuren, S. (2012). Flexible Imputation of Missing Data. Boca Raton: CRC Press.
Conditional/normalized multiple imputation I think one option would follow by analogy of predict on newdata in R. This supposes using mice to single-impute and then access the final regression model after burn in and convergence. This model is
43,203
SEM: Collinearity between two latent variables that are used to predict a third latent variable
Rules of thumb may say that multicollinearity is a problem only if two variables correlate above, say, .9 or even more. If two of your latent variables correlated that much, or even in the range of .7 / .8, then you have a problem before it comes to predicting the third variable: Your measurement model seems to be not very well defined. Maybe, for example, the two latents would be better modeled as only one? I would care much more about the measurement model then about multicollinearity.
SEM: Collinearity between two latent variables that are used to predict a third latent variable
Rules of thumb may say that multicollinearity is a problem only if two variables correlate above, say, .9 or even more. If two of your latent variables correlated that much, or even in the range of .7
SEM: Collinearity between two latent variables that are used to predict a third latent variable Rules of thumb may say that multicollinearity is a problem only if two variables correlate above, say, .9 or even more. If two of your latent variables correlated that much, or even in the range of .7 / .8, then you have a problem before it comes to predicting the third variable: Your measurement model seems to be not very well defined. Maybe, for example, the two latents would be better modeled as only one? I would care much more about the measurement model then about multicollinearity.
SEM: Collinearity between two latent variables that are used to predict a third latent variable Rules of thumb may say that multicollinearity is a problem only if two variables correlate above, say, .9 or even more. If two of your latent variables correlated that much, or even in the range of .7
43,204
SEM: Collinearity between two latent variables that are used to predict a third latent variable
Latent variable models are simply used to attempt to estimate the underlying constructs more reliably than by simply aggregating the items. Thus, in the structural part of the model (i.e. the regression) the same issues apply as in a standard regression. Apart from in extreme situations (e.g., a standardized regression coefficient greater than 1), there are no definitive cutoffs. But cutoffs can be interpreted as for standard regressions. Some suggest a VIF of >5 or >10 as problematic, for example, but it these numbers would be extremely lenient if you were interested in the effect on one variable on the DV after controlling for the others (https://doi.org/10.1081/QEN-120001878). One thing to note is that although calculating a VIF is easy in a standard regression and many packages/programs will do this automatically, it is not easy in a latent variable model. The calculation of VIF for a variable requires regressing it on all other predictors in the regression, which in a latent variable model means this has to be done in a latent variable model. As a result of this complexity, it is not surprising that this cannot be easily automated (and as far as I am aware has not been done). Note also that multicollinearity is actually more likely to be an issue in latent variable models than when you just add items together since you are greatly reducing the error included in the estimate and thereby increasing correlations between related constructs. What to do if you detect problematic multicollinearity will vary on a case by case basis. In most cases, it would probably be advisable to alter the measurement model, but there may be cases where such a course would not make sense. In such cases, you would probably be advised to drop one or more variables instead.
SEM: Collinearity between two latent variables that are used to predict a third latent variable
Latent variable models are simply used to attempt to estimate the underlying constructs more reliably than by simply aggregating the items. Thus, in the structural part of the model (i.e. the regressi
SEM: Collinearity between two latent variables that are used to predict a third latent variable Latent variable models are simply used to attempt to estimate the underlying constructs more reliably than by simply aggregating the items. Thus, in the structural part of the model (i.e. the regression) the same issues apply as in a standard regression. Apart from in extreme situations (e.g., a standardized regression coefficient greater than 1), there are no definitive cutoffs. But cutoffs can be interpreted as for standard regressions. Some suggest a VIF of >5 or >10 as problematic, for example, but it these numbers would be extremely lenient if you were interested in the effect on one variable on the DV after controlling for the others (https://doi.org/10.1081/QEN-120001878). One thing to note is that although calculating a VIF is easy in a standard regression and many packages/programs will do this automatically, it is not easy in a latent variable model. The calculation of VIF for a variable requires regressing it on all other predictors in the regression, which in a latent variable model means this has to be done in a latent variable model. As a result of this complexity, it is not surprising that this cannot be easily automated (and as far as I am aware has not been done). Note also that multicollinearity is actually more likely to be an issue in latent variable models than when you just add items together since you are greatly reducing the error included in the estimate and thereby increasing correlations between related constructs. What to do if you detect problematic multicollinearity will vary on a case by case basis. In most cases, it would probably be advisable to alter the measurement model, but there may be cases where such a course would not make sense. In such cases, you would probably be advised to drop one or more variables instead.
SEM: Collinearity between two latent variables that are used to predict a third latent variable Latent variable models are simply used to attempt to estimate the underlying constructs more reliably than by simply aggregating the items. Thus, in the structural part of the model (i.e. the regressi
43,205
What can be concluded from small sample size?
I didn't check your calculations but finding widely different standard deviations/sample size estimates from very small pilot studies is not surprising. Just like the sample mean, the sample standard deviation is a noisy estimate of its population counterpart. That's why it's not such a good idea to use a small pilot study to compute power or decide on sample size (even if it is, as you noted, standard advice). I discussed this further in these comments and, indirectly, in this answer to an unrelated question. As to whether or not the pilot data would be included in the final data set, the usual answer would be negative but thinking about it I am not sure if I can see a compelling reason, at least not if you are not using the mean or difference but only the standard deviation in your sample size calculations. On a related note, collecting data and stopping when your CI reaches a certain width is in fact sound (whereas repeatedly testing and stopping when the mean is significantly different from some value is a big no-no). It seems related to the accuracy in parameter estimation approach, which might be relevant to you. PS: Note that some of your statements about confidence intervals seems a little unclear at times. For example, by construction, 95% of them should contain the true mean, what increasing the sample size does is reduce their width, not change this frequency.
What can be concluded from small sample size?
I didn't check your calculations but finding widely different standard deviations/sample size estimates from very small pilot studies is not surprising. Just like the sample mean, the sample standard
What can be concluded from small sample size? I didn't check your calculations but finding widely different standard deviations/sample size estimates from very small pilot studies is not surprising. Just like the sample mean, the sample standard deviation is a noisy estimate of its population counterpart. That's why it's not such a good idea to use a small pilot study to compute power or decide on sample size (even if it is, as you noted, standard advice). I discussed this further in these comments and, indirectly, in this answer to an unrelated question. As to whether or not the pilot data would be included in the final data set, the usual answer would be negative but thinking about it I am not sure if I can see a compelling reason, at least not if you are not using the mean or difference but only the standard deviation in your sample size calculations. On a related note, collecting data and stopping when your CI reaches a certain width is in fact sound (whereas repeatedly testing and stopping when the mean is significantly different from some value is a big no-no). It seems related to the accuracy in parameter estimation approach, which might be relevant to you. PS: Note that some of your statements about confidence intervals seems a little unclear at times. For example, by construction, 95% of them should contain the true mean, what increasing the sample size does is reduce their width, not change this frequency.
What can be concluded from small sample size? I didn't check your calculations but finding widely different standard deviations/sample size estimates from very small pilot studies is not surprising. Just like the sample mean, the sample standard
43,206
identifying events (patterns) that occur before an event of interest using sequence of events data
I suppose you have some large training set available. This problem can be tackled with many different approaches and usually there is a trade-off between how well you can interpret findings/model and how good predictions you can make. I made something similar recently and after having a complex non-linear classifier that worked pretty well, I was asked to identify the exact moments/events that trigger when we should interfere with customers, that was practically too difficult, so I ended up remodelling using trees in order to allow managers understand what's happening in their data. More details follow: I start with approaches you can use to interpret what's going on: You will need to make a script to extract from the full dataset the sequences of length $n$ that lead to the event you are interested in. If $n$ is low and you have enough data you can measure frequencies of all combinations of events that lead to the event of interest. If situation is a bit more complex and there are no clear winners, you could try visualise these series of events using a tree as a form of a Markov chain. Using some ad-hoc cleaning, like removing edges with $p<0.1$, you could end-up with something actionable. If interpreting the results is not so important, but the critical thing is to predict if event of interest is gonna happen, then I would go for classic classification. You have series of events that lead to the event of interest (this is your positive class). You make some series of events that didn't lead to the event of interest (that's the negative class). You could have a critirion like "if no event of interest happens after 50 normal events then I consider series a negative". Now features could be the frequencies of events, the frequencies of pairs of events, times between events (speed). You can consider the series of events as series of words and use standard approaches for text classification. Having classes, and features pick a classifier and do some modelling.
identifying events (patterns) that occur before an event of interest using sequence of events data
I suppose you have some large training set available. This problem can be tackled with many different approaches and usually there is a trade-off between how well you can interpret findings/model and
identifying events (patterns) that occur before an event of interest using sequence of events data I suppose you have some large training set available. This problem can be tackled with many different approaches and usually there is a trade-off between how well you can interpret findings/model and how good predictions you can make. I made something similar recently and after having a complex non-linear classifier that worked pretty well, I was asked to identify the exact moments/events that trigger when we should interfere with customers, that was practically too difficult, so I ended up remodelling using trees in order to allow managers understand what's happening in their data. More details follow: I start with approaches you can use to interpret what's going on: You will need to make a script to extract from the full dataset the sequences of length $n$ that lead to the event you are interested in. If $n$ is low and you have enough data you can measure frequencies of all combinations of events that lead to the event of interest. If situation is a bit more complex and there are no clear winners, you could try visualise these series of events using a tree as a form of a Markov chain. Using some ad-hoc cleaning, like removing edges with $p<0.1$, you could end-up with something actionable. If interpreting the results is not so important, but the critical thing is to predict if event of interest is gonna happen, then I would go for classic classification. You have series of events that lead to the event of interest (this is your positive class). You make some series of events that didn't lead to the event of interest (that's the negative class). You could have a critirion like "if no event of interest happens after 50 normal events then I consider series a negative". Now features could be the frequencies of events, the frequencies of pairs of events, times between events (speed). You can consider the series of events as series of words and use standard approaches for text classification. Having classes, and features pick a classifier and do some modelling.
identifying events (patterns) that occur before an event of interest using sequence of events data I suppose you have some large training set available. This problem can be tackled with many different approaches and usually there is a trade-off between how well you can interpret findings/model and
43,207
Combine several softmax output probabilities
I think I may have found what I was looking for when I originally asked this question. A bit of googlefoo has led me to Linear Opinion Pools and variations thereof. Several papers are available here, here, here, here, here and finally here. If any forum members have anything else to add, it would be appreciated.
Combine several softmax output probabilities
I think I may have found what I was looking for when I originally asked this question. A bit of googlefoo has led me to Linear Opinion Pools and variations thereof. Several papers are available here,
Combine several softmax output probabilities I think I may have found what I was looking for when I originally asked this question. A bit of googlefoo has led me to Linear Opinion Pools and variations thereof. Several papers are available here, here, here, here, here and finally here. If any forum members have anything else to add, it would be appreciated.
Combine several softmax output probabilities I think I may have found what I was looking for when I originally asked this question. A bit of googlefoo has led me to Linear Opinion Pools and variations thereof. Several papers are available here,
43,208
Hypothesis test for the presence of a Gaussian signal in i.i.d additive Gaussian noise
You can use Grubb's test here Your statistical problem is essentially to test for a single "aberration" in your data vector. This is a very similar problem to using Grubb's test to detect an outlier. Indeed, one could reasonably say that it is the same problem. An obvious thing to do here is to test using Grubb's statistic, which is the maximum studentised magnitude of the data values: $$G(\mathbf{x}) \equiv \max_{i} \frac{|x_i - \bar{x}_n|}{s_n}.$$ Larger values of this test statistic are more conducive to the alternative hypothesis that there is an aberrant value in the underlying series. Under your normality assumption it is possible to get an asymptotic approximation for the tail area of the null distribution of this statistic (which is what is usually used in the test), but it is also quite simple to simulate the distribution of this statistic under the null hypothesis $H_0: \sigma = 0$. The advantage of Grubb's test is that it will generally detect the alternative case fairly easily when $\theta/s$ is reasonably large. By focusing entirely on the value with the highest studentised magnitude it will focus in on the most aberrant value in the observed series. Note that the test depends heavily on the assumption of an underlying normal distribution, and it is not at all robust to deviations from this distribution. (If the underlying distribution has tail behaviour that deviates from the normal distribution then it will mess up the hypothesis test. There is not really any way around this when you are trying to test for a single aberrant value.) Implementation: Here is an implementation in R of the Grubb's test, where we have programmed a simulation to approximate the true null distribution of the test statistic. We program the function Grubbs.test, which is a customised hypothesis test taking a data vector x and a stipulated number of simulations sims. (If we set progress = TRUE the function gives a progress bar to track the progress of the simulations; this is useful if the number of simulations is large.) Grubbs.test <- function(x, sims = 10^5, progress = TRUE) { #Set description of test and data method <- "Grubb's test (simulated)" data.name <- deparse(substitute(x)) #Check validity of inputs if (!is.numeric(x)) { stop("Error: Input x should be numeric data") } if (!is.numeric(sims)) { stop("Error: Input sims should be a positive integer") } if (sims != as.integer(sims)) { stop("Error: Input sims should be a positive integer"); } if (min(sims) < 1) { stop("Error: Input sims should be a positive integer") } if (!is.logical(progress)) { stop("Error: Input progress should be a logical value") } if (length(progress) != 1) { stop("Error: Input progress should be a single logical value") } #Set null and alternative hypotheses null.value <- 0 attr(null.value, "names") <- "aberration variance" alternative <- "greater" #Calculate test statistics n <- length(x) sample.mean <- mean(x) sample.sd <- sd(x) estimate <- max(abs(x-sample.mean))/sample.sd attr(estimate, "names") <- "maximum studentised magnitude" statistic <- estimate attr(statistic, "names") <- "G" #Calculate p-value SIM.STAT <- rep(0, sims) if (progress) { PROGRESS <- txtProgressBar(min = 0, max = sims) } for (i in 1:sims) { SIM.DATA <- rnorm(n) MEAN <- mean(SIM.DATA) SD <- sd(SIM.DATA) SIM.STAT[i] <- max(abs(SIM.DATA-MEAN))/SD if (progress) { setTxtProgressBar(PROGRESS, value = i) } } if (progress) { close(PROGRESS) } p.value <- sum(SIM.STAT >= statistic)/sims attr(p.value, "names") <- NULL #Create htest object TEST <- list(method = method, data.name = data.name, null.value = null.value, alternative = alternative, estimate = estimate, statistic = statistic, p.value = p.value) class(TEST) <- "htest" TEST } Let's try implementing this test for two cases, one where the null hypothesis is true and one where it is false. First we will generate two data sets DATA.NULL and DATA.ALT, where the latter includes an aberrant value generated from an underlying normal distribution with non-zero variance. #Set parameters n <- 100 m <- 4.2 s <- 1.2 sigma <- 3.1 #Generate mock data set.seed(730921341) ABERRATION <- rnorm(1, mean = 0, sd = sigma) VAL <- sample.int(n, size = 1) DATA.NULL <- rnorm(n, mean = m, sd = s) DATA.ALT <- DATA.NULL DATA.ALT[VAL] <- DATA.NULL[VAL] + ABERRATION Now we will implement Grubb's test on these data vectors to see if we can detetct the underlying aberration. As you can see, in this particular case (where $\sigma/s = 3.5$), the test correctly identifies that the first data vector does not have an aberrant value and the second data vector does. #Implement tests TEST1 <- Grubbs.test(DATA.NULL) TEST2 <- Grubbs.test(DATA.ALT) #Show output of tests TEST1 Grubb's test (simulated) data: DATA.NULL G = 2.2678, p-value = 0.9452 alternative hypothesis: true aberration variance is greater than 0 sample estimates: maximum studentised magnitude 2.267813 TEST2 Grubb's test (simulated) data: DATA.ALT G = 4.4083, p-value = 0.00031 alternative hypothesis: true aberration variance is greater than 0 sample estimates: maximum studentised magnitude 4.408309
Hypothesis test for the presence of a Gaussian signal in i.i.d additive Gaussian noise
You can use Grubb's test here Your statistical problem is essentially to test for a single "aberration" in your data vector. This is a very similar problem to using Grubb's test to detect an outlier.
Hypothesis test for the presence of a Gaussian signal in i.i.d additive Gaussian noise You can use Grubb's test here Your statistical problem is essentially to test for a single "aberration" in your data vector. This is a very similar problem to using Grubb's test to detect an outlier. Indeed, one could reasonably say that it is the same problem. An obvious thing to do here is to test using Grubb's statistic, which is the maximum studentised magnitude of the data values: $$G(\mathbf{x}) \equiv \max_{i} \frac{|x_i - \bar{x}_n|}{s_n}.$$ Larger values of this test statistic are more conducive to the alternative hypothesis that there is an aberrant value in the underlying series. Under your normality assumption it is possible to get an asymptotic approximation for the tail area of the null distribution of this statistic (which is what is usually used in the test), but it is also quite simple to simulate the distribution of this statistic under the null hypothesis $H_0: \sigma = 0$. The advantage of Grubb's test is that it will generally detect the alternative case fairly easily when $\theta/s$ is reasonably large. By focusing entirely on the value with the highest studentised magnitude it will focus in on the most aberrant value in the observed series. Note that the test depends heavily on the assumption of an underlying normal distribution, and it is not at all robust to deviations from this distribution. (If the underlying distribution has tail behaviour that deviates from the normal distribution then it will mess up the hypothesis test. There is not really any way around this when you are trying to test for a single aberrant value.) Implementation: Here is an implementation in R of the Grubb's test, where we have programmed a simulation to approximate the true null distribution of the test statistic. We program the function Grubbs.test, which is a customised hypothesis test taking a data vector x and a stipulated number of simulations sims. (If we set progress = TRUE the function gives a progress bar to track the progress of the simulations; this is useful if the number of simulations is large.) Grubbs.test <- function(x, sims = 10^5, progress = TRUE) { #Set description of test and data method <- "Grubb's test (simulated)" data.name <- deparse(substitute(x)) #Check validity of inputs if (!is.numeric(x)) { stop("Error: Input x should be numeric data") } if (!is.numeric(sims)) { stop("Error: Input sims should be a positive integer") } if (sims != as.integer(sims)) { stop("Error: Input sims should be a positive integer"); } if (min(sims) < 1) { stop("Error: Input sims should be a positive integer") } if (!is.logical(progress)) { stop("Error: Input progress should be a logical value") } if (length(progress) != 1) { stop("Error: Input progress should be a single logical value") } #Set null and alternative hypotheses null.value <- 0 attr(null.value, "names") <- "aberration variance" alternative <- "greater" #Calculate test statistics n <- length(x) sample.mean <- mean(x) sample.sd <- sd(x) estimate <- max(abs(x-sample.mean))/sample.sd attr(estimate, "names") <- "maximum studentised magnitude" statistic <- estimate attr(statistic, "names") <- "G" #Calculate p-value SIM.STAT <- rep(0, sims) if (progress) { PROGRESS <- txtProgressBar(min = 0, max = sims) } for (i in 1:sims) { SIM.DATA <- rnorm(n) MEAN <- mean(SIM.DATA) SD <- sd(SIM.DATA) SIM.STAT[i] <- max(abs(SIM.DATA-MEAN))/SD if (progress) { setTxtProgressBar(PROGRESS, value = i) } } if (progress) { close(PROGRESS) } p.value <- sum(SIM.STAT >= statistic)/sims attr(p.value, "names") <- NULL #Create htest object TEST <- list(method = method, data.name = data.name, null.value = null.value, alternative = alternative, estimate = estimate, statistic = statistic, p.value = p.value) class(TEST) <- "htest" TEST } Let's try implementing this test for two cases, one where the null hypothesis is true and one where it is false. First we will generate two data sets DATA.NULL and DATA.ALT, where the latter includes an aberrant value generated from an underlying normal distribution with non-zero variance. #Set parameters n <- 100 m <- 4.2 s <- 1.2 sigma <- 3.1 #Generate mock data set.seed(730921341) ABERRATION <- rnorm(1, mean = 0, sd = sigma) VAL <- sample.int(n, size = 1) DATA.NULL <- rnorm(n, mean = m, sd = s) DATA.ALT <- DATA.NULL DATA.ALT[VAL] <- DATA.NULL[VAL] + ABERRATION Now we will implement Grubb's test on these data vectors to see if we can detetct the underlying aberration. As you can see, in this particular case (where $\sigma/s = 3.5$), the test correctly identifies that the first data vector does not have an aberrant value and the second data vector does. #Implement tests TEST1 <- Grubbs.test(DATA.NULL) TEST2 <- Grubbs.test(DATA.ALT) #Show output of tests TEST1 Grubb's test (simulated) data: DATA.NULL G = 2.2678, p-value = 0.9452 alternative hypothesis: true aberration variance is greater than 0 sample estimates: maximum studentised magnitude 2.267813 TEST2 Grubb's test (simulated) data: DATA.ALT G = 4.4083, p-value = 0.00031 alternative hypothesis: true aberration variance is greater than 0 sample estimates: maximum studentised magnitude 4.408309
Hypothesis test for the presence of a Gaussian signal in i.i.d additive Gaussian noise You can use Grubb's test here Your statistical problem is essentially to test for a single "aberration" in your data vector. This is a very similar problem to using Grubb's test to detect an outlier.
43,209
Statistics of sample correlation for uniformly distributed samples
Your question is indeed asking for the finite sample distribution of $r_{N}$. To address your question, let me rephrase it in terms of linear regressions. So a linkage between $r_{N}$ and the ordinary least square (OLS) estimator could be highlighted. You observe two variables $\left\{ x_{i}\right\} _{i=1}^{N}$ and $\left\{ y_{i}\right\} _{i=1}^{N}$, and they are uncorrelated. Suppose you run a linear regression between $y_{i}$ and $x_{i}$, $$ y_{i}=\beta x_{i}+u_{i},\quad i=1,\ldots,N. $$ Since $y_{i}$ and $x_{i}$ are uncorrelated, the true value $\beta$ is $0$. Note that the OLS estimator of $\beta$ is $$ \hat{\beta}_{N}=\frac{\sum_{i=1}^{N}x_{i}y_{i}}{\sum_{i=1}^{N}x_{i}x_{i}}=\frac{N^{-1}\sum_{i=1}^{N}x_{i}y_{i}}{N^{-1}\sum_{i=1}^{N}x_{i}x_{i}}. $$ Here the numerator of $\hat{\beta}_{N}$ is your $r_{N}$. I did not impose any distribution assumptions about $x_{i}$ and $y_{i}$, so no loss of generality was incurred. Based on this linkage, we may approach your question by using the distribution of $\hat{\beta}_{N}$. However, it is well known that the finite sample distribution of $\hat{\beta}_{N}$ is not available in most cases. Consequently, my conclusion is pessimistic in that the 'exact' answer to your question might not exist in most cases. But an approximate $\tilde{N}$ can be easily found since $\hat{\beta}_{N}$ is asymptotically normal. First, consider a finite sample case. If $\left\{ x_{i}\right\} _{i=1}^{N}$ is fixed in your experiment, and $\left\{ y_{i}\right\} _{i=1}^{N}$ are i.i.d. normal with mean $0$ and variance $\sigma^{2}$. Then it is well known that $$ \hat{\beta}_{N}\mid x_{1},\ldots,x_{N}\sim N\left(\beta,\frac{\sigma^{2}}{N}\left(\frac{\sum_{i=1}^{N}x_{i}^{2}}{N}\right)^{-1}\right). $$ Consequently, $$ r_{N}\mid x_{1},\ldots,x_{N}\sim N\left(0,\frac{\sigma^{2}}{N}\left(\frac{\sum_{i=1}^{N}x_{i}^{2}}{N}\right)\right). $$ Denote $\sigma_{r,N}^{2}=\left(\sigma^{2}/N\right)\left(\sum_{i=1}^{N}x_{i}^{2}/N\right)$, and note that $\sigma_{r,N}$ is monotone decreasing with respect to $N$. Then given $\varepsilon$, we have $\Pr\left(\left|r_{N}\right|<\varepsilon\right)=1-2\Phi\left(-\varepsilon/\sigma_{r,N}\right)$. By letting $ $$1-2\Phi\left(-\varepsilon/\sigma_{r,N}\right)=\alpha$, you can solve $\tilde{N}$. (Remark: I think you are asking for such a $\tilde{N}$ that $\Pr\left(\left|r_{N}\right|<\varepsilon\right)\geq\alpha$ for all $N>\tilde{N}$.) But these arguments are based on the properties of normal distributions. Next, consider the large sample case ($N\rightarrow \infty$), where $x_i$ could be random. Suppose $\left\{ x_{i}\right\} _{i=1}^{N}$ and $\left\{ y_{i}\right\} _{i=1}^{N}$ satisfy the regularity conditions of the LLN and CLT. Asymptotically, we have $$ \hat{\beta}_{N}\rightarrow_{d}N\left(\beta,\frac{\sigma^{2}}{N}Q^{-1}\right),\quad Q=\mathrm{{plim}}_{N\rightarrow\infty}\frac{\sum_{i=1}^{N}x_{i}^{2}}{N}, $$ where $\sigma^{2}$ is the variance of $y_{i}$. By Slutsky lemma, we have $$ r_{N}\rightarrow_{d}N\left(0,\frac{\sigma^{2}}{N}Q\right). $$ It is obvious that $\sigma_{r,N}^{2}$ is a consistent estimator of $\left(\sigma^{2}/N\right)Q$. Then an approximate $\tilde{N}$ can be found in the same way.
Statistics of sample correlation for uniformly distributed samples
Your question is indeed asking for the finite sample distribution of $r_{N}$. To address your question, let me rephrase it in terms of linear regressions. So a linkage between $r_{N}$ and the ordinary
Statistics of sample correlation for uniformly distributed samples Your question is indeed asking for the finite sample distribution of $r_{N}$. To address your question, let me rephrase it in terms of linear regressions. So a linkage between $r_{N}$ and the ordinary least square (OLS) estimator could be highlighted. You observe two variables $\left\{ x_{i}\right\} _{i=1}^{N}$ and $\left\{ y_{i}\right\} _{i=1}^{N}$, and they are uncorrelated. Suppose you run a linear regression between $y_{i}$ and $x_{i}$, $$ y_{i}=\beta x_{i}+u_{i},\quad i=1,\ldots,N. $$ Since $y_{i}$ and $x_{i}$ are uncorrelated, the true value $\beta$ is $0$. Note that the OLS estimator of $\beta$ is $$ \hat{\beta}_{N}=\frac{\sum_{i=1}^{N}x_{i}y_{i}}{\sum_{i=1}^{N}x_{i}x_{i}}=\frac{N^{-1}\sum_{i=1}^{N}x_{i}y_{i}}{N^{-1}\sum_{i=1}^{N}x_{i}x_{i}}. $$ Here the numerator of $\hat{\beta}_{N}$ is your $r_{N}$. I did not impose any distribution assumptions about $x_{i}$ and $y_{i}$, so no loss of generality was incurred. Based on this linkage, we may approach your question by using the distribution of $\hat{\beta}_{N}$. However, it is well known that the finite sample distribution of $\hat{\beta}_{N}$ is not available in most cases. Consequently, my conclusion is pessimistic in that the 'exact' answer to your question might not exist in most cases. But an approximate $\tilde{N}$ can be easily found since $\hat{\beta}_{N}$ is asymptotically normal. First, consider a finite sample case. If $\left\{ x_{i}\right\} _{i=1}^{N}$ is fixed in your experiment, and $\left\{ y_{i}\right\} _{i=1}^{N}$ are i.i.d. normal with mean $0$ and variance $\sigma^{2}$. Then it is well known that $$ \hat{\beta}_{N}\mid x_{1},\ldots,x_{N}\sim N\left(\beta,\frac{\sigma^{2}}{N}\left(\frac{\sum_{i=1}^{N}x_{i}^{2}}{N}\right)^{-1}\right). $$ Consequently, $$ r_{N}\mid x_{1},\ldots,x_{N}\sim N\left(0,\frac{\sigma^{2}}{N}\left(\frac{\sum_{i=1}^{N}x_{i}^{2}}{N}\right)\right). $$ Denote $\sigma_{r,N}^{2}=\left(\sigma^{2}/N\right)\left(\sum_{i=1}^{N}x_{i}^{2}/N\right)$, and note that $\sigma_{r,N}$ is monotone decreasing with respect to $N$. Then given $\varepsilon$, we have $\Pr\left(\left|r_{N}\right|<\varepsilon\right)=1-2\Phi\left(-\varepsilon/\sigma_{r,N}\right)$. By letting $ $$1-2\Phi\left(-\varepsilon/\sigma_{r,N}\right)=\alpha$, you can solve $\tilde{N}$. (Remark: I think you are asking for such a $\tilde{N}$ that $\Pr\left(\left|r_{N}\right|<\varepsilon\right)\geq\alpha$ for all $N>\tilde{N}$.) But these arguments are based on the properties of normal distributions. Next, consider the large sample case ($N\rightarrow \infty$), where $x_i$ could be random. Suppose $\left\{ x_{i}\right\} _{i=1}^{N}$ and $\left\{ y_{i}\right\} _{i=1}^{N}$ satisfy the regularity conditions of the LLN and CLT. Asymptotically, we have $$ \hat{\beta}_{N}\rightarrow_{d}N\left(\beta,\frac{\sigma^{2}}{N}Q^{-1}\right),\quad Q=\mathrm{{plim}}_{N\rightarrow\infty}\frac{\sum_{i=1}^{N}x_{i}^{2}}{N}, $$ where $\sigma^{2}$ is the variance of $y_{i}$. By Slutsky lemma, we have $$ r_{N}\rightarrow_{d}N\left(0,\frac{\sigma^{2}}{N}Q\right). $$ It is obvious that $\sigma_{r,N}^{2}$ is a consistent estimator of $\left(\sigma^{2}/N\right)Q$. Then an approximate $\tilde{N}$ can be found in the same way.
Statistics of sample correlation for uniformly distributed samples Your question is indeed asking for the finite sample distribution of $r_{N}$. To address your question, let me rephrase it in terms of linear regressions. So a linkage between $r_{N}$ and the ordinary
43,210
Why do structure learning for Bayesian networks?
Great question! From what I've seen, folks usually do inference given the structure and assume the structure is a given. I haven't seen folks do structure learning (which is a hard problem as you and others have pointed out) just for doing inference. Bayesian networks encode conditional independence structure, so learning the structure is useful if you want to understand/explain the dependencies between random variables. For instance, if you have three random variables (smoking, tar in lungs, cancer) it's highly likely you will find that all these variables are associated with one another (i.e., taken pairwise, the variables are not independent of each other). However, if you do structure learning, you might also learn the fact that smoking is independent of cancer given the amount of tar deposits in lungs. With background and domain knowledge it might also be possible to use the Bayesian network structure to convincingly argue or support causal hypotheses.
Why do structure learning for Bayesian networks?
Great question! From what I've seen, folks usually do inference given the structure and assume the structure is a given. I haven't seen folks do structure learning (which is a hard problem as you an
Why do structure learning for Bayesian networks? Great question! From what I've seen, folks usually do inference given the structure and assume the structure is a given. I haven't seen folks do structure learning (which is a hard problem as you and others have pointed out) just for doing inference. Bayesian networks encode conditional independence structure, so learning the structure is useful if you want to understand/explain the dependencies between random variables. For instance, if you have three random variables (smoking, tar in lungs, cancer) it's highly likely you will find that all these variables are associated with one another (i.e., taken pairwise, the variables are not independent of each other). However, if you do structure learning, you might also learn the fact that smoking is independent of cancer given the amount of tar deposits in lungs. With background and domain knowledge it might also be possible to use the Bayesian network structure to convincingly argue or support causal hypotheses.
Why do structure learning for Bayesian networks? Great question! From what I've seen, folks usually do inference given the structure and assume the structure is a given. I haven't seen folks do structure learning (which is a hard problem as you an
43,211
Why do structure learning for Bayesian networks?
In a Bayesian Belief Network (BBN), the joint probability can be decomposed. Assume the following. U = {X1, X2, X3, X4 }, U is a set of variables P(U) = P(X1, X2, X3, X4), P is the joint probability Using the chain rule, you can decompose the P as follows $P(U) = P(X1, X2, X3, X4) = P(X1)P(X2|X1)P(X3|X1,X2)P(X4|X1,X2,X3)$ Because a BBN satisfies the Markov condition, you can decompose P as follows. $P(U) = \prod_i P(X_i|pa(X_i))$ Let's just say the BBN structure, its directed acyclic graph (DAG), is indeed the following. X1 -> X2 -> X3 -> X4 Then, $P(U) = P(X1, X2, X3, X4) = P(X1)P(X2|X1)P(X3|X2)P(X4|X3)$ Do you see any efficiency of computing P by using the the Markov condition versus the Chain Rule? A more concrete example. Let's say all variables are binary and take on the values yes/no. Let's say you observe X1=yes, X2=yes, X3=no, and you want to predict the states of X4. How would you do this? If you did not have the structure (DAG), then you can do counts (as you stated in your post) to compute the conditional probabilities. $P(X4=yes | X1=yes, X2=yes, X3=no)$ and $P(X4=no | X1=yes, X2=yes, X3=no)$ But, if you do have the DAG, you know you can do the following. $P(X4=yes | X3=no)$ and $P(X4=no | X3=no)$ Which is faster to compute, even if you are just counting, with or without the DAG?
Why do structure learning for Bayesian networks?
In a Bayesian Belief Network (BBN), the joint probability can be decomposed. Assume the following. U = {X1, X2, X3, X4 }, U is a set of variables P(U) = P(X1, X2, X3, X4), P is the joint probability
Why do structure learning for Bayesian networks? In a Bayesian Belief Network (BBN), the joint probability can be decomposed. Assume the following. U = {X1, X2, X3, X4 }, U is a set of variables P(U) = P(X1, X2, X3, X4), P is the joint probability Using the chain rule, you can decompose the P as follows $P(U) = P(X1, X2, X3, X4) = P(X1)P(X2|X1)P(X3|X1,X2)P(X4|X1,X2,X3)$ Because a BBN satisfies the Markov condition, you can decompose P as follows. $P(U) = \prod_i P(X_i|pa(X_i))$ Let's just say the BBN structure, its directed acyclic graph (DAG), is indeed the following. X1 -> X2 -> X3 -> X4 Then, $P(U) = P(X1, X2, X3, X4) = P(X1)P(X2|X1)P(X3|X2)P(X4|X3)$ Do you see any efficiency of computing P by using the the Markov condition versus the Chain Rule? A more concrete example. Let's say all variables are binary and take on the values yes/no. Let's say you observe X1=yes, X2=yes, X3=no, and you want to predict the states of X4. How would you do this? If you did not have the structure (DAG), then you can do counts (as you stated in your post) to compute the conditional probabilities. $P(X4=yes | X1=yes, X2=yes, X3=no)$ and $P(X4=no | X1=yes, X2=yes, X3=no)$ But, if you do have the DAG, you know you can do the following. $P(X4=yes | X3=no)$ and $P(X4=no | X3=no)$ Which is faster to compute, even if you are just counting, with or without the DAG?
Why do structure learning for Bayesian networks? In a Bayesian Belief Network (BBN), the joint probability can be decomposed. Assume the following. U = {X1, X2, X3, X4 }, U is a set of variables P(U) = P(X1, X2, X3, X4), P is the joint probability
43,212
Knapsack problem with uncertain profits
In the case of a stochastic optimization such as this, you really should have an objective function that weights risk. Ideally, this would be a utility function, which can be converted to an expected utility when there's a probability distribution on reward and used instead. (Note this assumes that the utilities of items are independent of each other, and of whether the other items are included in your final selection or not.) If you simply replace: Maximize: $\sum _{j=1}^{N}\sum _{j=1}^{\left | G_{i} \right |}p_{ij}x_{ij}$ with maximizing the expected return: Maximize: $\text{E}\sum _{j=1}^{N}\sum _{j=1}^{\left | G_{i} \right |}p_{ij}x_{ij} = \sum _{j=1}^{N}\sum _{j=1}^{\left | G_{i} \right |}\text{E}(p_{ij})x_{ij}$ you'll get an objective function where you are maximizing the expected return given the constraints. This requires nothing more than substituting $\text{E}p_{ij}$ for $p_{ij}$ in your objective function - and, from an estimation perspective, all you would need to do is substitute the predicted values of the $p_{ij}$ in the objective function. Grouping by risk (however measured) is irrelevant with this objective, unless for some reason it improves the estimation of the $p_{ij}$. If, on the other hand, you can form a utility function $U(p)$, then the expected maximum utility function becomes: Maximize: $\text{E}U(\sum _{j=1}^{N}\sum _{j=1}^{\left | G_{i} \right |}p_{ij}x_{ij}) = \sum _{j=1}^{N}\sum _{j=1}^{\left | G_{i} \right |}\text{E}U(p_{ij})x_{ij}$ (assuming, once again, a separable utility function) and the objective of your statistical analysis is to find a probability distribution (e.g., a posterior probability distribution) of the $p_{ij}$ that you can use to form $\text{E}U(p_ij)$. (See, for example, Savage, DeGroot, or Raiffa and Schlaifer on the very strong links between Bayesian statistics and utility theory.) You would then substitute $\text{E}U(p_{ij})$ into your objective function and solve just as if it were a deterministic problem - which it is, since you're maximizing an expected value and all the randomness is hidden inside the "expected value" part.
Knapsack problem with uncertain profits
In the case of a stochastic optimization such as this, you really should have an objective function that weights risk. Ideally, this would be a utility function, which can be converted to an expected
Knapsack problem with uncertain profits In the case of a stochastic optimization such as this, you really should have an objective function that weights risk. Ideally, this would be a utility function, which can be converted to an expected utility when there's a probability distribution on reward and used instead. (Note this assumes that the utilities of items are independent of each other, and of whether the other items are included in your final selection or not.) If you simply replace: Maximize: $\sum _{j=1}^{N}\sum _{j=1}^{\left | G_{i} \right |}p_{ij}x_{ij}$ with maximizing the expected return: Maximize: $\text{E}\sum _{j=1}^{N}\sum _{j=1}^{\left | G_{i} \right |}p_{ij}x_{ij} = \sum _{j=1}^{N}\sum _{j=1}^{\left | G_{i} \right |}\text{E}(p_{ij})x_{ij}$ you'll get an objective function where you are maximizing the expected return given the constraints. This requires nothing more than substituting $\text{E}p_{ij}$ for $p_{ij}$ in your objective function - and, from an estimation perspective, all you would need to do is substitute the predicted values of the $p_{ij}$ in the objective function. Grouping by risk (however measured) is irrelevant with this objective, unless for some reason it improves the estimation of the $p_{ij}$. If, on the other hand, you can form a utility function $U(p)$, then the expected maximum utility function becomes: Maximize: $\text{E}U(\sum _{j=1}^{N}\sum _{j=1}^{\left | G_{i} \right |}p_{ij}x_{ij}) = \sum _{j=1}^{N}\sum _{j=1}^{\left | G_{i} \right |}\text{E}U(p_{ij})x_{ij}$ (assuming, once again, a separable utility function) and the objective of your statistical analysis is to find a probability distribution (e.g., a posterior probability distribution) of the $p_{ij}$ that you can use to form $\text{E}U(p_ij)$. (See, for example, Savage, DeGroot, or Raiffa and Schlaifer on the very strong links between Bayesian statistics and utility theory.) You would then substitute $\text{E}U(p_{ij})$ into your objective function and solve just as if it were a deterministic problem - which it is, since you're maximizing an expected value and all the randomness is hidden inside the "expected value" part.
Knapsack problem with uncertain profits In the case of a stochastic optimization such as this, you really should have an objective function that weights risk. Ideally, this would be a utility function, which can be converted to an expected
43,213
Please help me refine this zero-inflated negative binomial model
The zero inflated model is designed to deal with overdispersed data - 87% zeros is usually considered overdispersed, but you can check if mean < variance after fitting a Poisson. A good way to see if you have dealt with overdispersion is to simply predict the share of $0,1,2,\ldots$ in your sample with your model. If you have overdispersed data, and only use negative binomial regression or Poisson, you will see that the predicted share in the sample and the actual share in the sample deviate a lot. This would be a sign that overdispersion is not dealt with adequately. But my guess is you're good - the additional logit process makes the model quite flexible. You can think about including interaction terms as predictors (as you mentioned); some may make sense and improve your predictions, others might not. To decide which to include, you either have some prior knowledge that some interaction makes a difference (maybe age has a different influence depending on the position?). Or you choose you model by dividing your entire sample in half, use the first half to fit the model, predict the second half using the estimates, and compare predicted and actual outcomes. You should quickly see which models give better predictions. This method also helps you avoid overfitting (i.e., fitting your existing data so closely that even random noise is incorporated, which can hurt predictive power). In order not to fit too closely to your training data set, the "training" half and the "prediction" half should be selected randomly. I see you do not include the same covariates in the Logit and the negative binomial process - why not? Ususally, each relevant predictor would be expected to influence both processes. EDIT: ok, just one thing. If your goal is prediction, you should probably not just look at significance, but also at the size of the coefficient. A large insignificant coefficient can change your predictions considerably (and thus you might want to keep it nonetheless), even though you would drop it if the goal were merely to explain the data. Since your data appears to be a panel (you observe players/teams repeatedly), you can think about more sophisticated stuff like fixed or random effects. Fixed effects do not allow out of sample predictions (you can't predict outcomes for a player you don't have in your sample), but should predict very well within sample. Not sure if this even exists yet for the zero inflated negative binomial; here is a recent application of a fixed effects ZI-Poisson. I am no specialist on random effects. But both can improve predictions if your predictors don't predict very well, and much of the action is going on in the unobservables. EDIT: if you observe some players only once, and want to make out of sample predictions, then fixed effects is not a good idea.
Please help me refine this zero-inflated negative binomial model
The zero inflated model is designed to deal with overdispersed data - 87% zeros is usually considered overdispersed, but you can check if mean < variance after fitting a Poisson. A good way to see if
Please help me refine this zero-inflated negative binomial model The zero inflated model is designed to deal with overdispersed data - 87% zeros is usually considered overdispersed, but you can check if mean < variance after fitting a Poisson. A good way to see if you have dealt with overdispersion is to simply predict the share of $0,1,2,\ldots$ in your sample with your model. If you have overdispersed data, and only use negative binomial regression or Poisson, you will see that the predicted share in the sample and the actual share in the sample deviate a lot. This would be a sign that overdispersion is not dealt with adequately. But my guess is you're good - the additional logit process makes the model quite flexible. You can think about including interaction terms as predictors (as you mentioned); some may make sense and improve your predictions, others might not. To decide which to include, you either have some prior knowledge that some interaction makes a difference (maybe age has a different influence depending on the position?). Or you choose you model by dividing your entire sample in half, use the first half to fit the model, predict the second half using the estimates, and compare predicted and actual outcomes. You should quickly see which models give better predictions. This method also helps you avoid overfitting (i.e., fitting your existing data so closely that even random noise is incorporated, which can hurt predictive power). In order not to fit too closely to your training data set, the "training" half and the "prediction" half should be selected randomly. I see you do not include the same covariates in the Logit and the negative binomial process - why not? Ususally, each relevant predictor would be expected to influence both processes. EDIT: ok, just one thing. If your goal is prediction, you should probably not just look at significance, but also at the size of the coefficient. A large insignificant coefficient can change your predictions considerably (and thus you might want to keep it nonetheless), even though you would drop it if the goal were merely to explain the data. Since your data appears to be a panel (you observe players/teams repeatedly), you can think about more sophisticated stuff like fixed or random effects. Fixed effects do not allow out of sample predictions (you can't predict outcomes for a player you don't have in your sample), but should predict very well within sample. Not sure if this even exists yet for the zero inflated negative binomial; here is a recent application of a fixed effects ZI-Poisson. I am no specialist on random effects. But both can improve predictions if your predictors don't predict very well, and much of the action is going on in the unobservables. EDIT: if you observe some players only once, and want to make out of sample predictions, then fixed effects is not a good idea.
Please help me refine this zero-inflated negative binomial model The zero inflated model is designed to deal with overdispersed data - 87% zeros is usually considered overdispersed, but you can check if mean < variance after fitting a Poisson. A good way to see if
43,214
Algorithm for determining performance speedup/slowdown in a code change vs. historical data?
Here's something that's not really an answer to your question, but may be helpful for your problem: One of the difficulties you mention is that you are doing ~400 t-tests, and so will end up with lots of spurious small p-values. One useful thing to use here is `false discovery rate' (FDR) analysis, which tries to determine what fraction of the small p-values are consistent with the null. If I were working on your problem, I'm pretty sure I'd use some FDR method. FDR control is a big topic (http://en.wikipedia.org/wiki/False_discovery_rate) so I won't try to describe it fully, but here are some links to get you started if you're interested: The paper that introduced FDR control: http://umassmed.edu/uploadedFiles/QHS/Controlling%20the%20False%20Discovery%20Rate%20manuscript.pdf A recent survey book: http://www-stat.stanford.edu/~ckirby/brad/papers/2010LSIexcerpt.pdf
Algorithm for determining performance speedup/slowdown in a code change vs. historical data?
Here's something that's not really an answer to your question, but may be helpful for your problem: One of the difficulties you mention is that you are doing ~400 t-tests, and so will end up with lots
Algorithm for determining performance speedup/slowdown in a code change vs. historical data? Here's something that's not really an answer to your question, but may be helpful for your problem: One of the difficulties you mention is that you are doing ~400 t-tests, and so will end up with lots of spurious small p-values. One useful thing to use here is `false discovery rate' (FDR) analysis, which tries to determine what fraction of the small p-values are consistent with the null. If I were working on your problem, I'm pretty sure I'd use some FDR method. FDR control is a big topic (http://en.wikipedia.org/wiki/False_discovery_rate) so I won't try to describe it fully, but here are some links to get you started if you're interested: The paper that introduced FDR control: http://umassmed.edu/uploadedFiles/QHS/Controlling%20the%20False%20Discovery%20Rate%20manuscript.pdf A recent survey book: http://www-stat.stanford.edu/~ckirby/brad/papers/2010LSIexcerpt.pdf
Algorithm for determining performance speedup/slowdown in a code change vs. historical data? Here's something that's not really an answer to your question, but may be helpful for your problem: One of the difficulties you mention is that you are doing ~400 t-tests, and so will end up with lots
43,215
Algorithm for determining performance speedup/slowdown in a code change vs. historical data?
HEre is something that isn't exactly an answer to the original question, but might be valuable and might also act as an answer to the question behind the question which is something to the effect of: "how do I make the most of my programming to speed up my code?" I bet you can modify a section, and re-run several times, much more quickly than you can re-write parts of it. If that is the case, then randomly inserting random-length pauses, and recording both section placed, length of pause inserted, and impact to overall runtime you could determine how a delay to one part of the code propagates to the rest of it. Is knowing which parts have the biggest impacts to overall speed your goal? Is the 'stochastic' intervention a plausible approach to something like this? Best of luck.
Algorithm for determining performance speedup/slowdown in a code change vs. historical data?
HEre is something that isn't exactly an answer to the original question, but might be valuable and might also act as an answer to the question behind the question which is something to the effect of:
Algorithm for determining performance speedup/slowdown in a code change vs. historical data? HEre is something that isn't exactly an answer to the original question, but might be valuable and might also act as an answer to the question behind the question which is something to the effect of: "how do I make the most of my programming to speed up my code?" I bet you can modify a section, and re-run several times, much more quickly than you can re-write parts of it. If that is the case, then randomly inserting random-length pauses, and recording both section placed, length of pause inserted, and impact to overall runtime you could determine how a delay to one part of the code propagates to the rest of it. Is knowing which parts have the biggest impacts to overall speed your goal? Is the 'stochastic' intervention a plausible approach to something like this? Best of luck.
Algorithm for determining performance speedup/slowdown in a code change vs. historical data? HEre is something that isn't exactly an answer to the original question, but might be valuable and might also act as an answer to the question behind the question which is something to the effect of:
43,216
Algorithm for determining performance speedup/slowdown in a code change vs. historical data?
First you want to know if there has been a statistically significant change in total testing time. Second, if there has been a change, which tests have changed? This is what I would do: Within each code state compute the mean for each time variable. Then for each time variable compute the standard deviation of its means. This measure of variability is how you incorporate information from the entire history of testing. Next use $t$-tests to check for changes from the previous code state (the null hypothesis is that the mean times in the current state equal the previous state means). The primary test is simply if there has been a change in overall time, so you're not examining a joint hypothesis and a simple $t$-test is sufficient. If there has been a change in total time, then I would compute $t$-statistics for the separate tests to see which tests are responsible for the change. A rough example written in R: # Hypothetical time data over 100 states: state <- rep(1:100, each = 5) t1 <- 1 + runif(500) t2 <- 2 + runif(500) t3 <- 3 + runif(500) total_time <- t1 + t2 + t3 d <- data.frame(state, total_time, t1, t2, t3) # Suppose current state is 100, then we want to compare it to state 99 # while taking into account information on variability based on all historical data. # Means within historical code states: d_means <- aggregate(d, by=list(d$state), mean) # Standard deviation of means up to current state: d_stdev <- sapply(d_means[d_means$state < 100, ], sd) # Central limit theorem tells us means are approx. normally distributed. # So we can use t-tests. # Test if total testing time has changed in current state: previous <- subset(d_means, state == 99) current <- subset(d_means, state == 100) t_total_time <- (current$total_time - previous$total_time) / d_stdev[['total_time']] # Now, for example, if abs(t_total_time) > 1.96, then time change is statistically # significant at roughly 5% level. # Check each test to see which ones have statistically significant change from # previous state: t_test_1 <- (current$t1 - previous$t1) / d_stdev[['t1']] t_test_2 <- (current$t2 - previous$t2) / d_stdev[['t2']] t_test_3 <- (current$t3 - previous$t3) / d_stdev[['t3']] print(t_total_time) print(t_test_1) print(t_test_2) print(t_test_3)
Algorithm for determining performance speedup/slowdown in a code change vs. historical data?
First you want to know if there has been a statistically significant change in total testing time. Second, if there has been a change, which tests have changed? This is what I would do: Within each
Algorithm for determining performance speedup/slowdown in a code change vs. historical data? First you want to know if there has been a statistically significant change in total testing time. Second, if there has been a change, which tests have changed? This is what I would do: Within each code state compute the mean for each time variable. Then for each time variable compute the standard deviation of its means. This measure of variability is how you incorporate information from the entire history of testing. Next use $t$-tests to check for changes from the previous code state (the null hypothesis is that the mean times in the current state equal the previous state means). The primary test is simply if there has been a change in overall time, so you're not examining a joint hypothesis and a simple $t$-test is sufficient. If there has been a change in total time, then I would compute $t$-statistics for the separate tests to see which tests are responsible for the change. A rough example written in R: # Hypothetical time data over 100 states: state <- rep(1:100, each = 5) t1 <- 1 + runif(500) t2 <- 2 + runif(500) t3 <- 3 + runif(500) total_time <- t1 + t2 + t3 d <- data.frame(state, total_time, t1, t2, t3) # Suppose current state is 100, then we want to compare it to state 99 # while taking into account information on variability based on all historical data. # Means within historical code states: d_means <- aggregate(d, by=list(d$state), mean) # Standard deviation of means up to current state: d_stdev <- sapply(d_means[d_means$state < 100, ], sd) # Central limit theorem tells us means are approx. normally distributed. # So we can use t-tests. # Test if total testing time has changed in current state: previous <- subset(d_means, state == 99) current <- subset(d_means, state == 100) t_total_time <- (current$total_time - previous$total_time) / d_stdev[['total_time']] # Now, for example, if abs(t_total_time) > 1.96, then time change is statistically # significant at roughly 5% level. # Check each test to see which ones have statistically significant change from # previous state: t_test_1 <- (current$t1 - previous$t1) / d_stdev[['t1']] t_test_2 <- (current$t2 - previous$t2) / d_stdev[['t2']] t_test_3 <- (current$t3 - previous$t3) / d_stdev[['t3']] print(t_total_time) print(t_test_1) print(t_test_2) print(t_test_3)
Algorithm for determining performance speedup/slowdown in a code change vs. historical data? First you want to know if there has been a statistically significant change in total testing time. Second, if there has been a change, which tests have changed? This is what I would do: Within each
43,217
Co-occurrence of properties in a population
For a much smaller number of properties, consider a log-linear model, or perhaps some other generalized linear model depending on the underlying process generating your data. Specifically, each of the "properties" of interest should be considered a binary variable (presence vs absence of property). Note that this approach can flexibly handle variables with any number of categories. The gist of this approach is that you are modeling log cell counts in the P-way table based on the P variables used. Your question number (1) involves testing for interactions between the variables. Your question (2) would involve creating a new categorical variable based on group membership, and testing whether or not this new variable is significantly related to log cell count. Depending upon your objectives, you should look into latent class models. This is similar to PCA, but adapted to categorical variables. If you would indeed rather use a large number of variables as stated in your question, this will combine the initial variables in an optimal way, thereby reducing them down to a smaller number of varibles that captures as large a proportion of the total variance as possible. This may help achieving your objective (1), as you can see which variables get grouped together.
Co-occurrence of properties in a population
For a much smaller number of properties, consider a log-linear model, or perhaps some other generalized linear model depending on the underlying process generating your data. Specifically, each of the
Co-occurrence of properties in a population For a much smaller number of properties, consider a log-linear model, or perhaps some other generalized linear model depending on the underlying process generating your data. Specifically, each of the "properties" of interest should be considered a binary variable (presence vs absence of property). Note that this approach can flexibly handle variables with any number of categories. The gist of this approach is that you are modeling log cell counts in the P-way table based on the P variables used. Your question number (1) involves testing for interactions between the variables. Your question (2) would involve creating a new categorical variable based on group membership, and testing whether or not this new variable is significantly related to log cell count. Depending upon your objectives, you should look into latent class models. This is similar to PCA, but adapted to categorical variables. If you would indeed rather use a large number of variables as stated in your question, this will combine the initial variables in an optimal way, thereby reducing them down to a smaller number of varibles that captures as large a proportion of the total variance as possible. This may help achieving your objective (1), as you can see which variables get grouped together.
Co-occurrence of properties in a population For a much smaller number of properties, consider a log-linear model, or perhaps some other generalized linear model depending on the underlying process generating your data. Specifically, each of the
43,218
How to test whether mean and variance is the same in two small samples?
I would argue that it isn't possible to properly perform a joint test on the first two moments without knowing more about the distribution. Since there is no general rule as to how moments interact, it is impossible to construct a tight confidence region. If you dare to make a normality assumption on both samples, the situation changes since the first two moments define the normal distribution, such that for example the Kolmogorov-Smirnoff test is equivalent to testing the first two moments. Be aware though that you would be using asymptotic results on assumed distributions.
How to test whether mean and variance is the same in two small samples?
I would argue that it isn't possible to properly perform a joint test on the first two moments without knowing more about the distribution. Since there is no general rule as to how moments interact, i
How to test whether mean and variance is the same in two small samples? I would argue that it isn't possible to properly perform a joint test on the first two moments without knowing more about the distribution. Since there is no general rule as to how moments interact, it is impossible to construct a tight confidence region. If you dare to make a normality assumption on both samples, the situation changes since the first two moments define the normal distribution, such that for example the Kolmogorov-Smirnoff test is equivalent to testing the first two moments. Be aware though that you would be using asymptotic results on assumed distributions.
How to test whether mean and variance is the same in two small samples? I would argue that it isn't possible to properly perform a joint test on the first two moments without knowing more about the distribution. Since there is no general rule as to how moments interact, i
43,219
Forecasting optimization techniques in fantasy baseball
Accounting for variance There's a lot to think about in optimising a lineup for fantasy sports. You're right that expectation and variance are huge parts of it. Naively it would seem that expected points earned is all that matters. However, certain contests will reward only the first place player out of thousands -- meaning you want very high variance teams so that your tail is fat enough to make a win possible*. Other contests reward all those in the top half equally, in which case you care more about expectation and less about having a tail -- you just want to get the maximum amount of your expected distribution above the halfway cutoff. For some intuition on how your lineup ties to variance, there are a couple of mechanisms. Certain players have a higher variance than others. Players on teams who never lose, for instance, tend to have pretty low variance. The main effect comes from picking players on the same team or picking players on opposing teams. Players on the same team have very high covariance -- they tend to all win or lose points together. Players facing each other have negative covariance -- either one does well or the other, but rarely both or neither. (This is magnified for certain positions, like striker vs opposing goalie in hockey or, I imagine, pitches vs opposing batters in baseball). Lineups featuring players with a high covariance to one another are lineups with a high variance. You're right that calculating the variance of a team has analogous to portfolio optimisation. The problem is exactly the same: assets are now players, expected returns are now expected points and variance is variance. Calculating the variance for a lineup given a set of players with known covariance is easy. If we are considering $N$ players, define $p$ as a binary vector of length $N$ with value 1 if a player is present on a team and 0 otherwise. $\Sigma$ is the $N*N$ covariance matrix of all players, then the variance of the lineup $\sigma$ is given by: $ \sigma = p^T \Sigma p $ Where $^T$ is the transposition. Covariance should not be calculated at an individual player level since there will never be enough data. Pitcher A's covariance with Batter B across an entire season is not useful, since they won't play each other in every game. Instead calculate it on a position level: the covariance of home team pitchers versus visiting shortstops, home team shortstops versus visiting pitchers, home team shortstops versus home team pitchers, etc. (Disclaimer: opinion, you could also calculate it purely as home vs away, or purely as home vs away and pitchers vs non-pitchers.) Effects of opposing players To the expectation-predicting point of your post, you should absolutely use information from the pitcher to predict the performance of a batter. Fantasy aficionados call this "defense against position" or "fantasy points against". Essentially the idea is to use the historic point earnings of batters who have faced this pitcher to predict future performance for all batters who face them. It's a hugely powerful predictor, and you can validate as you would any other model change. * There's a really cool paper on a bunch of guys from MIT optimising drafts for very top-heavy fantasy sport contests where they plan to make multiple entries and want to maximize the expectation of their entire multiple entry strategy. They care about having high variance within the lineups they enter, but also low correlation between their entries. They treat it as a max coverage problem and solve it with integer programming. It's a good read.
Forecasting optimization techniques in fantasy baseball
Accounting for variance There's a lot to think about in optimising a lineup for fantasy sports. You're right that expectation and variance are huge parts of it. Naively it would seem that expected poi
Forecasting optimization techniques in fantasy baseball Accounting for variance There's a lot to think about in optimising a lineup for fantasy sports. You're right that expectation and variance are huge parts of it. Naively it would seem that expected points earned is all that matters. However, certain contests will reward only the first place player out of thousands -- meaning you want very high variance teams so that your tail is fat enough to make a win possible*. Other contests reward all those in the top half equally, in which case you care more about expectation and less about having a tail -- you just want to get the maximum amount of your expected distribution above the halfway cutoff. For some intuition on how your lineup ties to variance, there are a couple of mechanisms. Certain players have a higher variance than others. Players on teams who never lose, for instance, tend to have pretty low variance. The main effect comes from picking players on the same team or picking players on opposing teams. Players on the same team have very high covariance -- they tend to all win or lose points together. Players facing each other have negative covariance -- either one does well or the other, but rarely both or neither. (This is magnified for certain positions, like striker vs opposing goalie in hockey or, I imagine, pitches vs opposing batters in baseball). Lineups featuring players with a high covariance to one another are lineups with a high variance. You're right that calculating the variance of a team has analogous to portfolio optimisation. The problem is exactly the same: assets are now players, expected returns are now expected points and variance is variance. Calculating the variance for a lineup given a set of players with known covariance is easy. If we are considering $N$ players, define $p$ as a binary vector of length $N$ with value 1 if a player is present on a team and 0 otherwise. $\Sigma$ is the $N*N$ covariance matrix of all players, then the variance of the lineup $\sigma$ is given by: $ \sigma = p^T \Sigma p $ Where $^T$ is the transposition. Covariance should not be calculated at an individual player level since there will never be enough data. Pitcher A's covariance with Batter B across an entire season is not useful, since they won't play each other in every game. Instead calculate it on a position level: the covariance of home team pitchers versus visiting shortstops, home team shortstops versus visiting pitchers, home team shortstops versus home team pitchers, etc. (Disclaimer: opinion, you could also calculate it purely as home vs away, or purely as home vs away and pitchers vs non-pitchers.) Effects of opposing players To the expectation-predicting point of your post, you should absolutely use information from the pitcher to predict the performance of a batter. Fantasy aficionados call this "defense against position" or "fantasy points against". Essentially the idea is to use the historic point earnings of batters who have faced this pitcher to predict future performance for all batters who face them. It's a hugely powerful predictor, and you can validate as you would any other model change. * There's a really cool paper on a bunch of guys from MIT optimising drafts for very top-heavy fantasy sport contests where they plan to make multiple entries and want to maximize the expectation of their entire multiple entry strategy. They care about having high variance within the lineups they enter, but also low correlation between their entries. They treat it as a max coverage problem and solve it with integer programming. It's a good read.
Forecasting optimization techniques in fantasy baseball Accounting for variance There's a lot to think about in optimising a lineup for fantasy sports. You're right that expectation and variance are huge parts of it. Naively it would seem that expected poi
43,220
Forecasting optimization techniques in fantasy baseball
Running with your example of picking between two players given the knowledge of an opposing pitcher, I think you could build a reasonable model using historical data to simulate outcomes. For example, suppose you are deciding to whether to start Player A or Player B. Player A is a 31 year old RH batter facing a RH starting pitcher that is the ace in his team’s rotation. You could create a sample of observations from the fantasy points Player A generated when he faced a strong RH starting pitcher over the last 200 games. For example, Player A may have faced 30 top ranked RH pitchers over the last 200 games so you would have 30 different fantasy point observations in your sample. 200 is totally arbitrary, you could use more or less history depending on how much of Player A’s history you feel is correlated to his recent performance. The more history you use the more games that will match the specifications of your sample, but some of the games might not be as applicable to Player A’s current skill. You could also use other players that are comparable to Player A’s skills, batting style, and age to increase the number of observations in your sample. Nate Silver talks about using comparable players in his book The Signal and the Noise. Furthermore, you could refine the games you add to the sample based on the ballpark the game is being played at (hitters park v. pitchers park), the weather (wind blowing in or out), the point in the season (early, mid, late), the type and frequency of pitches the pitcher throws, the quality of the team’s bullpen, ect…You could make the sample as specific and you like, although you might end up with only a few observations which would degrade the usefulness of simulating outcomes. Once you have a sample of games to draw from you can create a distribution of fantasy points that Player A might generate by bootstrapping the observations. If you repeat this same process for Player B and the pitcher he is facing you will have two distributions of fantasy points that each player is likely to generate in the upcoming game. You can compare the two distributions using statistical methods for comparing two means (t-test for normal distributions, Mann-Whitney U test for non-normal). If you are comparing multiple players you would need to use methods for comparing more than two means. As far as tracking the performance of your projections, the p-values derived from the comparison of means equate to the likelihood you would expect the player with lower projected fantasy points to outperform the player with higher projected points. If you make 10 projections, each that had a 10% p-value when you did the mean comparison, then you should expect to get about 9 of these projections right. If you are getting a lot more projections wrong then the p-values from your mean comparisons would suggest something might be wrong. This is a very brute force method for comparing two players and it relies heavily on historical data, but you could always build in some adjustment factors to tweak the ending distributions based on domain specific knowledge. For example, maybe you know that the player who bats right before Player A is on the DL and his replacement is not as good at getting on base. This will likely hamper Player A’s RBI production so maybe you want to shift the sample distribution of Player A’s expected fantasy points to the left to account for the likelihood that Player A's fantasy point generation will be less due to a lower RBI potential. You could even estimate this adjustment factor from data. All in all, there are a lot of things you can do by bootstrapping historical outcomes that you think are representative of the games you are interested in and comparing the resulting distributions.
Forecasting optimization techniques in fantasy baseball
Running with your example of picking between two players given the knowledge of an opposing pitcher, I think you could build a reasonable model using historical data to simulate outcomes. For example,
Forecasting optimization techniques in fantasy baseball Running with your example of picking between two players given the knowledge of an opposing pitcher, I think you could build a reasonable model using historical data to simulate outcomes. For example, suppose you are deciding to whether to start Player A or Player B. Player A is a 31 year old RH batter facing a RH starting pitcher that is the ace in his team’s rotation. You could create a sample of observations from the fantasy points Player A generated when he faced a strong RH starting pitcher over the last 200 games. For example, Player A may have faced 30 top ranked RH pitchers over the last 200 games so you would have 30 different fantasy point observations in your sample. 200 is totally arbitrary, you could use more or less history depending on how much of Player A’s history you feel is correlated to his recent performance. The more history you use the more games that will match the specifications of your sample, but some of the games might not be as applicable to Player A’s current skill. You could also use other players that are comparable to Player A’s skills, batting style, and age to increase the number of observations in your sample. Nate Silver talks about using comparable players in his book The Signal and the Noise. Furthermore, you could refine the games you add to the sample based on the ballpark the game is being played at (hitters park v. pitchers park), the weather (wind blowing in or out), the point in the season (early, mid, late), the type and frequency of pitches the pitcher throws, the quality of the team’s bullpen, ect…You could make the sample as specific and you like, although you might end up with only a few observations which would degrade the usefulness of simulating outcomes. Once you have a sample of games to draw from you can create a distribution of fantasy points that Player A might generate by bootstrapping the observations. If you repeat this same process for Player B and the pitcher he is facing you will have two distributions of fantasy points that each player is likely to generate in the upcoming game. You can compare the two distributions using statistical methods for comparing two means (t-test for normal distributions, Mann-Whitney U test for non-normal). If you are comparing multiple players you would need to use methods for comparing more than two means. As far as tracking the performance of your projections, the p-values derived from the comparison of means equate to the likelihood you would expect the player with lower projected fantasy points to outperform the player with higher projected points. If you make 10 projections, each that had a 10% p-value when you did the mean comparison, then you should expect to get about 9 of these projections right. If you are getting a lot more projections wrong then the p-values from your mean comparisons would suggest something might be wrong. This is a very brute force method for comparing two players and it relies heavily on historical data, but you could always build in some adjustment factors to tweak the ending distributions based on domain specific knowledge. For example, maybe you know that the player who bats right before Player A is on the DL and his replacement is not as good at getting on base. This will likely hamper Player A’s RBI production so maybe you want to shift the sample distribution of Player A’s expected fantasy points to the left to account for the likelihood that Player A's fantasy point generation will be less due to a lower RBI potential. You could even estimate this adjustment factor from data. All in all, there are a lot of things you can do by bootstrapping historical outcomes that you think are representative of the games you are interested in and comparing the resulting distributions.
Forecasting optimization techniques in fantasy baseball Running with your example of picking between two players given the knowledge of an opposing pitcher, I think you could build a reasonable model using historical data to simulate outcomes. For example,
43,221
How to find +/- uncertainty with a least squares regression
You could treat it like a multiple imputation problem. Basically you just specify distributions to characterize your uncertainty for each point, then you take several draws of your dataset. Fit your model to each set of draws. You then average the coefficients, average the variance-covariance matrices, and add a non-negative correction to the VCV's to reflect how different the models are from one another. I find Gelman's treatment of it to be quite readable at the intro-level. The formulas are at the end in the section on combining multiple imputations: www.stat.columbia.edu/~gelman/arm/missing.pdf One wrinkle: is the noise non-independent? Does error in one point predict error in another? If so, you need to specify a joint distribution in order to use MI, and take a draw from the multivariate pdf. This would be trickier. Edit: MI gives you properly-inflated SE's. I'm not sure how you'd use it to get an inflated $\sigma$
How to find +/- uncertainty with a least squares regression
You could treat it like a multiple imputation problem. Basically you just specify distributions to characterize your uncertainty for each point, then you take several draws of your dataset. Fit your
How to find +/- uncertainty with a least squares regression You could treat it like a multiple imputation problem. Basically you just specify distributions to characterize your uncertainty for each point, then you take several draws of your dataset. Fit your model to each set of draws. You then average the coefficients, average the variance-covariance matrices, and add a non-negative correction to the VCV's to reflect how different the models are from one another. I find Gelman's treatment of it to be quite readable at the intro-level. The formulas are at the end in the section on combining multiple imputations: www.stat.columbia.edu/~gelman/arm/missing.pdf One wrinkle: is the noise non-independent? Does error in one point predict error in another? If so, you need to specify a joint distribution in order to use MI, and take a draw from the multivariate pdf. This would be trickier. Edit: MI gives you properly-inflated SE's. I'm not sure how you'd use it to get an inflated $\sigma$
How to find +/- uncertainty with a least squares regression You could treat it like a multiple imputation problem. Basically you just specify distributions to characterize your uncertainty for each point, then you take several draws of your dataset. Fit your
43,222
How to find +/- uncertainty with a least squares regression
Consider a linear estimator $\mathbf{\hat{y}} = \mathbf{X\theta}$ fitted with linear regression $\mathbf{\theta} = (\mathbf{X^\top X})^{-1}\mathbf{X}^\top \mathbf{y}$. If $\mathbf{C}_y = \mathrm{diag}(\sigma_1^2,\sigma_2^2,\ldots,\sigma_m^2)$ is the covariance for the observations $\mathbf{y}$, the covariance for $\mathbf{\theta}$ is given by (see the lemma): $$ \mathbf{C}_\theta = (\mathbf{X^\top X})^{-1}\mathbf{X^\top C}_y \mathbf{X}(\mathbf{X^\top X})^{-1} $$ Lemma The covariance of a linear mapping $\mathbf{y} = \mathbf{Ax} + \mathbf{b}$ is $\mathbf{C}_y = \mathbf{AC}_x\mathbf{A^\top}$ with $\mathbf{C}_x$ the covariance for $\mathbf{x}$.
How to find +/- uncertainty with a least squares regression
Consider a linear estimator $\mathbf{\hat{y}} = \mathbf{X\theta}$ fitted with linear regression $\mathbf{\theta} = (\mathbf{X^\top X})^{-1}\mathbf{X}^\top \mathbf{y}$. If $\mathbf{C}_y = \mathrm{diag}
How to find +/- uncertainty with a least squares regression Consider a linear estimator $\mathbf{\hat{y}} = \mathbf{X\theta}$ fitted with linear regression $\mathbf{\theta} = (\mathbf{X^\top X})^{-1}\mathbf{X}^\top \mathbf{y}$. If $\mathbf{C}_y = \mathrm{diag}(\sigma_1^2,\sigma_2^2,\ldots,\sigma_m^2)$ is the covariance for the observations $\mathbf{y}$, the covariance for $\mathbf{\theta}$ is given by (see the lemma): $$ \mathbf{C}_\theta = (\mathbf{X^\top X})^{-1}\mathbf{X^\top C}_y \mathbf{X}(\mathbf{X^\top X})^{-1} $$ Lemma The covariance of a linear mapping $\mathbf{y} = \mathbf{Ax} + \mathbf{b}$ is $\mathbf{C}_y = \mathbf{AC}_x\mathbf{A^\top}$ with $\mathbf{C}_x$ the covariance for $\mathbf{x}$.
How to find +/- uncertainty with a least squares regression Consider a linear estimator $\mathbf{\hat{y}} = \mathbf{X\theta}$ fitted with linear regression $\mathbf{\theta} = (\mathbf{X^\top X})^{-1}\mathbf{X}^\top \mathbf{y}$. If $\mathbf{C}_y = \mathrm{diag}
43,223
Exploratory factor analysis using pooled longitudinal data
EFA is not the main issue here, you need to think long and hard about the meaning of correlations between your variables/questions. Your willingness to assume independence is doing all the work and feels like a way to sidestep a difficult problem through wishful thinking. I don't see how it can be reasonable, even with 6 months in between. That would mean assuming that someone's “well-being” is prone to arbitrary changes, with no link to personality or life circumstances because those are changing much more slowly. You can't expect that type of behavior from psychological variables. Note that personal attributes are not the only trouble here. Assuming independence would also require that changes between the three time points are essentially random with no relation with any other conceivable variable, thus making comparisons useless. Imagine that you are drawing a different random sample of 100 participants every six months. If you think the population's distribution on your measure could change in the meantime, ratings collected at a given point in time would be more similar to each other than to ratings collected at other times and these correlations would interact with interpersonal differences in unpredictable ways making correlations computed in the way you describe completely uninterpretable. This aspect of the assumption is not necessarily completely unreasonable (e.g. intelligence or personality are not supposed to change with the season) but you are probably not willing to make it since you do plan to look at changes between time points.
Exploratory factor analysis using pooled longitudinal data
EFA is not the main issue here, you need to think long and hard about the meaning of correlations between your variables/questions. Your willingness to assume independence is doing all the work and fe
Exploratory factor analysis using pooled longitudinal data EFA is not the main issue here, you need to think long and hard about the meaning of correlations between your variables/questions. Your willingness to assume independence is doing all the work and feels like a way to sidestep a difficult problem through wishful thinking. I don't see how it can be reasonable, even with 6 months in between. That would mean assuming that someone's “well-being” is prone to arbitrary changes, with no link to personality or life circumstances because those are changing much more slowly. You can't expect that type of behavior from psychological variables. Note that personal attributes are not the only trouble here. Assuming independence would also require that changes between the three time points are essentially random with no relation with any other conceivable variable, thus making comparisons useless. Imagine that you are drawing a different random sample of 100 participants every six months. If you think the population's distribution on your measure could change in the meantime, ratings collected at a given point in time would be more similar to each other than to ratings collected at other times and these correlations would interact with interpersonal differences in unpredictable ways making correlations computed in the way you describe completely uninterpretable. This aspect of the assumption is not necessarily completely unreasonable (e.g. intelligence or personality are not supposed to change with the season) but you are probably not willing to make it since you do plan to look at changes between time points.
Exploratory factor analysis using pooled longitudinal data EFA is not the main issue here, you need to think long and hard about the meaning of correlations between your variables/questions. Your willingness to assume independence is doing all the work and fe
43,224
Exploratory factor analysis using pooled longitudinal data
Putting the three time points as three times as many cases does not require assuming independence. Identically replicating three times the measurements obtained at a single time point would essentially produce the same factors as the factor analysis on that single time point. Therefore independence is not a problem. Presenting the three time points as three times as many cases will actually give more variance to those variables evolving across times, which will make the underlying evolving factors more salient. What the analysis of the pooled replicates will do is to work out common factors that inform the fifteen variables, causing them to be correlated. The contribution (weights) of the factors to the variables will be the same (i.e. common) across all measurement times. Once the factor scores are calculated for the 300 'cases', these scores may then be reorganised into three expression occasions for each of the 100 cases and submitted to repeated measure analysis (ANOVA or MANOVA, for instance). If you plan to use the Next Eigenvalue Sufficiency Test (NEST, Achim, 2017) to determine how many common factors are required for your analysis, I recommend applying NEST on the average of the three measurement times, since NEST needs to know the correct number of independent caases.
Exploratory factor analysis using pooled longitudinal data
Putting the three time points as three times as many cases does not require assuming independence. Identically replicating three times the measurements obtained at a single time point would essentiall
Exploratory factor analysis using pooled longitudinal data Putting the three time points as three times as many cases does not require assuming independence. Identically replicating three times the measurements obtained at a single time point would essentially produce the same factors as the factor analysis on that single time point. Therefore independence is not a problem. Presenting the three time points as three times as many cases will actually give more variance to those variables evolving across times, which will make the underlying evolving factors more salient. What the analysis of the pooled replicates will do is to work out common factors that inform the fifteen variables, causing them to be correlated. The contribution (weights) of the factors to the variables will be the same (i.e. common) across all measurement times. Once the factor scores are calculated for the 300 'cases', these scores may then be reorganised into three expression occasions for each of the 100 cases and submitted to repeated measure analysis (ANOVA or MANOVA, for instance). If you plan to use the Next Eigenvalue Sufficiency Test (NEST, Achim, 2017) to determine how many common factors are required for your analysis, I recommend applying NEST on the average of the three measurement times, since NEST needs to know the correct number of independent caases.
Exploratory factor analysis using pooled longitudinal data Putting the three time points as three times as many cases does not require assuming independence. Identically replicating three times the measurements obtained at a single time point would essentiall
43,225
Hierarchical regression using residuals
After a bit more digging, I suppose I'll take a stab at answering this myself. Each of the last two solutions I proposed is one half of a partial regression plot (aka added variable plot). That is, to construct a partial regression plot, the residuals from regressing the response variable against all predictor variables but one is plotted against the residuals from regressing the left-out predictor variable against all others. So actually, neither solution was quite right alone, but together, they make some sense—although, it seems that this is usually used in a much more qualitative way than what I was planning, but that's fine, since this was all basically meant to assuage as-yet-nonexistant reviewer concerns.
Hierarchical regression using residuals
After a bit more digging, I suppose I'll take a stab at answering this myself. Each of the last two solutions I proposed is one half of a partial regression plot (aka added variable plot). That is, to
Hierarchical regression using residuals After a bit more digging, I suppose I'll take a stab at answering this myself. Each of the last two solutions I proposed is one half of a partial regression plot (aka added variable plot). That is, to construct a partial regression plot, the residuals from regressing the response variable against all predictor variables but one is plotted against the residuals from regressing the left-out predictor variable against all others. So actually, neither solution was quite right alone, but together, they make some sense—although, it seems that this is usually used in a much more qualitative way than what I was planning, but that's fine, since this was all basically meant to assuage as-yet-nonexistant reviewer concerns.
Hierarchical regression using residuals After a bit more digging, I suppose I'll take a stab at answering this myself. Each of the last two solutions I proposed is one half of a partial regression plot (aka added variable plot). That is, to
43,226
How to find MLE when samples depend on the estimated parameter
I suggest you draw the likelihood as a function of $\theta$, without forgetting that $1/\theta$ must be greater than any observation (i.e. what are the bounds on $\theta$?). Keep in mind that everything but $\theta^{2n}$ in the likelihood is a constant, and so you can write it as $c.\theta^{2n}$; so just draw $\cal{L}/c$ over the domain of $\theta$. You may find it more convenient to deal with the log-likelihood, or you may not. It should help you clarify what you're doing. If you're still stuck, consider thinking in terms of $\psi = 1/\theta$ and then go back to doing it in terms of $\theta$. (Alternatively - look back at that uniform example. What would the MLE of $\theta$ be if the data were uniform on $[0,1/\theta]$? Can you see how to do the original problem now?)
How to find MLE when samples depend on the estimated parameter
I suggest you draw the likelihood as a function of $\theta$, without forgetting that $1/\theta$ must be greater than any observation (i.e. what are the bounds on $\theta$?). Keep in mind that everyth
How to find MLE when samples depend on the estimated parameter I suggest you draw the likelihood as a function of $\theta$, without forgetting that $1/\theta$ must be greater than any observation (i.e. what are the bounds on $\theta$?). Keep in mind that everything but $\theta^{2n}$ in the likelihood is a constant, and so you can write it as $c.\theta^{2n}$; so just draw $\cal{L}/c$ over the domain of $\theta$. You may find it more convenient to deal with the log-likelihood, or you may not. It should help you clarify what you're doing. If you're still stuck, consider thinking in terms of $\psi = 1/\theta$ and then go back to doing it in terms of $\theta$. (Alternatively - look back at that uniform example. What would the MLE of $\theta$ be if the data were uniform on $[0,1/\theta]$? Can you see how to do the original problem now?)
How to find MLE when samples depend on the estimated parameter I suggest you draw the likelihood as a function of $\theta$, without forgetting that $1/\theta$ must be greater than any observation (i.e. what are the bounds on $\theta$?). Keep in mind that everyth
43,227
How to find MLE when samples depend on the estimated parameter
In this kind of problem, it helps a lot to write explicitly the indicators in the definitions of the densities. You have $Y_1,\dots,Y_n$, conditionally IID given $\Theta=\theta$, such that $$ f_{Y_i\mid\Theta}(y_i\mid\theta) = 2y_i\theta^2\, I_{[0,\,1/\theta]}(y_i) \, . $$ Since $0\leq y_i\leq 1/\theta$ if and only if $0\leq \theta\leq 1/y_i$, the indicator can be rewritten as $$ I_{[0,\,1/\theta]}(y_i) = I_{[0,\,1/y_i]}(\theta) \, . $$ Introducing the notations $Y=(Y_1,\dots,Y_n)$ and $y=(y_1,\dots,y_n)$, the likelihood is $$ L_y(\theta) = f_{Y\mid\Theta}(y\mid\theta) = \prod_{i=1}^n f_{Y_i\mid\Theta}(y_i\mid\theta) = 2^n \left(\prod_{i=1}^n y_i\right) \theta^{2n} \left( \prod_{i=1}^n I_{[0,\,1/y_i]}(\theta) \right) \, . $$ But a product of indicators is the indicator of the intersection (why?), so $$ L_y(\theta) = 2^n \left(\prod_{i=1}^n y_i\right) \theta^{2n} I_{\cap_{i=1}^n [0,\,1/y_i]}(\theta) \, , $$ and (why?) $$ I_{\cap_{i=1}^n [0,\,1/y_i]}(\theta) = I_{[0,\,1/y_{(n)}]}(\theta) \, , $$ in which $y_{(n)}=\max \{y_1,\dots,y_n\}$. Hence, $$ L_y(\theta) = 2^n \left(\prod_{i=1}^n y_i\right) \theta^{2n} I_{[0,\,1/y_{(n)}]}(\theta) \, , $$ and this is maximized (why? draw the graph for some fixed sample $y$) when $\theta=1/y_{(n)}$, yielding the maximum likelihood estimator $$ \hat{\Theta}_{ML}=\frac{1}{Y_{(n)}} \, . $$
How to find MLE when samples depend on the estimated parameter
In this kind of problem, it helps a lot to write explicitly the indicators in the definitions of the densities. You have $Y_1,\dots,Y_n$, conditionally IID given $\Theta=\theta$, such that $$ f_{Y_i
How to find MLE when samples depend on the estimated parameter In this kind of problem, it helps a lot to write explicitly the indicators in the definitions of the densities. You have $Y_1,\dots,Y_n$, conditionally IID given $\Theta=\theta$, such that $$ f_{Y_i\mid\Theta}(y_i\mid\theta) = 2y_i\theta^2\, I_{[0,\,1/\theta]}(y_i) \, . $$ Since $0\leq y_i\leq 1/\theta$ if and only if $0\leq \theta\leq 1/y_i$, the indicator can be rewritten as $$ I_{[0,\,1/\theta]}(y_i) = I_{[0,\,1/y_i]}(\theta) \, . $$ Introducing the notations $Y=(Y_1,\dots,Y_n)$ and $y=(y_1,\dots,y_n)$, the likelihood is $$ L_y(\theta) = f_{Y\mid\Theta}(y\mid\theta) = \prod_{i=1}^n f_{Y_i\mid\Theta}(y_i\mid\theta) = 2^n \left(\prod_{i=1}^n y_i\right) \theta^{2n} \left( \prod_{i=1}^n I_{[0,\,1/y_i]}(\theta) \right) \, . $$ But a product of indicators is the indicator of the intersection (why?), so $$ L_y(\theta) = 2^n \left(\prod_{i=1}^n y_i\right) \theta^{2n} I_{\cap_{i=1}^n [0,\,1/y_i]}(\theta) \, , $$ and (why?) $$ I_{\cap_{i=1}^n [0,\,1/y_i]}(\theta) = I_{[0,\,1/y_{(n)}]}(\theta) \, , $$ in which $y_{(n)}=\max \{y_1,\dots,y_n\}$. Hence, $$ L_y(\theta) = 2^n \left(\prod_{i=1}^n y_i\right) \theta^{2n} I_{[0,\,1/y_{(n)}]}(\theta) \, , $$ and this is maximized (why? draw the graph for some fixed sample $y$) when $\theta=1/y_{(n)}$, yielding the maximum likelihood estimator $$ \hat{\Theta}_{ML}=\frac{1}{Y_{(n)}} \, . $$
How to find MLE when samples depend on the estimated parameter In this kind of problem, it helps a lot to write explicitly the indicators in the definitions of the densities. You have $Y_1,\dots,Y_n$, conditionally IID given $\Theta=\theta$, such that $$ f_{Y_i
43,228
Are there models for "censored" spatial point processes?
To start, this change in support problem is an active area of research, and so although it is usual to treat units of analysis in criminology as discrete, you can certainly make a case for treating it as a continuous field. Although I don't hold as such a negative view of using discrete units as you, I look forward to any further research and advances on the topic. I can see the hesitation to use larger areal units, like census block groups, but I don't have as much problem with smaller units like street segments or parcel units, which are becoming more popular in criminology all the time. On its face, it seems the problem is related to edge effects (as you labeled the question as a censored point process), but it is a little different. Edge effects are typically handled by creating a weight for observed point process, and points near the edge of the study space are weighted higher. You have a process you observe though, but it is binned at a precision that doesn't suit your fancy. This is very similar to the change of support problem, and attempts to solve it can be characterized as attempting to allocate the points (the suggestion) or by utilizing different techniques to take into the uncertainty in the aggregation. The dasymetric techniques listed are synonymous with the permutation/reallocation cardinal suggests in the comments. See the previous (two) answers of mine to a question of simulating similar outcomes. You can see examples of EM both for calculating ecological regressions, and for allocating estimates (see Tsutsumi & Murakami, 2012 - which is admittedly quite rough around the edges - as you can imaging by the title of the paper). The simulation approach you suggest is very similar to what Goovaerts (2008) suggests in his area-to-point kriging models. I would note though, that there are areas that can be legitimately considered places that should be cut out of the window. For instance, although technically possible, you can assume the lake in the park is an area where no crime occurs. It also changes depending on the type of crime; burglary (as usually defined) can only occur in non-public areas, a public park can not be the victim of a burglary. Similarly if you wanted to fit a model of traffic accidents or DUI they are pretty much limited to actual roads. Most contemporary examples of crime forecasting though ignore this (and still produce estimates in areas where it is not possible to have a crime committed). Taking such places into account is what intelligent dasymetric mapping is all about. Sorry, I believe there is no easy answer (and the best I can do is just provide a long list of literature that won't directly answer your question anyway). As a sidebar, I'm not diametrically opposed to representing reality like this, but the examples you in the comments are obviously not measures that are continuous fields. The only continuous field I can think of that criminologists have been interested in is (unless you are a really persnickety physicist) weather related. But, as perhaps always, how you go about representing the variables should be partly guided by what substantive questions you want answered. The continuous field approach to smoothing in the end confounds local and spatial spillover effects, and so is not reasonable to answer particular questions. For example, if a concerned citizen came to me and said, A parcel a block away, in a separate neighborhood group, was recently proposed to be rezoned to allow the sale of alcohol. Although it isn't in my neighborhood, I think my neighborhood should be allowed to vote on whether it is rezoned. Can you provide evidence if bars have an effect on crime not just where they are on the street, but a block away? This answer can not be addressed with bars as a continuous density formulation in the model. But this can be by treating street blocks as units of analysis and fitting a spatial model to take into account bars not only on the local street, but on the neighboring street.
Are there models for "censored" spatial point processes?
To start, this change in support problem is an active area of research, and so although it is usual to treat units of analysis in criminology as discrete, you can certainly make a case for treating it
Are there models for "censored" spatial point processes? To start, this change in support problem is an active area of research, and so although it is usual to treat units of analysis in criminology as discrete, you can certainly make a case for treating it as a continuous field. Although I don't hold as such a negative view of using discrete units as you, I look forward to any further research and advances on the topic. I can see the hesitation to use larger areal units, like census block groups, but I don't have as much problem with smaller units like street segments or parcel units, which are becoming more popular in criminology all the time. On its face, it seems the problem is related to edge effects (as you labeled the question as a censored point process), but it is a little different. Edge effects are typically handled by creating a weight for observed point process, and points near the edge of the study space are weighted higher. You have a process you observe though, but it is binned at a precision that doesn't suit your fancy. This is very similar to the change of support problem, and attempts to solve it can be characterized as attempting to allocate the points (the suggestion) or by utilizing different techniques to take into the uncertainty in the aggregation. The dasymetric techniques listed are synonymous with the permutation/reallocation cardinal suggests in the comments. See the previous (two) answers of mine to a question of simulating similar outcomes. You can see examples of EM both for calculating ecological regressions, and for allocating estimates (see Tsutsumi & Murakami, 2012 - which is admittedly quite rough around the edges - as you can imaging by the title of the paper). The simulation approach you suggest is very similar to what Goovaerts (2008) suggests in his area-to-point kriging models. I would note though, that there are areas that can be legitimately considered places that should be cut out of the window. For instance, although technically possible, you can assume the lake in the park is an area where no crime occurs. It also changes depending on the type of crime; burglary (as usually defined) can only occur in non-public areas, a public park can not be the victim of a burglary. Similarly if you wanted to fit a model of traffic accidents or DUI they are pretty much limited to actual roads. Most contemporary examples of crime forecasting though ignore this (and still produce estimates in areas where it is not possible to have a crime committed). Taking such places into account is what intelligent dasymetric mapping is all about. Sorry, I believe there is no easy answer (and the best I can do is just provide a long list of literature that won't directly answer your question anyway). As a sidebar, I'm not diametrically opposed to representing reality like this, but the examples you in the comments are obviously not measures that are continuous fields. The only continuous field I can think of that criminologists have been interested in is (unless you are a really persnickety physicist) weather related. But, as perhaps always, how you go about representing the variables should be partly guided by what substantive questions you want answered. The continuous field approach to smoothing in the end confounds local and spatial spillover effects, and so is not reasonable to answer particular questions. For example, if a concerned citizen came to me and said, A parcel a block away, in a separate neighborhood group, was recently proposed to be rezoned to allow the sale of alcohol. Although it isn't in my neighborhood, I think my neighborhood should be allowed to vote on whether it is rezoned. Can you provide evidence if bars have an effect on crime not just where they are on the street, but a block away? This answer can not be addressed with bars as a continuous density formulation in the model. But this can be by treating street blocks as units of analysis and fitting a spatial model to take into account bars not only on the local street, but on the neighboring street.
Are there models for "censored" spatial point processes? To start, this change in support problem is an active area of research, and so although it is usual to treat units of analysis in criminology as discrete, you can certainly make a case for treating it
43,229
Are there models for "censored" spatial point processes?
Censored spatial data is very common in the field of Cosmology. The issue is typically dealt with by creating a sample of random points with a flat distribution but that receives the same censoring as the data you are trying to model. Then, your analysis is adjusted by comparing effects seen in your data relative to effects seen in the random (but censored) data. The classic estimator is one by Landy & Szalay, for the analysis of spatial clustering in real space (as opposed to Fourier space). Go here for the article http://adsabs.harvard.edu/abs/1993ApJ...412...64L
Are there models for "censored" spatial point processes?
Censored spatial data is very common in the field of Cosmology. The issue is typically dealt with by creating a sample of random points with a flat distribution but that receives the same censoring as
Are there models for "censored" spatial point processes? Censored spatial data is very common in the field of Cosmology. The issue is typically dealt with by creating a sample of random points with a flat distribution but that receives the same censoring as the data you are trying to model. Then, your analysis is adjusted by comparing effects seen in your data relative to effects seen in the random (but censored) data. The classic estimator is one by Landy & Szalay, for the analysis of spatial clustering in real space (as opposed to Fourier space). Go here for the article http://adsabs.harvard.edu/abs/1993ApJ...412...64L
Are there models for "censored" spatial point processes? Censored spatial data is very common in the field of Cosmology. The issue is typically dealt with by creating a sample of random points with a flat distribution but that receives the same censoring as
43,230
How to create a random variables in a simulation using skewness and kurtosis as well as average and standard deviation input?
These features can be included in simulations from a symmetric distribution using transformations that control skewness and kurtosis such as the Johnson-SU transformation, the g-and-h, the g-and-k, the sinh-arcsinh, and the LambertW tranformations (Tukey-type transformations). A quick google search gives you relevant references for these transformations. See also Transformation to increase kurtosis and skewness of normal r.v
How to create a random variables in a simulation using skewness and kurtosis as well as average and
These features can be included in simulations from a symmetric distribution using transformations that control skewness and kurtosis such as the Johnson-SU transformation, the g-and-h, the g-and-k, th
How to create a random variables in a simulation using skewness and kurtosis as well as average and standard deviation input? These features can be included in simulations from a symmetric distribution using transformations that control skewness and kurtosis such as the Johnson-SU transformation, the g-and-h, the g-and-k, the sinh-arcsinh, and the LambertW tranformations (Tukey-type transformations). A quick google search gives you relevant references for these transformations. See also Transformation to increase kurtosis and skewness of normal r.v
How to create a random variables in a simulation using skewness and kurtosis as well as average and These features can be included in simulations from a symmetric distribution using transformations that control skewness and kurtosis such as the Johnson-SU transformation, the g-and-h, the g-and-k, th
43,231
Bayesian and frequentist approaches: What are some success stories for the former? [duplicate]
Adrian Raftery examined a set of statistics about coal-dust explosions in 19th-century British mines. Frequentist techniques had shown the coal mining accident rates changed over time gradually. Our of curiosity, Raftery experimented with Bayes' Theorem, and discovered that accident rates had plummeted suddenly in the early 1890s. A historian suggested why: in 1889, the miners had formed a safety coalition. from A history of Bayes Theorem. The original paper is here, though I would suggest the example in the PyMC literature for more clarity (i.e. less integrals haha) Also, from another post, there is the Table Game from (the very accessible pdf) The Table Game. The two proposed solutions, Bayesian and frequentist, are very different (and only one is correct!).
Bayesian and frequentist approaches: What are some success stories for the former? [duplicate]
Adrian Raftery examined a set of statistics about coal-dust explosions in 19th-century British mines. Frequentist techniques had shown the coal mining accident rates changed over time gradually. Our o
Bayesian and frequentist approaches: What are some success stories for the former? [duplicate] Adrian Raftery examined a set of statistics about coal-dust explosions in 19th-century British mines. Frequentist techniques had shown the coal mining accident rates changed over time gradually. Our of curiosity, Raftery experimented with Bayes' Theorem, and discovered that accident rates had plummeted suddenly in the early 1890s. A historian suggested why: in 1889, the miners had formed a safety coalition. from A history of Bayes Theorem. The original paper is here, though I would suggest the example in the PyMC literature for more clarity (i.e. less integrals haha) Also, from another post, there is the Table Game from (the very accessible pdf) The Table Game. The two proposed solutions, Bayesian and frequentist, are very different (and only one is correct!).
Bayesian and frequentist approaches: What are some success stories for the former? [duplicate] Adrian Raftery examined a set of statistics about coal-dust explosions in 19th-century British mines. Frequentist techniques had shown the coal mining accident rates changed over time gradually. Our o
43,232
Choosing between a MANOVA and a series of t-tests when comparing two groups
I have recently answered a very similar question, maybe you want to take a look: Assessing group differences on multiple outcomes. However, as the questions have not been marked as duplicates (and I am too new here to attempt it), let me add here the following. You have a very simple design: only two groups; MANOVA is not a simple procedure and so might be an overkill. Therefore I would start with separate t-tests, and if you can show that your groups differ according to several dependent variables, then perfect. Note that they should better differ consistently, e.g. one of the groups should always have a lower reaction time (and not sometimes lower, sometimes higher, which would be weird). See my linked answer about multiple comparisons. If you don't get convincing and consistent differences with individual t-tests, well, then you can try MANOVA -- again, see my answer with some further tips. Regarding your theoretical question: I assume you are asking when you can group dependent variables to run a MANOVA. I guess the answer is whenever you want. If you have several dependent variables, then whatever they are you can ask if your groups differ with regard to them.
Choosing between a MANOVA and a series of t-tests when comparing two groups
I have recently answered a very similar question, maybe you want to take a look: Assessing group differences on multiple outcomes. However, as the questions have not been marked as duplicates (and I a
Choosing between a MANOVA and a series of t-tests when comparing two groups I have recently answered a very similar question, maybe you want to take a look: Assessing group differences on multiple outcomes. However, as the questions have not been marked as duplicates (and I am too new here to attempt it), let me add here the following. You have a very simple design: only two groups; MANOVA is not a simple procedure and so might be an overkill. Therefore I would start with separate t-tests, and if you can show that your groups differ according to several dependent variables, then perfect. Note that they should better differ consistently, e.g. one of the groups should always have a lower reaction time (and not sometimes lower, sometimes higher, which would be weird). See my linked answer about multiple comparisons. If you don't get convincing and consistent differences with individual t-tests, well, then you can try MANOVA -- again, see my answer with some further tips. Regarding your theoretical question: I assume you are asking when you can group dependent variables to run a MANOVA. I guess the answer is whenever you want. If you have several dependent variables, then whatever they are you can ask if your groups differ with regard to them.
Choosing between a MANOVA and a series of t-tests when comparing two groups I have recently answered a very similar question, maybe you want to take a look: Assessing group differences on multiple outcomes. However, as the questions have not been marked as duplicates (and I a
43,233
Choosing between a MANOVA and a series of t-tests when comparing two groups
Many different statistical tests of significance can be applied in research studies. Factors such as the scale of measurement represented by the data, method of participant selection, number of groups being compared and number of independent variables determine which test of significance should be used in a given study. It is important that the researcher select the appropriate test because an incorrect test can lead to an incorrect decision of Type I or Type II error (Gay, Mills & Airasian, 2011). The t test is used to determine whether two groups of scores are significantly different at a selected probability level. Simple ANOVA is a test of significance used to determine whether scores from two or more groups are significantly different at a selected probability level. Whereas, the t test is appropriate test of difference between the means of two groups at a time (e.g., boys and girls). It is also possible to compute a series of t tests, one for each pair of means. ANOVA is the test for multiple group comparison (Gay, Mills & Airasian, 2011). MANOVA is the extended form of ANOVA. If a research study uses a factorial design to investigate two or more independent variables and the interactions between them, the appropriate statistical analysis is factorial, or multifactor analysis of variance. This analysis yields a separate F ratio for each independent variable and one for each interaction. When two or more independent variables are analyzed, multivariate analysis of variance MANOVA is used. For example, suppose that we want to consider whether gender and economic status both affect students’ college achievement. MANOVA will allow us to consider both independent variables (gender and economic status) and multiple dependent variables (e.g., college GPA as well as other test scores we may have from maths or language classes). As you can imagine, however, we need a large data set to run increasingly complex analysis with multiple independent and independent variables (Gay, Mills & Airasian, 2011).
Choosing between a MANOVA and a series of t-tests when comparing two groups
Many different statistical tests of significance can be applied in research studies. Factors such as the scale of measurement represented by the data, method of participant selection, number of groups
Choosing between a MANOVA and a series of t-tests when comparing two groups Many different statistical tests of significance can be applied in research studies. Factors such as the scale of measurement represented by the data, method of participant selection, number of groups being compared and number of independent variables determine which test of significance should be used in a given study. It is important that the researcher select the appropriate test because an incorrect test can lead to an incorrect decision of Type I or Type II error (Gay, Mills & Airasian, 2011). The t test is used to determine whether two groups of scores are significantly different at a selected probability level. Simple ANOVA is a test of significance used to determine whether scores from two or more groups are significantly different at a selected probability level. Whereas, the t test is appropriate test of difference between the means of two groups at a time (e.g., boys and girls). It is also possible to compute a series of t tests, one for each pair of means. ANOVA is the test for multiple group comparison (Gay, Mills & Airasian, 2011). MANOVA is the extended form of ANOVA. If a research study uses a factorial design to investigate two or more independent variables and the interactions between them, the appropriate statistical analysis is factorial, or multifactor analysis of variance. This analysis yields a separate F ratio for each independent variable and one for each interaction. When two or more independent variables are analyzed, multivariate analysis of variance MANOVA is used. For example, suppose that we want to consider whether gender and economic status both affect students’ college achievement. MANOVA will allow us to consider both independent variables (gender and economic status) and multiple dependent variables (e.g., college GPA as well as other test scores we may have from maths or language classes). As you can imagine, however, we need a large data set to run increasingly complex analysis with multiple independent and independent variables (Gay, Mills & Airasian, 2011).
Choosing between a MANOVA and a series of t-tests when comparing two groups Many different statistical tests of significance can be applied in research studies. Factors such as the scale of measurement represented by the data, method of participant selection, number of groups
43,234
Obtaining a log-normal waiting time via sequential exponential or gamma distributions - is it possible?
As mentioned in my comment, a way to approximate the log-normal by a gamma distribution is through the use of the KL-divergence.  That is, we choose the parameters of the gamma distribution to minimise $$KL(\kappa,\theta)=\int_{0}^{\infty}p(z|\mu,\sigma)\log\left(\frac{p(z|\mu,\sigma)}{q(z|\kappa,\theta)}\right)dz$$ Where $p(z|\mu,\sigma)$ is the log-normal density, and $q(z|\kappa,\theta)$ is the gamma density.  Let $C(\mu,\sigma)$ denote the terms which don't depend on $\kappa,\theta$ we have: $$KL(\kappa,\theta)=C(\mu,\sigma)+\log[\Gamma(\kappa)]+\kappa\log(\theta)-(\kappa-1)E_p[\log(z)]+\frac{1}{\theta}E_p[z]$$ Taking derivatives gives the following equations to be solved: $$\psi^{(0)}(\kappa)+\log(\theta)=E_p[\log(z)]=\mu$$ $$\kappa\theta=E_p[z]=\exp\left(\mu+\frac{1}{2}\sigma^2\right)$$ Where $\psi^{(m)}(x)$ is the polygamma function. These are not solvable analytically, although we can eliminate $\theta$ and we have: $$\kappa= \exp\left(\psi^{(0)}(\kappa)+\frac{1}{2}\sigma^2\right) $$ A starting value can be obtained by using the approximation $\psi^{(0)}(\kappa)\approx\log(\kappa)-(2\kappa)^{-1}$ which gives $\kappa\approx\sigma^{-2}$. This approximation gets better for smaller values of $\sigma^2$. Choosing this KL-divergence ensures that the log-likelihood ratio between p and q is small near the regions of high density in the exact log-normal distribution. Doing the divergence the other way $q\log\left(\frac{q}{p}\right)$ results in the log-likelihood ratio is small near the regions of high density in $q$.  This is known as Variational Bayes (although it is a non-standard application of it) and will typically understate the variance of the exact distribution. This results in the moment matching I gave in the comments. So the new equations to be solved are $$\psi^{(0)}(\kappa)+\log(\theta)=\mu$$ $$\kappa\psi^{(1)}(\kappa)+\frac{\psi^{(2)}(\kappa)}{2\sigma^2}=1$$ This could be important as the right tail of a gamma are lighter than a log-normal - $\exp(-az)$ compared to $\exp(-b[\log(z)]^2)$. To see this we get the same approximation (differentiating the approximation to the digamma function) for $\theta$ given the value of $\kappa$ but now $\kappa\approx\frac{1+\sqrt{1+4\sigma^2}}{2\sigma^2}>\sigma^{-2}$ - that is we have decreased the coefficient of variation compared to using the KL divergence used initially (which is also understated as the exact inverse of the squared CV is $\frac{1}{\exp(\sigma^2)-1}$).
Obtaining a log-normal waiting time via sequential exponential or gamma distributions - is it possib
As mentioned in my comment, a way to approximate the log-normal by a gamma distribution is through the use of the KL-divergence.  That is, we choose the parameters of the gamma distribution to minimis
Obtaining a log-normal waiting time via sequential exponential or gamma distributions - is it possible? As mentioned in my comment, a way to approximate the log-normal by a gamma distribution is through the use of the KL-divergence.  That is, we choose the parameters of the gamma distribution to minimise $$KL(\kappa,\theta)=\int_{0}^{\infty}p(z|\mu,\sigma)\log\left(\frac{p(z|\mu,\sigma)}{q(z|\kappa,\theta)}\right)dz$$ Where $p(z|\mu,\sigma)$ is the log-normal density, and $q(z|\kappa,\theta)$ is the gamma density.  Let $C(\mu,\sigma)$ denote the terms which don't depend on $\kappa,\theta$ we have: $$KL(\kappa,\theta)=C(\mu,\sigma)+\log[\Gamma(\kappa)]+\kappa\log(\theta)-(\kappa-1)E_p[\log(z)]+\frac{1}{\theta}E_p[z]$$ Taking derivatives gives the following equations to be solved: $$\psi^{(0)}(\kappa)+\log(\theta)=E_p[\log(z)]=\mu$$ $$\kappa\theta=E_p[z]=\exp\left(\mu+\frac{1}{2}\sigma^2\right)$$ Where $\psi^{(m)}(x)$ is the polygamma function. These are not solvable analytically, although we can eliminate $\theta$ and we have: $$\kappa= \exp\left(\psi^{(0)}(\kappa)+\frac{1}{2}\sigma^2\right) $$ A starting value can be obtained by using the approximation $\psi^{(0)}(\kappa)\approx\log(\kappa)-(2\kappa)^{-1}$ which gives $\kappa\approx\sigma^{-2}$. This approximation gets better for smaller values of $\sigma^2$. Choosing this KL-divergence ensures that the log-likelihood ratio between p and q is small near the regions of high density in the exact log-normal distribution. Doing the divergence the other way $q\log\left(\frac{q}{p}\right)$ results in the log-likelihood ratio is small near the regions of high density in $q$.  This is known as Variational Bayes (although it is a non-standard application of it) and will typically understate the variance of the exact distribution. This results in the moment matching I gave in the comments. So the new equations to be solved are $$\psi^{(0)}(\kappa)+\log(\theta)=\mu$$ $$\kappa\psi^{(1)}(\kappa)+\frac{\psi^{(2)}(\kappa)}{2\sigma^2}=1$$ This could be important as the right tail of a gamma are lighter than a log-normal - $\exp(-az)$ compared to $\exp(-b[\log(z)]^2)$. To see this we get the same approximation (differentiating the approximation to the digamma function) for $\theta$ given the value of $\kappa$ but now $\kappa\approx\frac{1+\sqrt{1+4\sigma^2}}{2\sigma^2}>\sigma^{-2}$ - that is we have decreased the coefficient of variation compared to using the KL divergence used initially (which is also understated as the exact inverse of the squared CV is $\frac{1}{\exp(\sigma^2)-1}$).
Obtaining a log-normal waiting time via sequential exponential or gamma distributions - is it possib As mentioned in my comment, a way to approximate the log-normal by a gamma distribution is through the use of the KL-divergence.  That is, we choose the parameters of the gamma distribution to minimis
43,235
Transforming two normal random variables
Because there's a subtlety here, this question is worth a correct answer. But let's develop it with as little work as possible, in the most straightforward manner. What subtlety? The variables $(U,V)$ do not determine $(X,Y).$ The change of variables from $(X,Y)$ to $(U,V)$ is two-to-one: because $(U,V)$ gives us information about $Y$ only in the form of $Y^2,$ whenever $(X,Y)$ corresponds to $(U,V),$ so does $(X,-Y).$ Almost surely, $Y\ne -Y$ (the chance of this for a Normal distribution of $Y$ is zero). This means the density of $(U,V)$ will be twice what a mindless application of the routine Calculus formulas indicates. Those routine formulas are, of course, the computation of the Jacobian. This is just an old-fashioned term for computing the differential element $\mathrm{d}x\,\mathrm{d}y$ in terms of the new variables. One of the easiest ways to work it out starts with the formulas $$X = V\sqrt{U};\ Y = \sqrt{1-V^2}\sqrt{U}.$$ Taking differentials, $$\begin{aligned} \mathrm{d}x\,\mathrm{d}y &= \left(\frac{v}{2\sqrt{u}}\mathrm{d}u + \sqrt{u}\mathrm{d}v\right)\,\left(\frac{\sqrt{1-v^2}}{2\sqrt{u}}\mathrm{d}u - \frac{v\sqrt{u}}{\sqrt{1-v^2}}\mathrm{d}v\right) \\ &= \frac{1}{2\sqrt{1-v^2}}\mathrm{d}v\,\mathrm{d}u. \end{aligned}$$ Substitute everything into the original probability element for the bivariate Normal distribution taking care to indicate what the possible values of the variables $u$ and $v$ can be. Omitting this is another pitfall that plagues the uninitiated, so I will be explicit, using $\mathcal{I}$ to represent the indicator function: $$\begin{aligned} f_{X,Y}(x,y)\,\mathrm{d}x\,\mathrm{d}y &= \frac{1}{2\pi\sigma^2} \exp\left(-\frac{x^2+y^2}{2\sigma^2}\right)\,\mathrm{d}x\,\mathrm{d}y \\ &= \frac{1}{2\pi\sigma^2} \exp\left(-\frac{u}{2\sigma^2}\right)\, \frac{1}{2\sqrt{1-v^2}}\mathrm{d}v\,\mathrm{d}u\ \mathcal{I}(u\ge 0)\,\mathcal{I}(-1\le v\le 1). \end{aligned}$$ (It would be incorrect to write this formula without the indicator functions. Usually readers are expected to notice that $\sqrt{1-v^2}$ is defined only for $-1\le v\le 1,$ so in informal settings we can get away without indicating that explicitly; but it's not quite as noticeable that although $\exp(-u/(2\sigma^2))$ is defined everywhere, its integral diverges unless $u$ is explicitly restricted.) Introduce the factor of $2$ from the two-to-one transformation and notice the probability element splits into a factor depending only on $u$ and one depending only on $v:$ $$f_{U,V}(u,v)\,\mathrm{d}v\,\mathrm{d}u = \left[\frac{1}{2\sigma^2} \exp\left(-\frac{u}{2\sigma^2}\right)\,\mathrm{d}u\ \mathcal{I}(u\ge 0)\right]\, \left[\frac{1}{\pi\sqrt{1-v^2}}\,\mathrm{d}v\ \mathcal{I}(-1\le v\le 1)\right].$$ In one stroke this answers (a) and (b): because the probability element factors, the variables $U$ and $V$ are independent. As a check, you may integrate the two factors separately over the set of real numbers: each integrates to $1,$ as it must for any univariate probability distribution. Question (c) is a routine exercise in a univariate change of variable, so discussing it doesn't add any further interest.
Transforming two normal random variables
Because there's a subtlety here, this question is worth a correct answer. But let's develop it with as little work as possible, in the most straightforward manner. What subtlety? The variables $(U,V)
Transforming two normal random variables Because there's a subtlety here, this question is worth a correct answer. But let's develop it with as little work as possible, in the most straightforward manner. What subtlety? The variables $(U,V)$ do not determine $(X,Y).$ The change of variables from $(X,Y)$ to $(U,V)$ is two-to-one: because $(U,V)$ gives us information about $Y$ only in the form of $Y^2,$ whenever $(X,Y)$ corresponds to $(U,V),$ so does $(X,-Y).$ Almost surely, $Y\ne -Y$ (the chance of this for a Normal distribution of $Y$ is zero). This means the density of $(U,V)$ will be twice what a mindless application of the routine Calculus formulas indicates. Those routine formulas are, of course, the computation of the Jacobian. This is just an old-fashioned term for computing the differential element $\mathrm{d}x\,\mathrm{d}y$ in terms of the new variables. One of the easiest ways to work it out starts with the formulas $$X = V\sqrt{U};\ Y = \sqrt{1-V^2}\sqrt{U}.$$ Taking differentials, $$\begin{aligned} \mathrm{d}x\,\mathrm{d}y &= \left(\frac{v}{2\sqrt{u}}\mathrm{d}u + \sqrt{u}\mathrm{d}v\right)\,\left(\frac{\sqrt{1-v^2}}{2\sqrt{u}}\mathrm{d}u - \frac{v\sqrt{u}}{\sqrt{1-v^2}}\mathrm{d}v\right) \\ &= \frac{1}{2\sqrt{1-v^2}}\mathrm{d}v\,\mathrm{d}u. \end{aligned}$$ Substitute everything into the original probability element for the bivariate Normal distribution taking care to indicate what the possible values of the variables $u$ and $v$ can be. Omitting this is another pitfall that plagues the uninitiated, so I will be explicit, using $\mathcal{I}$ to represent the indicator function: $$\begin{aligned} f_{X,Y}(x,y)\,\mathrm{d}x\,\mathrm{d}y &= \frac{1}{2\pi\sigma^2} \exp\left(-\frac{x^2+y^2}{2\sigma^2}\right)\,\mathrm{d}x\,\mathrm{d}y \\ &= \frac{1}{2\pi\sigma^2} \exp\left(-\frac{u}{2\sigma^2}\right)\, \frac{1}{2\sqrt{1-v^2}}\mathrm{d}v\,\mathrm{d}u\ \mathcal{I}(u\ge 0)\,\mathcal{I}(-1\le v\le 1). \end{aligned}$$ (It would be incorrect to write this formula without the indicator functions. Usually readers are expected to notice that $\sqrt{1-v^2}$ is defined only for $-1\le v\le 1,$ so in informal settings we can get away without indicating that explicitly; but it's not quite as noticeable that although $\exp(-u/(2\sigma^2))$ is defined everywhere, its integral diverges unless $u$ is explicitly restricted.) Introduce the factor of $2$ from the two-to-one transformation and notice the probability element splits into a factor depending only on $u$ and one depending only on $v:$ $$f_{U,V}(u,v)\,\mathrm{d}v\,\mathrm{d}u = \left[\frac{1}{2\sigma^2} \exp\left(-\frac{u}{2\sigma^2}\right)\,\mathrm{d}u\ \mathcal{I}(u\ge 0)\right]\, \left[\frac{1}{\pi\sqrt{1-v^2}}\,\mathrm{d}v\ \mathcal{I}(-1\le v\le 1)\right].$$ In one stroke this answers (a) and (b): because the probability element factors, the variables $U$ and $V$ are independent. As a check, you may integrate the two factors separately over the set of real numbers: each integrates to $1,$ as it must for any univariate probability distribution. Question (c) is a routine exercise in a univariate change of variable, so discussing it doesn't add any further interest.
Transforming two normal random variables Because there's a subtlety here, this question is worth a correct answer. But let's develop it with as little work as possible, in the most straightforward manner. What subtlety? The variables $(U,V)
43,236
Transforming two normal random variables
By Box Muller transformation $X=r\cos(\theta) \hspace{.5cm} Y=r\sin(\theta) \hspace{.5cm} X,Y \sim normal(0,1) \Leftrightarrow \theta \sim Uniform(0,2\pi) \hspace{.5cm} r^2\sim chi(2)$. $X$ and $Y$ are independent $\Leftrightarrow $ $\theta$ and $r$ are independent. also $\sin(\theta) \sim \cos(\theta) \sim \sin(2\theta) \sim 2\sin(\theta) \cos(\theta) \sim \cos(2\theta) \sim \cos(2\theta) \sim f $ that $ f(z) =\frac{1}{\pi \sqrt(1-z^2)} I_{[-1,1]}(z) $ since $z=\sin(\theta) \Rightarrow f(z)=|\frac{d}{dz} \sin^{-1}(z)| f_{\theta}(\sin^{-1}(z)) + |\frac{d}{dz} (\pi-\sin^{-1}(z))| f_{\theta}(\pi -\sin^{-1}(z)) =\frac{1}{\sqrt(1-z^2)} \frac{1}{2\pi} +\frac{1}{\sqrt(1-z^2)} \frac{1}{2\pi} =\frac{1}{\pi\sqrt(1-z^2)} $ similar for others. in hence if $X,Y(i.i.d)\sim N(0,\sigma^2)$ so $X=\sigma r \cos(\theta)$ and $Y=\sigma r \sin(\theta)$. in hence $U=\sigma^2 r^2$ and $ V=\frac{\sigma r\cos(\theta)}{r\sigma}=\frac{r\cos(\theta)}{r}=\cos(\theta) \sim f $ and $r$ is independent from any function of $\theta$ like $\sin(\theta)$. another example $\frac{2XY}{\sqrt(X^2+Y^2)}=\frac{2r^2 \sigma^2\cos(\theta) \sin(\theta)}{r\sigma}=2r \cos(\theta) \sin(\theta) =r \sigma \sin(2\theta) \sim \sigma r \sin(\theta) \sim N(0,\sigma^2)$
Transforming two normal random variables
By Box Muller transformation $X=r\cos(\theta) \hspace{.5cm} Y=r\sin(\theta) \hspace{.5cm} X,Y \sim normal(0,1) \Leftrightarrow \theta \sim Uniform(0,2\pi) \hspace{.5cm} r^2\sim chi(2)$. $X$ and $Y$
Transforming two normal random variables By Box Muller transformation $X=r\cos(\theta) \hspace{.5cm} Y=r\sin(\theta) \hspace{.5cm} X,Y \sim normal(0,1) \Leftrightarrow \theta \sim Uniform(0,2\pi) \hspace{.5cm} r^2\sim chi(2)$. $X$ and $Y$ are independent $\Leftrightarrow $ $\theta$ and $r$ are independent. also $\sin(\theta) \sim \cos(\theta) \sim \sin(2\theta) \sim 2\sin(\theta) \cos(\theta) \sim \cos(2\theta) \sim \cos(2\theta) \sim f $ that $ f(z) =\frac{1}{\pi \sqrt(1-z^2)} I_{[-1,1]}(z) $ since $z=\sin(\theta) \Rightarrow f(z)=|\frac{d}{dz} \sin^{-1}(z)| f_{\theta}(\sin^{-1}(z)) + |\frac{d}{dz} (\pi-\sin^{-1}(z))| f_{\theta}(\pi -\sin^{-1}(z)) =\frac{1}{\sqrt(1-z^2)} \frac{1}{2\pi} +\frac{1}{\sqrt(1-z^2)} \frac{1}{2\pi} =\frac{1}{\pi\sqrt(1-z^2)} $ similar for others. in hence if $X,Y(i.i.d)\sim N(0,\sigma^2)$ so $X=\sigma r \cos(\theta)$ and $Y=\sigma r \sin(\theta)$. in hence $U=\sigma^2 r^2$ and $ V=\frac{\sigma r\cos(\theta)}{r\sigma}=\frac{r\cos(\theta)}{r}=\cos(\theta) \sim f $ and $r$ is independent from any function of $\theta$ like $\sin(\theta)$. another example $\frac{2XY}{\sqrt(X^2+Y^2)}=\frac{2r^2 \sigma^2\cos(\theta) \sin(\theta)}{r\sigma}=2r \cos(\theta) \sin(\theta) =r \sigma \sin(2\theta) \sim \sigma r \sin(\theta) \sim N(0,\sigma^2)$
Transforming two normal random variables By Box Muller transformation $X=r\cos(\theta) \hspace{.5cm} Y=r\sin(\theta) \hspace{.5cm} X,Y \sim normal(0,1) \Leftrightarrow \theta \sim Uniform(0,2\pi) \hspace{.5cm} r^2\sim chi(2)$. $X$ and $Y$
43,237
Elementary MCMC pseudocode
If you're using Metropolis Hastings, then you don't have to worry too much about conjugacy of priors or finely-tuned proposal jumps. Conjugate priors are useful for avoiding or short-circuiting numerical computation. They shouldn't be necessary for running Metropolis Hastings on a simple model. For the proposal distribution, just try a random walk. If a proposal is outside the support of $\theta$, then reject it. (Think of it as having a prior value of zero.) Also, there's a minor typo I think: you add the log prior to the log likelihood, or multiply the prior by the likelihood.
Elementary MCMC pseudocode
If you're using Metropolis Hastings, then you don't have to worry too much about conjugacy of priors or finely-tuned proposal jumps. Conjugate priors are useful for avoiding or short-circuiting numer
Elementary MCMC pseudocode If you're using Metropolis Hastings, then you don't have to worry too much about conjugacy of priors or finely-tuned proposal jumps. Conjugate priors are useful for avoiding or short-circuiting numerical computation. They shouldn't be necessary for running Metropolis Hastings on a simple model. For the proposal distribution, just try a random walk. If a proposal is outside the support of $\theta$, then reject it. (Think of it as having a prior value of zero.) Also, there's a minor typo I think: you add the log prior to the log likelihood, or multiply the prior by the likelihood.
Elementary MCMC pseudocode If you're using Metropolis Hastings, then you don't have to worry too much about conjugacy of priors or finely-tuned proposal jumps. Conjugate priors are useful for avoiding or short-circuiting numer
43,238
How to test for mediation when working with binary data?
You can easily model this in structural modeling software such as Mplus. You need a model of X --> Z --> Y where Z is the mediator and inspect fit and/or residual correlations. If the model fit is poor, then Z may be an imperfect mediator, and residual correlations between the three variables should be inspected to see where residual effects persist, e.g. between X and Y if you have imperfect mediation. I am suggesting to use Mplus because it can very easily deal with categorical variables in its general linear modeling framework.
How to test for mediation when working with binary data?
You can easily model this in structural modeling software such as Mplus. You need a model of X --> Z --> Y where Z is the mediator and inspect fit and/or residual correlations. If the model fit is poo
How to test for mediation when working with binary data? You can easily model this in structural modeling software such as Mplus. You need a model of X --> Z --> Y where Z is the mediator and inspect fit and/or residual correlations. If the model fit is poor, then Z may be an imperfect mediator, and residual correlations between the three variables should be inspected to see where residual effects persist, e.g. between X and Y if you have imperfect mediation. I am suggesting to use Mplus because it can very easily deal with categorical variables in its general linear modeling framework.
How to test for mediation when working with binary data? You can easily model this in structural modeling software such as Mplus. You need a model of X --> Z --> Y where Z is the mediator and inspect fit and/or residual correlations. If the model fit is poo
43,239
How to test for mediation when working with binary data?
Nathaniel Herr discussed the problem (and solution) of using Logit regression with dichotomous mediator, predictor and outcome in his blog http://www.nrhpsych.com/mediation/logmed.html
How to test for mediation when working with binary data?
Nathaniel Herr discussed the problem (and solution) of using Logit regression with dichotomous mediator, predictor and outcome in his blog http://www.nrhpsych.com/mediation/logmed.html
How to test for mediation when working with binary data? Nathaniel Herr discussed the problem (and solution) of using Logit regression with dichotomous mediator, predictor and outcome in his blog http://www.nrhpsych.com/mediation/logmed.html
How to test for mediation when working with binary data? Nathaniel Herr discussed the problem (and solution) of using Logit regression with dichotomous mediator, predictor and outcome in his blog http://www.nrhpsych.com/mediation/logmed.html
43,240
Variational inference for nested Chinese restaurant process
David Blei has an implementation of hLDA on his website, though I'm not sure if it's variational or MCMC. It's the second one from the bottom in the software list.
Variational inference for nested Chinese restaurant process
David Blei has an implementation of hLDA on his website, though I'm not sure if it's variational or MCMC. It's the second one from the bottom in the software list.
Variational inference for nested Chinese restaurant process David Blei has an implementation of hLDA on his website, though I'm not sure if it's variational or MCMC. It's the second one from the bottom in the software list.
Variational inference for nested Chinese restaurant process David Blei has an implementation of hLDA on his website, though I'm not sure if it's variational or MCMC. It's the second one from the bottom in the software list.
43,241
Is there a practical limit to the size of a piece of data with 0 statistical redundancy?
I'll ty to answer the question in terms of Kolmogorov complexity, which is the length of the smallest description of a finite sequence, given a fixed description language. A sequence is called Kolmogorov random, if the Kolmogorov complexity is at least as big as the length of the sequence (i.e., the sequence is incompressible). For your problem, we use the set of programs on a fixed universal Turing machine as description language. Without loss of generality, we may assume that the universal Turing machine uses a binary alphabet. For each natural number $n>0$, there exists a Kolmogorov random sequence. The proof is simple: There are $2^n$ sequences of length $n$, but only $2^{n-1}$ programs of length less than $n$. So by the pigeonhole principle, there must be some sequences -- in fact, at least $2^n - 2^{n-1} = 2^{n-1}$ sequences -- of length $n$ that are incompressible. This proof is of course not constructive. Also, it is not computable if a given sequence is Kolmogorov random. Update To make a connection to statistical redundancy: If you generate a sequence by some random process, the Kolmogorov complexity divided by the length of the sequence converges to the entropy of the generating process (as the length of the sequence goes to infinity). Thus, a sequence generated by a Bernoulli process with p=0.5 will be "Kolmogorov random in the limit".
Is there a practical limit to the size of a piece of data with 0 statistical redundancy?
I'll ty to answer the question in terms of Kolmogorov complexity, which is the length of the smallest description of a finite sequence, given a fixed description language. A sequence is called Kolmogo
Is there a practical limit to the size of a piece of data with 0 statistical redundancy? I'll ty to answer the question in terms of Kolmogorov complexity, which is the length of the smallest description of a finite sequence, given a fixed description language. A sequence is called Kolmogorov random, if the Kolmogorov complexity is at least as big as the length of the sequence (i.e., the sequence is incompressible). For your problem, we use the set of programs on a fixed universal Turing machine as description language. Without loss of generality, we may assume that the universal Turing machine uses a binary alphabet. For each natural number $n>0$, there exists a Kolmogorov random sequence. The proof is simple: There are $2^n$ sequences of length $n$, but only $2^{n-1}$ programs of length less than $n$. So by the pigeonhole principle, there must be some sequences -- in fact, at least $2^n - 2^{n-1} = 2^{n-1}$ sequences -- of length $n$ that are incompressible. This proof is of course not constructive. Also, it is not computable if a given sequence is Kolmogorov random. Update To make a connection to statistical redundancy: If you generate a sequence by some random process, the Kolmogorov complexity divided by the length of the sequence converges to the entropy of the generating process (as the length of the sequence goes to infinity). Thus, a sequence generated by a Bernoulli process with p=0.5 will be "Kolmogorov random in the limit".
Is there a practical limit to the size of a piece of data with 0 statistical redundancy? I'll ty to answer the question in terms of Kolmogorov complexity, which is the length of the smallest description of a finite sequence, given a fixed description language. A sequence is called Kolmogo
43,242
Is there a practical limit to the size of a piece of data with 0 statistical redundancy?
I’ll improve shortly on my above comment: If a compression algorithm is fixed, an arbitrary large non-compressible (with this algorithm) piece of data can be obtained just by iterating the algorithm. If a cycle appear before hitting the desired size, pick some starting point out of this cycle, and try again. $\def\N\{\mathbb N^*}$Details. Considering that data are strings of 0 and 1, a file is (after prefixing it with a 1) nothing more than a (non zero) integer. The length of a file $n\in \N*$ is $\log(n)$. A compression algorithm is an injective function from $\N$ to $\N$ (it has to be injective to ensure decompression is possible). We say that $n$ is non-compressible if $\log(n) < \log(f(n))$. I will distinct two cases (not absolutely necessary bit the first case is nicer) First, assume $f$ is non surjective and you know some $n \notin f(\N)$ (this is quite reasonable for practical examples). As $f$ is injective, if the orbit $f^{(k)}(n)$ is ultimately cyclic, it has to go through $n$ again. As $n \notin f(\N)$, this is impossible: so the orbit is not ultimately cyclic, and it has to go through arbitrary big numbers. More precisely, the length of the successive numbers have two increase from time to time, so this sequence contains an infinite amount of non-compressible numbers. Some have to be larger than the prescribed size. In the general case, well, pick up a number $n$, and iterate. If you meet a non-compressible number of the desired size before hitting $n$ again, you are done. In the other case, pick up a starting point out of the cycle, and try again. You iterate this, each time excluding all the cycles previously described. The sequence generated also contains an infinite amount of non-compressible numbers.
Is there a practical limit to the size of a piece of data with 0 statistical redundancy?
I’ll improve shortly on my above comment: If a compression algorithm is fixed, an arbitrary large non-compressible (with this algorithm) piece of data can be obtained just by iterating the algorithm.
Is there a practical limit to the size of a piece of data with 0 statistical redundancy? I’ll improve shortly on my above comment: If a compression algorithm is fixed, an arbitrary large non-compressible (with this algorithm) piece of data can be obtained just by iterating the algorithm. If a cycle appear before hitting the desired size, pick some starting point out of this cycle, and try again. $\def\N\{\mathbb N^*}$Details. Considering that data are strings of 0 and 1, a file is (after prefixing it with a 1) nothing more than a (non zero) integer. The length of a file $n\in \N*$ is $\log(n)$. A compression algorithm is an injective function from $\N$ to $\N$ (it has to be injective to ensure decompression is possible). We say that $n$ is non-compressible if $\log(n) < \log(f(n))$. I will distinct two cases (not absolutely necessary bit the first case is nicer) First, assume $f$ is non surjective and you know some $n \notin f(\N)$ (this is quite reasonable for practical examples). As $f$ is injective, if the orbit $f^{(k)}(n)$ is ultimately cyclic, it has to go through $n$ again. As $n \notin f(\N)$, this is impossible: so the orbit is not ultimately cyclic, and it has to go through arbitrary big numbers. More precisely, the length of the successive numbers have two increase from time to time, so this sequence contains an infinite amount of non-compressible numbers. Some have to be larger than the prescribed size. In the general case, well, pick up a number $n$, and iterate. If you meet a non-compressible number of the desired size before hitting $n$ again, you are done. In the other case, pick up a starting point out of the cycle, and try again. You iterate this, each time excluding all the cycles previously described. The sequence generated also contains an infinite amount of non-compressible numbers.
Is there a practical limit to the size of a piece of data with 0 statistical redundancy? I’ll improve shortly on my above comment: If a compression algorithm is fixed, an arbitrary large non-compressible (with this algorithm) piece of data can be obtained just by iterating the algorithm.
43,243
Probability that at least one person at a party will accidentally choose their own gift
Why not build a stochastic simulation? You can get an empirical estimate. number the gifts according to who brought them. Gift 1 was brought by person 1. Uniformly randomly draw gifts without replacement count how many gifts were drawn at their number. So if gift 10 was the tenth one drawn, count it. store the value in an array repeat a couple hundred thousand times. Make a CDF of the distribution of the sums. See if you can fit it to something analytic. Part of the fun of a stochastic simulation is that you can change the rules, even in nonlinear ways, and have near-immediate results.
Probability that at least one person at a party will accidentally choose their own gift
Why not build a stochastic simulation? You can get an empirical estimate. number the gifts according to who brought them. Gift 1 was brought by person 1. Uniformly randomly draw gifts without replac
Probability that at least one person at a party will accidentally choose their own gift Why not build a stochastic simulation? You can get an empirical estimate. number the gifts according to who brought them. Gift 1 was brought by person 1. Uniformly randomly draw gifts without replacement count how many gifts were drawn at their number. So if gift 10 was the tenth one drawn, count it. store the value in an array repeat a couple hundred thousand times. Make a CDF of the distribution of the sums. See if you can fit it to something analytic. Part of the fun of a stochastic simulation is that you can change the rules, even in nonlinear ways, and have near-immediate results.
Probability that at least one person at a party will accidentally choose their own gift Why not build a stochastic simulation? You can get an empirical estimate. number the gifts according to who brought them. Gift 1 was brought by person 1. Uniformly randomly draw gifts without replac
43,244
What level to use when making inferences on the group mean in a hierarchical Bayesian analysis?
What has happened is that the estimates of the individual subject means have been shrunk towards the group mean, causing the std. deviation of the subject means (and consequently that of the mean of the subject means) to be "too small". This shrinkage is part and parcel of the hierarchical Bayesian approach. The group_mu values are the ones that you want. You can see in a more empirical manner that the group_mu values are correct by comparing the width of the observed 95% credible interval from your quantile summary to the width of the confidence interval you would expect in classical statistics if you had directly observed the 50 true subject means. In this case, that's just $1.96/\sqrt{50}$, or +/- 0.28, which corresponds pretty well to the quantile results you displayed above for group_mu: (-0.26,+0.25). Since you can't do better than you could if you'd actually observed the 50 subject means, it follows that the credible interval shouldn't be much smaller than the confidence interval (as you're not adding any substantial prior information to the likelihood.) Clearly the (-0.1, 0.09) quantiles of the alternative mean are too close to 0, by this comparison. In fact, you can use the ratio of the std. deviation of the mean of the estimated subject means to the std. deviation of group_mu as an index of how much shrinkage has taken place. (It's not the only such metric; I'm just pointing it out since you're calculating them both anyway.) If you have a very small ratio, that indicates, in a heuristic sense, that the hierarchical part of the model isn't adding much, and assuming all the subject means are the same may be a plausible alternative. Conversely, if the ratio is near one, that also indicates that the hierarchical part of the model isn't adding much, and just having a "fixed effects" model for the subject means would likely be almost as good - questions of modeling approaches etc. aside.
What level to use when making inferences on the group mean in a hierarchical Bayesian analysis?
What has happened is that the estimates of the individual subject means have been shrunk towards the group mean, causing the std. deviation of the subject means (and consequently that of the mean of t
What level to use when making inferences on the group mean in a hierarchical Bayesian analysis? What has happened is that the estimates of the individual subject means have been shrunk towards the group mean, causing the std. deviation of the subject means (and consequently that of the mean of the subject means) to be "too small". This shrinkage is part and parcel of the hierarchical Bayesian approach. The group_mu values are the ones that you want. You can see in a more empirical manner that the group_mu values are correct by comparing the width of the observed 95% credible interval from your quantile summary to the width of the confidence interval you would expect in classical statistics if you had directly observed the 50 true subject means. In this case, that's just $1.96/\sqrt{50}$, or +/- 0.28, which corresponds pretty well to the quantile results you displayed above for group_mu: (-0.26,+0.25). Since you can't do better than you could if you'd actually observed the 50 subject means, it follows that the credible interval shouldn't be much smaller than the confidence interval (as you're not adding any substantial prior information to the likelihood.) Clearly the (-0.1, 0.09) quantiles of the alternative mean are too close to 0, by this comparison. In fact, you can use the ratio of the std. deviation of the mean of the estimated subject means to the std. deviation of group_mu as an index of how much shrinkage has taken place. (It's not the only such metric; I'm just pointing it out since you're calculating them both anyway.) If you have a very small ratio, that indicates, in a heuristic sense, that the hierarchical part of the model isn't adding much, and assuming all the subject means are the same may be a plausible alternative. Conversely, if the ratio is near one, that also indicates that the hierarchical part of the model isn't adding much, and just having a "fixed effects" model for the subject means would likely be almost as good - questions of modeling approaches etc. aside.
What level to use when making inferences on the group mean in a hierarchical Bayesian analysis? What has happened is that the estimates of the individual subject means have been shrunk towards the group mean, causing the std. deviation of the subject means (and consequently that of the mean of t
43,245
What level to use when making inferences on the group mean in a hierarchical Bayesian analysis?
If you wish to make inferences about the group level then your distribution of interest is $p(\mu_{gr}|Y)$. The simple reason is that $\mu_{gr}$ is actually a random variable in your generative model. Mean_mu is not a random variable in your generative model, it is a statistic that either your sampler happened to generate or you happened to compute. Furthermore, mean_mu is actually a point estimate of the posterior distribution of the true group mean, your distribution of interest. Point estimates provide less information than the full distribution, and you already have the full distribution itself (or at least a large number of samples that approximate it).
What level to use when making inferences on the group mean in a hierarchical Bayesian analysis?
If you wish to make inferences about the group level then your distribution of interest is $p(\mu_{gr}|Y)$. The simple reason is that $\mu_{gr}$ is actually a random variable in your generative model.
What level to use when making inferences on the group mean in a hierarchical Bayesian analysis? If you wish to make inferences about the group level then your distribution of interest is $p(\mu_{gr}|Y)$. The simple reason is that $\mu_{gr}$ is actually a random variable in your generative model. Mean_mu is not a random variable in your generative model, it is a statistic that either your sampler happened to generate or you happened to compute. Furthermore, mean_mu is actually a point estimate of the posterior distribution of the true group mean, your distribution of interest. Point estimates provide less information than the full distribution, and you already have the full distribution itself (or at least a large number of samples that approximate it).
What level to use when making inferences on the group mean in a hierarchical Bayesian analysis? If you wish to make inferences about the group level then your distribution of interest is $p(\mu_{gr}|Y)$. The simple reason is that $\mu_{gr}$ is actually a random variable in your generative model.
43,246
Study replication from a Bayesian point of view
Looks like you're talking about Meta-Analysis, a statistical study on previous studies. This is not a exclusively Bayesian concept, there are many frequentist meta-analysis, but as this chapter points out, it is a good fit for Bayesian statistics. A google search of 'bayesian meta-analysis' turns up many articles.
Study replication from a Bayesian point of view
Looks like you're talking about Meta-Analysis, a statistical study on previous studies. This is not a exclusively Bayesian concept, there are many frequentist meta-analysis, but as this chapter points
Study replication from a Bayesian point of view Looks like you're talking about Meta-Analysis, a statistical study on previous studies. This is not a exclusively Bayesian concept, there are many frequentist meta-analysis, but as this chapter points out, it is a good fit for Bayesian statistics. A google search of 'bayesian meta-analysis' turns up many articles.
Study replication from a Bayesian point of view Looks like you're talking about Meta-Analysis, a statistical study on previous studies. This is not a exclusively Bayesian concept, there are many frequentist meta-analysis, but as this chapter points
43,247
Study replication from a Bayesian point of view
The "direct replication" you mention is an issue; whatever parameter is being assessed in Study A is also there in Study B, so it makes no sense to say an effect is e.g. positive in one and negative in the other, or zero in one and not the other, or whatever - meaning non-replication can not happen in Bayesian analyses, because of coherence. Of course, if you are not in the situation where both studies have already been conducted (and most people planning replication are not) then it's perfectly possible to have a decision based on Study A's data be later contradicted by Study B, and this is true whether one is Bayesian or not. Also, with different parameters in Study A and Study B, Bayesians can easily end up concluding that they differ, even if the prior information pointed elsewhere.
Study replication from a Bayesian point of view
The "direct replication" you mention is an issue; whatever parameter is being assessed in Study A is also there in Study B, so it makes no sense to say an effect is e.g. positive in one and negative i
Study replication from a Bayesian point of view The "direct replication" you mention is an issue; whatever parameter is being assessed in Study A is also there in Study B, so it makes no sense to say an effect is e.g. positive in one and negative in the other, or zero in one and not the other, or whatever - meaning non-replication can not happen in Bayesian analyses, because of coherence. Of course, if you are not in the situation where both studies have already been conducted (and most people planning replication are not) then it's perfectly possible to have a decision based on Study A's data be later contradicted by Study B, and this is true whether one is Bayesian or not. Also, with different parameters in Study A and Study B, Bayesians can easily end up concluding that they differ, even if the prior information pointed elsewhere.
Study replication from a Bayesian point of view The "direct replication" you mention is an issue; whatever parameter is being assessed in Study A is also there in Study B, so it makes no sense to say an effect is e.g. positive in one and negative i
43,248
Study replication from a Bayesian point of view
My first reaction is what's the confidence intervals on those estimates (or credible interval if it was a Bayesian analysis)? If the confidence interval is something like, 95% CI [ .1, .5] and 95% CI [.2, .14] I'd conclude that they estimate d to be within a similar range. Even if the results of one of the studies was not significant, like, 95% CI [ -.2, .8] and 95% CI [.2, .14] I'd still conclude they found consistent results.
Study replication from a Bayesian point of view
My first reaction is what's the confidence intervals on those estimates (or credible interval if it was a Bayesian analysis)? If the confidence interval is something like, 95% CI [ .1, .5] and 95% CI
Study replication from a Bayesian point of view My first reaction is what's the confidence intervals on those estimates (or credible interval if it was a Bayesian analysis)? If the confidence interval is something like, 95% CI [ .1, .5] and 95% CI [.2, .14] I'd conclude that they estimate d to be within a similar range. Even if the results of one of the studies was not significant, like, 95% CI [ -.2, .8] and 95% CI [.2, .14] I'd still conclude they found consistent results.
Study replication from a Bayesian point of view My first reaction is what's the confidence intervals on those estimates (or credible interval if it was a Bayesian analysis)? If the confidence interval is something like, 95% CI [ .1, .5] and 95% CI
43,249
Testing for Spatial Autocorrelation in a Negative Binomial Regression Model
I suspect you can use moran.mc to do a monte-carlo permutation test. Basically, it computes a measure of spatial correlation for your residuals, then randomly reassigns your residuals to your regions and recomputes the measure. Do that 999 times, see where your data measure ranks with your MC measures. If its in the far positive tail, you can say you have significant residual autocorrelation.
Testing for Spatial Autocorrelation in a Negative Binomial Regression Model
I suspect you can use moran.mc to do a monte-carlo permutation test. Basically, it computes a measure of spatial correlation for your residuals, then randomly reassigns your residuals to your regions
Testing for Spatial Autocorrelation in a Negative Binomial Regression Model I suspect you can use moran.mc to do a monte-carlo permutation test. Basically, it computes a measure of spatial correlation for your residuals, then randomly reassigns your residuals to your regions and recomputes the measure. Do that 999 times, see where your data measure ranks with your MC measures. If its in the far positive tail, you can say you have significant residual autocorrelation.
Testing for Spatial Autocorrelation in a Negative Binomial Regression Model I suspect you can use moran.mc to do a monte-carlo permutation test. Basically, it computes a measure of spatial correlation for your residuals, then randomly reassigns your residuals to your regions
43,250
Showing that the power of a test approaches 1 as the sample size approaches infinity
You are almost there, but you need to make your arguments more formal. Rewrite the null and alternative hypothesis more generally so that they read $$ \begin{align} \mathfrak{h}_0{}:{}\beta_1 &= \beta^0_1\\ \mathfrak{h}_a{}:{}\beta_1&=\beta_1^a \end{align} $$ Then, using standard machinery, and under the linear regression model, we can show that under the null: $$ \begin{align} \dfrac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} &\rightarrow^d X\\ &{\sim}\text{t}(n-K) \end{align} $$ where $t(n-K)$ is the t-distribution with $n-K$ degrees of freedom, and $K$ is equal to the total number of regressors ($K=2$). Now recall that the definition of convergence in probability is that the distribution functions of the sequence of statistics converges to the distribution function of the limiting random variable at each continuity point of the limiting distribution. In this case, $$ \scriptstyle \begin{align} \lim_{n\to\infty}\mathbb{P}\left[\left|\frac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} \right| > t_{1-\tfrac{\alpha}{2}}(n-K)\right] &= \lim_{n\to \infty}\mathbb{P}\left[\frac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} > t_{1-\tfrac{\alpha}{2}}(n-K)\right] \\ &\quad+ \lim_{n\to \infty}\mathbb{P}\left[\frac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} \leq -t_{1-\tfrac{\alpha}{2}}(n-K)\right] \\ &= \mathbb{P}\left[X > t_{1-\tfrac{\alpha}{2}}(n-K) \right] + \mathbb{P}\left[X \leq -t_{1-\tfrac{\alpha}{2}(n-K)} \right] \\ %&= 1-\Phi(z_{1-\tfrac{\alpha}{2}}) + \Phi(z_{\tfrac{\alpha}{2}}) \\ &= \alpha \end{align} $$ where $\alpha$ is the nominal size of the test, and $t_\alpha(d)$ is the $\alpha$-th quantile of the t-distribution with $d$ degrees of freedom. This proves that the t-test has the correct size asymptotically. Now, under the alternative, we have that $$ \begin{align} \dfrac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^a\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} &\rightarrow^d X\\ &{\sim}\text{t}(n-K) \end{align} $$ This implies that $$ \begin{align} \dfrac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} &=\dfrac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^a\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)}+\dfrac{\sqrt{n}\left(\beta^a_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} \\ &= \mathcal{O}_p(1)+ \mathcal{O}_p(\sqrt{n}) \\ &= \mathcal{O}_p(\sqrt{n}) \end{align} $$ By definition of orders of magnitude, this means that w.p.a. 1 under the alternative, the t-statistic is greater than any fixed (finite) critical value.
Showing that the power of a test approaches 1 as the sample size approaches infinity
You are almost there, but you need to make your arguments more formal. Rewrite the null and alternative hypothesis more generally so that they read $$ \begin{align} \mathfrak{h}_0{}:{}\beta_1 &= \be
Showing that the power of a test approaches 1 as the sample size approaches infinity You are almost there, but you need to make your arguments more formal. Rewrite the null and alternative hypothesis more generally so that they read $$ \begin{align} \mathfrak{h}_0{}:{}\beta_1 &= \beta^0_1\\ \mathfrak{h}_a{}:{}\beta_1&=\beta_1^a \end{align} $$ Then, using standard machinery, and under the linear regression model, we can show that under the null: $$ \begin{align} \dfrac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} &\rightarrow^d X\\ &{\sim}\text{t}(n-K) \end{align} $$ where $t(n-K)$ is the t-distribution with $n-K$ degrees of freedom, and $K$ is equal to the total number of regressors ($K=2$). Now recall that the definition of convergence in probability is that the distribution functions of the sequence of statistics converges to the distribution function of the limiting random variable at each continuity point of the limiting distribution. In this case, $$ \scriptstyle \begin{align} \lim_{n\to\infty}\mathbb{P}\left[\left|\frac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} \right| > t_{1-\tfrac{\alpha}{2}}(n-K)\right] &= \lim_{n\to \infty}\mathbb{P}\left[\frac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} > t_{1-\tfrac{\alpha}{2}}(n-K)\right] \\ &\quad+ \lim_{n\to \infty}\mathbb{P}\left[\frac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} \leq -t_{1-\tfrac{\alpha}{2}}(n-K)\right] \\ &= \mathbb{P}\left[X > t_{1-\tfrac{\alpha}{2}}(n-K) \right] + \mathbb{P}\left[X \leq -t_{1-\tfrac{\alpha}{2}(n-K)} \right] \\ %&= 1-\Phi(z_{1-\tfrac{\alpha}{2}}) + \Phi(z_{\tfrac{\alpha}{2}}) \\ &= \alpha \end{align} $$ where $\alpha$ is the nominal size of the test, and $t_\alpha(d)$ is the $\alpha$-th quantile of the t-distribution with $d$ degrees of freedom. This proves that the t-test has the correct size asymptotically. Now, under the alternative, we have that $$ \begin{align} \dfrac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^a\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} &\rightarrow^d X\\ &{\sim}\text{t}(n-K) \end{align} $$ This implies that $$ \begin{align} \dfrac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} &=\dfrac{\sqrt{n}\left(\widehat{\beta}_1- \beta_1^a\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)}+\dfrac{\sqrt{n}\left(\beta^a_1- \beta_1^0\right)}{\widehat{\text{a.var.}}(\widehat{\beta}_1)} \\ &= \mathcal{O}_p(1)+ \mathcal{O}_p(\sqrt{n}) \\ &= \mathcal{O}_p(\sqrt{n}) \end{align} $$ By definition of orders of magnitude, this means that w.p.a. 1 under the alternative, the t-statistic is greater than any fixed (finite) critical value.
Showing that the power of a test approaches 1 as the sample size approaches infinity You are almost there, but you need to make your arguments more formal. Rewrite the null and alternative hypothesis more generally so that they read $$ \begin{align} \mathfrak{h}_0{}:{}\beta_1 &= \be
43,251
How to interpret coefficients in a regression with ARIMA errors?
To answer some of my own questions, after additional reading and experimenting: The trick with the coefficient is that it's in the space of the data after Box-Cox transformation. So invert the transformation to get the beta in the original units. Yes, the standard approach in intervention analysis is to use a step function for the regressor, unless you have reason to think that the effect will be either an impulse or a slower ramp-up. One of several resources that I found useful was McLeod et al., Time Series Analysis with R. I figured out the Box-Cox thing by reading the forecast::forecast.Arima() code.
How to interpret coefficients in a regression with ARIMA errors?
To answer some of my own questions, after additional reading and experimenting: The trick with the coefficient is that it's in the space of the data after Box-Cox transformation. So invert the transf
How to interpret coefficients in a regression with ARIMA errors? To answer some of my own questions, after additional reading and experimenting: The trick with the coefficient is that it's in the space of the data after Box-Cox transformation. So invert the transformation to get the beta in the original units. Yes, the standard approach in intervention analysis is to use a step function for the regressor, unless you have reason to think that the effect will be either an impulse or a slower ramp-up. One of several resources that I found useful was McLeod et al., Time Series Analysis with R. I figured out the Box-Cox thing by reading the forecast::forecast.Arima() code.
How to interpret coefficients in a regression with ARIMA errors? To answer some of my own questions, after additional reading and experimenting: The trick with the coefficient is that it's in the space of the data after Box-Cox transformation. So invert the transf
43,252
First iteration in MCMC coda chain is different from initial values
I haven't dug into the JAGS source code, but often people consider the initial values to be iteration 0, and for iteration 1 to be the result after a single pass through the Gibbs sampler. Also, if there are any Metropolis steps, there is likely to be a short adaptation phase before iteration 1 irrespective of the burn-in setting.
First iteration in MCMC coda chain is different from initial values
I haven't dug into the JAGS source code, but often people consider the initial values to be iteration 0, and for iteration 1 to be the result after a single pass through the Gibbs sampler. Also, if th
First iteration in MCMC coda chain is different from initial values I haven't dug into the JAGS source code, but often people consider the initial values to be iteration 0, and for iteration 1 to be the result after a single pass through the Gibbs sampler. Also, if there are any Metropolis steps, there is likely to be a short adaptation phase before iteration 1 irrespective of the burn-in setting.
First iteration in MCMC coda chain is different from initial values I haven't dug into the JAGS source code, but often people consider the initial values to be iteration 0, and for iteration 1 to be the result after a single pass through the Gibbs sampler. Also, if th
43,253
First iteration in MCMC coda chain is different from initial values
First, JAGS doesn't do burn-in clipping - R2jags does something, but I don't know what that is. Second, adaptation (see the JAGS user manual) may affect initial values. Third, even if you turn off adaptation, R2jags used to have a bug with initial values. Better to use rjags instead.
First iteration in MCMC coda chain is different from initial values
First, JAGS doesn't do burn-in clipping - R2jags does something, but I don't know what that is. Second, adaptation (see the JAGS user manual) may affect initial values. Third, even if you turn off ada
First iteration in MCMC coda chain is different from initial values First, JAGS doesn't do burn-in clipping - R2jags does something, but I don't know what that is. Second, adaptation (see the JAGS user manual) may affect initial values. Third, even if you turn off adaptation, R2jags used to have a bug with initial values. Better to use rjags instead.
First iteration in MCMC coda chain is different from initial values First, JAGS doesn't do burn-in clipping - R2jags does something, but I don't know what that is. Second, adaptation (see the JAGS user manual) may affect initial values. Third, even if you turn off ada
43,254
Comparing structural equation models with multivariate non-normality
This won't work, the models rarely get inflated in the same way. The proper analysis should involve Satorra-Benter scaled difference. I am not sure as to what the bootstrap analogues would be, although I am sure something can be constructed along the lines of the Bollen-Stine bootstrap (which should have become known as Beran-Srivastava bootstrap). I don't know if AMOS allows enough flexibility to construct the appropriate bootstrap scheme for the nested model testing, although I am sure it can run the bootstrap for the overall test.
Comparing structural equation models with multivariate non-normality
This won't work, the models rarely get inflated in the same way. The proper analysis should involve Satorra-Benter scaled difference. I am not sure as to what the bootstrap analogues would be, althoug
Comparing structural equation models with multivariate non-normality This won't work, the models rarely get inflated in the same way. The proper analysis should involve Satorra-Benter scaled difference. I am not sure as to what the bootstrap analogues would be, although I am sure something can be constructed along the lines of the Bollen-Stine bootstrap (which should have become known as Beran-Srivastava bootstrap). I don't know if AMOS allows enough flexibility to construct the appropriate bootstrap scheme for the nested model testing, although I am sure it can run the bootstrap for the overall test.
Comparing structural equation models with multivariate non-normality This won't work, the models rarely get inflated in the same way. The proper analysis should involve Satorra-Benter scaled difference. I am not sure as to what the bootstrap analogues would be, althoug
43,255
On the applicability of Benjamini-Hochberg
Instead of independent tests you have dependent tests. But multiple testing concepts like familywise error rate (FWER) and false discovery rate (FDR) still apply. The complication is in the computation of quantities like FWER as probabilities simultaneously rejecting two of the hypotheses is no longer the product of the individual rejection probabilities.
On the applicability of Benjamini-Hochberg
Instead of independent tests you have dependent tests. But multiple testing concepts like familywise error rate (FWER) and false discovery rate (FDR) still apply. The complication is in the computat
On the applicability of Benjamini-Hochberg Instead of independent tests you have dependent tests. But multiple testing concepts like familywise error rate (FWER) and false discovery rate (FDR) still apply. The complication is in the computation of quantities like FWER as probabilities simultaneously rejecting two of the hypotheses is no longer the product of the individual rejection probabilities.
On the applicability of Benjamini-Hochberg Instead of independent tests you have dependent tests. But multiple testing concepts like familywise error rate (FWER) and false discovery rate (FDR) still apply. The complication is in the computat
43,256
On the applicability of Benjamini-Hochberg
Sorted test statistics are not a problem for B-H as the (re)sorting is an inherent part of the procedure. In the eigenvalue case-- when testing for the rank of the eigenspace-- it is actually the dependence between the eigenvalues that is more problematic. I am not sure if the PRDS condition needed for B-H is satisfied, so you could either consider a more general FDR controlling procedure such as B-H-Y, or have a look at some works on the distribution of eigen values (say, B. Nadler and I.M. Johnstone Detection Performance of Roy's Largest Root Test when the noise covariance matrix is arbitrary, Statistical Signal Processing Conference, Nice, France, 2011.).
On the applicability of Benjamini-Hochberg
Sorted test statistics are not a problem for B-H as the (re)sorting is an inherent part of the procedure. In the eigenvalue case-- when testing for the rank of the eigenspace-- it is actually the de
On the applicability of Benjamini-Hochberg Sorted test statistics are not a problem for B-H as the (re)sorting is an inherent part of the procedure. In the eigenvalue case-- when testing for the rank of the eigenspace-- it is actually the dependence between the eigenvalues that is more problematic. I am not sure if the PRDS condition needed for B-H is satisfied, so you could either consider a more general FDR controlling procedure such as B-H-Y, or have a look at some works on the distribution of eigen values (say, B. Nadler and I.M. Johnstone Detection Performance of Roy's Largest Root Test when the noise covariance matrix is arbitrary, Statistical Signal Processing Conference, Nice, France, 2011.).
On the applicability of Benjamini-Hochberg Sorted test statistics are not a problem for B-H as the (re)sorting is an inherent part of the procedure. In the eigenvalue case-- when testing for the rank of the eigenspace-- it is actually the de
43,257
Linear regression vs analysis of variance: how to explain the difference?
ANOVA and Linear regression are twin princesses grown in different castles. Please see the book of Andy Field: Discovering statistics using SPSS. He has a very nice explanation including the evolution in time of this two. Anyway put bluntly: they are very similar and developed in parallel for a certain period of time by different scientific communities. NB: Of course the comparison is software independent.
Linear regression vs analysis of variance: how to explain the difference?
ANOVA and Linear regression are twin princesses grown in different castles. Please see the book of Andy Field: Discovering statistics using SPSS. He has a very nice explanation including the evolution
Linear regression vs analysis of variance: how to explain the difference? ANOVA and Linear regression are twin princesses grown in different castles. Please see the book of Andy Field: Discovering statistics using SPSS. He has a very nice explanation including the evolution in time of this two. Anyway put bluntly: they are very similar and developed in parallel for a certain period of time by different scientific communities. NB: Of course the comparison is software independent.
Linear regression vs analysis of variance: how to explain the difference? ANOVA and Linear regression are twin princesses grown in different castles. Please see the book of Andy Field: Discovering statistics using SPSS. He has a very nice explanation including the evolution
43,258
Lag length selection Granger causality test
The question here is really about the best way to select lag length for a VAR, as I noted in this answer. Granger causality doesn't even enter into it until your model for the time series is selected, which is why you may not see many papers specifically concerned with lag order for Granger causality tests. It's more about lag order selection for vector autoregressive models. I'd take a look at this paper for a relatively recent reference on which criteria (AIC, BIC, SIC, HQC) are most appropriate, though they may largely agree for your application.
Lag length selection Granger causality test
The question here is really about the best way to select lag length for a VAR, as I noted in this answer. Granger causality doesn't even enter into it until your model for the time series is selected,
Lag length selection Granger causality test The question here is really about the best way to select lag length for a VAR, as I noted in this answer. Granger causality doesn't even enter into it until your model for the time series is selected, which is why you may not see many papers specifically concerned with lag order for Granger causality tests. It's more about lag order selection for vector autoregressive models. I'd take a look at this paper for a relatively recent reference on which criteria (AIC, BIC, SIC, HQC) are most appropriate, though they may largely agree for your application.
Lag length selection Granger causality test The question here is really about the best way to select lag length for a VAR, as I noted in this answer. Granger causality doesn't even enter into it until your model for the time series is selected,
43,259
Double exponential smoothing in multivariate multilevel panel regression
Double exponential smoothing can viewed as reduced version of Kalman filter. It is not optimal but can be more robust. You may try Kalman filtering in R.
Double exponential smoothing in multivariate multilevel panel regression
Double exponential smoothing can viewed as reduced version of Kalman filter. It is not optimal but can be more robust. You may try Kalman filtering in R.
Double exponential smoothing in multivariate multilevel panel regression Double exponential smoothing can viewed as reduced version of Kalman filter. It is not optimal but can be more robust. You may try Kalman filtering in R.
Double exponential smoothing in multivariate multilevel panel regression Double exponential smoothing can viewed as reduced version of Kalman filter. It is not optimal but can be more robust. You may try Kalman filtering in R.
43,260
Pairwise Mahalanobis distance in R [duplicate]
The following worked for me in similar example where R is a dataframe of 54 individuals and 8 variables. Mahalanobis distance Ma between individuals X1 and X2 can be computed as ff: # express difference (X1-X2) as atomic row vector d <- as.matrix(X1-X2)[1,] # solve (covariance matrix) %*% x = d for x x <- solve(cov(R),d) # Mahalanobis calculation forced in two steps Ma <- sum(d*x)
Pairwise Mahalanobis distance in R [duplicate]
The following worked for me in similar example where R is a dataframe of 54 individuals and 8 variables. Mahalanobis distance Ma between individuals X1 and X2 can be computed as ff: # express differen
Pairwise Mahalanobis distance in R [duplicate] The following worked for me in similar example where R is a dataframe of 54 individuals and 8 variables. Mahalanobis distance Ma between individuals X1 and X2 can be computed as ff: # express difference (X1-X2) as atomic row vector d <- as.matrix(X1-X2)[1,] # solve (covariance matrix) %*% x = d for x x <- solve(cov(R),d) # Mahalanobis calculation forced in two steps Ma <- sum(d*x)
Pairwise Mahalanobis distance in R [duplicate] The following worked for me in similar example where R is a dataframe of 54 individuals and 8 variables. Mahalanobis distance Ma between individuals X1 and X2 can be computed as ff: # express differen
43,261
Pairwise Mahalanobis distance in R [duplicate]
You could try the gendistance function in the nbpMatching package Here's a short example modified from the help page, with two variables instead of 10: df <- data.frame(id=1:33, val1=rnorm(33), val2=rnorm(33)) df.dist <- gendistance(df, idcol=1) df.dist$dist The distance matrix will have a 34th row/column-- this is for use in matching, and you can ignore it.
Pairwise Mahalanobis distance in R [duplicate]
You could try the gendistance function in the nbpMatching package Here's a short example modified from the help page, with two variables instead of 10: df <- data.frame(id=1:33, val1=rnorm(33), val2=r
Pairwise Mahalanobis distance in R [duplicate] You could try the gendistance function in the nbpMatching package Here's a short example modified from the help page, with two variables instead of 10: df <- data.frame(id=1:33, val1=rnorm(33), val2=rnorm(33)) df.dist <- gendistance(df, idcol=1) df.dist$dist The distance matrix will have a 34th row/column-- this is for use in matching, and you can ignore it.
Pairwise Mahalanobis distance in R [duplicate] You could try the gendistance function in the nbpMatching package Here's a short example modified from the help page, with two variables instead of 10: df <- data.frame(id=1:33, val1=rnorm(33), val2=r
43,262
Pairwise Mahalanobis distance in R [duplicate]
There a very easy way to do it using R Package "biotools". In this case you will get a Squared Distance Mahalanobis Matrix. #Manly (2004, p.65-66) x1 <- c(131.37, 132.37, 134.47, 135.50, 136.17) x2 <- c(133.60, 132.70, 133.80, 132.30, 130.33) x3 <- c(99.17, 99.07, 96.03, 94.53, 93.50) x4 <- c(50.53, 50.23, 50.57, 51.97, 51.37) #size (n x p) #Means x <- cbind(x1, x2, x3, x4) #size (p x p) #Variances and Covariances Cov <- matrix(c(21.112,0.038,0.078,2.01, 0.038,23.486,5.2,2.844, 0.078,5.2,24.18,1.134, 2.01,2.844,1.134,10.154), 4, 4) library(biotools) Mahalanobis_Distance<-D2.dist(x, Cov) print(Mahalanobis_Distance)
Pairwise Mahalanobis distance in R [duplicate]
There a very easy way to do it using R Package "biotools". In this case you will get a Squared Distance Mahalanobis Matrix. #Manly (2004, p.65-66) x1 <- c(131.37, 132.37, 134.47, 135.50, 136.17) x2 <
Pairwise Mahalanobis distance in R [duplicate] There a very easy way to do it using R Package "biotools". In this case you will get a Squared Distance Mahalanobis Matrix. #Manly (2004, p.65-66) x1 <- c(131.37, 132.37, 134.47, 135.50, 136.17) x2 <- c(133.60, 132.70, 133.80, 132.30, 130.33) x3 <- c(99.17, 99.07, 96.03, 94.53, 93.50) x4 <- c(50.53, 50.23, 50.57, 51.97, 51.37) #size (n x p) #Means x <- cbind(x1, x2, x3, x4) #size (p x p) #Variances and Covariances Cov <- matrix(c(21.112,0.038,0.078,2.01, 0.038,23.486,5.2,2.844, 0.078,5.2,24.18,1.134, 2.01,2.844,1.134,10.154), 4, 4) library(biotools) Mahalanobis_Distance<-D2.dist(x, Cov) print(Mahalanobis_Distance)
Pairwise Mahalanobis distance in R [duplicate] There a very easy way to do it using R Package "biotools". In this case you will get a Squared Distance Mahalanobis Matrix. #Manly (2004, p.65-66) x1 <- c(131.37, 132.37, 134.47, 135.50, 136.17) x2 <
43,263
Pairwise Mahalanobis distance in R [duplicate]
Here is the code to do it: library("MASS") library("ICSNP") x0<-mvrnorm(33,1:10,diag(c(seq(1,1/2,l=10)),10)) x1<-pair.diff(x0) #C-implementation. dM<-mahalanobis(x1,colMeans(x1),var(x1)) Following Roman Luštrik's suggestion, here are more details. The OP asked for pairwise Mahalanobis distance, which are multivariate U-statistics of distance. I have first seen them mentionned in Croux et al. 94 (below equation 6.4) but i'm sure others such as Oja have explored this concept.
Pairwise Mahalanobis distance in R [duplicate]
Here is the code to do it: library("MASS") library("ICSNP") x0<-mvrnorm(33,1:10,diag(c(seq(1,1/2,l=10)),10)) x1<-pair.diff(x0) #C-implementation. dM<-mahalanobis(x1,colMeans(x1),var(x1)) Following
Pairwise Mahalanobis distance in R [duplicate] Here is the code to do it: library("MASS") library("ICSNP") x0<-mvrnorm(33,1:10,diag(c(seq(1,1/2,l=10)),10)) x1<-pair.diff(x0) #C-implementation. dM<-mahalanobis(x1,colMeans(x1),var(x1)) Following Roman Luštrik's suggestion, here are more details. The OP asked for pairwise Mahalanobis distance, which are multivariate U-statistics of distance. I have first seen them mentionned in Croux et al. 94 (below equation 6.4) but i'm sure others such as Oja have explored this concept.
Pairwise Mahalanobis distance in R [duplicate] Here is the code to do it: library("MASS") library("ICSNP") x0<-mvrnorm(33,1:10,diag(c(seq(1,1/2,l=10)),10)) x1<-pair.diff(x0) #C-implementation. dM<-mahalanobis(x1,colMeans(x1),var(x1)) Following
43,264
Repeated measurements with missing values
Let me propose an answer - I am happy to hear constructive criticism: Merge measurements of technical replicates (taking the union) I assume that the between-replicates variation is about the same as the within-replicate variation (for any variable). Apply statistical tests of difference of mean for the combined data for each biological replicate and each variable. Apply multiplicity correction. For variables detected in both biological replicate sets: if direction of change is in both direction: calculate combined p-values using Fisher's method else, set p-value to 1 For variables seen in only one biological replicate set, use its original p-value (just penalize but don't remove them) Do I miss any assumptions such that you would deem this procedure unsound?
Repeated measurements with missing values
Let me propose an answer - I am happy to hear constructive criticism: Merge measurements of technical replicates (taking the union) I assume that the between-replicates variation is about the same a
Repeated measurements with missing values Let me propose an answer - I am happy to hear constructive criticism: Merge measurements of technical replicates (taking the union) I assume that the between-replicates variation is about the same as the within-replicate variation (for any variable). Apply statistical tests of difference of mean for the combined data for each biological replicate and each variable. Apply multiplicity correction. For variables detected in both biological replicate sets: if direction of change is in both direction: calculate combined p-values using Fisher's method else, set p-value to 1 For variables seen in only one biological replicate set, use its original p-value (just penalize but don't remove them) Do I miss any assumptions such that you would deem this procedure unsound?
Repeated measurements with missing values Let me propose an answer - I am happy to hear constructive criticism: Merge measurements of technical replicates (taking the union) I assume that the between-replicates variation is about the same a
43,265
Support vector machine for text classification
LibSVM hasn't been getting reliable performance for me, of late. Have you tried using SVMLight ever? You might also try looking at which features are showing the most predictive power in your model, and adding some sort of enriched-type feature. For example, if I were classifying documents on whether they contain information related to protein-protein interaction, I wouldn't really care about the specific names of the proteins as predictive features. I would pre-process my documents and normalize all protein mentions with some common term that wouldn't normally occur in my documents, like "THISWORDUSEDTOBEAPROTEIN". Previous research (sorry, I can't think of any citations off the top of my head except my own paper Ambert & Cohen, 2012) has shown that this can lead to improved classifier performance by preventing the classifier from getting distracted by common genes (e.g., ADH1A) and ignoring rare ones, instead combining the predictive power of all genes into a single feature you could think of as "GeneMentioned".
Support vector machine for text classification
LibSVM hasn't been getting reliable performance for me, of late. Have you tried using SVMLight ever? You might also try looking at which features are showing the most predictive power in your model, a
Support vector machine for text classification LibSVM hasn't been getting reliable performance for me, of late. Have you tried using SVMLight ever? You might also try looking at which features are showing the most predictive power in your model, and adding some sort of enriched-type feature. For example, if I were classifying documents on whether they contain information related to protein-protein interaction, I wouldn't really care about the specific names of the proteins as predictive features. I would pre-process my documents and normalize all protein mentions with some common term that wouldn't normally occur in my documents, like "THISWORDUSEDTOBEAPROTEIN". Previous research (sorry, I can't think of any citations off the top of my head except my own paper Ambert & Cohen, 2012) has shown that this can lead to improved classifier performance by preventing the classifier from getting distracted by common genes (e.g., ADH1A) and ignoring rare ones, instead combining the predictive power of all genes into a single feature you could think of as "GeneMentioned".
Support vector machine for text classification LibSVM hasn't been getting reliable performance for me, of late. Have you tried using SVMLight ever? You might also try looking at which features are showing the most predictive power in your model, a
43,266
Support vector machine for text classification
If you haven't done so, you can usually gain efficiency by stemming the words, as I explain on this post. Stemming will replace words by their stem, so that for instance 'sky' and 'skies', or 'hope', 'hopes' and 'hoped', will be recognized as identical. If your texts are in English, you will most likely end up using Porter's stemming algorithm of which you can find many implementations, one of the most famous being that included in NLTK (in Python). The post mentioned above contains a code snippet that shows how to use it. Another idea that I develop in this post is to use co-inertia analysis (CIA), a forgotten variant of canonical analysis to reduce the dimension of the data, while keeping maximal correlation with your classes. You would end up with only two or three scores instead of the few hundreds that you must have in your corpus, which might give a better bias-variance deal.
Support vector machine for text classification
If you haven't done so, you can usually gain efficiency by stemming the words, as I explain on this post. Stemming will replace words by their stem, so that for instance 'sky' and 'skies', or 'hope',
Support vector machine for text classification If you haven't done so, you can usually gain efficiency by stemming the words, as I explain on this post. Stemming will replace words by their stem, so that for instance 'sky' and 'skies', or 'hope', 'hopes' and 'hoped', will be recognized as identical. If your texts are in English, you will most likely end up using Porter's stemming algorithm of which you can find many implementations, one of the most famous being that included in NLTK (in Python). The post mentioned above contains a code snippet that shows how to use it. Another idea that I develop in this post is to use co-inertia analysis (CIA), a forgotten variant of canonical analysis to reduce the dimension of the data, while keeping maximal correlation with your classes. You would end up with only two or three scores instead of the few hundreds that you must have in your corpus, which might give a better bias-variance deal.
Support vector machine for text classification If you haven't done so, you can usually gain efficiency by stemming the words, as I explain on this post. Stemming will replace words by their stem, so that for instance 'sky' and 'skies', or 'hope',
43,267
Support vector machine for text classification
A simple thing to try, if you haven't done so already, is to normalize each document vector so the magnitude is 1. SVMs tend to perform better if the magnitude of each training vector is similar.
Support vector machine for text classification
A simple thing to try, if you haven't done so already, is to normalize each document vector so the magnitude is 1. SVMs tend to perform better if the magnitude of each training vector is similar.
Support vector machine for text classification A simple thing to try, if you haven't done so already, is to normalize each document vector so the magnitude is 1. SVMs tend to perform better if the magnitude of each training vector is similar.
Support vector machine for text classification A simple thing to try, if you haven't done so already, is to normalize each document vector so the magnitude is 1. SVMs tend to perform better if the magnitude of each training vector is similar.
43,268
Support vector machine for text classification
You can clean up your tekst documents using Soundex, a phonetic algorithm for indexing words by sound. This Soundex methods reduces the number of spelling mistakes. There is a good implementation of soundex in SAS, namely the function Soundex()
Support vector machine for text classification
You can clean up your tekst documents using Soundex, a phonetic algorithm for indexing words by sound. This Soundex methods reduces the number of spelling mistakes. There is a good implementation of s
Support vector machine for text classification You can clean up your tekst documents using Soundex, a phonetic algorithm for indexing words by sound. This Soundex methods reduces the number of spelling mistakes. There is a good implementation of soundex in SAS, namely the function Soundex()
Support vector machine for text classification You can clean up your tekst documents using Soundex, a phonetic algorithm for indexing words by sound. This Soundex methods reduces the number of spelling mistakes. There is a good implementation of s
43,269
How to perform regression on panel-data with timelag in SPSS / PASW?
You may want to apply the Fama-MacBeth regression technique outlined in their 1972 paper (link is a PDF, couldn't find a regular citation page for it.) This is a crude method since it doesn't do much residual clustering or analysis, but it's easy to implement and almost certainly already exists in SPSS. Instead of risk premium, you'll be calculating some sort of trade volume premium on your factors. The huge problem you're going to run into is between-company correlations, both in trade volume and in things like being newsworthy enough to tweet about. Since you only have a small number of observations per company, I don't think it's possible to estimate the correlations with much accuracy, without pre-specifying some sort of model that depends on the correlations and allows you to infer them.
How to perform regression on panel-data with timelag in SPSS / PASW?
You may want to apply the Fama-MacBeth regression technique outlined in their 1972 paper (link is a PDF, couldn't find a regular citation page for it.) This is a crude method since it doesn't do much
How to perform regression on panel-data with timelag in SPSS / PASW? You may want to apply the Fama-MacBeth regression technique outlined in their 1972 paper (link is a PDF, couldn't find a regular citation page for it.) This is a crude method since it doesn't do much residual clustering or analysis, but it's easy to implement and almost certainly already exists in SPSS. Instead of risk premium, you'll be calculating some sort of trade volume premium on your factors. The huge problem you're going to run into is between-company correlations, both in trade volume and in things like being newsworthy enough to tweet about. Since you only have a small number of observations per company, I don't think it's possible to estimate the correlations with much accuracy, without pre-specifying some sort of model that depends on the correlations and allows you to infer them.
How to perform regression on panel-data with timelag in SPSS / PASW? You may want to apply the Fama-MacBeth regression technique outlined in their 1972 paper (link is a PDF, couldn't find a regular citation page for it.) This is a crude method since it doesn't do much
43,270
How to perform regression on panel-data with timelag in SPSS / PASW?
For easy to running your data analysis, try the eviews software or stata, etc. In SPSS, if you want to running the time lag data analysis, you must perform the data, like 1 to 2 etc. For example: x : 12, 13,12,17,9,12 You can create the new variable x1 : 13, 12, 17, 9 and 12. The first number data variable for x not available... and so on.
How to perform regression on panel-data with timelag in SPSS / PASW?
For easy to running your data analysis, try the eviews software or stata, etc. In SPSS, if you want to running the time lag data analysis, you must perform the data, like 1 to 2 etc. For example: x :
How to perform regression on panel-data with timelag in SPSS / PASW? For easy to running your data analysis, try the eviews software or stata, etc. In SPSS, if you want to running the time lag data analysis, you must perform the data, like 1 to 2 etc. For example: x : 12, 13,12,17,9,12 You can create the new variable x1 : 13, 12, 17, 9 and 12. The first number data variable for x not available... and so on.
How to perform regression on panel-data with timelag in SPSS / PASW? For easy to running your data analysis, try the eviews software or stata, etc. In SPSS, if you want to running the time lag data analysis, you must perform the data, like 1 to 2 etc. For example: x :
43,271
Contraindication for STL decompostion
I think with LOESS like any other smoother results will depend on the degree of smoothing. So I think that you can get very different decompositions depending on the amount of smoothing. How much waviness is do to periodicity and how much is just random noise? i think this could be difficult to say. Similar problem come up in kernel density estimation where a bump in a density may be real or may be an artifact of not enough smoothing.
Contraindication for STL decompostion
I think with LOESS like any other smoother results will depend on the degree of smoothing. So I think that you can get very different decompositions depending on the amount of smoothing. How much wa
Contraindication for STL decompostion I think with LOESS like any other smoother results will depend on the degree of smoothing. So I think that you can get very different decompositions depending on the amount of smoothing. How much waviness is do to periodicity and how much is just random noise? i think this could be difficult to say. Similar problem come up in kernel density estimation where a bump in a density may be real or may be an artifact of not enough smoothing.
Contraindication for STL decompostion I think with LOESS like any other smoother results will depend on the degree of smoothing. So I think that you can get very different decompositions depending on the amount of smoothing. How much wa
43,272
What's the simplest way to create a beanplot in MATLAB? [closed]
I found an excellent series of plot tools on Matlab File Exchange that creates bean plots among several other distribution plots. http://www.mathworks.com/matlabcentral/fileexchange/23661-violin-plots-for-plotting-multiple-distributions-distributionplot-m
What's the simplest way to create a beanplot in MATLAB? [closed]
I found an excellent series of plot tools on Matlab File Exchange that creates bean plots among several other distribution plots. http://www.mathworks.com/matlabcentral/fileexchange/23661-violin-plots
What's the simplest way to create a beanplot in MATLAB? [closed] I found an excellent series of plot tools on Matlab File Exchange that creates bean plots among several other distribution plots. http://www.mathworks.com/matlabcentral/fileexchange/23661-violin-plots-for-plotting-multiple-distributions-distributionplot-m
What's the simplest way to create a beanplot in MATLAB? [closed] I found an excellent series of plot tools on Matlab File Exchange that creates bean plots among several other distribution plots. http://www.mathworks.com/matlabcentral/fileexchange/23661-violin-plots
43,273
What's the simplest way to create a beanplot in MATLAB? [closed]
I know this isn't necessarily what you are looking for, but I suggested to the "improvement request" folks at my work that they ask for variation on the bean plot as option for variability plots in one of MATLAB's competitors. We are a relatively big customer so a useful proportion of our requests actually do get implemented in the product. It sometimes takes a year or three before it is rolled out. I see the bean plot as having good value for EDA in my work environment. If their competitors have it and their competitors customers are using it for good value then there is incentive for MathWorks to implement it in MATLAB. Eventually there is good incentive, it takes time. That is how to make it happen natively inside MATLAB. That is not how to hack it to work with existing MATLAB methods.
What's the simplest way to create a beanplot in MATLAB? [closed]
I know this isn't necessarily what you are looking for, but I suggested to the "improvement request" folks at my work that they ask for variation on the bean plot as option for variability plots in on
What's the simplest way to create a beanplot in MATLAB? [closed] I know this isn't necessarily what you are looking for, but I suggested to the "improvement request" folks at my work that they ask for variation on the bean plot as option for variability plots in one of MATLAB's competitors. We are a relatively big customer so a useful proportion of our requests actually do get implemented in the product. It sometimes takes a year or three before it is rolled out. I see the bean plot as having good value for EDA in my work environment. If their competitors have it and their competitors customers are using it for good value then there is incentive for MathWorks to implement it in MATLAB. Eventually there is good incentive, it takes time. That is how to make it happen natively inside MATLAB. That is not how to hack it to work with existing MATLAB methods.
What's the simplest way to create a beanplot in MATLAB? [closed] I know this isn't necessarily what you are looking for, but I suggested to the "improvement request" folks at my work that they ask for variation on the bean plot as option for variability plots in on
43,274
How to best display forecast deviation?
After looking at your sample data (and assuming its fairly representative of your actual data), the thing that jumped out was the relatively low actual traffic value, regardless of forecast deviation. So, you could consider two charts to show your data: Chart of actual traffic Chart of actual deviation (not percentage). Using a small-multiple approach with the same scale, you can show the actual traffic with the calculated deviation from forecast, and get a sense of their relative impacts. This helps emphasize that regardless of the percentage deviation, the relative impact is small to the overall traffic usage. If you really want to make that impact, you could include a total traffic/deviation line which would really de-emphasize the large deviation/small traffic entries. Obviously, you lose some finer detail (not that there was much to begin with), but provide a better overall picture. EDIT: Here's a copy of the bottom chart with Excel's normal gridlines turned on and the chart areas shaded (left with transparency and right without). The Excel Bar Charts have everything default stripped out and then are re-designed with the minimum structure necessary to convey the info, then they're lined up with the appropriate spreadsheet rows.
How to best display forecast deviation?
After looking at your sample data (and assuming its fairly representative of your actual data), the thing that jumped out was the relatively low actual traffic value, regardless of forecast deviation.
How to best display forecast deviation? After looking at your sample data (and assuming its fairly representative of your actual data), the thing that jumped out was the relatively low actual traffic value, regardless of forecast deviation. So, you could consider two charts to show your data: Chart of actual traffic Chart of actual deviation (not percentage). Using a small-multiple approach with the same scale, you can show the actual traffic with the calculated deviation from forecast, and get a sense of their relative impacts. This helps emphasize that regardless of the percentage deviation, the relative impact is small to the overall traffic usage. If you really want to make that impact, you could include a total traffic/deviation line which would really de-emphasize the large deviation/small traffic entries. Obviously, you lose some finer detail (not that there was much to begin with), but provide a better overall picture. EDIT: Here's a copy of the bottom chart with Excel's normal gridlines turned on and the chart areas shaded (left with transparency and right without). The Excel Bar Charts have everything default stripped out and then are re-designed with the minimum structure necessary to convey the info, then they're lined up with the appropriate spreadsheet rows.
How to best display forecast deviation? After looking at your sample data (and assuming its fairly representative of your actual data), the thing that jumped out was the relatively low actual traffic value, regardless of forecast deviation.
43,275
Multivariate time series model evaluation with conditional moments
There are some methods out there for two sample testing of covariance matrices but no one has specifically looked at testing for conditional covariance matrices. Are you interested in an overall differences between covariances or differences in specific rows of the covariance matrices or recovering the exact support of the difference ? If the first, you might be able to use existing literature on two sample testing of covariance matrices. This would definitely work for point 2 in your question. This is really an open area of research and quite under explored in the time-varying setting. An alternative to KL-distances is using the maximum t-statistic across all the entries of your conditional covariance matrix.
Multivariate time series model evaluation with conditional moments
There are some methods out there for two sample testing of covariance matrices but no one has specifically looked at testing for conditional covariance matrices. Are you interested in an overall diffe
Multivariate time series model evaluation with conditional moments There are some methods out there for two sample testing of covariance matrices but no one has specifically looked at testing for conditional covariance matrices. Are you interested in an overall differences between covariances or differences in specific rows of the covariance matrices or recovering the exact support of the difference ? If the first, you might be able to use existing literature on two sample testing of covariance matrices. This would definitely work for point 2 in your question. This is really an open area of research and quite under explored in the time-varying setting. An alternative to KL-distances is using the maximum t-statistic across all the entries of your conditional covariance matrix.
Multivariate time series model evaluation with conditional moments There are some methods out there for two sample testing of covariance matrices but no one has specifically looked at testing for conditional covariance matrices. Are you interested in an overall diffe
43,276
Incremental learning methods in R
I'd suggest starting out by taking a look at MOA (Massive Online Analysis) from the University of Waikato in New Zealand. This is the same group behind Weka. (As an aside both Moa and Weka are New Zealand native species.... though the former is now extinct...) https://moa.cms.waikato.ac.nz/ "MOA is the most popular open source framework for data stream mining, with a very active growing community (blog). It includes a collection of machine learning algorithms (classification, regression, clustering, outlier detection, concept drift detection and recommender systems) and tools for evaluation. Related to the WEKA project, MOA is also written in Java, while scaling to more demanding problems." There is an R wrapper but I've not tried it; based on Git history it may be a bit out of date. COre MOA is actively maintained. HTH Chris (from New Zealand...)
Incremental learning methods in R
I'd suggest starting out by taking a look at MOA (Massive Online Analysis) from the University of Waikato in New Zealand. This is the same group behind Weka. (As an aside both Moa and Weka are New Zea
Incremental learning methods in R I'd suggest starting out by taking a look at MOA (Massive Online Analysis) from the University of Waikato in New Zealand. This is the same group behind Weka. (As an aside both Moa and Weka are New Zealand native species.... though the former is now extinct...) https://moa.cms.waikato.ac.nz/ "MOA is the most popular open source framework for data stream mining, with a very active growing community (blog). It includes a collection of machine learning algorithms (classification, regression, clustering, outlier detection, concept drift detection and recommender systems) and tools for evaluation. Related to the WEKA project, MOA is also written in Java, while scaling to more demanding problems." There is an R wrapper but I've not tried it; based on Git history it may be a bit out of date. COre MOA is actively maintained. HTH Chris (from New Zealand...)
Incremental learning methods in R I'd suggest starting out by taking a look at MOA (Massive Online Analysis) from the University of Waikato in New Zealand. This is the same group behind Weka. (As an aside both Moa and Weka are New Zea
43,277
Proofs of the central limit theorem
As I recall in this version the random variables are independent with finite variances but the variance need not all be the same. The CLT result holds under a somewhat complicated condition called the Lindeberg condition and the traditional proofs use transform methods. But the proof we learned was probabilistic. It involved splitting the sum into two pieces. One piece converged to N(0,1) in distribution and the other converge to 0 in probability. This technique was used because it was much easier to show the first sum satisfied the CLT. But the fact that the second sum was negligible was harder. The following link gives an interesting paper by Larry Goldstein that give a probabilistic proof of the Linderberg Feller Theorem that is very similar or the same. It also may be of interest to the OP because it includes some history on the CLT. http://bcf.usc.edu/~larry/papers/pdf/lin.pdf
Proofs of the central limit theorem
As I recall in this version the random variables are independent with finite variances but the variance need not all be the same. The CLT result holds under a somewhat complicated condition called th
Proofs of the central limit theorem As I recall in this version the random variables are independent with finite variances but the variance need not all be the same. The CLT result holds under a somewhat complicated condition called the Lindeberg condition and the traditional proofs use transform methods. But the proof we learned was probabilistic. It involved splitting the sum into two pieces. One piece converged to N(0,1) in distribution and the other converge to 0 in probability. This technique was used because it was much easier to show the first sum satisfied the CLT. But the fact that the second sum was negligible was harder. The following link gives an interesting paper by Larry Goldstein that give a probabilistic proof of the Linderberg Feller Theorem that is very similar or the same. It also may be of interest to the OP because it includes some history on the CLT. http://bcf.usc.edu/~larry/papers/pdf/lin.pdf
Proofs of the central limit theorem As I recall in this version the random variables are independent with finite variances but the variance need not all be the same. The CLT result holds under a somewhat complicated condition called th
43,278
Data entry tool for sparse table
+1 for the question. I have not searched the web a lot for existing tools (presumably you did before posting your question here), but I am guessing someone would have to create a GUI to submit data like you want. You need to consider what kind of format you want to work with elsewhere in your analysis though, because you may want to work with sparse formats in your code, but interact with the data as a traditional 2D matrix when viewing it or manually modifying elements. This question is tagged with R, but it is not clear from the question itself how you are using R. If this needs to be R, then ignore the rest of this... If I had to create this functionality myself I would do it in Python using a few libraries Create a GUI using formlayout to take data row/column entries with very little code Take the user submissions and store them in a variety of sparse formats using scipy or pandas, which also let you easily go back and forth between sparse and dense formats. Use tablib (or built-in methods for pandas data frames) to write data to Excel or other "tabular data" file formats. If you want to programmatically read/write/format Excel then consider using pytools or win32com If you are working with the data at an interactive session, the Spyder IDE provides a great "variable explorer" GUI that you could use to manually modify elements of your densely-viewed-but-actually-sparse-format data. So, hopefully someone posts an ready to go solution for you, but I do not think it would be terribly time consuming or difficult for you (or someone you know) to create what you need. Good luck!
Data entry tool for sparse table
+1 for the question. I have not searched the web a lot for existing tools (presumably you did before posting your question here), but I am guessing someone would have to create a GUI to submit data li
Data entry tool for sparse table +1 for the question. I have not searched the web a lot for existing tools (presumably you did before posting your question here), but I am guessing someone would have to create a GUI to submit data like you want. You need to consider what kind of format you want to work with elsewhere in your analysis though, because you may want to work with sparse formats in your code, but interact with the data as a traditional 2D matrix when viewing it or manually modifying elements. This question is tagged with R, but it is not clear from the question itself how you are using R. If this needs to be R, then ignore the rest of this... If I had to create this functionality myself I would do it in Python using a few libraries Create a GUI using formlayout to take data row/column entries with very little code Take the user submissions and store them in a variety of sparse formats using scipy or pandas, which also let you easily go back and forth between sparse and dense formats. Use tablib (or built-in methods for pandas data frames) to write data to Excel or other "tabular data" file formats. If you want to programmatically read/write/format Excel then consider using pytools or win32com If you are working with the data at an interactive session, the Spyder IDE provides a great "variable explorer" GUI that you could use to manually modify elements of your densely-viewed-but-actually-sparse-format data. So, hopefully someone posts an ready to go solution for you, but I do not think it would be terribly time consuming or difficult for you (or someone you know) to create what you need. Good luck!
Data entry tool for sparse table +1 for the question. I have not searched the web a lot for existing tools (presumably you did before posting your question here), but I am guessing someone would have to create a GUI to submit data li
43,279
Data entry tool for sparse table
Software that is designed for "CATI" (computer assisted telephone interviewing) is usually very good for fast keyboard based data entry. "CfMC" is an example. The way you could design this in a CATI-type data collection program would be to have one multi-select question with 300 options. The data entry operator would see a screen with all 300 options listed, and could punch in the numbers one at a time using a numeric keypad. For example, they would punch 12, 122, 150, 264, 299, and then continue. For each of the 300 options, there would be a followup question conditioned to whether or not it was selected in the first question. So, if they selected five options on the first question, they would receive 5 followup screens one after another, and enter the values for those columns. From there it is very easy to get that sparse table into whatever format you like.
Data entry tool for sparse table
Software that is designed for "CATI" (computer assisted telephone interviewing) is usually very good for fast keyboard based data entry. "CfMC" is an example. The way you could design this in a CATI-t
Data entry tool for sparse table Software that is designed for "CATI" (computer assisted telephone interviewing) is usually very good for fast keyboard based data entry. "CfMC" is an example. The way you could design this in a CATI-type data collection program would be to have one multi-select question with 300 options. The data entry operator would see a screen with all 300 options listed, and could punch in the numbers one at a time using a numeric keypad. For example, they would punch 12, 122, 150, 264, 299, and then continue. For each of the 300 options, there would be a followup question conditioned to whether or not it was selected in the first question. So, if they selected five options on the first question, they would receive 5 followup screens one after another, and enter the values for those columns. From there it is very easy to get that sparse table into whatever format you like.
Data entry tool for sparse table Software that is designed for "CATI" (computer assisted telephone interviewing) is usually very good for fast keyboard based data entry. "CfMC" is an example. The way you could design this in a CATI-t
43,280
Do variations of ELO system exist for non-mirror games?
In our ranking system rankade you can build hybrid groups with both regular and ghost users. In your Starcraft example you should have as many actual players as in your playing group and three ghost (Terran, Zerg, Protoss). Then, you should record every match as a 2-on-2 match, building each faction with an actual player and his playing race, so doing something like 'Mike/Terran vs John/Protoss'. There's obviously an issue that our algorithm can't manage (races have no capability to 'learn' over games, but their ree will change according to their performance), but it seems a good way to estimate what you called "'true skill' of a player" (warning: 'Trueskill' is a MS trade mark! :) ), cleaning it from races unbalancement effects. If you're interested, check this link, where a rankade user worked this way (with a different goal - he was interested in races true ranking, cleaned from players unbalancement - and before 'ghost' feature was released) on '7 wonders' boardgame.
Do variations of ELO system exist for non-mirror games?
In our ranking system rankade you can build hybrid groups with both regular and ghost users. In your Starcraft example you should have as many actual players as in your playing group and three ghost (
Do variations of ELO system exist for non-mirror games? In our ranking system rankade you can build hybrid groups with both regular and ghost users. In your Starcraft example you should have as many actual players as in your playing group and three ghost (Terran, Zerg, Protoss). Then, you should record every match as a 2-on-2 match, building each faction with an actual player and his playing race, so doing something like 'Mike/Terran vs John/Protoss'. There's obviously an issue that our algorithm can't manage (races have no capability to 'learn' over games, but their ree will change according to their performance), but it seems a good way to estimate what you called "'true skill' of a player" (warning: 'Trueskill' is a MS trade mark! :) ), cleaning it from races unbalancement effects. If you're interested, check this link, where a rankade user worked this way (with a different goal - he was interested in races true ranking, cleaned from players unbalancement - and before 'ghost' feature was released) on '7 wonders' boardgame.
Do variations of ELO system exist for non-mirror games? In our ranking system rankade you can build hybrid groups with both regular and ghost users. In your Starcraft example you should have as many actual players as in your playing group and three ghost (
43,281
How to show that polar coordinates in a uniform distribution on a disk are independent?
The solution may be a bit quirky, with a lot of variables, but it works fine for me. We know that $X$,$Y$ - random variables in $\mathbb{R}^n$ and $\mathbb{R}^m$ are independent iff $$\mathbb{E}(\varphi (X) \psi (Y) )= \mathbb{E}(\varphi(X)) \cdot \mathbb{E}(\psi(Y)) $$ $ \forall \varphi \in C^{\infty}_{0} $, $ \forall \psi \in C^{\infty}_{0} $, where $C^{\infty}_{0} $ are continuos on compact smooth functions. If $(X,Y)$ are uniformly distributed on the unit disc $D=\{(x,y):x^{2}+y^{2}<1\}$. Then we have that $$\mathbb{P}_{(X,Y)}(dxdy)=\frac{1}{\pi}\mathbb{1}_D (x,y) dxdy$$ Analogically we define two distance and angle functions: $$\begin{cases}r:\mathbb{R^2}\rightarrow \mathbb{R}\\ \vartheta:\mathbb{R^2}\rightarrow \mathbb{R}\end{cases}$$ Now we have $R=r(X,Y)$ and $\Theta=\vartheta(X,Y)$ and by passing to polar coordinates with $\begin{cases}\rho=r(x,y)\\ \gamma = \vartheta(x,y) \end{cases}$ we can show that $$\mathbb{E}(\varphi(R))=2 \int\limits^1_0 \varphi(\rho)\rho d\rho$$ $$\mathbb{E}(\psi(\Theta))=\frac{1}{2\pi}\int\limits^{2\pi}_{0} \psi (\gamma) d\gamma$$ Now we see that $$\mathbb{E}(\varphi(R)\psi(\Theta))=\frac{1}{\pi} \int \limits_{D} \varphi(r(x,y))\cdot \psi(\vartheta(x,y))dxdy=\\ \frac{1}{\pi}\int\limits^1_0[\int\limits^{2\pi}_{0} \varphi(\rho) \psi(\gamma)d\gamma]\rho d\rho=\frac{1}{\pi} \int\limits^1_0 \varphi(\rho) \rho d\rho \cdot \int\limits^{2\pi}_{0} \psi(\gamma)d\gamma= \\ \mathbb{E}(\varphi(R)) \cdot \mathbb{E}(\psi(\Theta)) $$ Using Fubini's theorem we prove that $R$ and $\Theta$ are independent.
How to show that polar coordinates in a uniform distribution on a disk are independent?
The solution may be a bit quirky, with a lot of variables, but it works fine for me. We know that $X$,$Y$ - random variables in $\mathbb{R}^n$ and $\mathbb{R}^m$ are independent iff $$\mathbb{E}(\varp
How to show that polar coordinates in a uniform distribution on a disk are independent? The solution may be a bit quirky, with a lot of variables, but it works fine for me. We know that $X$,$Y$ - random variables in $\mathbb{R}^n$ and $\mathbb{R}^m$ are independent iff $$\mathbb{E}(\varphi (X) \psi (Y) )= \mathbb{E}(\varphi(X)) \cdot \mathbb{E}(\psi(Y)) $$ $ \forall \varphi \in C^{\infty}_{0} $, $ \forall \psi \in C^{\infty}_{0} $, where $C^{\infty}_{0} $ are continuos on compact smooth functions. If $(X,Y)$ are uniformly distributed on the unit disc $D=\{(x,y):x^{2}+y^{2}<1\}$. Then we have that $$\mathbb{P}_{(X,Y)}(dxdy)=\frac{1}{\pi}\mathbb{1}_D (x,y) dxdy$$ Analogically we define two distance and angle functions: $$\begin{cases}r:\mathbb{R^2}\rightarrow \mathbb{R}\\ \vartheta:\mathbb{R^2}\rightarrow \mathbb{R}\end{cases}$$ Now we have $R=r(X,Y)$ and $\Theta=\vartheta(X,Y)$ and by passing to polar coordinates with $\begin{cases}\rho=r(x,y)\\ \gamma = \vartheta(x,y) \end{cases}$ we can show that $$\mathbb{E}(\varphi(R))=2 \int\limits^1_0 \varphi(\rho)\rho d\rho$$ $$\mathbb{E}(\psi(\Theta))=\frac{1}{2\pi}\int\limits^{2\pi}_{0} \psi (\gamma) d\gamma$$ Now we see that $$\mathbb{E}(\varphi(R)\psi(\Theta))=\frac{1}{\pi} \int \limits_{D} \varphi(r(x,y))\cdot \psi(\vartheta(x,y))dxdy=\\ \frac{1}{\pi}\int\limits^1_0[\int\limits^{2\pi}_{0} \varphi(\rho) \psi(\gamma)d\gamma]\rho d\rho=\frac{1}{\pi} \int\limits^1_0 \varphi(\rho) \rho d\rho \cdot \int\limits^{2\pi}_{0} \psi(\gamma)d\gamma= \\ \mathbb{E}(\varphi(R)) \cdot \mathbb{E}(\psi(\Theta)) $$ Using Fubini's theorem we prove that $R$ and $\Theta$ are independent.
How to show that polar coordinates in a uniform distribution on a disk are independent? The solution may be a bit quirky, with a lot of variables, but it works fine for me. We know that $X$,$Y$ - random variables in $\mathbb{R}^n$ and $\mathbb{R}^m$ are independent iff $$\mathbb{E}(\varp
43,282
Negative weights in a moving average?
Summary The weights are selected to achieve a mathematical end. In Spencer's case, the goal is to allow cubic trends to pass through the filter undistorted. This means that if we decompose the input $X_t$ into a deterministic polynomial trend component $m(t) \equiv c_3 t^3 + c_2 t^2 + c_1 t + c_0$ and a centered stochastic component $Y_t$, such that $X_t \equiv m(t) + Y_t$, then $\mathcal F \left[ X_t \right] \to m_t$ as $\sigma_Y \to 0$, where $\mathcal F$ is the filtering operation. Example Here is an illustrated example using Mathematica. I'm going to compare Spencer's filter with a 15-tap double-sided symmetric moving average. n = 101; c = RandomReal[{-1, 1}, 4]; x = RandomVariate[NormalDistribution[0, .1], n]; result = GraphicsGrid@{{ ListPlot@MovingAverage[x + Table[c.{1, t, t^2, t^3}, {t, -1, 1, 2/(n - 1)}], {-3, -6, -5, 3, 21, 46, 67, 74, 67, 46, 21, 3, -5, -6, -3}/230], ListPlot@MovingAverage[ x + Table[c.{1, t, t^2, t^3}, {t, -1, 1, 2/(n - 1)}], 15]}, {ListPlot@Table[c.{1, t, t^2, t^3}, {t, -1, 1, 2/(n - 1)}], ListPlot@{x + Table[c.{1, t, t^2, t^3}, {t, -1, 1, 2/(n - 1)}]}}} Clockwise from the top left: the output of Spencer's filter, the output of the symmetric filter, the noisy input ($X_t$), the cubic trend ($m_t$). This is with $c=\{-0.26988, -0.34137, 0.670082, 0.820887\}$ (the polynomial coefficients, in ascending order of degree). Discussion As you can see, Spencer's filter is more sensitive than the symmetric filter, owing to the negative weights. The low-pass effect of the symmetric filter is good for denoising (we're comparing the norm of the difference): Part[#2, 8 ;; -8] - MovingAverage[#1 + #2, 15] & [x, Table[c.{1, t, t^2, t^3} , {t, -1, 1, 2/(n - 1)}]] // Norm > 0.197244 for the symmetric filter versus Part[#2, 8 ;; -8] - MovingAverage[#1 + #2, {-3, -6, -5, 3, 21, 46, 67, 74, 67, 46, 21, 3, -5, -6, -3}/230] & [x, Table[c.{1, t, t^2, t^3} , {t, -1, 1, 2/(n - 1)}]] // Norm > 0.411789 for Spencer's. However, it also distorts the trend (the same test without the noise): Part[#2, 8 ;; -8] - MovingAverage[#2, 15] & [x, Table[c.{1, t, t^2, t^3} , {t, -1, 1, 2/(n - 1)}]] // Norm > 0.097972 versus Part[#2, 8 ;; -8] - MovingAverage[#2, {-3, -6, -5, 3, 21, 46, 67, 74, 67, 46, 21, 3, -5, -6, -3}/230] & [x, Table[c.{1, t, t^2, t^3} , {t, -1, 1, 2/(n - 1)}]] // Norm > 4.05378*10^-16 Further reading These lecture notes go into the derivation. You might also find resident user Rob Hyndman's article on moving averages useful.
Negative weights in a moving average?
Summary The weights are selected to achieve a mathematical end. In Spencer's case, the goal is to allow cubic trends to pass through the filter undistorted. This means that if we decompose the input $
Negative weights in a moving average? Summary The weights are selected to achieve a mathematical end. In Spencer's case, the goal is to allow cubic trends to pass through the filter undistorted. This means that if we decompose the input $X_t$ into a deterministic polynomial trend component $m(t) \equiv c_3 t^3 + c_2 t^2 + c_1 t + c_0$ and a centered stochastic component $Y_t$, such that $X_t \equiv m(t) + Y_t$, then $\mathcal F \left[ X_t \right] \to m_t$ as $\sigma_Y \to 0$, where $\mathcal F$ is the filtering operation. Example Here is an illustrated example using Mathematica. I'm going to compare Spencer's filter with a 15-tap double-sided symmetric moving average. n = 101; c = RandomReal[{-1, 1}, 4]; x = RandomVariate[NormalDistribution[0, .1], n]; result = GraphicsGrid@{{ ListPlot@MovingAverage[x + Table[c.{1, t, t^2, t^3}, {t, -1, 1, 2/(n - 1)}], {-3, -6, -5, 3, 21, 46, 67, 74, 67, 46, 21, 3, -5, -6, -3}/230], ListPlot@MovingAverage[ x + Table[c.{1, t, t^2, t^3}, {t, -1, 1, 2/(n - 1)}], 15]}, {ListPlot@Table[c.{1, t, t^2, t^3}, {t, -1, 1, 2/(n - 1)}], ListPlot@{x + Table[c.{1, t, t^2, t^3}, {t, -1, 1, 2/(n - 1)}]}}} Clockwise from the top left: the output of Spencer's filter, the output of the symmetric filter, the noisy input ($X_t$), the cubic trend ($m_t$). This is with $c=\{-0.26988, -0.34137, 0.670082, 0.820887\}$ (the polynomial coefficients, in ascending order of degree). Discussion As you can see, Spencer's filter is more sensitive than the symmetric filter, owing to the negative weights. The low-pass effect of the symmetric filter is good for denoising (we're comparing the norm of the difference): Part[#2, 8 ;; -8] - MovingAverage[#1 + #2, 15] & [x, Table[c.{1, t, t^2, t^3} , {t, -1, 1, 2/(n - 1)}]] // Norm > 0.197244 for the symmetric filter versus Part[#2, 8 ;; -8] - MovingAverage[#1 + #2, {-3, -6, -5, 3, 21, 46, 67, 74, 67, 46, 21, 3, -5, -6, -3}/230] & [x, Table[c.{1, t, t^2, t^3} , {t, -1, 1, 2/(n - 1)}]] // Norm > 0.411789 for Spencer's. However, it also distorts the trend (the same test without the noise): Part[#2, 8 ;; -8] - MovingAverage[#2, 15] & [x, Table[c.{1, t, t^2, t^3} , {t, -1, 1, 2/(n - 1)}]] // Norm > 0.097972 versus Part[#2, 8 ;; -8] - MovingAverage[#2, {-3, -6, -5, 3, 21, 46, 67, 74, 67, 46, 21, 3, -5, -6, -3}/230] & [x, Table[c.{1, t, t^2, t^3} , {t, -1, 1, 2/(n - 1)}]] // Norm > 4.05378*10^-16 Further reading These lecture notes go into the derivation. You might also find resident user Rob Hyndman's article on moving averages useful.
Negative weights in a moving average? Summary The weights are selected to achieve a mathematical end. In Spencer's case, the goal is to allow cubic trends to pass through the filter undistorted. This means that if we decompose the input $
43,283
SVAR, Cholesky decomposition and impulse-response function in R
Take a look at the package vars in R.
SVAR, Cholesky decomposition and impulse-response function in R
Take a look at the package vars in R.
SVAR, Cholesky decomposition and impulse-response function in R Take a look at the package vars in R.
SVAR, Cholesky decomposition and impulse-response function in R Take a look at the package vars in R.
43,284
Sampling variance is reduced when removing duplicates -- why?
I don't understand the motivation for removing duplicates and using the HT estimator on the particular probabilities you are using. More appropriate is to accept that the drawing is with replacement and hence there are duplicates (why would this be a problem? - normally it makes things simpler); and use the correct probabilities $z_i$ in the HT estimator. Edit: A couple of other thoughts You also probably need to apply a finite population correction factor. By removing the duplicates you are in effect just moving to a smaller sampling size and changing from sampling with replacement to sampling without replacement. Edit by StasK: Continuing with point 2: what you get is sometimes called Poisson sample. I am pretty sure that the pairwise selection probabilities are wrong, and $\pi_{ij} \neq \pi_i \pi_j$ in this case. Generally, sampling without replacement, and with unequal probabilities, is a HUGELY complicated thing. Brewer and Hanif (1982) list about 50 methods to do it properly, although only for about a dozen of these methods the pairwise probabilities of selection are tractable.
Sampling variance is reduced when removing duplicates -- why?
I don't understand the motivation for removing duplicates and using the HT estimator on the particular probabilities you are using. More appropriate is to accept that the drawing is with replacement a
Sampling variance is reduced when removing duplicates -- why? I don't understand the motivation for removing duplicates and using the HT estimator on the particular probabilities you are using. More appropriate is to accept that the drawing is with replacement and hence there are duplicates (why would this be a problem? - normally it makes things simpler); and use the correct probabilities $z_i$ in the HT estimator. Edit: A couple of other thoughts You also probably need to apply a finite population correction factor. By removing the duplicates you are in effect just moving to a smaller sampling size and changing from sampling with replacement to sampling without replacement. Edit by StasK: Continuing with point 2: what you get is sometimes called Poisson sample. I am pretty sure that the pairwise selection probabilities are wrong, and $\pi_{ij} \neq \pi_i \pi_j$ in this case. Generally, sampling without replacement, and with unequal probabilities, is a HUGELY complicated thing. Brewer and Hanif (1982) list about 50 methods to do it properly, although only for about a dozen of these methods the pairwise probabilities of selection are tractable.
Sampling variance is reduced when removing duplicates -- why? I don't understand the motivation for removing duplicates and using the HT estimator on the particular probabilities you are using. More appropriate is to accept that the drawing is with replacement a
43,285
How can I find out if a subset of Stack Exchange users increase/decrease their post rate based on badges earned?
In order to fully understand my answer and the references that I will provide, I will first (informally) introduce some concepts related to biology - most of the techniques that I will refer to are used in computational biology and therefore most of the reference you will find will assume a basic familiarity with the terms. A gene is a unit from a living organism that can be "expressed" when required - that is, the gene will perform the action that it is associated with (often by coding the proteins that it represents that will perform the desired action). e.g. a cell may build a variable amount of proteins from a gene that regulate its metabolism. Biologists are often interested in tracking these genes and/or their expressions through time or evolution. In your case, you are interested in understanding how the individual actions of the users (similar to a gene) are expressed through activity over time. A user (similar to the organism) has several different actions that he can perform and we are assuming that the type of user and his current situation has some form of correlation with the actions that he will perform. I would consider looking at two or three different techniques that are available - biclustering (sometimes row and column clustering, see figure 1 in link) and perhaps some sort of evolutionary tree (which is taken from this article) or a Hidden Markov Model. In the case of biclustering, the idea is as follows, place the users on one axis and the actions on another axis of a matrix. The values in this matrix will represent the number of actions that said user has made of the relevant type. Reorder the users and actions in a way that groups similar items near each other 1, 2 and then use some form of clustering to group your users automatically (some algorithms can be find here). The result of biclustering is that you can group users into subgroups and identify their traits in terms of actions. Note that in this case, you will only have a "snapshot" of users and their actions - in order to better understand the trends through which user actions evolve, you might need to perform several biclusters for different scenarios. Perhaps you might create biclusters for users that have spent a particular amount of time using Stack Exchange (say 1month, 3months, 6months, 1year) or users that have undergone a particular event (say just been awarded a badge yesterday). This will allow you to analyse the trends better - although the exact statistics and interpretation should be properly interpreted. As @AndyW pointed out in his link to How can I improve my analysis of the effects of reputation on voting? there are several problems that can arise from the data. Misrepresentation, missing data, inaccurate data and small amount of data are but some problems that you might encounter. Baldi and Brunak explain some of the problems that are typically encountered in data found in biological databases. In particular note that there might be non-trivial redundancies in your data that you might need to normalise in some way (e.g. the same user in different stack exchange forums). The alternative technique that I might suggest is based on evolutionary trees and/or Markov Models (HMM) - I grouped the discussion on these techniques because you could potentially use them in a similar manner. In this case, we might visualise a starting point from which all users start and the users "evolve" or "change state" due to different phenomena. After each state change, they are likely to perform a different volume and/or proportion of actions. The main problem here will be creating the ideal taxonomy or HMM topology. If (perhaps through biclustering as above) we identify four different types of user, a user will start by being assigned to one of these states and while in each of these state he will perform a different volume and proportion of actions. From this point onwards I will focus on the use of HMMs as evolutionary trees are not designed to model cycles or transfers from one groups to another - which might make them better suited. The work to be done in this case is to train the HMM from the data and identify how likely a user is to move from one state to another - notably from one state to the inactive user end state, where a user is no longer active. This will allow you to create a model of user behaviour. Now, once you have this HMM trained, all you need to do is get the list of user actions and trace this user through the most probable path - while in a particular state a user will be considered to be "of that type". HTH
How can I find out if a subset of Stack Exchange users increase/decrease their post rate based on ba
In order to fully understand my answer and the references that I will provide, I will first (informally) introduce some concepts related to biology - most of the techniques that I will refer to are us
How can I find out if a subset of Stack Exchange users increase/decrease their post rate based on badges earned? In order to fully understand my answer and the references that I will provide, I will first (informally) introduce some concepts related to biology - most of the techniques that I will refer to are used in computational biology and therefore most of the reference you will find will assume a basic familiarity with the terms. A gene is a unit from a living organism that can be "expressed" when required - that is, the gene will perform the action that it is associated with (often by coding the proteins that it represents that will perform the desired action). e.g. a cell may build a variable amount of proteins from a gene that regulate its metabolism. Biologists are often interested in tracking these genes and/or their expressions through time or evolution. In your case, you are interested in understanding how the individual actions of the users (similar to a gene) are expressed through activity over time. A user (similar to the organism) has several different actions that he can perform and we are assuming that the type of user and his current situation has some form of correlation with the actions that he will perform. I would consider looking at two or three different techniques that are available - biclustering (sometimes row and column clustering, see figure 1 in link) and perhaps some sort of evolutionary tree (which is taken from this article) or a Hidden Markov Model. In the case of biclustering, the idea is as follows, place the users on one axis and the actions on another axis of a matrix. The values in this matrix will represent the number of actions that said user has made of the relevant type. Reorder the users and actions in a way that groups similar items near each other 1, 2 and then use some form of clustering to group your users automatically (some algorithms can be find here). The result of biclustering is that you can group users into subgroups and identify their traits in terms of actions. Note that in this case, you will only have a "snapshot" of users and their actions - in order to better understand the trends through which user actions evolve, you might need to perform several biclusters for different scenarios. Perhaps you might create biclusters for users that have spent a particular amount of time using Stack Exchange (say 1month, 3months, 6months, 1year) or users that have undergone a particular event (say just been awarded a badge yesterday). This will allow you to analyse the trends better - although the exact statistics and interpretation should be properly interpreted. As @AndyW pointed out in his link to How can I improve my analysis of the effects of reputation on voting? there are several problems that can arise from the data. Misrepresentation, missing data, inaccurate data and small amount of data are but some problems that you might encounter. Baldi and Brunak explain some of the problems that are typically encountered in data found in biological databases. In particular note that there might be non-trivial redundancies in your data that you might need to normalise in some way (e.g. the same user in different stack exchange forums). The alternative technique that I might suggest is based on evolutionary trees and/or Markov Models (HMM) - I grouped the discussion on these techniques because you could potentially use them in a similar manner. In this case, we might visualise a starting point from which all users start and the users "evolve" or "change state" due to different phenomena. After each state change, they are likely to perform a different volume and/or proportion of actions. The main problem here will be creating the ideal taxonomy or HMM topology. If (perhaps through biclustering as above) we identify four different types of user, a user will start by being assigned to one of these states and while in each of these state he will perform a different volume and proportion of actions. From this point onwards I will focus on the use of HMMs as evolutionary trees are not designed to model cycles or transfers from one groups to another - which might make them better suited. The work to be done in this case is to train the HMM from the data and identify how likely a user is to move from one state to another - notably from one state to the inactive user end state, where a user is no longer active. This will allow you to create a model of user behaviour. Now, once you have this HMM trained, all you need to do is get the list of user actions and trace this user through the most probable path - while in a particular state a user will be considered to be "of that type". HTH
How can I find out if a subset of Stack Exchange users increase/decrease their post rate based on ba In order to fully understand my answer and the references that I will provide, I will first (informally) introduce some concepts related to biology - most of the techniques that I will refer to are us
43,286
Sum of lognormal distributed insurance claims
Firstly, the Kolmogorov-Smirnov is a test for a completely specified distribution. If you estimate the parameters rather than pre-specify them, the test doesn't have the intended properties - in particular, it is much less likely to reject the null, either when it's true or when it's false. You simply can't use it without taking account of the estimation of parameters. Second, it's not a particularly powerful test in any case. Also, while the sum of lognormals isn't lognormal, it's frequently a remarkably good approximation, so you shouldn't expect to get much power against it even in fairly large samples. Any of these suggest a lack of tendency to reject the null. Some recommendations: (i) since a particularly good test for normality is the Shapiro-Wilk test, you could take your sum of lognormals, take logs and test that for normality; alternatively - (ii) since the deviations of a sum of lognormals from lognormality are going to tend to be smooth, this suggests doing smooth tests. Again, I'd suggest working with testing the log of the approximately-lognormal for normality. Smooth tests for normality are detailed in the book by Rayner and Best (Smooth Tests of Goodness of Fit) as well as several of their papers. Either of these should do fine.
Sum of lognormal distributed insurance claims
Firstly, the Kolmogorov-Smirnov is a test for a completely specified distribution. If you estimate the parameters rather than pre-specify them, the test doesn't have the intended properties - in parti
Sum of lognormal distributed insurance claims Firstly, the Kolmogorov-Smirnov is a test for a completely specified distribution. If you estimate the parameters rather than pre-specify them, the test doesn't have the intended properties - in particular, it is much less likely to reject the null, either when it's true or when it's false. You simply can't use it without taking account of the estimation of parameters. Second, it's not a particularly powerful test in any case. Also, while the sum of lognormals isn't lognormal, it's frequently a remarkably good approximation, so you shouldn't expect to get much power against it even in fairly large samples. Any of these suggest a lack of tendency to reject the null. Some recommendations: (i) since a particularly good test for normality is the Shapiro-Wilk test, you could take your sum of lognormals, take logs and test that for normality; alternatively - (ii) since the deviations of a sum of lognormals from lognormality are going to tend to be smooth, this suggests doing smooth tests. Again, I'd suggest working with testing the log of the approximately-lognormal for normality. Smooth tests for normality are detailed in the book by Rayner and Best (Smooth Tests of Goodness of Fit) as well as several of their papers. Either of these should do fine.
Sum of lognormal distributed insurance claims Firstly, the Kolmogorov-Smirnov is a test for a completely specified distribution. If you estimate the parameters rather than pre-specify them, the test doesn't have the intended properties - in parti
43,287
How does pooling and resampling affect variance of sample mean?
Assume that each $X_n$ is distributed with mean $\mu_n$ and variance $\sigma^2_n$, for $n=1,..., N$. For each $n$, we draw a sample of size $K_n$, denoted by $\hat{X}_{n,k}$, $k=1,...,K_n$. Let $M=\sum_{n=1}^N K_n$. Then, for each sample we obtain the mean $$ \bar{\hat{X}}_{n} = \frac{1}{K_n} \sum_{k=1}^{K_n} \hat{X}_{n,k}. $$ Expected value and variance of each original mean The expected value and variance of each $\bar{\hat{X}}_{n}$ is straightforward. We have $$E[\bar{\hat{X}}_n] = \mu_n$$ and $$\textrm{var}[\bar{\hat{X}}_n]= \frac{\sigma^2_n}{K_n}.$$ Expected value and variance of each bootstrap mean Now consider the empirical distribution $\hat{F}$ obtained from the combined sample of $$\left\{\hat{X}_{1,1},...,\hat{X}_{1,K_1}, ... \hat{X}_{N,1},..., \hat{X}_{N,K_N}\right\}.$$ This is a mixture distribution. A draw from a random variable $Y_n \sim \hat{F}$ has expected value $$\mu = E[Y_n] = \sum_{\nu=1}^N \frac{K_\nu}{M} \mu_\nu$$ and variance $$ \textrm{var}[Y_n] = \sum_{\nu=1}^N \frac{K_\nu}{M} \left(\left( \mu_\nu - \mu \right)^2 + \sigma_\nu^2 \right). $$ Take a draw of size $K_n$ from $Y_n$. Note that the distribution of each $Y_n$ is the same. Then, as before, the sample mean is $$\bar{\hat{Y}}_n = \frac{1}{K_n} \sum_{k=1}^{K_n} \hat{Y}_{n,k}.$$ The expected value and variance of each $\bar{\hat{Y}}_n$ is $$E[\bar{\hat{Y}}_n] = \mu$$ and $$ \textrm{var}[\bar{\hat{Y}}_n] = \frac{1}{K_n} \sum_{\nu=1}^N \frac{K_\nu}{M} \left(\left( \mu_\nu - \mu \right)^2 + \sigma_\nu^2 \right). $$ Expected value and variance of the collection of original means Consider that a draw from our collection $\left\{ \bar{\hat{X}}_1, ..., \bar{\hat{X}}_N \right\}$ is a draw from a population with a mixture distribution with equal weights $\frac1N$ and with expectation and variances for each component already determined. Therefore, the mean of this population is given by $$\bar\mu = \frac1N \sum_{n=1}^N \mu_n$$ and the variance of this population is given by $$ \frac1N \sum_{n=1}^N \left(\left(\mu_n - \bar\mu \right)^2 + \frac{\sigma^2_n}{K_n}\right)= \frac1N \sum_{n=1}^N \left(\mu_n - \bar\mu \right)^2 + \frac1N \sum_{n=1}^N \frac{\sigma^2_n}{K_n}.$$ Expected value and variance of the collection of bootstrap means In a similar vein, we examine a draw from our collection $\left\{ \bar{\hat{Y}}_1, ..., \bar{\hat{Y}}_N \right\}$. Again, this is a mixture distribution with equal weights $1/N$ and with expectation and variances for each component already determined. Therefore, the mean of this population is $$\frac1N \sum_{n=1}^N \mu = \frac1N \sum_{n=1}^N \sum_{\nu=1}^N \frac{K_\nu}{M} \mu_\nu = \sum_{\nu=1}^N \frac{K_\nu}{M} \mu_\nu.$$ Note that this is the same as each individual expectation, so that the variance of this population is given by $$ \sum_{n=1}^N \frac1N \frac{1}{K_n} \sum_{\nu=1}^N \frac{K_\nu}{M} \left(\left( \mu_\nu - \mu \right)^2 + \sigma_\nu^2 \right), $$ which can be rewritten as $$ \frac1N \sum_{n=1}^N \frac{1}{K_n} \sum_{\nu=1}^N \frac{K_\nu}{M} \left( \mu_\nu - \mu \right)^2 + \frac1N \sum_{n=1}^N \frac{1}{K_n} \sum_{\nu=1}^N \frac{K_\nu}{M} \sigma_\nu^2. $$ Letting $$\frac{1}{H(K_1, ..., K_N)} = \frac1N \sum_{n=1}^N \frac{1}{K_n},$$ we see that $H=H(K_1,..., K_N)$ is the reciprocal of the arithmetic mean of the reciprocals, so that $H$ is the harmonic mean of the $K_n$. This allows us to rewrite the variance as $$ \frac{1}{H} \sum_{\nu=1}^N \frac{K_\nu}{M} \left( \mu_\nu - \mu \right)^2 + \frac{1}{H} \sum_{\nu=1}^N \frac{K_\nu}{M} \sigma_\nu^2. $$ Consequences Since each $K_n \ge 1$, we have that $H \ge 1$, with equality only when all the $K_n=1$. Therefore, the reciprocal $1/H \le 1$ with equality only when all the $K_n=1$. Comparing the variance of the original sample means with the variance of the bootstrap means, we see that they differ in two ways. First, the terms in the variance of the bootstrap means contain weights proportional to the $K_n$ rather than equal weighting. This includes the centering value for the term involving the expectations. Second, the terms in the variance of the bootstrap means are multiplied by the reciprocal of the harmonic mean of the $K_n$. Suppose the $K_n=K\ge1$, $n=1,..., N$. That is, all the samples are of the same size. Then, $M=NK$, all the weights are equal to $1/N$, and the terms in summation for the bootstrap means are the same as those from the original samples. If $K=1$, then the variance of the bootstrap means is the same as the variance of the original sample means. If $K>1$, though, the variance of the bootstrap means is less than the variance of the original sample means due to the multiplier of the reciprocal of the harmonic mean. Empirical check Assuming any of this is accurate, we can look at some specific examples. Here is some code that should compute the given equations for the variance. # Calculate the variance of the original means. var.orig <- function(mu, s2, K) { N <- length(K) mu.bar <- mean(mu) v <- (1/N) * sum((mu - mu.bar)^2) + (1/N) * sum(s2/K) return(v) } # Calculate the variance of the bootstrap means. var.boot <- function(mu, s2, K) { N <- length(K) M <- sum(K) mu.w <- sum( (K/M) * mu) v <- (1/N) * sum(1/K) * ( sum( (K/M) * (mu - mu.w)^2 ) + sum( (K/M) * s2) ) return(v) } Then, we can try some specific values. # Set up some combinations. Test <- data.frame( mu1 = c(0, 0, 0, 0, 0, 0, 0, 0, 0), mu2 = c(1, 1, 1, 1, 1, 1, 1, 1, 1), mu3 = c(2, 2, 2, 20, 2, 2, 2, 10, 1), si1 = c(1, 1, 5, 1, 1, 5, 10, 1, 3), si2 = c(1, 1, 5, 1, 1, 5, 1, 1, 1), si3 = c(1, 1, 5, 1, 1, 10, 1, 1, 20), K1 = c(1, 2, 2, 2, 90, 5, 20, 20, 10), K2 = c(1, 2, 2, 2, 1, 5, 2, 2, 5), K3 = c(1, 2, 2, 20, 20, 10, 2, 20, 30) ) # Run through them. for (i in 1:dim(Test)[1]) { mu <- c(Test$mu1[i], Test$mu2[i], Test$mu3[i]) s2 <- c(Test$si1[i], Test$si2[i], Test$si3[i]) K <- c(Test$K1[i], Test$K2[i], Test$K3[i]) Test$var.orig[i] <- var.orig(mu, s2, K) Test$var.boot[i] <- var.boot(mu, s2, K) } This yields the following results: Test # mu1 mu2 mu3 si1 si2 si3 K1 K2 K3 var.orig var.boot #1 0 1 2 1 1 1 1 1 1 1.6666667 1.6666667 #2 0 1 2 1 1 1 2 2 2 1.1666667 0.8333333 #3 0 1 2 5 5 5 2 2 2 3.1666667 2.8333333 #4 0 1 20 1 1 1 2 2 20 85.0166667 18.8489583 #5 0 1 2 1 1 1 90 1 20 1.0203704 0.5635547 #6 0 1 2 5 5 10 5 5 10 1.6666667 1.3645833 #7 0 1 2 10 1 1 20 2 2 1.1666667 3.0989583 #8 0 1 10 1 1 1 20 2 20 20.4222222 5.1070295 #9 0 1 1 3 1 20 10 5 30 0.6111111 1.5871056 Empirically, picking larger samples from populations with higher variance tends to increase the bootstrap variance.
How does pooling and resampling affect variance of sample mean?
Assume that each $X_n$ is distributed with mean $\mu_n$ and variance $\sigma^2_n$, for $n=1,..., N$. For each $n$, we draw a sample of size $K_n$, denoted by $\hat{X}_{n,k}$, $k=1,...,K_n$. Let $M=\
How does pooling and resampling affect variance of sample mean? Assume that each $X_n$ is distributed with mean $\mu_n$ and variance $\sigma^2_n$, for $n=1,..., N$. For each $n$, we draw a sample of size $K_n$, denoted by $\hat{X}_{n,k}$, $k=1,...,K_n$. Let $M=\sum_{n=1}^N K_n$. Then, for each sample we obtain the mean $$ \bar{\hat{X}}_{n} = \frac{1}{K_n} \sum_{k=1}^{K_n} \hat{X}_{n,k}. $$ Expected value and variance of each original mean The expected value and variance of each $\bar{\hat{X}}_{n}$ is straightforward. We have $$E[\bar{\hat{X}}_n] = \mu_n$$ and $$\textrm{var}[\bar{\hat{X}}_n]= \frac{\sigma^2_n}{K_n}.$$ Expected value and variance of each bootstrap mean Now consider the empirical distribution $\hat{F}$ obtained from the combined sample of $$\left\{\hat{X}_{1,1},...,\hat{X}_{1,K_1}, ... \hat{X}_{N,1},..., \hat{X}_{N,K_N}\right\}.$$ This is a mixture distribution. A draw from a random variable $Y_n \sim \hat{F}$ has expected value $$\mu = E[Y_n] = \sum_{\nu=1}^N \frac{K_\nu}{M} \mu_\nu$$ and variance $$ \textrm{var}[Y_n] = \sum_{\nu=1}^N \frac{K_\nu}{M} \left(\left( \mu_\nu - \mu \right)^2 + \sigma_\nu^2 \right). $$ Take a draw of size $K_n$ from $Y_n$. Note that the distribution of each $Y_n$ is the same. Then, as before, the sample mean is $$\bar{\hat{Y}}_n = \frac{1}{K_n} \sum_{k=1}^{K_n} \hat{Y}_{n,k}.$$ The expected value and variance of each $\bar{\hat{Y}}_n$ is $$E[\bar{\hat{Y}}_n] = \mu$$ and $$ \textrm{var}[\bar{\hat{Y}}_n] = \frac{1}{K_n} \sum_{\nu=1}^N \frac{K_\nu}{M} \left(\left( \mu_\nu - \mu \right)^2 + \sigma_\nu^2 \right). $$ Expected value and variance of the collection of original means Consider that a draw from our collection $\left\{ \bar{\hat{X}}_1, ..., \bar{\hat{X}}_N \right\}$ is a draw from a population with a mixture distribution with equal weights $\frac1N$ and with expectation and variances for each component already determined. Therefore, the mean of this population is given by $$\bar\mu = \frac1N \sum_{n=1}^N \mu_n$$ and the variance of this population is given by $$ \frac1N \sum_{n=1}^N \left(\left(\mu_n - \bar\mu \right)^2 + \frac{\sigma^2_n}{K_n}\right)= \frac1N \sum_{n=1}^N \left(\mu_n - \bar\mu \right)^2 + \frac1N \sum_{n=1}^N \frac{\sigma^2_n}{K_n}.$$ Expected value and variance of the collection of bootstrap means In a similar vein, we examine a draw from our collection $\left\{ \bar{\hat{Y}}_1, ..., \bar{\hat{Y}}_N \right\}$. Again, this is a mixture distribution with equal weights $1/N$ and with expectation and variances for each component already determined. Therefore, the mean of this population is $$\frac1N \sum_{n=1}^N \mu = \frac1N \sum_{n=1}^N \sum_{\nu=1}^N \frac{K_\nu}{M} \mu_\nu = \sum_{\nu=1}^N \frac{K_\nu}{M} \mu_\nu.$$ Note that this is the same as each individual expectation, so that the variance of this population is given by $$ \sum_{n=1}^N \frac1N \frac{1}{K_n} \sum_{\nu=1}^N \frac{K_\nu}{M} \left(\left( \mu_\nu - \mu \right)^2 + \sigma_\nu^2 \right), $$ which can be rewritten as $$ \frac1N \sum_{n=1}^N \frac{1}{K_n} \sum_{\nu=1}^N \frac{K_\nu}{M} \left( \mu_\nu - \mu \right)^2 + \frac1N \sum_{n=1}^N \frac{1}{K_n} \sum_{\nu=1}^N \frac{K_\nu}{M} \sigma_\nu^2. $$ Letting $$\frac{1}{H(K_1, ..., K_N)} = \frac1N \sum_{n=1}^N \frac{1}{K_n},$$ we see that $H=H(K_1,..., K_N)$ is the reciprocal of the arithmetic mean of the reciprocals, so that $H$ is the harmonic mean of the $K_n$. This allows us to rewrite the variance as $$ \frac{1}{H} \sum_{\nu=1}^N \frac{K_\nu}{M} \left( \mu_\nu - \mu \right)^2 + \frac{1}{H} \sum_{\nu=1}^N \frac{K_\nu}{M} \sigma_\nu^2. $$ Consequences Since each $K_n \ge 1$, we have that $H \ge 1$, with equality only when all the $K_n=1$. Therefore, the reciprocal $1/H \le 1$ with equality only when all the $K_n=1$. Comparing the variance of the original sample means with the variance of the bootstrap means, we see that they differ in two ways. First, the terms in the variance of the bootstrap means contain weights proportional to the $K_n$ rather than equal weighting. This includes the centering value for the term involving the expectations. Second, the terms in the variance of the bootstrap means are multiplied by the reciprocal of the harmonic mean of the $K_n$. Suppose the $K_n=K\ge1$, $n=1,..., N$. That is, all the samples are of the same size. Then, $M=NK$, all the weights are equal to $1/N$, and the terms in summation for the bootstrap means are the same as those from the original samples. If $K=1$, then the variance of the bootstrap means is the same as the variance of the original sample means. If $K>1$, though, the variance of the bootstrap means is less than the variance of the original sample means due to the multiplier of the reciprocal of the harmonic mean. Empirical check Assuming any of this is accurate, we can look at some specific examples. Here is some code that should compute the given equations for the variance. # Calculate the variance of the original means. var.orig <- function(mu, s2, K) { N <- length(K) mu.bar <- mean(mu) v <- (1/N) * sum((mu - mu.bar)^2) + (1/N) * sum(s2/K) return(v) } # Calculate the variance of the bootstrap means. var.boot <- function(mu, s2, K) { N <- length(K) M <- sum(K) mu.w <- sum( (K/M) * mu) v <- (1/N) * sum(1/K) * ( sum( (K/M) * (mu - mu.w)^2 ) + sum( (K/M) * s2) ) return(v) } Then, we can try some specific values. # Set up some combinations. Test <- data.frame( mu1 = c(0, 0, 0, 0, 0, 0, 0, 0, 0), mu2 = c(1, 1, 1, 1, 1, 1, 1, 1, 1), mu3 = c(2, 2, 2, 20, 2, 2, 2, 10, 1), si1 = c(1, 1, 5, 1, 1, 5, 10, 1, 3), si2 = c(1, 1, 5, 1, 1, 5, 1, 1, 1), si3 = c(1, 1, 5, 1, 1, 10, 1, 1, 20), K1 = c(1, 2, 2, 2, 90, 5, 20, 20, 10), K2 = c(1, 2, 2, 2, 1, 5, 2, 2, 5), K3 = c(1, 2, 2, 20, 20, 10, 2, 20, 30) ) # Run through them. for (i in 1:dim(Test)[1]) { mu <- c(Test$mu1[i], Test$mu2[i], Test$mu3[i]) s2 <- c(Test$si1[i], Test$si2[i], Test$si3[i]) K <- c(Test$K1[i], Test$K2[i], Test$K3[i]) Test$var.orig[i] <- var.orig(mu, s2, K) Test$var.boot[i] <- var.boot(mu, s2, K) } This yields the following results: Test # mu1 mu2 mu3 si1 si2 si3 K1 K2 K3 var.orig var.boot #1 0 1 2 1 1 1 1 1 1 1.6666667 1.6666667 #2 0 1 2 1 1 1 2 2 2 1.1666667 0.8333333 #3 0 1 2 5 5 5 2 2 2 3.1666667 2.8333333 #4 0 1 20 1 1 1 2 2 20 85.0166667 18.8489583 #5 0 1 2 1 1 1 90 1 20 1.0203704 0.5635547 #6 0 1 2 5 5 10 5 5 10 1.6666667 1.3645833 #7 0 1 2 10 1 1 20 2 2 1.1666667 3.0989583 #8 0 1 10 1 1 1 20 2 20 20.4222222 5.1070295 #9 0 1 1 3 1 20 10 5 30 0.6111111 1.5871056 Empirically, picking larger samples from populations with higher variance tends to increase the bootstrap variance.
How does pooling and resampling affect variance of sample mean? Assume that each $X_n$ is distributed with mean $\mu_n$ and variance $\sigma^2_n$, for $n=1,..., N$. For each $n$, we draw a sample of size $K_n$, denoted by $\hat{X}_{n,k}$, $k=1,...,K_n$. Let $M=\
43,288
Incorporating a treatment into a classification scheme
You might try some tree based models, such as randomForest or GBM in R. Both models are good at picking up non-linear effects and interactions, and both also produce variable importance measures that will probably be useful in your analysis. GBM in particular might be useful, as it fits each successive tree to the residuals of the model. In this way, after the model captures the effects of geometric dimensions, it will explore how the various treatments might be used to explain the "leftover" (or residual) variance. On the other hand, random forests require very little tuning and are harder to screw up than GBM models. I would make sure each treatment is its set of variables, e.g. total time in fire, min/mean/median/max/cumulative bending and pulling pressure, etc. Particularly in GBM models, more variables are better, so be thorough! How are you measuring how "good" your models are? Are you cross-validating them?
Incorporating a treatment into a classification scheme
You might try some tree based models, such as randomForest or GBM in R. Both models are good at picking up non-linear effects and interactions, and both also produce variable importance measures that
Incorporating a treatment into a classification scheme You might try some tree based models, such as randomForest or GBM in R. Both models are good at picking up non-linear effects and interactions, and both also produce variable importance measures that will probably be useful in your analysis. GBM in particular might be useful, as it fits each successive tree to the residuals of the model. In this way, after the model captures the effects of geometric dimensions, it will explore how the various treatments might be used to explain the "leftover" (or residual) variance. On the other hand, random forests require very little tuning and are harder to screw up than GBM models. I would make sure each treatment is its set of variables, e.g. total time in fire, min/mean/median/max/cumulative bending and pulling pressure, etc. Particularly in GBM models, more variables are better, so be thorough! How are you measuring how "good" your models are? Are you cross-validating them?
Incorporating a treatment into a classification scheme You might try some tree based models, such as randomForest or GBM in R. Both models are good at picking up non-linear effects and interactions, and both also produce variable importance measures that
43,289
Incorporating a treatment into a classification scheme
The functional form of the model is going to be very important here. In fact there might be interaction effects between the treatments (sensitivity of breaking to bending might depend on whether it has been put through fire before) and hence you need to use a non-linear functional form So, instead of a form like: $$y=\beta_{fire}x_{fire}+ \beta_{bending}x_{bending} + .. $$ you might want to use a form: $$y=\beta_{bending-fire}x_{bending}x_{fire} + ..+\beta_{fire}x_{fire}+ \beta_{bending}x_{bending} + .. $$ You should start with this simple linear model and then move on to random forests since they will automatically create these interactions if they are important
Incorporating a treatment into a classification scheme
The functional form of the model is going to be very important here. In fact there might be interaction effects between the treatments (sensitivity of breaking to bending might depend on whether it ha
Incorporating a treatment into a classification scheme The functional form of the model is going to be very important here. In fact there might be interaction effects between the treatments (sensitivity of breaking to bending might depend on whether it has been put through fire before) and hence you need to use a non-linear functional form So, instead of a form like: $$y=\beta_{fire}x_{fire}+ \beta_{bending}x_{bending} + .. $$ you might want to use a form: $$y=\beta_{bending-fire}x_{bending}x_{fire} + ..+\beta_{fire}x_{fire}+ \beta_{bending}x_{bending} + .. $$ You should start with this simple linear model and then move on to random forests since they will automatically create these interactions if they are important
Incorporating a treatment into a classification scheme The functional form of the model is going to be very important here. In fact there might be interaction effects between the treatments (sensitivity of breaking to bending might depend on whether it ha
43,290
How can I test for a difference between ordered groups?
Spearman correlation is fine as far as it goes, but don't stop there. What if there is a nonlinear relationship? E.g., perhaps the cost difference between those who rate the toy bad vs. medium is not comparable to the cost difference between those who rate it medium vs. good. An ANOVA would help you detect this. There's a reason to use ANOVA instead of 2 T-tests. Others might explain it better, but in a nutshell, the combination of omnibus test and (if significant) post hoc tests preserves Type I and Type II error rates better than the 2 T-tests would.
How can I test for a difference between ordered groups?
Spearman correlation is fine as far as it goes, but don't stop there. What if there is a nonlinear relationship? E.g., perhaps the cost difference between those who rate the toy bad vs. medium is no
How can I test for a difference between ordered groups? Spearman correlation is fine as far as it goes, but don't stop there. What if there is a nonlinear relationship? E.g., perhaps the cost difference between those who rate the toy bad vs. medium is not comparable to the cost difference between those who rate it medium vs. good. An ANOVA would help you detect this. There's a reason to use ANOVA instead of 2 T-tests. Others might explain it better, but in a nutshell, the combination of omnibus test and (if significant) post hoc tests preserves Type I and Type II error rates better than the 2 T-tests would.
How can I test for a difference between ordered groups? Spearman correlation is fine as far as it goes, but don't stop there. What if there is a nonlinear relationship? E.g., perhaps the cost difference between those who rate the toy bad vs. medium is no
43,291
How can I test for a difference between ordered groups?
Looks like Page's trend test would suit you well - it could help you to test hypothesis $H_0\colon m_{good}=m_{medium}=m_{bad}, $ where $m $ is a measure of central tendency of estimated cost, against the ordered alternative $H_1\colon m_{good}>m_{medium}>m_{bad}. $ It also nonparametric, so you don't have to assume the distributions are normal. See test description and R implementation.
How can I test for a difference between ordered groups?
Looks like Page's trend test would suit you well - it could help you to test hypothesis $H_0\colon m_{good}=m_{medium}=m_{bad}, $ where $m $ is a measure of central tendency of estimated cost, agains
How can I test for a difference between ordered groups? Looks like Page's trend test would suit you well - it could help you to test hypothesis $H_0\colon m_{good}=m_{medium}=m_{bad}, $ where $m $ is a measure of central tendency of estimated cost, against the ordered alternative $H_1\colon m_{good}>m_{medium}>m_{bad}. $ It also nonparametric, so you don't have to assume the distributions are normal. See test description and R implementation.
How can I test for a difference between ordered groups? Looks like Page's trend test would suit you well - it could help you to test hypothesis $H_0\colon m_{good}=m_{medium}=m_{bad}, $ where $m $ is a measure of central tendency of estimated cost, agains
43,292
Subtree replacement vs subtree raising
My knee jerk response is: without a measure of goodness the word "better" has no meaning. I am trending to "c, none of the above" as my preferred approach The approach to "build", if you mean build = grow, is to split on the best leaf until a stopping criterion is breached. Like all Machine Learning tools, there are two goals for the tree, and they comprise a measure of goodness for the pruning process: maximize generalization, minimize error in representation. If you can agree to these two, in a general sense, then I can proceed with an answer.
Subtree replacement vs subtree raising
My knee jerk response is: without a measure of goodness the word "better" has no meaning. I am trending to "c, none of the above" as my preferred approach The approach to "build", if you mean build
Subtree replacement vs subtree raising My knee jerk response is: without a measure of goodness the word "better" has no meaning. I am trending to "c, none of the above" as my preferred approach The approach to "build", if you mean build = grow, is to split on the best leaf until a stopping criterion is breached. Like all Machine Learning tools, there are two goals for the tree, and they comprise a measure of goodness for the pruning process: maximize generalization, minimize error in representation. If you can agree to these two, in a general sense, then I can proceed with an answer.
Subtree replacement vs subtree raising My knee jerk response is: without a measure of goodness the word "better" has no meaning. I am trending to "c, none of the above" as my preferred approach The approach to "build", if you mean build
43,293
Minimum-Distance estimation of mixed/mixture distributions
Due to the convoluted nature of the $\alpha$-stable distributions (no likelihood), I would suggest using an ABC technique to estimate the mixture. Peters et al. have a recent paper on this. (Here are some slides from Gareth Peters, as well.) Barthelmé and Chopin use a slightly different technique based on expectation-propagation to estimate their $\alpha$-stable model. Even though those papers do not address directly the mixture issue, the mixture part is the easy part: using a Gibbs sampler that separates the data into two groups for the two components at each (Gibbs) step means that both distributions are estimated separately.
Minimum-Distance estimation of mixed/mixture distributions
Due to the convoluted nature of the $\alpha$-stable distributions (no likelihood), I would suggest using an ABC technique to estimate the mixture. Peters et al. have a recent paper on this. (Here are
Minimum-Distance estimation of mixed/mixture distributions Due to the convoluted nature of the $\alpha$-stable distributions (no likelihood), I would suggest using an ABC technique to estimate the mixture. Peters et al. have a recent paper on this. (Here are some slides from Gareth Peters, as well.) Barthelmé and Chopin use a slightly different technique based on expectation-propagation to estimate their $\alpha$-stable model. Even though those papers do not address directly the mixture issue, the mixture part is the easy part: using a Gibbs sampler that separates the data into two groups for the two components at each (Gibbs) step means that both distributions are estimated separately.
Minimum-Distance estimation of mixed/mixture distributions Due to the convoluted nature of the $\alpha$-stable distributions (no likelihood), I would suggest using an ABC technique to estimate the mixture. Peters et al. have a recent paper on this. (Here are
43,294
How to adjust for a mid-study change in diagnostic protocol?
based on the question and comments, can you make an adjustment so that you deflate the number of cases under the new protocol to what they "would" have had under the old protocol? If you know the difference in the specificity and the sensitivity for both diagnostic tests, and you know the number of patients that the two sites are testing, can you adjust their new figures on the basis of the differences between those two tests. You're not worried about "true" positives, just about the total number diagnosed. But you'll need the numbers of patients tested in order to make the correction. One possible issue: did the two sites change over completely to the new diagnostic method, or did they run a combination of both methods (old method on some patients, new method on others) at the same time? If so, I can't think of a correction for that.
How to adjust for a mid-study change in diagnostic protocol?
based on the question and comments, can you make an adjustment so that you deflate the number of cases under the new protocol to what they "would" have had under the old protocol? If you know the diff
How to adjust for a mid-study change in diagnostic protocol? based on the question and comments, can you make an adjustment so that you deflate the number of cases under the new protocol to what they "would" have had under the old protocol? If you know the difference in the specificity and the sensitivity for both diagnostic tests, and you know the number of patients that the two sites are testing, can you adjust their new figures on the basis of the differences between those two tests. You're not worried about "true" positives, just about the total number diagnosed. But you'll need the numbers of patients tested in order to make the correction. One possible issue: did the two sites change over completely to the new diagnostic method, or did they run a combination of both methods (old method on some patients, new method on others) at the same time? If so, I can't think of a correction for that.
How to adjust for a mid-study change in diagnostic protocol? based on the question and comments, can you make an adjustment so that you deflate the number of cases under the new protocol to what they "would" have had under the old protocol? If you know the diff
43,295
Power needed to detect an interaction
You need a significantly larger sample size to detect an effect for an interaction. To detect an effect of size $d$ for an interact, you need a sample size that is about 4 times larger than the sample size required to detect a main effect of size $d$. This is because for the interaction you're essentially taking the difference in the difference between two groups so your standard error has four terms instead of two. For a clear discussion of this, see 16.4 in Regression and Other Stories available online here. It should also be noted though that the sort of post-hoc power analysis you seem to be suggesting here is not advisable. You cannot reliably estimate the power needed for an analysis after the fact based only on your estimate for $d$.
Power needed to detect an interaction
You need a significantly larger sample size to detect an effect for an interaction. To detect an effect of size $d$ for an interact, you need a sample size that is about 4 times larger than the sample
Power needed to detect an interaction You need a significantly larger sample size to detect an effect for an interaction. To detect an effect of size $d$ for an interact, you need a sample size that is about 4 times larger than the sample size required to detect a main effect of size $d$. This is because for the interaction you're essentially taking the difference in the difference between two groups so your standard error has four terms instead of two. For a clear discussion of this, see 16.4 in Regression and Other Stories available online here. It should also be noted though that the sort of post-hoc power analysis you seem to be suggesting here is not advisable. You cannot reliably estimate the power needed for an analysis after the fact based only on your estimate for $d$.
Power needed to detect an interaction You need a significantly larger sample size to detect an effect for an interaction. To detect an effect of size $d$ for an interact, you need a sample size that is about 4 times larger than the sample
43,296
Power needed to detect an interaction
If we use the question by Macro: "To achieve the same power, does one require a greater sample size when testing an interaction than when testing a main effect?" It does not necessarily need a bigger sample with "that" many in each dummy variable category, but you have to be aware of the problem of multicollinearity, since you create multicollinearity with the interaction term. This can lead to insignificant variables, in your example your interaction term. This problem can be cured with centering. See how this is done here with an example. Some minor explanation of the different centering techniques]Aiken's book on interpreting interaction terms(see below for link) With centering your R-squared values will remain the same. Multicolliearity: Aiken's Book:
Power needed to detect an interaction
If we use the question by Macro: "To achieve the same power, does one require a greater sample size when testing an interaction than when testing a main effect?" It does not necessarily need a bigge
Power needed to detect an interaction If we use the question by Macro: "To achieve the same power, does one require a greater sample size when testing an interaction than when testing a main effect?" It does not necessarily need a bigger sample with "that" many in each dummy variable category, but you have to be aware of the problem of multicollinearity, since you create multicollinearity with the interaction term. This can lead to insignificant variables, in your example your interaction term. This problem can be cured with centering. See how this is done here with an example. Some minor explanation of the different centering techniques]Aiken's book on interpreting interaction terms(see below for link) With centering your R-squared values will remain the same. Multicolliearity: Aiken's Book:
Power needed to detect an interaction If we use the question by Macro: "To achieve the same power, does one require a greater sample size when testing an interaction than when testing a main effect?" It does not necessarily need a bigge
43,297
Using a histogram to estimate class label densities in a tree learner
I didn't understand very well what you want to do with histograms. If you have a set of features $R_j$ and you are able to generate a split $s$ you can compute $Q(R_j,s)$ easily.Given the split you directly have the two subset of records $R_{jls}$ and $R_{jrs}$ and you need only to compute the probability distribution across classes over these three sets. More specifically you only need: $$p_i^j \ \ i=1,\dots,K$$ $$p_i^{jls} \ \ i=1,\dots,K$$ $$p_i^{jrs} \ \ i=1,\dots,K$$ And you can compute these values counting the number of records for each class for a particular set of records. $$p_i^j = \frac{|R^i_j|}{|R_j|} $$ $$p_i^{jls} = \frac{|R^i_{jls}|}{|R_{jls}|} $$ $$p_i^{jrs} = \frac{|R^i_{jrs}|}{|R_{jrs}|} $$ Where, for example, $R_j^i$ are the records of class $i$ in the set $R_j$. You only need to keep track of the records in a node, that is associated to a set of records, and be able to find a split. If you have all the records in a particular node you might also be able to find splits, for example with an exhaustive search across all possible splits for each feature. If you have a record $(\mathbf{x},y)=(x_1,\dots,x_n,y)$ you put it in a different set according to a test on the feature $x_i$ just looking if $$x_i < \vartheta$$ (if $x_i$ is a continuous parameter) When you have a split you can compute $Q$, then varying $\vartheta$ a varying feature you can find the best split according to $Q$ measure.
Using a histogram to estimate class label densities in a tree learner
I didn't understand very well what you want to do with histograms. If you have a set of features $R_j$ and you are able to generate a split $s$ you can compute $Q(R_j,s)$ easily.Given the split you d
Using a histogram to estimate class label densities in a tree learner I didn't understand very well what you want to do with histograms. If you have a set of features $R_j$ and you are able to generate a split $s$ you can compute $Q(R_j,s)$ easily.Given the split you directly have the two subset of records $R_{jls}$ and $R_{jrs}$ and you need only to compute the probability distribution across classes over these three sets. More specifically you only need: $$p_i^j \ \ i=1,\dots,K$$ $$p_i^{jls} \ \ i=1,\dots,K$$ $$p_i^{jrs} \ \ i=1,\dots,K$$ And you can compute these values counting the number of records for each class for a particular set of records. $$p_i^j = \frac{|R^i_j|}{|R_j|} $$ $$p_i^{jls} = \frac{|R^i_{jls}|}{|R_{jls}|} $$ $$p_i^{jrs} = \frac{|R^i_{jrs}|}{|R_{jrs}|} $$ Where, for example, $R_j^i$ are the records of class $i$ in the set $R_j$. You only need to keep track of the records in a node, that is associated to a set of records, and be able to find a split. If you have all the records in a particular node you might also be able to find splits, for example with an exhaustive search across all possible splits for each feature. If you have a record $(\mathbf{x},y)=(x_1,\dots,x_n,y)$ you put it in a different set according to a test on the feature $x_i$ just looking if $$x_i < \vartheta$$ (if $x_i$ is a continuous parameter) When you have a split you can compute $Q$, then varying $\vartheta$ a varying feature you can find the best split according to $Q$ measure.
Using a histogram to estimate class label densities in a tree learner I didn't understand very well what you want to do with histograms. If you have a set of features $R_j$ and you are able to generate a split $s$ you can compute $Q(R_j,s)$ easily.Given the split you d
43,298
Twitter data and regression time series
You can use an ARMAX Model to relate the amount of new followers (y) to the number of tweets per day (x). This model will suggest the appropriate delay and response mechanism. Care should be taken to ensure that outiliers/level shifts/local time trends are correctly identified and incorporated. There may also be the need to take into account particular days of the week, particular days of the month , holiday effects et al.
Twitter data and regression time series
You can use an ARMAX Model to relate the amount of new followers (y) to the number of tweets per day (x). This model will suggest the appropriate delay and response mechanism. Care should be taken to
Twitter data and regression time series You can use an ARMAX Model to relate the amount of new followers (y) to the number of tweets per day (x). This model will suggest the appropriate delay and response mechanism. Care should be taken to ensure that outiliers/level shifts/local time trends are correctly identified and incorporated. There may also be the need to take into account particular days of the week, particular days of the month , holiday effects et al.
Twitter data and regression time series You can use an ARMAX Model to relate the amount of new followers (y) to the number of tweets per day (x). This model will suggest the appropriate delay and response mechanism. Care should be taken to
43,299
Combining n-grams
Not sure if this is what you're looking for, but you might want to look at Katz backoff. This entails training vanilla n-gram models for $1 \le n \le N$, then estimating probabilities for large n by "backing off" to an (n-1)-gram model when the n-gram in question was not observed more often than some frequency threshold.
Combining n-grams
Not sure if this is what you're looking for, but you might want to look at Katz backoff. This entails training vanilla n-gram models for $1 \le n \le N$, then estimating probabilities for large n by "
Combining n-grams Not sure if this is what you're looking for, but you might want to look at Katz backoff. This entails training vanilla n-gram models for $1 \le n \le N$, then estimating probabilities for large n by "backing off" to an (n-1)-gram model when the n-gram in question was not observed more often than some frequency threshold.
Combining n-grams Not sure if this is what you're looking for, but you might want to look at Katz backoff. This entails training vanilla n-gram models for $1 \le n \le N$, then estimating probabilities for large n by "
43,300
One standard error rule for variable selection
Isn't it as simple as calculating error of mean of $R'[T_i]$ (for a given i) using each cross validation fold as an "independent" measurement? (i.e. calculating standard deviation of $R'[T_i]$ (across K folds) and then dividing by $\sqrt{K-1}$ gives a reasonable resampling-based proxy of that standard error)
One standard error rule for variable selection
Isn't it as simple as calculating error of mean of $R'[T_i]$ (for a given i) using each cross validation fold as an "independent" measurement? (i.e. calculating standard deviation of $R'[T_i]$ (across
One standard error rule for variable selection Isn't it as simple as calculating error of mean of $R'[T_i]$ (for a given i) using each cross validation fold as an "independent" measurement? (i.e. calculating standard deviation of $R'[T_i]$ (across K folds) and then dividing by $\sqrt{K-1}$ gives a reasonable resampling-based proxy of that standard error)
One standard error rule for variable selection Isn't it as simple as calculating error of mean of $R'[T_i]$ (for a given i) using each cross validation fold as an "independent" measurement? (i.e. calculating standard deviation of $R'[T_i]$ (across