Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 1 out of 3 pages
Summary

Summary STA2020 coding

Document preview thumbnail
Preview 1 out of 3 pages

STA2020 coding for labs

Content preview

Week 2:

drywide <- read.csv("drying_times_wide.csv")
mean(drywide$Paint.1)
mean(drywide$Paint.2)
sd(drywide$Paint.1)

drylong <- read.csv("drying_times_long.csv")
View(drylong)
t <- aov(drying_time ~ paint , data= drylong)
summary( t)


Week 3:

oat_variety<-read.csv (‘oat_variety.csv’)
View(oat_variety)
variety <- as.factor(oat_variety$variety)
mean(oat_variety$yield [oat_variety$variety == "Golden.rain"])
mean(oat_variety$yield [oat_variety$variety == "Marvellous"])
mean(oat_variety$yield [oat_variety$variety == "Victory"])
sd(oat_variety$yield [oat_variety$variety == "Golden.rain"])
t <- aov(yield ~ variety + plot , data = oat_variety)
summary( t)


Week 4:

insects<-read.csv(‘insects_data.csv’)
mean(insects$counts [insects$species == "Megacrania" & insects$season == "Spring"])
mean(insects$counts [insects$species == "Extatosoma" & insects$season == "Autumn"]) spelificmean
t <- aov(counts ~ species + season + species*season, data = insects_data)
summary( t)
IwayAnova
Week 5:

Install readxl package
library(readxl)
calls<-read_excel(‘calls.xlsx’)
mean(calls$Calls)
t <- lm(Executions ~ Calls)
im independent dependent simple linear regression
summary( t)
cor(y=calls$Executions, x=calls$Calls)
regression <- lm(Executions~Calls, data=calls)
summary(regression)
con nt(regression)
plot(x=calls$Calls, y=calls$Executions)
xlab= “number of phone calls”, ylab= “number of executions”


Week 6:

View(multreg)
df <- read.csv("multreg.csv")
View(df)
mult.numeric <- df[ , c("Price", "PlotSize", "FloorArea", "Trees", "Distance")]
cor.multi.numeric <- cor(mult.numeric)
multiple linearregression
cor(mult.numeric)
df$Pool <- as.factor(df$Pool) convertingnumericvariables to fan or variables
contrasts(df$Pool)
t <- lm(Price ~ PlotSize + FloorArea + Trees + Distance + Pool + PlotSize*FloorArea, data = df)
summary( t)
imlynxdata
con nt( t)
predict( t)
torind estimateddependentvariable

Week 7:

log <- read.csv("logreg.csv")
View(log)
dep explanatory
t <- glm(cases ~ sex + income , data = log, family = "binomial" )
logistic regression
summary( t)

mb_data <- read.csv('step.csv')
str(mb_data)
mb_data$medschl <- as.factor(mb_data$medschl)
mb_data$region <- as.factor(mb_data$region)
t.full <- lm(length ~ . , mb_data) modelbuilding
summary( t.full)
t.empty <- lm(length ~ 1, mb_data) stepwiseregression
step.model <- step( t.empty, scope = formula( t.full), direction = 'forward')
summary(step.model)

Document information

Uploaded on
May 15, 2024
Number of pages
3
Written in
2023/2024
Type
Summary
$8.08

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
10
Followers
1
Items
18
Last sold
8 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions