Hello R users, I'm trying to understand the meaning of the results returned by the command 'predict' with type="terms". I thought it was the matrix with the fitted values for each term (value of predictor * related coef), but the calculation is different. I include an example below: y <- rnorm(10) x1 <- rnorm(10) x2 <- rnorm(10) model <- lm(y ~ x1 + x2) predict(model,type="terms")[1,] cbind(x1,x2)[1,] * t(coef(model)[2:3]) I guess the true result should be the second one. Maybe the command include some additional transformation? Any suggestion? Thanks for your time
Antonio Gasparrini Public and Environmental Health Research Unit (PEHRU) London School of Hygiene & Tropical Medicine Keppel Street, London WC1E 7HT, UK Office: 0044 (0)20 79272406 - Mobile: 0044 (0)79 64925523 Skype contact: a.gasparrini http://www.lshtm.ac.uk/people/gasparrini.antonio ( http://www.lshtm.ac.uk/pehru/ ) ______________________________________________ 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.