1
$\begingroup$

enter image description here

my data looks like this:

I have two groups of people - Students and the elderly.

59 out of 266 students said "YES" 23 out of 127 elderly people said "YES"

The rest said "no"

I am trying to find out where this difference in their answers is statistically significant.

My first way was chi square test that says they are different with a p lower than 0,05. However, my binomial logit with only one independent variable brings this result result of binomial logit, meaning that the difference is not significant.

What am I missing here?

Thanks!

$\endgroup$
1
  • $\begingroup$ What is “Tarifb”? You’re right that the logistic regression test and the chi-squared test should have similar results (in fact, the chi-squared test of a $2\times2$ table is equivalent to a score test of the logistic regression slope), but, based on its name, it is not clear that the variable you included in the logistic regression is meaningful to your analysis. $\endgroup$
    – Dave
    Mar 4, 2023 at 5:57

1 Answer 1

0
$\begingroup$

I just did this myself and got totally different results from you.


x_student <- rep("student", 266)
y_student <- c(rep(0, 266 - 59), rep(1, 59))
x_elderly <- rep("elderly", 127)
y_elderly <- c(rep(0, 127 - 23), rep(1, 23))
x <- c(x_student, x_elderly)
y <- c(y_student, y_elderly)
L <- glm(y ~ x, family = binomial)
summary(L)

m <- matrix(c(
    23, 137 - 23,
    59, 266 - 59
), 2, 2)
chisq.test(m)

My chi-squared test returns a p-value of $0.253$, while my logistic regression coefficient has a p-value of $0.354$, neither of which match your work. (I could believe that I made a mistake in my code, but I think it is correct.) While these p-values are different, they are close enough, and neither signals data that are inconsistent with the implicit null hypothesis that elderly people and students respond differently to the survey. Given that both groups have about an $80/20$ split, this is not surprising, particularly since you only have a few hundred observations and, thus, not a bunch of power to detect a small difference.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.