R Markdown Task 1

belgium_data <- subset(data, cntry == “BE”)

model <- lm(trstprl ~ wrkprty, data = belgium_data)

coefficients <- coef(model)

Named num [1:2] 4.03 1.17

Answer: Trust in European Parliment=4.03+1.17×wrkprty

Interpretation: The intercept (4.03) represents the expected trust in the European Parliament for someone who has not worked in a political party. The coefficient of wrkprty (1.17) suggests that for individuals who have worked in a political party, their trust in the European Parliament is expected to be 1.17 units higher, on average, compared to those who haven’t worked in a political party.

Task 2

bulgaria_data <- subset(data, cntry == “BG”)

model_bulgaria <- lm(stfdem ~ brncntr, data = bulgaria_data)

summary(model_bulgaria)

Call: lm(formula = stfdem ~ brncntr, data = bulgaria_data)

Residuals: Min 1Q Median 3Q Max -8.706 -7.706 -5.706 -3.706 90.294

Coefficients: Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.2629 1.6494 5.616 2e-08 *** brncntr -0.5565 1.6246 -0.343 0.732
— Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 21.49 on 13238 degrees of freedom Multiple R-squared: 8.863e-06, Adjusted R-squared: -6.668e-05 F-statistic: 0.1173 on 1 and 13238 DF, p-value: 0.732

# From the model output, the intercept is 9.2629, and the coefficient for brncntr (representing being born outside Bulgaria) is -0.5565

Linear Regression=Intercept+Coefficient of brncntr×1

= 9.2629+(−0.5565)×1

= 8.7064

Answer: Based on the regression model, the expected average satisfaction with democracy for respondents not born in Bulgaria is approximately 8.7064.

Task 3

germany_data <- subset(data, cntry == “DE”)

model_germany <- lm(stfgov ~ empl, data = germany_data)

install.packages(“remotes”)

remotes::install_github(“datalorax/equatiomatic”, force = TRUE)

library(equatiomatic)

equatiomatic::extract_eq(model_germany, use_coefs = TRUE)

= 4.32 + 0.32()

Answer: The regression model is stfgov(hat)=4.32+0.32×empl

The regression equation suggests that the satisfaction with government (stfgov) is 4.32 when employment status (empl) is zero. Each additional unit increase in ‘empl’ is associated with an increase of 0.32 units in ‘stfgov’, indicating a direct relationship between employment status and satisfaction with government.