#Lab 4 R code STAT 3022
#Generating the data we will be working with
set.seed(8051)
x <- runif(19,0,10)
y <- 1 + 2*x + rnorm(19,sd = 2)
plot(x,y,pch = 20) #postive coefficient
#There are many types of outliers and we want to determine if we're looking at
#STAT 3022 Lab 6
#Create a 10x10 matrix of 100 random numbers from a t distribution with 12
degrees of freedom. Write your code
#underneath the set.seed(34) command. Assign it to variable name tMat
set.seed(34)
?"matrix"
tMat <- matrix(rt(100, df=12), nco
#First lets look at an example of how looking for a fit where there is not one
can lead to erroneous conclusions
set.seed(37) # y does not hava relation with x
y <- rnorm(10)
x <- 1:10
plot(x,y, xlim = c(0,12) # no real relationship between x and y
#So fa
#STAT 3022 Lab 7
#Load in libraries
require(cfcdae)
#Without using the Bonferonni adjustment we see that when dong multiple
comparisons our errors are actually quite higher than
#0.05 which is what we would expect with doing tests at the alpha = 0.05 leve
#Stat 3022 Lab 9 R code
#We will be looking at a dataset for O Ring failures before the Challenger
disaster of 1984. Please install the faraway package before beginning
library(faraway)
data(orings)
attach(orings)
View(orings)
#On the day before the launc
#STAT 3022 Lab 5 R code
require(MASS)
#Review of how to get help with R
#What if I wanted to draw a random sample from a set of numbers?
#First I need to decide whether to find a built in function
#or create one myself. I'll google first to see if such a
#STAT 3022 R code for Lab 12: predict function
data("faithful")
View(faithful)
#Exploratory data analysis
lapply(faithful, class)
summary(faithful)
par(mfrow = c(1,1)
hist(faithful$eruptions)
hist(faithful$waiting)
#Create the model
m1 <- lm(eruptions ~ w
#R code for Lab 13 Stat 3022
#Examples from these websites#
#http:/www.ats.ucla.edu/stat/r/library/bootstrap.htm
#http:/www.r-bloggers.com/bootstrap-example/
#examples of using the function sample, ramdom sample from the population, check
the median and s