Skip to content

Started a mixed effects example for one variable RCBD. - #42

Open
moorepants wants to merge 2 commits into
masterfrom
rcbd-one-var-mixed-effects
Open

Started a mixed effects example for one variable RCBD.#42
moorepants wants to merge 2 commits into
masterfrom
rcbd-one-var-mixed-effects

Conversation

@moorepants

Copy link
Copy Markdown
Member

@msimmond Here is a base for a simpler mixed effects model. I just copied the data from the other RCBD example, added a year column, and adjusted the numbers for the second year with some randomness.

> source('rcbd_one_var_year.R', print.eval = TRUE)
Linear mixed effect model results
===============================================================================
Linear mixed-effects model fit by REML
 Data: my.data 
       AIC      BIC    logLik
  120.7264 130.0519 -53.36321

Random effects:
 Formula: ~1 | Block
        (Intercept)
StdDev:    1.336126

 Formula: ~1 | Year %in% Block
         (Intercept) Residual
StdDev: 3.311861e-05 1.237766

Fixed effects: Yield ~ Treatment 
                      Value Std.Error DF  t-value p-value
(Intercept)        6.027597 0.7986341 21 7.547383  0.0000
TreatmentVariety B 2.651774 0.6188832 21 4.284773  0.0003
TreatmentVariety C 3.680206 0.6188832 21 5.946527  0.0000
TreatmentVariety D 1.585305 0.6188832 21 2.561557  0.0182
 Correlation: 
                   (Intr) TrtmVB TrtmVC
TreatmentVariety B -0.387              
TreatmentVariety C -0.387  0.500       
TreatmentVariety D -0.387  0.500  0.500

Standardized Within-Group Residuals:
       Min         Q1        Med         Q3        Max 
-2.2653194 -0.4627162  0.1031063  0.5976403  1.6475445 

Number of Observations: 32
Number of Groups: 
          Block Year %in% Block 
              4               8 
===============================================================================

Comment thread examples/rcbd_one_var_year.R Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think block is nested within year. Thus, it should be ~1|Year/Block. I'll look into this some more to be sure.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might be right.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be true based on other examples, so I'll edit it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants