1
$\begingroup$

I am using the glmer function from the lme4 package to model nest attendance as a function of temperature, temporal variables, and experimental treatment. My model is relatively complicated — it contains multiple polynomial terms and interactions. The model is specified as:

FullModel<-glmer(Attendance~poly(TemperatureS, 2, raw=FALSE)+CoverType+poly(IncDayS,2, raw=FALSE)+poly(TimeS,2,raw=FALSE)+poly(TemperatureS,2,raw=false)*CoverType+poly(TemperatureS,2,raw=FALSE)*poly(IncDayS,2, raw=FALSE)+(1|ID), data=Attendance, family=binomial)

Where:

  • Attendance is binary (on vs. off the nest), coded as 0/1
  • Temperature is numeric
  • Incday= day of incubation, numeric
  • Time is numeric
  • CoverType is categorical with two levels
  • ID is the identity of the bird the observation is from, categorical with 14 levels

All of the numeric variables (so temperature, day of incubation, and time) have been scaled using the rescale function from the arm package, which centers and divides by 2 standard deviations, per Gelman 2007. However, when I run the model, I get the following warning message:

Warning message: Some predictor variables are on very different scales: consider rescaling

Why am I getting this warning if the numeric predictors have already been rescaled? Given that they have been scaled, is it okay to ignore this warning, or will this affect my model results?

All thoughts are greatly appreciated!

$\endgroup$
4
  • 1
    $\begingroup$ How are TemperatureS and Temperature related? IncDayS and IncDay? $\endgroup$
    – whuber
    Dec 7, 2020 at 20:12
  • $\begingroup$ How many observations do you have in each Attendance group? Is there some reason you are using polynomial terms instead of potentially more helpful restricted cubic splines? Are you sure that you need the interaction term between two polynomials (which I suspect might be leading to the warning)? $\endgroup$
    – EdM
    Dec 7, 2020 at 21:15
  • $\begingroup$ Sorry for the confusion! I shouldn't have used TemperatureS and Temperature interchangeably. Temperature is the unscaled version, TemperatureS is the rescaled version. The same goes for IncDay and IncDayS. I'm only using the rescaled versions in the models. $\endgroup$
    – C.H.
    Dec 8, 2020 at 2:24
  • $\begingroup$ @EdM, I am a relative novice when it comes to statistics and haven't heard about restricted cubic splines. I will look into those. As for the interaction term, I included it because in species similar to the one I'm studying, incubating adults have been observed leaving their nests unattended more frequently earlier on in the incubation cycle because younger embryos are less sensitive to temperature changes than older ones. Because of that, I thought it was likely that there might be a significant interaction between temperature and day of incubation. $\endgroup$
    – C.H.
    Dec 8, 2020 at 2:28

1 Answer 1

3
$\begingroup$

Before you worry too much about the warning, pay more attention to the model construction. I fear that you might have jumped into a complicated model containing interacting polynomial terms, without looking in detail at what the data themselves indicate. Look at the raw data very carefully as a function of your predictors before you proceed. A few suggestions for what to do next follow.

First, see how well a model with only linear terms for the continuous predictors might work. That would cut down the model complexity substantially and make it easier for your audience to understand. My hunch, without seeing your data, is that the warning you get arises from the interaction term between two quadratic orthogonal polynomials, which are coded internally in ways that aren't necessarily intuitive and might lead to apparent differences in scale among predictor terms. Even if you need non-linear terms for the main effects, you might be able to get away with interaction terms that only involve linear trends.

Second, if you do need to incorporate non-linear terms for continuous predictors, it's usually better to use restricted cubic splines. Forcing a quadratic fit can give poor fit at the extremes of the data range. A restricted cubic spline with 3 knots will give a smooth, flexible fit between the outermost knots and a simple linear fit outside those knots, while only using up 1 more degree of freedom than a linear fit. They are simply provided, for example, by the rcs() function in the R rms package. I suspect that a model (1) replacing the polynomial terms with splines and (2) limiting the interactions to linear terms will remove your warning.

Third, in terms of the model itself, try to get some local statistical support. For example, there's both an IncDayS and a TimeS predictor. It's not clear what different processes those 2 time-related predictors are capturing, and if they are highly correlated then the model results might be hard to interpret. I also wonder whether this might be better described by a repeated-events survival model. Those issues might need expert help from someone you can work closely with.

Fourth, devote some effort to becoming less of a novice in statistics. As you know, properly performed biological field studies depend on a detailed understanding of the subject matter, which continues to develop over time. Proper experimental design and analysis of results similarly depend on an understanding of statistical principles. You don't need to become a professional statistician yourself, but you do need to know enough to handle simple designs, to know when to seek outside help, and how to talk intelligently with an expert when needed. An Introduction to Statistical Learning is one free and accessible reference. Look over the resources provided by Frank Harrell under the RMS (Regression Modeling Strategies) and BBR (Biostatistics for Biomedical Research) headings. Consult the R Companion for the Handbook of Biological Statistics.

$\endgroup$
3
  • $\begingroup$ Thank you for this advice. I didn't include this in the original post for the sake of brevity, but the polynomial terms were chosen after plotting the data and observing a nonlinear relationship. I created competing models using the linear vs. polynomial term for each variable using AICc, and the polynomial terms outperformed the linear terms. I thought, based on the thread linked below, that I needed to use polynomial terms in the interaction if polynomial terms were used with those main effects. But, if that is not the case, then I will try using just linear predictors in the interaction. $\endgroup$
    – C.H.
    Dec 9, 2020 at 14:42
  • $\begingroup$ All variables were checked for multicollinearity using both Spearman's rank correlation prior to model building and by checking the vif of the model. In addition to adjusting the interaction term to contain just the linear versions of the predictors, I will switch to using restricted cubic splines for the nonlinear terms. Thank you again for taking the time to answer my question. Link to thread referenced in my previous comment: stats.stackexchange.com/questions/51985/… $\endgroup$
    – C.H.
    Dec 9, 2020 at 14:42
  • $\begingroup$ @C.H. my answer could be seen to underplay the importance of evaluating the high-order interaction terms; my intent was that you should evaluate whether omitting those terms made any substantive difference in the model. A useful compromise with two interacting flexibly transformed continuous predictors (splines, polynomials, etc), recommended by Frank Harrell in Section 2.7.2 of his course notes, is to specify an interaction of one predictor in its untransformed form with the nonlinear transformation of the other, and also vice-versa. $\endgroup$
    – EdM
    Dec 9, 2020 at 15:08

Your Answer

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

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