[R] using lme and 'by' function to extract the co-efficients by individuals

tom_pienkowski tom.pienkowski at blueyonder.co.uk
Mon Oct 24 17:36:08 CEST 2011


Hi all 

I'm trying to use the 'by' function to extract the co-efficients from a
mixed model which is performed on multiple individuals. I basically have a
group of individuals and for each individual I want the co-efficient for
there change in 'pots_hauled' in response to a change in 'vpue' with my
random variable being 'ns_a_vpue'. 

The problem I am having is that the co-efficients for all my individuals are
returning as the same! So I'm not getting the individuals co-efficients, I'm
not even sure what it is returning. Here is a sample of my code:


mod_1 <- lme(pots_hauled ~ rc_a_vpue ,(random = ~1 | a_vpue), data = data1)



by(data1, id, summary)

by(data1, list(pots_hauled=pots_hauled,id=id ), summary)

by(data1, id, function(x) lme(pots_hauled ~ a_vpue ,(random = ~1 |
ns_a_vpue), data = data1)))



lmid <- by(data1, id, function(x) lme(pots_hauled ~ a_vpue ,(random = ~1 |
ns_a_vpue), data = data1))

sapply(lmid, coef)



Any help would be much appretiated!

Tom Pienkowski

--
View this message in context: http://r.789695.n4.nabble.com/using-lme-and-by-function-to-extract-the-co-efficients-by-individuals-tp3933555p3933555.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list