You are on page 1of 1

## http://r-statistics.co/Linear-Regression.

html

ejemplito<-
c(1,2,32,1,2,3,4,1,1,1,2,3,4,5,6,2,4,5,23,1,9,10,11,12,13,1,44,55,1,1,2,3,4,5,7,88,
99)
quantile(ejemplito)
fivenum(ejemplito)
summary(ejemplito)
set.seed(10)
precipAmount <- sample(precip,60,replace=TRUE)
precipGrp <- as.factor(rep(seq(from=1,to=3,by=1),20))
precipDF <- data.frame(precipAmount, precipGrp)
boxplot(precipAmount ~ precipGrp, data=precipDF)
precipOut <- aov(precipAmount ~ precipGrp, data=precipDF)
summary(precipOut)

head(mtcars)
mean( mtcars$mpg[ mtcars$am == 0 ] )
mean( mtcars$mpg[ mtcars$am == 1 ] )
sd( mtcars$mpg[ mtcars$am == 0 ] )
sd( mtcars$mpg[ mtcars$am == 1 ] )
boxplot(mpg ~ am, data=mtcars)
lm(mpg ~ am, data=mtcars)
mean( sample(mtcars$mpg[ mtcars$am == 0 ],size=19,replace=TRUE) )
mean( sample(mtcars$mpg[ mtcars$am == 1 ],size=13,replace=TRUE) )

meanDiffs <- replicate(100, mean( sample(mtcars$mpg[ mtcars$am == 0 ],


size=19,replace=TRUE) ) - mean( sample(mtcars$mpg[ mtcars$am ==
1 ], size=13,replace=TRUE) ))

hist(meanDiffs)
t.test(mtcars$mpg[mtcars$am==0] ,mtcars$mpg[mtcars$am==1])

scatter.smooth(x=mtcars$wt, y=mtcars$qsec, main="ejemplito 1")

linearMod <- lm(wt ~ qsec, data=mtcars)


linearMod
summary(linearMod)

You might also like