# Tag Info

12

In a classical hypothesis test, you have a test statistic that orders the evidence from that which is most conducive to the null hypothesis to that which is most conducive to the alternative hypothesis. (Without loss of generality, suppose that a higher value of this statistic is more conducive to the alternative hypothesis.) The p-value of the test is the ...

11

This is a special case of a real symmetric quadratic form $\mathbf{x^\prime \mathbb{Q} x},$ where $$z(x+y) + yz = xy+yz+xz= \frac{1}{2}\pmatrix{x,&y,&z}\pmatrix{0&1&1\\1&0&1\\1&1&0}\pmatrix{x\\y\\z}.$$ We find its eigenvalues $\lambda$ by solving its characteristic equation $$p_{\mathbb Q}(\lambda) = \det\left(\mathbb{Q} - \... 8 ... [0.5] would be the probability that I observed the data in question isn't quite right. It's really the probability of occurrence of a more extreme value than your observed value of the test statistic if the null hypothesis held; see the Wikipedia page, for example. If the null hypothesis holds, then the p-values of your statistic have a uniform ... 7 The Pearson test is popular because it's simple to compute - it's amenable to hand-calculation even without a calculator (or historically, even without log-tables) - and yet generally has good power compared to alternatives; the simplicity means it continues to be taught in the most basic subjects. There might be argued that there's an element of ... 7 Poisson regression. Here is an example of a potential table you may be describing. category method 1 2 3 4 hand 101 210 590 99 machine 97 401 403 99 A poisson regression with additive effects should yield the same expected cell count as the chi-square procedure. Here is how we would fit the model and make the expected cell ... 7 By inspection, it is pretty clear that Cat is under-represented in the second database. Let's see how that plays out in a chi-squared test of your 2\times 4 contingency matrix. db1 = c(22000, 2300, 42009, 106000) db2 = c( 380, 30, 7, 260) MAT= rbind(db1,db2); MAT [,1] [,2] [,3] [,4] db1 22000 2300 42009 106000 db2 380 30 ... 6 The chisquare function tests given counts against expected counts. That's not what you intend. You're testing a contingency table. Use the chi2_contingency function with takes a table (nested array) as input and returns: chi2: float The test statistic. p: float The p-value of the test dof: int Degrees of freedom expected: ndarray, same ... 6 Despite the title -- which is software-specific -- there are some statistical issues within this thread. A probability density necessarily integrates to 1 over the range of the data. In your case the empirical range is about 1 or 2 \times 10^{-3} or more plainly about 0.001 or 0.002. So the average density should be between 1000 and 500, which ... 5 You're right; there's nothing special in terms of likelihood about 100 heads. You're right about that. One deserves to get equally excited about 20 heads, then 3 tails, then 6 more heads, then all tails. This leads to my slant on this, based on Bayes' rule: seeing 100 heads in a row leads us to doubt our certainty that it's a fair coin with f=0.5—our ... 4 You have a contingency table. Under the null hypothesis where there is no relationship between column and row variable, each cell count can be estimated from its row * column probability as you have in the code. When you simulated the data by using a random uniform distribution, you basically cut the counts without consideration for the row or column ... 4 That's true, the intercept is significant (the expected naive value is not 0), but there's no significance in the effect of the region over the intercept. Actually your emmeans is showing values close to 1. {Hint: Make histograms/boxplots/distribution plots with Distance as numerical variable stratified by region. Are you able to see differences between them ... 4 A \chi^2-test would be the obvious choice, especially since you do not seem to have a problem with small cell counts. 4 An algebraically equivalent model (with the random error term \epsilon explicitly added) is$$\begin{aligned} x(t) &= A_0 + A\left[\cos(\phi)\sin(\omega \, t) + \sin(\phi)\cos(\omega\, t)\right] + \epsilon\\ &= \beta_0 + \beta_1\sin(\omega \, t) + \beta_2 \cos(\omega\, t) + \epsilon \end{aligned}$$where$$\begin{aligned} A_0 &= \beta_0\\ A &...

3

Assuming the outcome is the proportion of correct individual answers to each of three independant questions or groups of questions without any ordering, one way to compute the sample size required to achieve a given statistical power is to rely on the chi-squared test. From there on, the effect size can be defined in two different ways. The first approach is ...

3

You can perform the goodness of fit test. Given two vectors of data you test, through the chi-squared test, if they are significantly different or, given a vector of data, you test if their frequencies significantly differ from a given vector of probabilities. Data comparison: x1 = c(100, 300, 400, 200) x2 = c(101, 302, 399, 202) chisq.test(x=x1,y=x2) ...

3

I tend to think that with such a big contingency table there must be some structure to the table, so the null hypothesis of independence is really void if interest. But the chi-square test of independence can be calculated, it is not meaningless, it just seems a waste of time. If you go that way, you might have problems with the chisquare approximation ...

3

The choice of analytic approach is a bit too arbitrary for my taste, which raises the question of why was matching done on variables that are so very easy to adjust for as covariates using a flexible nonlinear function of age. I am assuming that no observations were discarded during the matching process (which would have made matching an even worse choice). ...

3

I would consider this to be a natural experiment. While sometimes the separation into groups is geographic (see, e.g., https://en.wikipedia.org/wiki/Natural_experiment#History), other times the separation into groups is temporal (e.g., https://en.wikipedia.org/wiki/Natural_experiment#Smoking_ban) or otherwise. You could also see this as a quasi-experiment (...

3

Looking at your residuals table you are actually considering more species than birds alone. Nasty little buggers won't let your feeding trays alone? Seriously though, personally I usually compare the observed table with the expected table directly to see where the changes are (provided of course that I have reasons to reject the null hypothesis of ...

3

The G-test has become a favorite of mine for proportion testing. ;) The way it works is by fitting a (multinomial) logistic regression model with a factor variable as a predictor, plus an intercept. Then it fits an intercept-only model. Finally, it performs a likelihood ratio test of the factor variable by comparing the two models. (I have verified this with ...

3

The (Pearson) $\chi^2$ test is a test of independence which has nothing to do with agreement. The $\chi^2$ test assigns the same $p$-value to two raters who agree 100% of the time as to two raters who disagree exactly 100% of the time. The Kappa only classifies the first scenario as high agreement.

3

Arya's answer is great. I'll offer the frequentist take. First off, all outcomes are not equiprobable under common assumptions. Some sequences are equivalent under the assumption that the former flip tells you nothing about the next flip. If this is a dubious assumption, then we could talk about probabilities of sequences, but under this assumption its ...

3

When the data are in a contingency table, the formula to use is $df = (r-1)(c-1)$ where $r$ is the number of rows and $c$ is the number of columns. So in this particular case the answer will be 6.

3

This isn't going to work, for three reasons That's not the test that cox.zph does. It hasn't been for years (as the comments point out). It now does the actual score test. You're looking at the correlation between the Schoenfeld residuals and time; the default in cox.zph is to use the Kaplan-Meier estimator instead of just time. You can't get around the ...

2

What you propose looks OK. Since there is no estimated parameters, the number of degrees of freedom should be $10000 - 1$. Then you can find p-values from the $\chi^2_{9999}$ distribution. But your last paragraph indicated the setting is different: I can get alerts when a drive is above a threshold number of fragments relative to the number of fragments ...

2

Just in case anyone is looking for the Python version of this, you can use scipy ch2_contingency: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.chi2_contingency.html Using the same example as @Henry import numpy as np from scipy.stats import chi2_contingency obs = np.array([[10, 72], [20, 69]]) chi2, p, dof, ex = chi2_contingency(obs) ...

2

There can be a lot of confusion about $\chi^2$ tests, as they appear in any application that involves sums of independent normally distributed random variables. The first version is the standard test for a contingency table or similar comparisons of known against expected values. The second version seems to be an application of minimum chi-square estimation, ...

2

Histograms, KDEs and ECDFs for comparing a sample to a distribution. Often (sample) empirical CDFs (ECDFs) give a better idea of the CDF of a population than histograms do at suggesting the density function. [To make an ECDF of a sample of size $n,$ sort the data, start at $0$ height at the left, increment upwards by $1/n$ at each sorted data point, ending ...

2

In situations where providing code is helpful, it is almost always better for it to be code that actually runs. It's not just a matter of one_side_normal not being defined, you also don't say how you handle values over 4, which will give an error in hist However, in this case the answers are simple enough. Firstly: Your code rejects the null hypothesis ...

2

The "exactness" of Fisher's test depends on the assumption that each of the row totals and column totals (the "margins") is given as part of the experimental design. That's what's meant by "fixed marginal distributions." In that case the distribution of counts among cells exactly follows a hypergeometric distribution. For ...

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