New answers tagged

3

It would help to add the context in which you saw this. I've seen it used in the case of Deviance Goodness of Fit Tests for GLM. My answer is inspired by that. A chisquare's mean is equal to it's degrees of freedom (depending on the scenario, this could be number of data points less one, but if the model has parameters then it would be data points - ...


0

The Beta is not the appropriate way to model this in my opinion. Using a GAM. Let's set up the problem library(tidyverse) library(mgcv) year<- c(2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2014,2015,2016) females<- c(4503,4500,3345,3408,1903,4398,2784,4607,3714,3934,1488,551,1591,2391) males<- c(1359,1360,916,827,561,745,537,759,367,...


2

Chi-squared test. I think I see what you are doing with the chi-squared test. Here are simulated data for groups A and B, with categories labeled with numbers 1 through 6. Using R statistical software, I have selected different theoretical probability apportionments to categories for the two groups. Make category counts for A and B. set.seed(528) p.a = c(....


1

A warning is not an error report. I don't think the low expected frequencies implied here are really problematic. Let's first note what should be explicit, which is that the chi-square test result is based on omitting observations that are NA on either variable, which does seem a very good idea. However, the row and column percents presented include NAs, ...


0

Personally I'd probably be fine if somebody presented this to me and said, overall this is significant, and the bar diagram shows what is responsible for the significance, so I wouldn't require additional formal tests. However, you may want to do them anyway. Here is what you can do. There are seven ways to split the four levels of age in two classes (1 vs ...


0

Thanks @StubbornAtom for the comment. Note that \begin{align*} \frac{X_{i} - \bar{X}}{\sigma} &= \frac{X_{i}}{\sigma} - \frac{\mu}{\sigma} - \frac{1}{n\sigma}\sum_{i = 1}^{n}X_{i} + \frac{\mu}{\sigma}\\ &= \frac{X_{i} - \mu}{\sigma} - \frac{1}{n}\sum_{i = 1}^{n}\frac{X_{i} - \mu}{\sigma}\\ &= Z_{i} - \frac{1}{n}\sum_{j = 1}^{n}Z_{j} \end{align*}...


0

The ability to distinguish 2 proportions depends on the precision with which you can estimate the true proportions from the observed data. That's related to the variance. Consider just a single population with 2 groups and a true proportion $p$ in group 1 and thus $(1-p)$ in group 2. If you take a sample of size $n$ from that population, the variance of the ...


0

Treating responses as nominal. Treating your Likert scale of responses 1 though 8 as categorical data: at the 5% level of significance, a chi-squared test marginally rejects (P-value 0.048) the null hypothesis that responses for 'mit' and 'ohne' have the same distributions of Likert values. ohne = c(9,11,16,11,13,13,13,10) mit = c(5 ,6, 5,12,12,27,18,11) ...


1

The error comes from: ?chisq.unif.test .... min.bin.size: The minimum number of data points to have in each bin. If bins cannot be chosen without violating this constraint, an error is generated. The default is 10. This parameter is ignored if ‘bins’ is specified. The test will bin your values and I guess with that above, ...


3

As other commentators have pointed out, Wilks' theorem (Wilks 1938) only shows that, under various regularity conditions, this statistic is asymptotically chi-squared distributed. The asymptotic result follows from taking a multivariate Taylor expansion of the log-likelihood function and looking at what happens when the MLE is a critical point of the ...


2

That is a large topic, and the quality of the approximation must be studied, generally, on a case-by-case basis. That's why simulation is a useful approach. So the best way to answer your question is by an example, which you can adapt for your data and models. So I will simulate, in R, some data for a logistic regression, and I will simulate binomial ...


1

Goodness of fit is usually meant as an expression to test whether the model is sufficiently likely to be not too incorrect. If the description of your data and the parametrization is correct, then $\chi^2$ minimization allows of the strongest tests that exists. It consists of two parts: analyze the distribution of the standardized residuals as you ...


0

You are doing the tests correctly, mechanically. But you may or may not be doing the test you want depending on your research question. And you are certainly wrestling with what a Fisher Test does. May I suggest checking Stat's Exchange here for more info and perhaps a follow-on question there.


0

I'll let you use moment generating functions or other methods to prove that $X_i \stackrel{iid}{\sim}\mathsf{Exp}(\mathrm{rate}=1/\theta)$ implies $T = \sum_{i=1}^n X_i \sim \mathsf{Gamma}(\mathrm{shape}=n, \mathrm{rate} = 1/\theta).$ For $n=5, \theta=10, \lambda = 1/\theta = 0.1,$ the following simulation in R verifies that this 'works' for a specific ...


1

Your response variable is ordinal with three levels, so try ordinal logistic regression, two models, one with each of the competing predictors, and compare them. You can for instance evaluate each of the models with cross-validation and see which is best. Or fit one model with both predictors?


-1

To get the right sample size, you might need to use G-power for having a more accurate sample size. Your data seems to meet the chi-square assumptions. But generally in each cell, you must have a value more than 5 at least 80% of the cells must have a value more than 5.


0

I have the same problem. Using your code, if you calculate the chi-squared the hard way: chisq_res <- ((M-M.exp)^2)/M.exp + ((MN-MN.exp)^2)/MN.exp + ((N-N.exp)^2)/N.exp chisq_res = 2.83 and NOT 6. I think this is because the package expects contingency tables. But the genotype distribution is more complex. Then, as suggested by machine, you can use: ...


1

This sounds like a self-study question, so I’ll show you how to derive this. The mean is the expected value, so $\mathbb{E}X=\int_{\mathbb{R}}xf_X(x)dx$. Variance is related to the expected value of both $X$ and $X^2$: $$var(X)=\mathbb{E}[X^2]-(\mathbb{E}X)^2$$ The expected value of a transformation $g$ of a variable is given by $\int_{\mathbb{R}}g(x)f_X(x)...


1

You would expect slight differences. The Rao-Scott tests were developed (according to Alastair Scott) to give approximately correct inference for estimated population tables, so the code estimates the population table, calls chisq.test() on it, and rescales the statistic. Even for simple random sampling, this will introduce slight variations. When ...


0

Sorry, but you got it wrong. Without any constraints there is no maxent distribution, as for instance uniform distributions on $[-n,n]$ have entropies going to infinity with $n$. You must have some constraints. Typically, the constraints do not come from the data, they come from some external considerations. If you are interested in distributions on the ...


1

The chi square test chisq.test() evaluates whether the observed values in a two way contingency table are significantly different from their expected values. In the case of the posted question, the contingency table evaluated by the test looks like this, where the column dimension represents the columns from the data frame, and the row dimension of the ...


1

The general sentiment on Cross Validated is that formal goodness-of-fit testing is not helpful: either you have too few observations to reject, or you have so many that the tests become sensitive to deviations from normality that are not practically significant because your data are “close enough”. Graphical examination such as histograms, kernel density ...


0

While it's certainly unusual to see a value of exactly 0 for the chi-square statistic for Little's MCAR test, it's not impossible. It probably means there's something systematic that's ensuring that the means of observed variables for each missing data pattern are the same.


3

For an effective ad hoc test, I suggest you use height categories 'Below 16' and 'Above 16' for each type of forest. This will result in at $2 \times 2$ table with sufficiently large counts to use a chi-squared test. TBL = rbind(c(135,22), c(143,46)) cq.out = chisq.test(TBL); cq.out Pearson's Chi-squared test with Yates' continuity correction data:...


1

Since the question has sit unanswered for days, I'll try to give a (probably incomplete) answer. You can perform a chi-squared test on your data, but you need to understand which question it will answer, and it might be different than the one you are interested in. From your question, I see that you are worried that the participants in higher levels are ...


1

You cannot get exactly the same, without implementing an optimization for the MinChisq estimate of the mean of your poisson, $\hat{\lambda}$. So below is an example using the "ML" option to estimate $\hat{\lambda}$, and you still get a chi-sq test in the end. This is convenient because the MLE estimator of lambda will be the mean: set.seed(111) x.poi<-...


1

I guess you are on the right track, but I am not familiar with your data and study site, so I can't be sure. I can be sure that your terminology is not quite right. You can't use the numbers in your last row study site as expected counts because they are estimated probabilities adding to $1.$ study.site = c(0.22, 0.40, 0.01, 0.01, 0.03, 0.01, 0.00, 0.00, 0....


0

The inverse of $\Sigma_0$ can also be found by the Sherman-Morrison formula. With $\pi = (\pi_1, \ldots, \pi_{c-1})$ and $\pi_c = 1 - \pi_1 - \ldots - \pi_{c-1}$ the $(c-1) \times (c-1)$-matrix $\Sigma_0$ can be written as $$\Sigma_0 = \mathrm{diag}(\pi) - \pi \pi^T.$$ Since $1 - \pi^T\mathrm{diag}(1/\pi) \pi = \pi_c$ the Sherman-Morrison formula gives ...


3

With enough data, the tests you mention are all the same. At sample sizes this large, the binomial is very well approximated by a normal distribution with the same mean and variance. But more to your question, you could use any of those tests. Here are some results in R. results = c(5000, 500000, 6000, 499000) m = matrix(results, nrow = 2) #Chisquare ...


0

The key form you want to reach is expression (5) below. The derivation is all algebra. Assume the model $Y_i=\beta_0+\beta_1X_i+\varepsilon_i$. Then $\bar Y=\beta_0 +\beta_1\bar X+\bar\varepsilon$ so that $$Y_i-\bar Y = \beta_1(X_i-\bar X) + (\varepsilon_i-\bar\varepsilon).\tag1$$ The least squares estimators of $\beta_0$ and $\beta_1$ are, respectively, $$ ...


1

If $X$ has a chisquare distribution, then $\frac1X$ has the inverse chisquare distribution. For details see Wikipedia.


2

The F-distribution used in hypothesis testing is not the sampling distribution of the F-ratio computed in your sample. It is the sampling distribution of the F-ratio under the null hypothesis. We simply compare our computed F-ratio to the sampling distribution under the null hypothesis to assess whether our assumption about the population from which the ...


1

Match Distribution. One variable with several categories. A classic example is rolling a die and testing whether it is 'fair', which means probabilities of each of the six numbers should be the the same. Example with simulated fair die. The R procedure assumes that the null hypothesis is that probabilities of the categories are equal, if no other ...


Top 50 recent answers are included