# Thread: Logistic regression and significance of continuous variables across 3 periods

1. ## Logistic regression and significance of continuous variables across 3 periods

I'm currently working on a logistic regression analysis in R with a binary response variable (0 = non-used; 1 = used location). I am modeling non-random habitat selection for a species of wildlife. I recently ran into an issue where I need to evaluate non-random habitat selection across 3 seasonal periods to determine if habitat selection varies by season. In other words, I need to determine if my continuous independent variables differ across 3 seasons (categorical variable with values 1-3). Would it be appropriate to build a model with the continuous independent variables and include a seasonal categorical variable into the same model? I'm not entirely sure how to evaluate whether the continuous independent variables differ across season.

results_full <- glmer(R0A1 ~ MP_Scaled+ MPHW_Scaled+ HW_Scaled +
YP_Scaled+ AG_Scaled+ Shrub_Scaled+
Season+(1|ID)+ (1|Year)+ (1|Site),
data=secondorder, family=binomial)

summary(results_full)

2. ## Re: Logistic regression and significance of continuous variables across 3 periods

not familiar with R coding, what does this part stand for "+(1|ID)+ (1|Year)+ (1|Site),".

I basic first approach may be inserting an interaction term between the continuous and trichotomized variable.

3. ## Re: Logistic regression and significance of continuous variables across 3 periods

Originally Posted by hlsmith
not familiar with R coding, what does this part stand for "+(1|ID)+ (1|Year)+ (1|Site),".

I basic first approach may be inserting an interaction term between the continuous and trichotomized variable.
Thanks for the message! The (1|ID)...etc. stand for random effects in a generalized linear mixed effects model.

The updated code that I developed after thinking about it this morning a little more is as follows:

results_full<-glmer(R0A1~MP_Scaled:Season+MPHW_Scaled:Season+HW_Scaled:Season+YP_Scaled:Season+Shrub_Scaled:Season+(1|ID)+(1|Year)+(1|Site),data=secondorder,family=binomial)
summary(results_full)

However, I'm not entirely sure if main effects need to be included into the model for logistic regression similar to ANOVA?

4. ## Re: Logistic regression and significance of continuous variables across 3 periods

I thought that is what the "|" represented, but you didn't reference this was a multilevel logistic model. Both covariates at the same level in the model? If yes, I would assume that main effects should be in the model. But I could be wrong.

Side note, should ID and Site be nested in year. I don't know your context, but ID seems like a small unit, then where, then when. But once again I could be wrong.

 Tweet