3
$\begingroup$

I have been provided a sample logistic regression as follows:

glm(formula = output ~ X1 + X2 + X3 + X4 + X5 + X1:term + term:X5 - 1, family="binomial", data=mydata)

There are a few things I'm confused by here:

1) What is going on with the X1:term + term:X5 terms? What do they mean in the context of glm()?

2) There does not seem to be an intercept term in the output under Coefficients. Could this be for any other reason than there simply not being an intercept term?

3) The AIC for the model is 50000. How should I interpret this? Can I interpret this without more models to compare to? If it is not useful, what else should I be looking for instead?

$\endgroup$

1 Answer 1

5
$\begingroup$

1) In standard R regression formulas, x1:x2 means to include a new covariate that is the product of x1 and x2. It is more common, and generally better practice, to use x1*x2, which fits main effects for x1 and x2 and interaction term between x1 and x2, i.e. x1 * x2 == x1 + x2 + x1:x2. So in this regression formula, there is no main effect of term, i.e. it is only used to alter the effect of X1 and X5. There may be some very special reason for this in this model, but it is unusual.

EDIT: As pointed out by Scortchi, if the formula contains a categorical variable (which term may well be one), then when R expands the formula, it does not chose a baseline category to drop, as the model will still be identifiable with all categories included. This may be helpful in regards to simplifying interpretation. For example, suppose I have ~ gender * treatment. Then if I want to interpret the effect of treatment on females (assuming males as baseline), I need to look at treatment + treatment:genderFemale. On the other hand, if I fit ~ gender * treatment - 1, I can look directly at genderFemale:treatment for the estimated effect of treatment on females.

2) By writing - 1, the R formula implies that no intercept should be fit. This is generally a bad idea if the covariates are all continuous, but may lead to an easier interpretation in certain cases with categorical variables.

3) AIC, for an individual model, is not particularly useful.

$\endgroup$
6
  • 1
    $\begingroup$ Run x1 <- c(1,0);model.matrix(~x1-1);model.matrix(~factor(x1)-1). What -1 does in the formula varies according to the class of x1: giving you a silly model or a harmless reparametrization. $\endgroup$
    – Scortchi
    Commented Mar 4, 2016 at 17:07
  • $\begingroup$ @Scortchi: good point. I'll edit the answer to reflect this. $\endgroup$
    – Cliff AB
    Commented Mar 4, 2016 at 17:10
  • $\begingroup$ @CliffAB Provided one more update regarding the AIC question. This may be something I should search the site for on my own for more detail. $\endgroup$
    – 114
    Commented Mar 4, 2016 at 17:19
  • 1
    $\begingroup$ @114: in regards to AIC, it is generally used to compare the predictive accuracy of two different models, although I will state that it should be used with caution. If you're not comparing two models, there's no real question to be answered regarding AIC or the like. $\endgroup$
    – Cliff AB
    Commented Mar 4, 2016 at 17:21
  • 1
    $\begingroup$ @114: In general, -1 in a formula means "drop the intercept from the model". It is not directly related to the term:X5 part of the formula. If all your covariates are numeric, then R does nothing but fit a model with no intercept. On the other hand, if there are categorical variables, R no longer drops the baseline group from the covariates, which it does by default. R drops these baseline groups be default, because otherwise the model would be unidentifiable if an intercept is included. With no intercept, the model is identifiable with the baseline groups, so they are not dropped. $\endgroup$
    – Cliff AB
    Commented Mar 4, 2016 at 17:33

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.