> View(Defectsafterdelivery)
> defects.old.rate<-c(Defectsafterdelivery$X2010,Defectsafterdelivery$X2011)
> defects.old.rate<-defects.old.rate[1:22]
> month.nr<-(1:22)
> defects.old.rate<-matrix(c(month.nr,defects.old.rate),ncol = 2)
> View(defects.old.rate)
> defects.old.rate.mod<-lm(defects.old.rate[,2]~defects.old.rate[,1])
> summary(defects.old.rate.mod)
Call:
lm(formula = defects.old.rate[, 2] ~ defects.old.rate[, 1])
Residuals:
Min 1Q Median 3Q Max
-14.440 -6.678 -1.944 6.976 22.572
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 817.4156 4.0677 200.952 < 2e-16 ***
defects.old.rate[, 1] 1.3354 0.3097 4.312 0.000339 ***
—
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 9.216 on 20 degrees of freedom
Multiple R-squared: 0.4818, Adjusted R-squared: 0.4558
F-statistic: 18.59 on 1 and 20 DF, p-value: 0.0003394
> plot(defects.old.rate[,1],defects.old.rate[,2],xlab=”month“,ylab=’Number of
Defects’)
> abline(defects.old.rate.mod.pch=2,col=“red”)
Warning message:
In int_abline(a = a, b = b, h = h, v = v, untf = untf, …) :
“defects.old.rate.mod.pch” is not a graphical parameter
> abline(defects.old.rate.mod,pch=2,col=“red”)
> library(lattice)
Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
“defects.old.rate.mod.pch” is not a graphical parameter
2: In doTryCatch(return(expr), name, parentenv, handler) :
“defects.old.rate.mod.pch” is not a graphical parameter
Restarting R session…
> install.packages(“lattice”)
Warning in install.packages :
cannot open URL ‘http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES.rd
s’: HTTP status was ‘404 Not Found’
Warning in install.packages :
cannot open URL ‘http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.4
/PACKAGES.rds’: HTTP status was ‘404 Not Found’
trying URL ‘https://cran.rstudio.com/bin/windows/contrib/3.4/lattice_0.20-35.
zip’
Content type ‘application/zip’ length 739647 bytes (722 KB)
downloaded 722 KB
package ‘lattice’ successfully unpacked and MD5 sums checked