I use SAS to fit a simple mixed model where there is nested random effects of Block within Location like this:

proc mixed data = SAS_R_1;
  class Location Block Trt;
  model Adj = Location Trt Location*Trt;
  random Block(Location);

There is a lot of output but I focus mostly on the random effects covariance estimates:

Covariance Parameter Estimates

Cov Parm        Estimate

Block(Location) 0.005619
Residual        0.03458

Then I try the same mode in R/lmer:

mymodel <- lmer(Adj ~ Location * Trt + (1|Location/Block), dt

but this raises a warning:

Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?
2: In as_lmerModLT(model, devfun) :
  Model may not have converged with 1 eigenvalue close to zero: 8.4e-10

Can I ignore this warning ?

In R my data looks like this:

  Location Block Trt    Adj
1        A     1   3 3.1645
2        A     1   4 3.1250
3        A     1   2 3.1594
4        A     1   1 3.2500
5        A     2   2 2.7130
6        A     2   1 3.2028

The full dataset is here: https://www.mediafire.com/file/afvgxc3y1xmekx9/SAS_R_1.csv/file

Any help will be very gratefully received.

  • 1
    $\begingroup$ I don't know the details of how R and SAS try to make the model converge (there may be different defaults) but I would never ignore a warning. Investigate. Then you might do something about it or not, but don't just ignore it. Are your variables on different scales? Are there any warnings in the voluminous SAS output? (There are some good papers from people at SAS about warnings and problems in PROC MIXED. $\endgroup$
    – Peter Flom
    Commented Nov 20, 2023 at 11:58

1 Answer 1


Can I ignore this warning ?

You certainly can, but I doubt that would be a good idea.

The problem you have encountered seems to be due to the way the variables are coded. If we look at a cross tabulation for the random effect factors, we obtain:

df <- read.csv("SAS_R_1.csv")
df$Location <- as.factor(df$Location)
df$Block <- as.factor(df$Block)
df$Trt <- as.factor(df$Trt)

xtabs( ~ Location + Block, data = df)

Location 1 2 3
       A 4 4 4
       B 4 4 4
       C 4 4 4
       D 4 4 4
       E 4 4 4
       F 4 4 4
       G 4 4 4
       H 4 4 4
       I 4 4 4

Notice that every block "belongs" to all locations. This looks at first site like these should be crossed random effects, but since you say that blocks are nested within locations, this means the coding of the blocks is not unique across different locations. So you could create a new variable equal to Location:Block, or you can just use Location:Block as the factor for random intercepts:

lmer(Adj ~ Location * Trt + (1|Location:Block), data = df)

and this converges normally and results in the following random effects estimates:

Random effects:
 Groups         Name        Std.Dev.
 Location:Block (Intercept) 0.07496 
 Residual                   0.18595 

which are the same as your estimates from SAS (note that SAS outputs variances by default whereas lmer outputs standard deviations.


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