# Tag Info

22

I am going to reverse-engineer this from experience with discrimination cases. I can definitely establish where the values of "one in 741," etc, came from. However, so much information was lost in translation that the rest of my reconstruction relies on having seen how people do statistics in courtroom settings. I can only guess at some of the details. ...

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 ...

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 ...

12

Different visuals will be better at highlighting different features, but Mosaic plots work well for a general view (checking to see if anything stands out). Maybe that's what you meant by dodged bar plot. Like most options, they're not symmetric in that they represent relative frequencies better in one dimension than the other. A nice feature is that the ...

12

Ultimately, it's apples and oranges. Logistic regression is a way to model a nominal variable as a probabilistic outcome of one or more other variables. Fitting a logistic-regression model might be followed up with testing whether the model coefficients are significantly different from 0, computing confidence intervals for the coefficients, or examining how ...

12

Your 2-sided test implicitly allots exactly half of your 5% significance level to "masks are harmful" ($M_-$) and the other half to "masks are beneficial" ($M_+$). To a Bayesian like Taleb that might suggest that you aren't properly thinking about your prior, because it implies that the amount of evidence it would take you to accept $M_-$ ...

11

The first test tells you that the odds ratio between A and B, ignoring C, is different from 1. Looking at the stratified analysis helps you decide whether it's all right to ignore C. The CMH test tells you that the odds ratio between A and B, adjusting for C, is different from one. It returns a weighted average of the stratum-specific odds ratios, so if ...

11

In the $2\times 2$ case the distributional assumption is given by two independent binomial random variables $X_1 \sim Bin(n_1, \theta_1)$ and $X_2 \sim Bin(n_2, \theta_2)$. The null hypothesis is the equality $\theta_1=\theta_2$. But Fisher's exact test is a conditional test: it relies on the conditional distribution of $X_1$ given $X_1+X_2$. This ...

11

I don't see a big difference in the results: d = read.table(text="Group Black Red A 296 14 B 292 16 C 301 7 D 289 23", header=T) chisq.test(d[,2:3]) # Pearson's Chi-squared test # # data: d[, 2:3] # X-squared = 8.893, df = 3, p-value = ...

10

Fisher's so-called "exact" test makes the same kind of subtle assumptions that $\chi^2$ tests make. The two variables being assessed for association are truly polytomous all-or-nothing variables such as dead/alive US/Europe. If one or both of the variables is a simplification of an underlying continuum, categorical data analysis should not be undertaken at ...

10

The solution depends intimately on how the data were collected and summarized. This answer takes you through a process of thinking about the data, analyzing them, reflecting on the results, and improving the test until some insight is achieved. Along the way we develop and compare five variants of the $\chi^2$ test. Fisher's test is not applicable because ...

10

There isn't going to be a one-size-fits-all solution here. If you have a very simple table (e.g., $2\times 2$), simply presenting the table is probably best. If you want an actual figure, mosaic plots (as @xan suggests) are probably a nice place to start. There are some other options that are analogous to mosaic plots, including sieve plots, association ...

9

To complement @gung's and @xan's answers, here's an example of mosaic and association plots using vcd in R. > tab period activity morning noon afternoon evening feed 28 4 0 56 social 38 5 9 10 travel 6 6 14 13 To obtain the plots: require(vcd) mosaic(tab, shade=T, legend=T)...

9

I agree that the "best" plot doesn't exist independent of dataset, readership and purpose. For two measured variables, scatter plots are arguably the design that leaves all others in its wake, except for specific purposes, but no such market leader is evident for categorical data. My aim here is just to mention a simple method, often re-discovered ...

9

They are asymptotically the same. They are just different ways of getting at the same idea. More specifically, Pearson's chi-squared test is a score test, whereas the G-test is a likelihood ratio test. To get a better sense of those ideas, it may help you to read my answer here: Why do my p-values differ between logistic regression output, chi-squared ...

8

What you are asking for here is a post-hoc power analysis. (More specifically, "the probability of correctly rejecting the null hypothesis" is the power, and 1-power is beta, "the probability of a type-II error". You ask for both, but we only need one to know the other.) We take your existing dataset as the alternative hypothesis / model of the true data ...

8

You need McNemar's test (http://en.wikipedia.org/wiki/McNemar%27s_test , http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3346204/). Following is an example: 1300 pts and 1300 matched controls are studied. The smoking status is tabled as follows: Normal |no |yes| Cancer|No |1000|40 | |Yes |200 |60 | Each entry of the table ...

8

To analyze a multi-way contingency table, you use log-linear models. In truth, log-linear models are a special case of the Poisson generalized linear model, so you could do that, but log-linear models are more user-friendly. In Python, you may need to use the Poisson GLM, as I gather log-linear models may not be implemented. I will demonstrate the log-...

7

The "focal" association between category $i$ of one nominal variable and category $j$ of the other one is expressed by the frequency residual in the cell $ij$, as we know. If the residual is 0 then it means the frequency is what is expected when the two nominal variables are not associated. The larger the residual the greater is the association due to the ...

7

A lot of the time, you may not need to do anything. The "5" rule is overly conservative, and there are a number of less restrictive (but somewhat more complex) guidelines to be found in the more recent literature (where 'more recent' means 'over the last half century or more'). For example, if all your cells have expected higher than 1 and about 80% are ...

7

I've looked into it using [R], and I am a bit surprised to see no packaged formula readily accessible for a test that is ubiquitous in the medical sciences. So it takes some minimal tweaking. First off, the link in my comment to the OP is excellent, providing a makeshift formula; however, the following is an example using well-known formulas in [R]: 1. ...

7

The paradox is that there exist 2x2x2 contingency tables (Agresti, Categorical Data Analysis) where the marginal association has a different direction from each conditional association [...] Am I missing a subtle transformation from the original Simpson/Yule examples of contingency tables into real values that justify the regression line visualization? ...

6

They measure slightly different things and need not give the same answers. Chi-square measures association. It treats neither variable as dependent or independent. It can handle mxn tables, where the only limit is sample size, and gives one statistic for the whole table which is relatively easy to interpret. Logistic regression does treat one variable as ...

6

The table tells you a great deal. Let's begin with the first rule of data analysis: draw a picture. par(mfrow=c(1,2)) Test.1 <- table(exampledata1$Group, exampledata1$Test.1) Test.2 <- table(exampledata1$Group, exampledata1$Test.2) mosaicplot(Test.1 ~ Group, data=exampledata1, col=c("gray", "tan")) mosaicplot(Test.2 ~ Group, data=exampledata1, col=c("...

6

The formula for the standardized residuals is: \begin{align}\text{Pearson's residuals}\,&=\,\frac{\text{Observed - Expected}}{ \sqrt{\text{Expected}}}\\ d_{ij}&=\frac{n_{ij}-m_{ij}}{\sqrt{m_{ij}}} \end{align} where $m_{ij} = E( f_{ij})$ is the expected frequency of the $i$-th row and the $j$-th column. The sum of squared standardized ...

6

The Fisher's Exact Test is a test of the odds ratio. If the contingency table has values enumerated by: $$\begin{array}{c|cc} & Y & \bar{Y} \\ \hline X & a & b \\ \bar{X} & c & d \end{array}$$ Then the odds ratio is given by $$OR = \dfrac{ad}{bc}$$ And you can see the OR is the same if the contingency table is "transposed", \$OR = ...

6

The names row variable and column variable work fine for me, if indeed names are needed at all. It is perhaps more common, and typically more helpful, to refer to the names of the variables (gender, tree species, enjoyment of movie, attitude to some proposal, or whatever). Which is presented in rows and which in columns is immaterial to the analysis of ...

6

First, there is no reason to use the original Bonferroni Correction any more. As the Wikipedia page notes, the Holm modification to the that method is uniformly more powerful while maintaining the same control over family-wise error rate. There are extensions and alternatives that might provide even better power. Second, I personally find false-discovery ...

5

Quoting from the documentation (help(escalc)): Cell entries with a zero count can be problematic, especially for the relative risk and the odds ratio. Adding a small constant to the cells of the 2x2 tables is a common solution to this problem. When to="only0" (the default), the value of add (the default is 1/2) is added to each cell of those 2x2 tables ...

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