1
$\begingroup$

I'm analyzing a dataset with a set of binary predictors and a binary response variable using logistic regression.

The response variable equals 1 only if some variable $x=1$, so there is a clear link between these variables. However, both in models with single or multiple predictors, the coefficient of that variable is not significant (has high standard error).

Minimal reproducible example in R:

data<- data.frame(x=c(rep(0,10),rep(1,10)), y=c(rep(0,12),rep(1,8)))
model<- glm(y~x,data=data,family=binomial(link="logit"))
summary(model)
Coefficients:
            Estimate Std. Error z value Pr(>|z|)
(Intercept)   -20.57    1773.04  -0.012    0.991
x              21.95    1773.04   0.012    0.990

Is logistic regression inappropriate for such data? Models with this predictor explain the most variance, but reporting results with the coefficient of the most important predictor that is non-significant seems incorrect. Is there a proper way to indicate a link between such variables?

$\endgroup$
2

1 Answer 1

0
$\begingroup$

A couple notes first regarding your questions:

Is logistic regression inappropriate for such data?

In theory, yes.

Models with this predictor explain the most variance, but reporting results with the coefficient of the most important predictor that is non-significant seems incorrect.

This is not true. You should always report the results of your pre-specified model because it is a true test of your hypothesis rather than an attempt at a fishing expedition for $p$ values.

On to your major problem here. It looks like your data has a case of quasi-complete separation. Inspecting the data directly shows us this:

> data
   x y
1  0 0
2  0 0
3  0 0
4  0 0
5  0 0
6  0 0
7  0 0
8  0 0
9  0 0
10 0 0
11 1 0
12 1 0
13 1 1
14 1 1
15 1 1
16 1 1
17 1 1
18 1 1
19 1 1
20 1 1

Which shows that only two cases are not the same as the others. The model is consequently unreliable and should be abandoned. Some possible options are discussed here and the linked article above. Probably your best bet is a penalized model or a Bayes model with very precise priors, but that won't guarantee a good model, only the chance of one.

$\endgroup$
1
  • $\begingroup$ Very precise priors are not needed! All you need is a normal prior with mean = 0 and standard deviation of 2 applied on the logit scale. A prior like this is not very informative. It only prevents the sampler from spending too much time exploring the areas close to +/- infinity. $\endgroup$
    – Stefan
    Commented Feb 23 at 15:29

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.