library(foreign) library(psych) library(ggplot2) library(plyr) library(car) library(rms) ## Get Education vpr1 <- read.spss("questionnaire part 1a.sav", to.data.frame=TRUE, use.value.labels = F) izo <- vpr1[,"V02"] izo2 <- as.numeric(levels(izo))[izo] izo2[izo2<3|izo2>5] <- NA izo2[izo2==5]<-0 # Tehniki izo2[izo2==3|izo2==4]<-1 # Diplomirane MS izo2 <- factor(izo2,labels=c("Low","High")) newTab <- data.frame(Education = izo2) ## CARATIVE FACTORS vpr2 <- read.spss("questionnaire part 2a.sav", to.data.frame=TRUE, use.value.labels = F) vpr2 <- vpr2[,4:73] sets2 <- list(c(1:6), c(7:13), c(14:19), c(20:26), c(27:32), c(33:38), c(39:47), c(48:54), c(55:64), c(65:70)) for(s in sets2) newTab <- cbind(newTab,(apply(vpr2[,s], 1, mean))) nameStrs <- c("Humanism", "Hope", "Sensibility", "HelpingRelationship", "ExpresionOfEmotions", "ProblemSolving", "Teaching", "Environment", "Needs", "Spirituality") names(newTab)[2:11] <- nameStrs newTab <- na.omit(newTab) logitEdu <- glm(Education ~ ., data = newTab, family = "binomial") summary(logitEdu) vif(logitEdu) # Multiple t-tests pVals <- c() for(i in 2:11) { res <- t.test(newTab[newTab$Education=="Low",i],newTab[newTab$Education=="High",i]) pVals <- c(pVals, res$p.value) conf.int1 <- t.test(newTab[newTab$Education=="Low",i])$conf.int } p.adjust(pVals, method = "BH") pdf("plotsPaper3_.pdf", width = 6, height = 3) dev.off()