x=c(1004,975,992,935,985,932,953)#barometric pressure y=c(41,100,65,145,80,151,132)#wind speed plot(x,y) cyclone.model=lm(y~x) #to get estimates, std.errs, tests for parameters, etc: summary(cyclone.model) #to compute predicted (fitted) values predict(cyclone.model) #to get prediction for a given X (here x=945): predict(cyclone.model,newdata=data.frame(x=945)) #if you also want to compute standard errors for predicted mean: predict(cyclone.model,newdata=data.frame(x=945),se.fit=TRUE) #if you want to compute the confidence interval for the mean: predict(cyclone.model,newdata=data.frame(x=945),interval="confidence") #if you want to compute the prediction interval for the mean: predict(cyclone.model,newdata=data.frame(x=945),interval="predict") #if you want to compute the confidence region (at each observed X): predict(cyclone.model,newdata=data.frame(x=x),interval="confidence") #to plot the two curves (lower and upper) and the regression line on the scatterplot: plot(x,y) curve(predict(cyclone.model, newdata = data.frame(x = x)), add = TRUE)#plots the regression line curve(predict(cyclone.model, newdata = data.frame(x = x), interval = "prediction")[ , "lwr"], add = TRUE)#plots the lower limit of the confidence region curve(predict(cyclone.model, newdata = data.frame(x = x), interval = "prediction")[ , "upr"], add = TRUE)#plots the upper limit of the confidence region