[R] how to include a factor or class Variable

arunkumar1111 akpbond007 at gmail.com
Thu Nov 17 14:36:38 CET 2011


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.



More information about the R-help mailing list