# Tag Info

54

It is very unfortunate that McNemar's test is so difficult for people to understand. I even notice that at the top of its Wikipedia page it states that the explanation on the page is difficult for people to understand. The typical short explanation for McNemar's test is either that it is: 'a within-subjects chi-squared test', or that it is 'a test of the ...

50

It gave the warning because many of the expected values will be very small and therefore the approximations of p may not be right. In R you can use chisq.test(a, simulate.p.value = TRUE) to use simulate p values. However, with such small cell sizes, all estimates will be poor. It might be good to just test pass vs. fail (deleting "no show") either with ...

36

We use these tests for different reasons and under different circumstances. $z$-test. A $z$-test assumes that our observations are independently drawn from a Normal distribution with unknown mean and known variance. A $z$-test is used primarily when we have quantitative data. (i.e. weights of rodents, ages of individuals, systolic blood pressure, etc.) ...

35

Short answer: you can't. There is no statistical test that will tell you whether a predictor that contains the integers between 1 and 10 is a numeric predictor (e.g., number of children) or encodes ten different categories. (If the predictor contains negative numbers, or the smallest number is larger than one, or it skips integers, this might argue against ...

27

This answer is in two main parts: firstly, using linear interpolation, and secondly, using transformations for more accurate interpolation. The approaches discussed here are suitable for hand calculation when you have limited tables available, but if you're implementing a computer routine to produce p-values, there are much better approaches (if tedious when ...

27

The issue is that the chi-square approximation to the distribution of the test statistic relies on the counts being roughly normally distributed. If many of the expected counts are very small, the approximation may be poor. Note that the actual distribution of the chi-square statistic for independence in contingency tables is discrete, not continuous. The ...

24

Well, it seems I've made a hash of this. Let me try to explain this again, in a different way and we'll see if it might help clear things up. The traditional way to explain McNemar's test vs. the chi-squared test is to ask if the data are "paired" and to recommend McNemar's test if the data are paired and the chi-squared test if the data are "unpaired". ...

23

Pearson's 1900 paper is out of copyright, so we can read it online. You should begin by noting that this paper is about the goodness of fit test, not the test of independence or homogeneity. He proceeds by working with the multivariate normal, and the chi-square arises as a sum of squared standardized normal variates. You can see from the discussion on ...

22

In applied statistics, chisquared test statistics arise as sums of squared residuals, or from sums of squared effects or from log-likelihood differences. In all of these applications, the aim is to test whether some vector parameter is zero vs the alternative that it is non-zero and the chisquare statistic is related to the squared size of the observed ...

20

There is a misunderstanding here. The difference between the null deviance and the model's deviance is distributed as a chi-squared with degrees of freedom equal to the null df minus the model's df. For your model, that would be: 1-pchisq(256600 - 237230, df=(671266 - 671263)) # [1] 0 By default, pchisq() gives the proportion of the distribution to the ...

20

You can use an offset: glm with family="binomial" estimates parameters on the log-odds or logit scale, so $\beta_0=0$ corresponds to log-odds of 0 or a probability of 0.5. If you want to compare against a probability of $p$, you want the baseline value to be $q = \textrm{logit}(p)=\log(p/(1-p))$. The statistical model is now \begin{split} Y & \sim \...

17

1) The Kolmogorov-Smirnov can still be used, but if you use the tabulated critical values it will be conservative (which is only a problem because it pushes down your power curve). Better to get the permutation distribution of the statistic, so that your significance levels are what you choose them to be. This will only make a big difference if there are a ...

17

There are some common misunderstandings here. The chi-squared test is perfectly fine to use with tables that are larger than $2\!\times\! 2$. In order for the actual distribution of the chi-squared test statistic to approximate the chi-squared distribution, the traditional recommendation is that all cells have expected values $\ge 5$. Two things must be ...

17

There may be some confusion about term "Barnard"s test or "Boschloo"s test. Barnard's exact test is an unconditional test in the sense that it does not condition on both margins. Therefore, both the second and third bullets are Barnard's test. We should instead write: Both margins fixed (Hypergeometric Dist'n)→Fisher's exact test One margin fixed (Double ...

17

F tables: The easiest way of all -- if you can -- is to use a statistics package or other program to give you the critical value. So for example, in R, we can do this: qf(.95,5,6744) [1] 2.215425 (but you can as easily calculate an exact p-value for your F). Usually F tables come with an "infinity" degrees of freedom at the end of the table, but a few ...

15

For such small counts, you could use Fisher's exact test: > fisher.test(a) Fisher's Exact Test for Count Data data: a p-value = 0.02618 alternative hypothesis: two.sided

15

The colors represent the level of the residual for that cell / combination of levels. The legend is presented at the plot's right. More specifically, blue means there are more observations in that cell than would be expected under the null model (independence). Red means there are fewer observations than would have been expected. You can read this as ...

15

If your test statistic follows $\chi^2_1$ distribution, then you have to look at the probability of observing value $0.065$ or greater value under this distribution. Using R software to get the values you can find that probability of observing such or greater value is $0.79$ under null distribution: > 1-pchisq(0.065, df = 1) [1] 0.798761 so obviously $0.... 14 There are an infinite number of ways of being non-Gaussian. For example, you mentioned skewness and kurtosis - while those measures are certainly ways of identifying distributions that aren't Gaussian, and they can be combined into a single measure of deviation from Gaussian-ness* (and even form the basis of some common tests of normality), they're ... 14 The basic results of chi-square goodness-of-fit testing can be understood hierarchically. Level 0. The classical Pearson's chi-square test statistic for testing a multinomial sample against a fixed probability vector$p$is $$X^2(p) = \sum_{i=1}^k \frac{(X^{(n)}_i - n p_i)^2}{n p_i} \stackrel{d}{\to} \chi_{k-1}^2 \>,$$ where$X_i^{(n)}$denotes the ... 14 I'd use a permutation test instead of either the Normal approximation or the chi-square. The permutation test is exact and most powerful, conditional upon the data. In this case, we can't calculate all the permutations of the groups, but we can generate a lot of random permutations of the data and get a pretty precise value: group <- c(rep("A",90),rep("... 14 There is a fundamental confusion here: The$p$-value you got comes from the$\chi^2$test. It tells you the probability of getting a$\chi^2$statistic as extreme or more extreme than yours if the null hypothesis is true. It tells you nothing about how big the effect is. On the other hand, Cramer's$V$is a measure of effect size. It tells you how ... 14 Expected counts are the projected frequencies in each cell if the null hypothesis is true (aka, no association between the variables.) Given the follow 2x2 table of outcome (O) and exposure (E) as an example, a, b, c, and d are all observed counts: The expected count for each cell would be the product of the corresponding row and column totals divided by ... 14 Let us have a 2x2 frequency table where columns are two groups of respondents and rows are the two responses "Yes" and "No". And we've turned the frequencies into the proportions within group, i.e. into the vertical profiles: Gr1 Gr2 Total Yes p1 p2 p No q1 q2 q -------------- 100% 100% 100% n1 n2 N ... 13 The standard statistical model underlying analysis of contingency tables is to assume that (unconditional on the total count) the cell counts are independent Poisson random variables. So if you have an$n \times m$contingency table, the statistical model used as a basis for analysis takes each cell count to have unconditional distribution:$$X_{i,j} \text{... 13 You could also use coeftest from lmtestpackage: > aa <- arima(lh, order = c(1,0,0)) > coeftest(aa) z test of coefficients: Estimate Std. Error z value Pr(>|z|) ar1 0.57393 0.11614 4.9417 7.743e-07 *** intercept 2.41329 0.14661 16.4602 < 2.2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ... 13 Is chi-squared always a one-sided test? That really depends on two things: what hypothesis is being tested. If you're testing variance of normal data against a specified value, it's quite possible to be dealing with the upper or lower tails of the chi-square (one-tailed), or both tails of the distribution. We have to remember that$\frac{(O-E)^2} E$type ... 13 This turns out to be quite straightforward. This is clearly binomial sampling. There are two ways to look at it. Method 1, that of the spreadsheet, it to treat the observed counts$X_i$as$\sim \text{Bin}(N_i,p_i)$, which may be approximated as$\text{N}(\mu_i=N_i\cdot p_i,\sigma_i^2=N_i\cdot p_i(1-p_i))$. As such,$Z_i=(X_i-\mu_i)/\sigma_i$are ... 13 Yes, it's possible to do a chi-square test on this. Specifically, this is the chi-square goodness of fit test. To do it correctly you set up two cells (one for dead, one for not dead), like so: Dead NotDead Total Obs 19 101 120 Exp 12 108 120 The chi-square is$\sum_i (O_i-E_i)^2/E_i$and has$k-1$df, where$k\$ is the ...

13

What about a Poisson regression? I created a data frame containing your data, plus an index t for the time (in months) and a variable monthdays for the number of days in each month. T <- read.table("suicide.txt", header=TRUE) U <- data.frame( year = as.numeric(rep(rownames(T),each=12)), month = rep(colnames(T),nrow(T)), t = seq(0, ...

Only top voted, non community-wiki answers of a minimum length are eligible