Doing linear prediction with R: How to access the predicted parameter(s)?
问题 I am new to R and I am trying to do linear prediction. Here is some simple data: test.frame<-data.frame(year=8:11, value= c(12050,15292,23907,33991)) Say if I want to predict the value for year=12 . This is what I am doing (experimenting with different commands): lma=lm(test.frame$value~test.frame$year) # let's get a linear fit summary(lma) # let's see some parameters attributes(lma) # let's see what parameters we can call lma$coefficients # I get the intercept and gradient predict(lm(test