2022-12-21

How to handle Nas in Lme4

I am using lme4 R package, but I have NA values in data. I am running the command given below (where, Rtot contains some NaN values.)

 event_lme <- lmer(Rtot ~1 + (1 |EQID))
  

Rtot contains some NaN values.

When I run this it gives me this error :

"Error in KhatriRao(sm, t(mm)) : (p <- ncol(X)) == ncol(Y) is not TRUE"

I don't want to drop NA values. Ultimately I am looking for ranef(event_lme) which will have NA values at appropriate places.

Here is a subset of my data

Rtot EQID
NA 127
NA 30
0.058011 151
NA 127
0.5780 1135
0.3306 127
First 1135
0.208 1039
0..057 30

Please advise how to resolve this.

Thanks



No comments:

Post a Comment