podatki <- read.table("~/R/Tamara/Serbia.csv", header=TRUE, sep=";", dec=",")
podatki <- podatki[c(115, 565:576)]
head(podatki)
## atcherp Political LGBT Immigrants SupportEU Identity Age Male
## 1 0 5 1.243838 -0.07422807 1 0 62 1
## 2 0 NA 1.243838 -1.51756359 1 0 81 1
## 3 0 0 1.243838 -1.51756359 1 0 40 1
## 4 10 5 1.243838 1.41746061 1 0 67 1
## 5 10 10 1.243838 -1.07789409 1 0 40 1
## 6 8 5 1.243838 1.59619225 1 0 38 0
## Education Education_Mother Education_Father Income Religiosity
## 1 12 6 9 6 0
## 2 12 2 3 NA 4
## 3 7 3 3 NA 8
## 4 12 1 2 1 10
## 5 3 3 3 3 10
## 6 9 3 3 3 10
podatki$PoliticalRev <- 10-podatki$Political
podatki$LGBTRev <- podatki$LGBT*(-1)
podatki$IdentityRev <- 10-podatki$Identity
Data description:
PoliticalRev: 0 (right) - 10 (left)
LGBTRev: Factor (high values for LGBT)
Immigrant: Factor (high values for immigrants)
Support for EU: 0 - againts, 1 - for
IdentityRev: How emotionally attached to country (0-very, 10-not at all-tolerant)
Age: Age in years
Male: 1 - Male, 0 - Female
Education: 1-18 (higher value means higher education)
Education_Mother
Education_Father
Income: 1-10 (higher value means higher income)
Religiosity: 0-10 (higher value means more religious)
library(pastecs)
round(stat.desc(podatki, basic=FALSE), 2)
## atcherp Political LGBT Immigrants SupportEU
## median 5.00 5.00 -3.000000e-02 -3.000000e-02 1.00
## mean 7.38 4.38 0.000000e+00 0.000000e+00 0.64
## SE.mean 0.37 0.07 2.000000e-02 2.000000e-02 0.01
## CI.mean.0.95 0.73 0.14 4.000000e-02 4.000000e-02 0.02
## var 280.42 6.91 7.400000e-01 8.800000e-01 0.23
## std.dev 16.75 2.63 8.600000e-01 9.400000e-01 0.48
## coef.var 2.27 0.60 -2.514061e+15 -1.496906e+15 0.76
## Identity Age Male Education Education_Mother
## median 9.00 55.00 0.00 8.00 3.00
## mean 7.69 53.68 0.48 7.68 4.33
## SE.mean 0.06 0.40 0.01 0.09 0.08
## CI.mean.0.95 0.13 0.79 0.02 0.17 0.16
## var 8.33 325.15 0.25 15.88 13.66
## std.dev 2.89 18.03 0.50 3.99 3.70
## coef.var 0.38 0.34 1.04 0.52 0.85
## Education_Father Income Religiosity PoliticalRev
## median 3.00 4.00 6.00 5.00
## mean 5.49 4.69 5.87 5.62
## SE.mean 0.09 0.07 0.07 0.07
## CI.mean.0.95 0.18 0.13 0.13 0.14
## var 17.04 6.96 9.16 6.91
## std.dev 4.13 2.64 3.03 2.63
## coef.var 0.75 0.56 0.52 0.47
## LGBTRev IdentityRev
## median 3.000000e-02 1.00
## mean 0.000000e+00 2.31
## SE.mean 2.000000e-02 0.06
## CI.mean.0.95 4.000000e-02 0.13
## var 7.400000e-01 8.33
## std.dev 8.600000e-01 2.89
## coef.var 2.514061e+15 1.25
fit1 <- lm(PoliticalRev ~ Age + Male + Education + Income + Religiosity + Education:Religiosity,
data = podatki)
summary(fit1)
##
## Call:
## lm(formula = PoliticalRev ~ Age + Male + Education + Income +
## Religiosity + Education:Religiosity, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.8760 -1.1371 -0.2762 1.6580 5.5583
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.236160 0.518340 8.173 8.87e-16 ***
## Age 0.015153 0.004792 3.162 0.00161 **
## Male -0.149346 0.161219 -0.926 0.35448
## Education 0.125042 0.042861 2.917 0.00361 **
## Income 0.063484 0.033501 1.895 0.05838 .
## Religiosity 0.058535 0.059023 0.992 0.32156
## Education:Religiosity -0.023082 0.006556 -3.521 0.00045 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.557 on 1022 degrees of freedom
## (1001 observations deleted due to missingness)
## Multiple R-squared: 0.04648, Adjusted R-squared: 0.04088
## F-statistic: 8.303 on 6 and 1022 DF, p-value: 0.000000008413
fit1a <- lm(PoliticalRev ~ Age + Male + Education + Education_Mother + Education_Father + Income + Religiosity,
data = podatki)
summary(fit1a)
##
## Call:
## lm(formula = PoliticalRev ~ Age + Male + Education + Education_Mother +
## Education_Father + Income + Religiosity, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -7.0561 -1.1457 -0.2478 1.6019 5.5686
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.732640 0.500491 11.454 < 2e-16 ***
## Age 0.011296 0.005773 1.957 0.0507 .
## Male -0.155475 0.165228 -0.941 0.3469
## Education 0.011392 0.024628 0.463 0.6438
## Education_Mother -0.025957 0.034868 -0.744 0.4568
## Education_Father -0.034612 0.030543 -1.133 0.2574
## Income 0.070626 0.034443 2.051 0.0406 *
## Religiosity -0.136208 0.028103 -4.847 0.00000146 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.57 on 993 degrees of freedom
## (1029 observations deleted due to missingness)
## Multiple R-squared: 0.04082, Adjusted R-squared: 0.03406
## F-statistic: 6.037 on 7 and 993 DF, p-value: 0.0000006526
fit2 <- lm(LGBTRev ~ Age + Male + Education + Income + Religiosity + Education:Religiosity,
data = podatki)
summary(fit2)
##
## Call:
## lm(formula = LGBTRev ~ Age + Male + Education + Income + Religiosity +
## Education:Religiosity, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.95479 -0.64024 0.02922 0.57095 2.67851
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.289540 0.133092 2.175 0.0298 *
## Age -0.006997 0.001264 -5.535 3.72e-08 ***
## Male -0.302815 0.043446 -6.970 4.91e-12 ***
## Education 0.054404 0.011674 4.660 3.47e-06 ***
## Income 0.023273 0.009276 2.509 0.0122 *
## Religiosity -0.032166 0.014887 -2.161 0.0309 *
## Education:Religiosity -0.002490 0.001754 -1.419 0.1561
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7939 on 1369 degrees of freedom
## (654 observations deleted due to missingness)
## Multiple R-squared: 0.1513, Adjusted R-squared: 0.1475
## F-statistic: 40.66 on 6 and 1369 DF, p-value: < 2.2e-16
fit2a <- lm(LGBTRev ~ Age + Male + Education + Education_Mother + Education_Father + Income + Religiosity,
data = podatki)
summary(fit2a)
##
## Call:
## lm(formula = LGBTRev ~ Age + Male + Education + Education_Mother +
## Education_Father + Income + Religiosity, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.07490 -0.63133 0.02077 0.58228 2.63200
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.134242 0.131838 1.018 0.3088
## Age -0.003197 0.001547 -2.067 0.0390 *
## Male -0.307215 0.044291 -6.936 6.29e-12 ***
## Education 0.029736 0.006593 4.510 7.06e-06 ***
## Education_Mother 0.015334 0.009758 1.571 0.1163
## Education_Father 0.018729 0.008416 2.225 0.0262 *
## Income 0.016690 0.009511 1.755 0.0795 .
## Religiosity -0.050200 0.007448 -6.740 2.37e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.792 on 1317 degrees of freedom
## (705 observations deleted due to missingness)
## Multiple R-squared: 0.1619, Adjusted R-squared: 0.1574
## F-statistic: 36.34 on 7 and 1317 DF, p-value: < 2.2e-16
fit3 <- lm(Immigrants ~ Age + Male + Education + Income + Religiosity + Education:Religiosity,
data = podatki)
summary(fit3)
##
## Call:
## lm(formula = Immigrants ~ Age + Male + Education + Income + Religiosity +
## Education:Religiosity, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.19089 -0.61655 0.02072 0.64972 2.20126
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.046432 0.155282 0.299 0.76497
## Age -0.007460 0.001472 -5.067 0.000000461 ***
## Male -0.060743 0.049805 -1.220 0.22283
## Education 0.042548 0.013292 3.201 0.00140 **
## Income 0.028765 0.010610 2.711 0.00679 **
## Religiosity 0.013214 0.017161 0.770 0.44143
## Education:Religiosity -0.002926 0.002007 -1.458 0.14501
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9025 on 1336 degrees of freedom
## (687 observations deleted due to missingness)
## Multiple R-squared: 0.0635, Adjusted R-squared: 0.05929
## F-statistic: 15.1 on 6 and 1336 DF, p-value: < 2.2e-16
fit3a <- lm(Immigrants ~ Age + Male + Education + Education_Mother + Education_Father + Income + Religiosity,
data = podatki)
summary(fit3a)
##
## Call:
## lm(formula = Immigrants ~ Age + Male + Education + Education_Mother +
## Education_Father + Income + Religiosity, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.0092 -0.6580 0.0138 0.6293 2.2378
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.028755 0.153576 -0.187 0.85150
## Age -0.004929 0.001797 -2.742 0.00618 **
## Male -0.062629 0.050817 -1.232 0.21801
## Education 0.017737 0.007592 2.336 0.01963 *
## Education_Mother 0.009663 0.011283 0.856 0.39191
## Education_Father 0.017319 0.009783 1.770 0.07691 .
## Income 0.023888 0.010884 2.195 0.02836 *
## Religiosity -0.007028 0.008561 -0.821 0.41186
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.9026 on 1288 degrees of freedom
## (734 observations deleted due to missingness)
## Multiple R-squared: 0.06991, Adjusted R-squared: 0.06486
## F-statistic: 13.83 on 7 and 1288 DF, p-value: < 2.2e-16
fit4 <- glm(SupportEU ~ Age + Male + Education + Income + Religiosity + Education:Religiosity,
family=binomial,
data = podatki)
summary(fit4)
##
## Call:
## glm(formula = SupportEU ~ Age + Male + Education + Income + Religiosity +
## Education:Religiosity, family = binomial, data = podatki)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.8653 -1.3653 0.8758 0.9677 1.1856
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.5924259 0.3889746 1.523 0.1277
## Age -0.0048047 0.0036311 -1.323 0.1858
## Male -0.0448965 0.1227600 -0.366 0.7146
## Education 0.0854187 0.0354037 2.413 0.0158 *
## Income -0.0002054 0.0256282 -0.008 0.9936
## Religiosity 0.0296524 0.0433281 0.684 0.4937
## Education:Religiosity -0.0121687 0.0051745 -2.352 0.0187 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1569.7 on 1206 degrees of freedom
## Residual deviance: 1551.9 on 1200 degrees of freedom
## (823 observations deleted due to missingness)
## AIC: 1565.9
##
## Number of Fisher Scoring iterations: 4
fit4a <- lm(atcherp ~ Age + Male + Education + Income + Religiosity + Education:Religiosity,
data = podatki)
summary(fit4a)
##
## Call:
## lm(formula = atcherp ~ Age + Male + Education + Income + Religiosity +
## Education:Religiosity, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.937 -5.601 -2.315 0.828 85.193
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.99945 2.40709 2.908 0.00369 **
## Age 0.03792 0.02314 1.639 0.10149
## Male -1.82243 0.79127 -2.303 0.02140 *
## Education 0.07563 0.20894 0.362 0.71744
## Income -0.27340 0.16698 -1.637 0.10177
## Religiosity 0.41154 0.26329 1.563 0.11825
## Education:Religiosity -0.07020 0.03136 -2.239 0.02531 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.2 on 1519 degrees of freedom
## (504 observations deleted due to missingness)
## Multiple R-squared: 0.02626, Adjusted R-squared: 0.02242
## F-statistic: 6.829 on 6 and 1519 DF, p-value: 0.0000003662
fit5 <- lm(IdentityRev ~ Age + Male + Education + Income + Religiosity + Education:Religiosity,
data = podatki)
summary(fit5)
##
## Call:
## lm(formula = IdentityRev ~ Age + Male + Education + Income +
## Religiosity + Education:Religiosity, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -4.5421 -1.8300 -0.7335 1.2204 9.5765
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.615429 0.422006 13.307 < 2e-16 ***
## Age -0.035988 0.004051 -8.884 < 2e-16 ***
## Male -0.139413 0.138543 -1.006 0.314
## Education 0.064804 0.036618 1.770 0.077 .
## Income -0.137867 0.029222 -4.718 0.00000260 ***
## Religiosity -0.221235 0.046184 -4.790 0.00000183 ***
## Education:Religiosity 0.002525 0.005494 0.460 0.646
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.659 on 1514 degrees of freedom
## (509 observations deleted due to missingness)
## Multiple R-squared: 0.1169, Adjusted R-squared: 0.1134
## F-statistic: 33.41 on 6 and 1514 DF, p-value: < 2.2e-16