lab1 - x<-data1[,1] y<-data1[,2]...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
STAT5044: lab 1 Inyoung Kim
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Outline 1 How to estimate the regression line in R
Background image of page 2
Example A substance used in biological and medical research is shipped by airfreight to users in cartons of 1,000 ampules. The data, involving 10 shipments, were collected on the number of times the carton was transferred from one aircraft to another over the shipment route (X) and the number of ampules found to be found to be broken upon arrival (Y). We want to know the relationship between the shipment route and the number of ampules
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fit the simple linear model library(alr3) library(MASS) library(zoo) library(lmtest) library(asuR) library(lattice) library(grid) library(faraway) data1<-read.table("C:/data/airfreight.txt",header=T)
Background image of page 4
Fit linear regression Model ShipmentRoute NumberOfAmpules 1 16 0 9 2 17 0 12 3 22 1 13 0 8 1 15 2 19 0 11
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fit linear regression Model Scatter plot 0.0 0.5 1.0 1.5 2.0 2.5 3.0 8 10 12 14 16 18 20 22 x y
Background image of page 6
Fit the simple linear model
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: x&lt;-data1[,1] y&lt;-data1[,2] lmfit&lt;-lm(y x) Fit linear regression Model summary(lmfit) Call: lm(formula = y x) Residuals: Min 1Q Median 3Q Max-2.2-1.2 0.3 0.8 1.8 Coefficients: Estimate Std. Error t value Pr(&gt;|t|) (Intercept) 10.2000 0.6633 15.377 3.18e-07 *** x 4.0000 0.4690 8.528 2.75e-05 ***---Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 1.483 on 8 degrees of freedom Multiple R-Squared: 0.9009, Adjusted R-squared: 0.8885 F-statistic: 72.73 on 1 and 8 DF, p-value: 2.749e-05 Fit linear regression Model #scatter plot and fitted line par(mfcol=c(1,1)) plot(x,y) abline(lmfit) Fit linear regression Model The tted regression line 0.0 0.5 1.0 1.5 2.0 2.5 3.0 8 10 12 14 16 18 20 22 x y...
View Full Document

This note was uploaded on 01/02/2012 for the course STAT 5044` taught by Professor Staff during the Fall '11 term at Virginia Tech.

Page1 / 10

lab1 - x&amp;amp;lt;-data1[,1] y&amp;amp;lt;-data1[,2]...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online