[R] loess with missing data points
1Rnwb
sbpurohit at gmail.com
Tue Oct 5 22:56:49 CEST 2010
Hello List,
I have a longitudinal samples on multiple individuals, for initial analysis,
i am doing some plots to see how the variable changes with the age. In some
of the individuals one or two data points are missing,
IL1Ra Age.at.Sample.Collection Subject.ID
6.575466 2.004106 00709-0
NA 2.162902 00709-0
5.115421 3.312799 00709-0
6.119626 3.515400 00709-0
5.705648 4.156057 00709-0
7.298887 4.405201 00709-0
6.195063 4.577686 00709-0
6.574864 5.541409 00709-0
When I run
cap<-paste(sub.id,cases2$group[1],sep=" ")
plot(cases2$IL1Ra~cases2$Age.at.Sample.Collection, ylab="eo_conc",xlab="Age
at Sample",pch=1, ylim=c(3,10), xlim=c(0,22),main=cap)
points(cases2$MIP1b~cases2$Age.at.Sample.Collection,pch=2,ylim=c(1.5,10),col="red")
points(cases2$MCP1~cases2$Age.at.Sample.Collection,,pch=3,
ylim=c(1.5,10),col="brown")
lines(predict(loess(cases2$IL1Ra~cases2$Age.at.Sample.Collection))~cases2$Age.at.Sample.Collection,
lwd=1, lty=1)
lines(predict(loess(cases2$MIP1b~cases2$Age.at.Sample.Collection))~cases2$Age.at.Sample.Collection,
col="red", lwd=1, lty=1)
lines(predict(loess(cases2$MCP1~cases2$Age.at.Sample.Collection))~cases2$Age.at.Sample.Collection,col="brown",
lwd=1, lty=1)
I get error
Error in model.frame.default(formula = predict(loess(cases2$IL1Ra ~
cases2$Age.at.Sample.Collection)) ~ :
variable lengths differ (found for 'cases2$Age.at.Sample.Collection')
In addition: There were 50 or more warnings (use warnings() to see the first
50)
I tried using na.action=na.omit, which is not working at all.
I would appreciate some pointers in this regards to get these charts.
Thanks
--
View this message in context: http://r.789695.n4.nabble.com/loess-with-missing-data-points-tp2956851p2956851.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list