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. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.