100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary STA2020 coding

Rating
-
Sold
-
Pages
3
Uploaded on
15-05-2024
Written in
2023/2024

STA2020 coding for labs









Whoops! We can’t load your doc right now. Try again or contact support.

Document information

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

Subjects

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)
R125,33
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
hslisa001

Get to know the seller

Seller avatar
hslisa001 University of Cape Town
View profile
Follow You need to be logged in order to follow users or courses
Sold
9
Member since
1 year
Number of followers
1
Documents
18
Last sold
3 weeks ago

0,0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

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

Student with book image

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

Alisha Student

Frequently asked questions