how to include a factor or class Variable
Please post this to r-sig-mixed-models instead. Or, better yet, consult your local statistician, as your question indicates a profound lack of understanding that may require more back and forth discussion than can occur on an internet help site. -- Bert
On Thu, Nov 17, 2011 at 5:36 AM, arunkumar1111 <akpbond007 at gmail.com> wrote:
Hi
How to include a factor or class variable to a fixed effect of lmer
function. when i included it throws an error. Please help
My code
data <- read.delim("C:/TestData/data.txt")
?Mon=as.factor(data$Month)
?lmerform= "Y~ X2 +X3 + Month:Mon + (1|State)+ (1+ X5|State)"
?lmerfit=lmer(formula=lmerform,data=data)
?summary(lmerfit)
My data
State ? Year ? ?Month ? Y ? ? ? X2 ? ? ?X3 ? ? ?X4 ? ? ?X5 ? ? ?X6
GA ? ? ?1960 ? ?1 ? ? ? 27.8 ? ?397.5 ? 42.2 ? ?50.7 ? ?78.3 ? ?65.8
FA ? ? ?1960 ? ?2 ? ? ? 29.9 ? ?413.3 ? 38.1 ? ?52 ? ? ?79.2 ? ?66.9
GA ? ? ?1961 ? ?3 ? ? ? 29.8 ? ?439.2 ? 40.3 ? ?54 ? ? ?79.2 ? ?67.8
FA ? ? ?1961 ? ?4 ? ? ? 30.8 ? ?459.7 ? 39.5 ? ?55.3 ? ?79.2 ? ?69.6
GA ? ? ?1962 ? ?1 ? ? ? 31.2 ? ?492.9 ? 37.3 ? ?54.7 ? ?77.4 ? ?68.7
FA ? ? ?1962 ? ?2 ? ? ? 33.3 ? ?528.6 ? 38.1 ? ?63.7 ? ?80.2 ? ?73.6
GA ? ? ?1963 ? ?3 ? ? ? 35.6 ? ?560.3 ? 39.3 ? ?69.8 ? ?80.4 ? ?76.3
--
View this message in context: http://r.789695.n4.nabble.com/how-to-include-a-factor-or-class-Variable-tp4079991p4079991.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at 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.
Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm