IMJ
IMJ

Reputation: 85

Translate SAS to (Random effect ANOVA)

I'm trying to translate my SAS code for random effect ANOVA to R here is my code:

 proc glm data=A;
 class group;
 model common = group;
 random group;
 run;

'group' is group membership, and common is IV. Please, translate this code into R code.

(edited)

my data looks like this:

   id  common    group
    1       4        A
    2       2        A
    3       3        A
    4       2        B
    5       2        B
    6       3        C
    7       4        C
    8       3        C

Upvotes: 1

Views: 77

Answers (1)

Prem
Prem

Reputation: 11965

I think you are looking for lme and the code can be written as:

library(nlme)

#let's say A (a dataframe) has the sample data
A$group <- as.factor(A$group)

#model
fit <- lme(common ~ group, random = ~ 1 | group, data = A, na.action=T)

Upvotes: 0

Related Questions