s-news
[Top] [All Lists]

extracting sample size per group

To: <s-news@lists.biostat.wustl.edu>
Subject: extracting sample size per group
From: "Fletcher, Thomas" <fletchert@umsl.edu>
Date: Thu, 6 Oct 2005 12:55:42 -0500
Thread-index: AcXKnystsYWF5LQrTM63zDt09FBSTA==
Thread-topic: extracting sample size per group

S News List –

 

I am aware of how to extract the coefficients by group for a linear mixed effects model (e.g., coef (lme.model), but I can’t quite figure out how to get the sample size for each group. Any suggestions?

 

To give an example, suppose you have a dataset with 1000 individuals belonging to one of 10 groups. You create a lme model.

# create data

x <- rnorm(1000)

y <- .5*x+rnorm(1000)

g <- rep(1:10,100)

data <- cbind(x,y,g)

data <- data.frame(data)

 

#create a linear mixed effects model

tmod <- lme(y~x,random=~1|g,data="">

 

# extracts coefficients for each group

coef(tmod)

 

# How do you get the sample size per group? In this example, the sample size is balanced by design, but what about real data where the group sizes are not balanced?

 

 

Thanks

Tom

 

 

 

-------------------------------------------------

Thomas D. Fletcher, PhD

Assistant Professor

Department of Psychology

University of Missouri - St. Louis

One University Boulevard

St. Louis, MO 63121

-------------------------------------------------

 

<Prev in Thread] Current Thread [Next in Thread>