R version 2.9.2 (2009-08-24)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
>
> heights.table <- read.table('http://www-stat.stanford.edu/~jtaylo/courses/stats191/data/heights.table', header=T, sep=',')
> attach(heights.table)
>
> wife.lm <- lm(WIFE ~ HUSBAND)
>
> # Confidence and forecasting intervals for wife.lm
>
> print(confint(wife.lm, level=0.90)) # confidence interval for
5 % 95 %
(Intercept) 24.6455625 60.451862
HUSBAND 0.5933172 0.798534
> # parameters
> print(predict(wife.lm, list(HUSBAND=160), interval='confidence', level=0.90))
fit lwr upr
1 153.8968 152.1214 155.6723
> # confidence interval for
> # regression line at X=160
>
> print(predict(wife.lm, list(HUSBAND=160), interval='prediction', level=0.90))
fit lwr upr
1 153.8968 143.8503 163.9433
> # prediction interval for
> # regression line at X=160
>
>
>
> proc.time()
user system elapsed
0.548 0.012 0.563
R script