Skip to content
Snippets Groups Projects
Select Git revision
  • 0ad3a421aa425db840d81d7717be3a34f37c3f87
  • main default protected
  • test_coef
  • 21-things-to-take-care-of-before-submission
4 results

ols_quiz.R

Blame
  • user avatar
    Marder authored
    0ad3a421
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ols_quiz.R 3.25 KiB
    
    quiz_data$Treatment_C <- as.factor(quiz_data$Treatment_C)
    quiz_data$Treatment_D <- as.factor(quiz_data$Treatment_D)
    
    quiz_data$Treatment_C <- relevel(quiz_data$Treatment_C, ref = "No Treatment 3")
    quiz_data$Treatment_D <- relevel(quiz_data$Treatment_D, ref = "No Treatment 3")
    
    ols_percentage_correct_A<- lm( percentage_correct ~ as.factor(Treatment_A) ,quiz_data)
    summary(ols_percentage_correct_A)
    ols_percentage_correct_control_A<- lm( percentage_correct ~ as.factor(Treatment_A) + Z_Mean_NR + as.factor(Gender)+Age_mean+ QFIncome + Uni_degree,quiz_data)
    summary(ols_percentage_correct_control_A)
    
    ols_percentage_correct_B<- lm( percentage_correct ~ as.factor(Treatment_B) ,quiz_data)
    summary(ols_percentage_correct_B)
    ols_percentage_correct_control_B<- lm( percentage_correct ~ as.factor(Treatment_B) + Z_Mean_NR + as.factor(Gender)+Age_mean+ QFIncome + Uni_degree,quiz_data)
    summary(ols_percentage_correct_control_B)
    
    ols_percentage_correct_C<- lm( percentage_correct ~ as.factor(Treatment_C) ,quiz_data)
    summary(ols_percentage_correct_C)
    ols_percentage_correct_control_C<- lm( percentage_correct ~ as.factor(Treatment_C) + Z_Mean_NR + as.factor(Gender)+Age_mean+ QFIncome + Uni_degree,quiz_data)
    summary(ols_percentage_correct_control_C)
    
    vif(ols_percentage_correct_control_C)
    
    
    ols_percentage_correct_D<- lm( percentage_correct ~ as.factor(Treatment_D) ,quiz_data)
    summary(ols_percentage_correct_D)
    ols_percentage_correct_control_D<- lm( percentage_correct ~ as.factor(Treatment_D) + Z_Mean_NR + as.factor(Gender)+Age_mean+ QFIncome + Uni_degree,quiz_data)
    summary(ols_percentage_correct_control_D)
    # 
    # # Create an HTML results table with customized names and stars
    # results_table_3 <- stargazer(
    #   ols_quiz_1a, ols_quiz_control_1a, ols_quiz_1b, ols_quiz_control_1b,  
    #   align = TRUE,
    #   type = "html",
    #   dep.var.labels = "No. correct quiz questions",
    #   covariate.labels = c("Video 1", "Video 2", "No Info choosen", "Text 1", "Text 2",
    #                        "Female", "Divers", "Age", "mittlere Reife", "Abitur", "Berufsausbildung",
    #                        "Hochschulabschluss") ,
    #   star.cutoffs = c(0.1, 0.05, 0.01),  # Custom significance levels
    #   star.char = c("*", "**", "***")  # Custom significance stars
    # )
    # 
    # # Save the HTML table to a file
    # writeLines(results_table_3, "Estimation_results/ols/quiz_1.html")
    # 
    # # Create an HTML results table with customized names and stars
    # results_table_4 <- stargazer(
    #   ols_quiz_2a, ols_quiz_control_2a, ols_quiz_2b, ols_quiz_control_2b,  
    #   align = TRUE,
    #   type = "html",
    #   dep.var.labels = "No. correct quiz questions",
    #   covariate.labels = c("Video", "No Info choosen", "Text",
    #                        "Female", "Divers", "Age", "mittlere Reife", "Abitur", "Berufsausbildung",
    #                        "Hochschulabschluss") ,
    #     star.cutoffs = c(0.1, 0.05, 0.01),  # Custom significance levels
    #   star.char = c("*", "**", "***")  # Custom significance stars
    # )
    # 
    # # Save the HTML table to a file
    # writeLines(results_table_4, "Estimation_results/ols/quiz_2.html")
    # 
    # 
    # # Poisson regression
    # poisson_quiz_2b <- glm(
    #   number_correct ~ Dummy_Video + Dummy_no_info + Dummy_nv,
    #   quiz_data = quiz_data,
    #   family = poisson
    # )
    # summary(poisson_quiz_2b)