File: 03_explaining-scipop-attitudes.R

Comment: Weighted regression model for Ordinary People subscale score (mean)
Category: Statistical Modeling
Code:
m1.ppl.svyglm.fit <- svyglm(scipopppl ~ age + gender + education.comp + education.uni + sciprox.score + urbanity.log + languageregion.ger + languageregion.ita, design = bar.design.scipopppl, family = gaussian, na.action = na.omit) m2.ppl.svyglm.fit <- svyglm(scipopppl ~ age + gender + education.comp + education.uni + sciprox.score + urbanity.log + languageregion.ger + languageregion.ita + polorientation + religiosity, design = bar.design.scipopppl, family = gaussian, na.action = na.omit) m3.ppl.svyglm.fit <- svyglm(scipopppl ~ age + gender + education.comp + education.uni + sciprox.score + urbanity.log + languageregion.ger + languageregion.ita + polorientation + religiosity + interestscience + sciliteracy + trustscience + trustscientists, design = bar.design.scipopppl, family = gaussian, na.action = na.omit)

Comment:  Model assumption checks   Do some assumption checks for multiple linear regression (e.g., see Field, 2012, p. 292). These are:  (1) Multicollinearity  (2) Nonnormality/heteroscedasticity of residuals  Assumption checks (1): Multicollinearity   Specify model and inspect GVIFs  Note: The VIF (usual collinearity diagnostic) may not be applicable to models with dummy regressors  constructed from a polytomous categorical variable or polynomial regressors (Fox, 2016: 357). Fox and  Monette (1992) introduced generalized variance inflation factor (GVIF) for these cases. As  education.uni/education.comp and languageregion.ger/languageregion.ita are such dummy regressors based  on polytomous categorial variables (i.e. education and languageregion), we should compute GVIFs.  car::vif() does that automatically.  GVIFs of SciPop Score models 
Category: Statistical Test
Code:
car::vif(m1.scipopgoertz.svyglm.fit) %>% as.data.frame %>% rename(GVIF = deparse(substitute(.))) car::vif(m2.scipopgoertz.svyglm.fit) %>% as.data.frame %>% rename(GVIF = deparse(substitute(.))) car::vif(m3.scipopgoertz.svyglm.fit) %>% as.data.frame %>% rename(GVIF = deparse(substitute(.)))

Comment: Nonnormality/heteroscedasticity of residuals of ppl Score models
Category: Statistical Modeling
Code:
distributionchecks(m1.ppl.svyglm.fit) distributionchecks(m2.ppl.svyglm.fit) distributionchecks(m3.ppl.svyglm.fit)

Comment: ADDITIONAL ANALYSIS B: TESTING A USHAPED RELATIONSHIP BETWEEN SCIPOP AND POLITICAL ORIENTATION   1st test: Quadratic regression on weighted data
Category: Statistical Test
Code:
bar2019pop$polorientation2 <- bar2019pop$polorientation^2 bar.design <- svydesign(id = ~0, data = bar2019pop, weights = ~weight) quad.scipopgoertz.svyglm.fit <- svyglm(scipopgoertz ~ age + gender + education.comp + education.uni + sciprox.score + urbanity.log + languageregion.ger + languageregion.ita + polorientation + polorientation2 + religiosity + interestscience + sciliteracy + trustscience + trustscientists, design = bar.design, family = gaussian, na.action = na.omit) summ(model = quad.scipopgoertz.svyglm.fit, binary.inputs = "full", n.sd = 2, transform.response = F, confint = F, vifs = F, scale = F, model.info = T,  model.fit = T, digits = 4) quad.scipopgoertz.svyglm.fit$aic m0.scipopgoertz.svyglm.fit <- svyglm(scipopgoertz ~ 1, bar.design, family = gaussian, na.action = na.omit) anova(m0.scipopgoertz.svyglm.fit, quad.scipopgoertz.svyglm.fit, test = "F", method = "Wald")