1

I am performing a linear mixed-effect model.

library(readr)
library(nlme)
data = read_csv('data/data.csv') #131 observations, 22 variables
head(data)

states year green…¹ it preCAPE prePr preRH preTEMP preVPD preWS <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 AK 2011 4.61 49.6 0.056 -20.3 -1.74 -7.22 0.015 0.59 2 AK 2013 19.1 26.4 13.8 6.38 1.39 3.54 -0.018 -3.17 3 AK 2003 0.605 23.0 -3.37 -4.12 -1.31 -9.16 0.052 7.51 4 NJ 2007 10.9 14.5 7.22 -5.28 -1.55 -4.87 0.044 1.61 5 WY 2004 2.74 14.5 -0.533 -20.8 -0.01 -5.09 0.016 1.54 6 AK 2001 -4.39 13.2 -9.65 52.3 -0.71 6.80 -0.061 7.89

lmm <- lme(greenup ~ preCAPE+prePr+preRH+preTEMP+preWS, data = data, random = ~1+preCAPE+prePr+preRH+preTEMP+preWS|states, method = 'ML', control = lmeControl(opt = "optim", msMaxIter=1000, maxIter = 1000, msMaxEval = 1000))

I get this error

Error in solve.default(pdMatrix(a, factor = TRUE)) : 
  system is computationally singular: reciprocal condition number = 3.08241e-44

I have used 5 variables in the linear mixed effect model for 131 observations. If I include the variable preVPD, I have 6 variables for 131 observations and everything works out well.

lmm <- lme(greenup ~ preCAPE+prePr+preRH+preTEMP+preVPD+preWS, data = data, random = ~1+preCAPE+prePr+preRH+preTEMP+preVPD+preWS|states, method = 'ML', control = lmeControl(opt = "optim", msMaxIter=1000, maxIter = 1000, msMaxEval = 1000))

These are the correlations between variables

> cor(postSM.early$preVPD, postSM.early$preCAPE)
[1] 0.2326779
> cor(postSM.early$preVPD, postSM.early$prePr)
[1] -0.1834306
> cor(postSM.early$preVPD, postSM.early$preRH)
[1] -0.6796942
> cor(postSM.early$preVPD, postSM.early$preTEMP)
[1] 0.8591199
> cor(postSM.early$preVPD, postSM.early$preWS)
[1] -0.144461
> cor(postSM.early$preCAPE, postSM.early$prePr)
[1] 0.5014529
> cor(postSM.early$preCAPE, postSM.early$preRH)
[1] -0.1001166
> cor(postSM.early$preCAPE, postSM.early$preTEMP)
[1] 0.2592998
> cor(postSM.early$preCAPE, postSM.early$preWS)
[1] 0.3096927
> cor(postSM.early$prePr, postSM.early$preRH)
[1] 0.4004015
> cor(postSM.early$prePr, postSM.early$preTEMP)
[1] 0.008052118
> cor(postSM.early$prePr, postSM.early$preWS)
[1] 0.5471488
> cor(postSM.early$preRH, postSM.early$preTEMP)
[1] -0.3157974
> cor(postSM.early$preRH, postSM.early$preWS)
[1] 0.08955221
> cor(postSM.early$preTEMP, postSM.early$preWS)
[1] -0.07545749

I have looked at this but it does not help. How can I fix this?

Edit: Here is a link to the data.

Thomas
  • 528
  • 1
    your model is presumably extremely complicated, with a lot of r.e. – utobi Nov 13 '22 at 12:21
  • also, can you tell something about the data? – utobi Nov 13 '22 at 12:22
  • I have added some data information. Data is generally standardized to the mean. Should I standardize it even further e.g. with the range? I do not understand the complexity of the model may influence. Model 1 excl. VPD gives me an error but model 2 incl. VPD as a parameter does not give me an error? Is model 2 not more complex? – Thomas Nov 13 '22 at 13:28
  • 1
    That is certainly unusual. Perhaps if you can share the data, ideally with dput() someone might be able to track down the issue. For what it is worth I do not think this is a programming issue, there is a statistical question hiding here. – mdewey Nov 13 '22 at 16:46
  • I have added a link to my data used here @mdewey. I still get the same error. – Thomas Nov 14 '22 at 08:11
  • 2
    I cannot post an answer while this is closed and I am not sure I have tracked down the exact cause but the bottom line as @utobi suggested is that you are trying to fit a complex pattern of random effects (re). If you delete either PR or WS from the random effect formula the model converges. However in the one case the re are negligible and virtually uncorrelated in the other the re are larger but highly correlated. Why adding a sixth term helps is anybody's guess. Incidentally I have used here the variable names from the data you posted not the ones in your question here. – mdewey Nov 14 '22 at 13:47
  • A site search finds 16 answers -- perhaps one of them will help you. – whuber Nov 15 '22 at 17:00

0 Answers0