R Markdown Task 1
belgium_data <- subset(data, cntry == “BE”)
model <- lm(trstprl ~ wrkprty, data = belgium_data)
coefficients <- coef(model)
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
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)