hierarchical data - Error in R: multi effects models -


i'm having few issue's i'd appreciate with.

 head(new.data)   wsz_code treatment_code year month tthm cl2_free      bro3 colour  ph  turb seasons 1        2              3 1996     1 30.7     0.35 0.5000750   0.75 7.4 0.055  winter 2        6              1 1996     2 24.8     0.25 0.5001375   0.75 6.9 0.200  winter 3        7              4 1996     2 60.4     0.05 0.5001375   0.75 7.1 0.055  winter 4        7              4 1996     2 58.1     0.15 0.5001570   0.75 7.5 0.055  winter 5        7              4 1996     3 62.2     0.20 0.5003881   2.00 7.6 0.055  spring 6        5              2 1996     3 40.3     0.15 0.5003500   2.00 7.7 0.055  spring          library(nlme)     > mod3 <- lme(tthm ~ cl2_free, random= ~ 1| treatment_code/wsz_code, data=new.data, method ="ml")     > mod3     linear mixed-effects model fit maximum likelihood       data: new.data        log-likelihood: -1401.529       fixed: tthm ~ cl2_free      (intercept)    cl2_free         54.45240   -40.15033       random effects:      formula: ~1 | treatment_code             (intercept)     stddev: 0.004156934       formula: ~1 | wsz_code %in% treatment_code             (intercept) residual     stddev:    10.90637 13.52372      number of observations: 345     number of groups:                    treatment_code wsz_code %in% treatment_code                                 4                            8      > plot(augpred(mod3))     error in plot(augpred(mod3)) :        error in evaluating argument 'x' in selecting method function 'plot': error in sprintf(gettext(fmt, domain = domain), ...) :        invalid type of argument[1]: 'symbol' 

i'm not sure why error. ranef plot seems ok

plot(ranef(mod3)) 

but gives value of random intercepts, no tthm predictions. i'm looking way plot predictions in typical augpred show random effects each zone. hope makes sense.

you need groupeddata object use augpred. hope helps.

best wishes @csjcampbell

con <- textconnection(" wsz_code treatment_code year month tthm cl2_free      bro3 colour  ph  turb seasons         2              3 1996     1 30.7     0.35 0.5000750   0.75 7.4 0.055  winter         6              1 1996     2 24.8     0.25 0.5001375   0.75 6.9 0.200  winter         7              4 1996     2 60.4     0.05 0.5001375   0.75 7.1 0.055  winter         7              4 1996     2 58.1     0.15 0.5001570   0.75 7.5 0.055  winter         7              4 1996     3 62.2     0.20 0.5003881   2.00 7.6 0.055  spring         5              2 1996     3 40.3     0.15 0.5003500   2.00 7.7 0.055  spring ") new.data <- read.table(con, header = true)  library(nlme)  new.data.grp <- groupeddata(tthm ~ cl2_free | treatment_code/wsz_code, data = new.data) mod3 <- lme(tthm ~ cl2_free, random= ~ 1| treatment_code/wsz_code, data=new.data.grp, method ="ml") mod3 ap3 <- augpred(mod3) plot(ap3) 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -