Skip to content
Prev 14168 / 20628 Next

F and P values for random factors

Hi Dan, Tom, Ben and Alex.

Thank you for your response. Earlier I was not aware that my attachments
will not go through via r-sig-mixed-models at r-project.org.

I will apply example that Alex showed in his email.
Just FYI I am copying text from the previous attachment along with original
attachment. At least few of you can see my data and question. I wish I
could have webpage where I could put my question and data.

Once again I thank you for the help and guidance.

#################################################################################################
#################################################################################################

I have a RCBD experiment with 4 factors:

   -  ?         Genotype or cultigen (CLT);
   - ?         Location (LC);
   - ?         Year (YR); and
   - ?         Blocks or Replication (RP) within location and year.

The levels of my treatments/factors are

?         Cultigen = 10;

?         Location = 5

?         Year = 2

?         Rep = 4

The response *Rijkr* of the genotype *i* in the location *j*, year *k* and
block *r *is modelled as:

*Rijkr = m + CLTi + LCj + YRk + RPr (LCj YRk) + CLTi *LCj + CLTi *YRk +
LCj*YRk + CLTi*LCj*YRk + eijkr*

*NOTE: **Dependent or response variable in this example is MKMGHA. *



I want to compute ANOVA (analysis of variable) while considering all the
factors as random factors in R.



Below is the part of R code I used while using glm function to compute
ANOVA. But I don?t know how to get the *F* ratio and *p* values.

*#ANOVA using GLM , all factors are considered as random*



*  #convert numeric predictor variable into factors*

  tempa2a <- tempa2

  tempa2a$YR <- as.factor(tempa2a$YR)

  tempa2a$RP <- as.factor(tempa2a$RP)

*  #Get structure of data *

*  #(character vs. numeric vs. matrix vs. vector vs. factor)*

  str(tempa2a)



tempa3 <- glm(MKMGHA ~ LC + YR + LC:YR + RP %in% (LC:YR) + CLT + CLT:LC +

                CLT:YR + CLT:LC:YR, family = gaussian , data= tempa2a )



anova1 <- anova(tempa3)

*#convert anova into data frame*

anova2 <- as.data.frame(anova1)

*#convert rownames into column*

anova2$sov <- rownames(anova2)

*# drop rownames*

rownames(anova2) <- NULL





After gleaning online literature it looks like I need to use lme function
nlme4 package. But I don?t know how to compute the *F* ratio and *p* values
as I never used this function/package earlier.



#################################################################################################
#################################################################################################
Sincerely,
M-
On Fri, Feb 5, 2016 at 7:16 PM, Philippi, Tom <tom_philippi at nps.gov> wrote: