mirror of
https://asciireactor.com/otho/cs-5821.git
synced 2024-11-24 06:05:08 +00:00
58 lines
1.5 KiB
R
Executable File
58 lines
1.5 KiB
R
Executable File
auto = read.table("auto.data",header=T,na.strings="?")
|
|
auto
|
|
attach(auto)
|
|
horsepower
|
|
plot(mpg ~ horsepower)
|
|
fit = lm(mpg ~ horsepower)
|
|
fit
|
|
summary(fit)
|
|
lines(fit)
|
|
abline(fit)
|
|
abline(fit,col="red")
|
|
plot(mpg ~ horsepower,pch="x")
|
|
abline(fit,col="red")
|
|
abline(fit,col="red",size="2")
|
|
abline(fit,col="red",lt="2")
|
|
help(abline)
|
|
abline(fit,col="red",lwd="2")
|
|
abline(fit,col="red",lwd="4")
|
|
summary(lm)
|
|
summary(fit)
|
|
help(predict)
|
|
predict(fit,horsepower=98)
|
|
predict(fit)
|
|
predict(fit,98)
|
|
predict(fit[98])
|
|
help(predict)
|
|
help(predict.lm)
|
|
predict(lm(mpg ~ 98)
|
|
predict(lm(mpg ~ horsepower)
|
|
predict(lm(mpg ~ 98))
|
|
pre
|
|
predict(fit,data.frame(p=98(
|
|
predict(fit,data.frame(p=98))
|
|
predict(fit,data.frame(p=c(98)))
|
|
predict(fit,data.frame(p=c(98)),interval="confidence")
|
|
predict(fit,data.frame(horesepower=c(98)),interval="confidence")
|
|
predict(fit,interval="confidence")
|
|
fit
|
|
predict(fit,data.frame(c(98))interval="confidence")
|
|
predict(fit,data.frame(p=c(98))interval="confidence")
|
|
predict(fit,data.frame(p=c(98)),interval="confidence")
|
|
predict(fit,data.frame(p=c(98)),interval="confidence")
|
|
names(fit)
|
|
coef(fit)
|
|
confint(fit)
|
|
predict(fit,data.frame(horsepower=c(1,98)),interval="confidence")
|
|
predict(fit,data.frame(horsepower=c(98)),interval="confidence")
|
|
predict(fit,data.frame(horsepower=98),interval="confidence")
|
|
predict(fit,data.frame(horsepower=98),interval="prediction")
|
|
dev.print(pdf,"mpg_horsepower_regression.pdf")
|
|
plot(fit)
|
|
par(mfrow=c(2,2))
|
|
plot(fit)
|
|
dev.print(pdf,"fit_quality.pdf")
|
|
save
|
|
save()
|
|
q()
|