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.