2022-01-20

Multiple linear regression in R (covariance analysis)

Hello guys I am having a problem regarding the following task. I hope someone can help me.

It is about the calculation of regression of GPA on school type using TOSCA data.

I need to factorize the nominal scaled predictor and I need 'vocational high school' as reference category. This is what I have done so far, but I do not if this is right.

Thank you in advance!

setwd("C:/Users/...")

library(readr)

datTOSCA <- read_csv("C:/Users/u...", header = TRUE, na="NA") datTOSCA <-lm(GPA ~ schooltype, data = TOSCAToTeach_syn) summary(datTOSCA)

str(datTOSCA) datTOSCA$schooltype <- as.factor(schooltype) str(datTOSCA) datTOSCA$schooltype <- factor(datTOSCA$schooltype) schooltype <- factor(c("allGym", "beruflGym", "allGym", "beruflGym")) levels (schooltype) nlevels(schooltype)

contr.treatment(n=2, base=2) c(datTOSCA$schooltype, contr.treatment(2, 2), na=NA)

datTOSCA <-lm(GPA ~ C(datTOSCA$schooltype, contr.treatment(2, 2)), TOSCAToTeach_syn) summary(datTOSCA)



from Recent Questions - Stack Overflow https://ift.tt/3KnOlq9
https://ift.tt/eA8V8J

No comments:

Post a Comment