Hi, I'm using lars package to run some regression analysis and my doubt now is how can I predict my model to another dataset? Let me explain a little better: I have a dataset from which I withhold some data. With the data that wasn't withheld, I create the model. Now, what I'm not being able to do is apply the model back to the data that I withheld. Any suggestions? Here it goes the code:
require(lars) x <- as.matrix(lars.input[c(1:152)]) y <- lars.input[,c(149)] larsdata <- as.data.frame(cbind(y,x)) attach(larsdata) lars.model <- lars(x,y) fit <- predict.lars(lars.model,x)$fit plot(y ~ fit[,ncol(fit)]) #so far, so good fit2 <- predict.lars(lars.model,withhold)$fit plot(withhold$logBA ~ fit2[,ncol(fit2)]) #this is when the mess shows up Thanks! _______________________________________________________________ Giovanni Giacomin Estudante de Engenharia de Agrimensura e Cartográfica - Universidade Federal de Viçosa Science Without Borders Student - Geography with emphasis in GIS - University of Montana [[alternative HTML version deleted]]
______________________________________________ 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.