Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 1. OLP-Functions
- source(file.choose())
- # 2. Packages
- library(car)
- library(moments)
- library(ggplot2)
- library(GGally)
- library(scatterplot3d)
- library(effects)
- library(lavaan)
- library(semPlot)
- library(Rcpp)
- library(lme4)
- library(lmerTest)
- library(sjPlot)
- library(lattice)
- options(scipen=999)
- # 3. Dataset
- load(file.choose()) # Rdata
- #renaming variables
- Montenegro$Thuisvoelen<-(Montenegro$ASBGSSB)
- mean(Montenegro$Thuisvoelen, na.rm=T)
- sd(Montenegro$Thuisvoelen, na.rm=T)
- Montenegro$Geslacht<-(Montenegro$ASBG01)
- Montenegro$Thuistaal<-(Montenegro$ASBG03)
- Montenegro$Leermiddelen_thuis<-(Montenegro$ASBGHRL)
- Montenegro$Gepest_voelen<-(Montenegro$ASBGSB)
- #recoding variables
- Montenegro$Gepest_voelenR <-(Montenegro$Gepest_voelen)*-1
- Montenegro$Gepest_voelen
- Montenegro$Gepest_voelenR
- #z-score
- Montenegro$Leermiddelen_thuisZ <- zscore(Montenegro$Leermiddelen_thuis)
- Montenegro$Gepest_voelenRZ <- zscore(Montenegro$Gepest_voelenR)
- Montenegro$Gepest_voelenZ <- zscore(Montenegro$Gepest_voelen)
- Montenegro$ThuisvoelenZ <- zscore(Montenegro$ASBGSSB)
- #categorical variables > dummyvariables
- Montenegro$Meisje<-(Montenegro$Geslacht=="1")*1
- Montenegro$Jongen<-(Montenegro$Geslacht=="2")*1
- Montenegro$Instructietaal_Zelfde <- (Montenegro$Thuistaal=="1" | Montenegro$Thuistaal=="2" )*1
- Montenegro$Instructietaal_Andere <- (Montenegro$Thuistaal=="3" | Montenegro$Thuistaal=="4")*1
- ## So far so good
- Montenegro_Model2C0 <- lmer(ThuisvoelenZ ~ 1 + (1|IDSCHOOL) + (1|IDCLASS), data = Montenegro, REML = F)
- summary(Montenegro_Model2C0)
- Montenegro_Model2C1 <- lmer(ThuisvoelenZ ~ 1 + Gepest_voelenRZ + (1 + Gepest_voelenRZ|IDSCHOOL) + (1|IDCLASS), data = Montenegro, REML = F)
- summary(Montenegro_Model2C1)
- ## Here, things start to go wrong...
- Montenegro_Model2C2 <- lmer(ThuisvoelenZ ~ 1 + Gepest_voelenRZ + Instructietaal_Andere + (1 + Gepest_voelenRZ|IDSCHOOL) + (1 + Instructietaal_Andere|IDSCHOOL) + (1|IDCLASS), data = Montenegro, REML = F)
- summary(Montenegro_Model2C2)
- Montenegro_Model2C3 <- lmer(ThuisvoelenZ ~ 1 + Gepest_voelenRZ + Instructietaal_Andere + Leermiddelen_thuisZ + (1 + Gepest_voelenRZ|IDSCHOOL) + (1 + Instructietaal_Andere|IDSCHOOL) + (1 + Leermiddelen_thuisZ|IDSCHOOL) + (1|IDCLASS), data = Montenegro, REML = F)
- summary(Montenegro_Model2C3)
- Montenegro_Model2C4 <- lmer(ThuisvoelenZ ~ 1 + Gepest_voelenRZ + Instructietaal_Andere + Leermiddelen_thuisZ + Meisje + (1 + Gepest_voelenRZ|IDSCHOOL) + (1 + Instructietaal_Andere|IDSCHOOL) + (1 + Leermiddelen_thuisZ|IDSCHOOL) + (1|IDCLASS), data = Montenegro, REML = F)
- summary(Montenegro_Model2C4)
- Montenegro_NA<-na.omit(Montenegro[c("IDSCHOOL","IDCLASS","ThuisvoelenZ", "Meisje", "Instructietaal_Andere", "Instructietaal_Zelfde", "Gepest_voelenRZ" , "Leermiddelen_thuisZ")])
- Montenegro_Model2C0NA <- lmer(ThuisvoelenZ ~ 1 + (1|IDSCHOOL) + (1|IDCLASS), data = Montenegro_NA, REML = F)
- Montenegro_Model2c1NA <- lmer(ThuisvoelenZ ~ 1 + Gepest_voelenRZ + (1 + Gepest_voelenRZ|IDSCHOOL) + (1|IDCLASS), data = Montenegro_NA, REML = F)
- Montenegro_Model2C2NA <- lmer(ThuisvoelenZ ~ 1 + Gepest_voelenRZ + Instructietaal_Andere + (1 + Instructietaal_Andere|IDSCHOOL) + (1 + Gepest_voelenRZ|IDSCHOOL) + (1|IDCLASS), data = Montenegro_NA, REML = F)
- Montenegro_Model2C3NA <- lmer(ThuisvoelenZ ~ 1 + Gepest_voelenRZ + Instructietaal_Andere + Leermiddelen_thuisZ + (1 + Gepest_voelenRZ|IDSCHOOL) + (1 + Instructietaal_Andere|IDSCHOOL) + (1 + Leermiddelen_thuisZ|IDSCHOOL) + (1|IDCLASS), data = Montenegro_NA, REML = F)
- Montenegro_Model2C4NA <- lmer(ThuisvoelenZ ~ 1 + Gepest_voelenRZ + Instructietaal_Andere + Leermiddelen_thuisZ + Meisje + (1 + Gepest_voelenRZ|IDSCHOOL) + (1 + Instructietaal_Andere|IDSCHOOL) + (1 + Leermiddelen_thuisZ|IDSCHOOL) + (1|IDCLASS), data = Montenegro_NA, REML = F)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement