Hello.... Trying to apply a model to each level of a factor For example, i have three levels of a variable I call 'Code'...I want to model the data under each level of code differently...I've attached a sample data set... http://r.789695.n4.nabble.com/file/n3913431/data.txt data.txt I.E for code 0HY0 I want to model y~ 1|strain + 1|code *both code and strain are random effects... for code 0HY1 run a separate model with different y's.... y~ 1|strain + 1|code tapply does not work (or rather i cannot get it to work) In SAS i would simply use PROC MIXED data=data; by code; model y=; random code strain /solution; run; Not so easy in R? thanks! -- View this message in context: http://r.789695.n4.nabble.com/Analyze-each-factor-separtely-tp3913431p3913431.html Sent from the R help mailing list archive at Nabble.com.