podatki <- read.table("~/R/Tamara/Croatia.csv", header=TRUE, sep=";", dec=",")
podatki <- podatki[c(115, 563:574)]
head(podatki)
## atcherp Political LGBT Immigrats SupportEU Identitiy Age Male
## 1 88 8 0.6838839 0.3524827 0 NA 39 0
## 2 88 NA NA NA 1 NA 74 0
## 3 7 3 0.9444896 0.8905329 1 NA 84 0
## 4 88 NA 0.5053813 0.8000890 1 NA 30 0
## 5 77 NA -0.5774030 NA NA NA 32 1
## 6 88 NA NA NA NA 10 77 0
## Education Education_Mother Education_Father Income Religiosity
## 1 11 6 11 NA 6
## 2 2 1 2 1 5
## 3 2 3 3 NA 9
## 4 11 5 6 NA 3
## 5 5 5 NA 1 6
## 6 2 2 2 1 7
podatki$PoliticalRev <- 10-podatki$Political
podatki$LGBTRev <- podatki$LGBT*(-1)
podatki$ImmigrantsRev <- podatki$Immigrats*(-1)
podatki$IdentityRev <- 10-podatki$Identitiy
head(podatki)
## atcherp Political LGBT Immigrats SupportEU Identitiy Age Male
## 1 88 8 0.6838839 0.3524827 0 NA 39 0
## 2 88 NA NA NA 1 NA 74 0
## 3 7 3 0.9444896 0.8905329 1 NA 84 0
## 4 88 NA 0.5053813 0.8000890 1 NA 30 0
## 5 77 NA -0.5774030 NA NA NA 32 1
## 6 88 NA NA NA NA 10 77 0
## Education Education_Mother Education_Father Income Religiosity
## 1 11 6 11 NA 6
## 2 2 1 2 1 5
## 3 2 3 3 NA 9
## 4 11 5 6 NA 3
## 5 5 5 NA 1 6
## 6 2 2 2 1 7
## PoliticalRev LGBTRev ImmigrantsRev IdentityRev
## 1 2 -0.6838839 -0.3524827 NA
## 2 NA NA NA NA
## 3 7 -0.9444896 -0.8905329 NA
## 4 NA -0.5053813 -0.8000890 NA
## 5 NA 0.5774030 NA NA
## 6 NA NA NA 0
Data description:
PoliticalRev: 0 (right) - 10 (left)
LGBTRev: Factor (high values for LGBT)
ImmigrantsRev: Factor (high values for immigrants)
Support for EU: 0 - againts, 1 - for
IdentityRev: How emotionally attached to country (0-very, 10-not at all)
Age: Age in years
Male: 1 - Male, 0 - Female
Education: 1-15 (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 Immigrats SupportEU
## median 6.00 5.00 -1.400000e-01 -3.000000e-02 1.00
## mean 7.33 4.79 0.000000e+00 0.000000e+00 0.84
## SE.mean 0.27 0.07 2.000000e-02 2.000000e-02 0.01
## CI.mean.0.95 0.53 0.13 4.000000e-02 4.000000e-02 0.02
## var 132.30 6.77 7.400000e-01 8.500000e-01 0.13
## std.dev 11.50 2.60 8.600000e-01 9.200000e-01 0.37
## coef.var 1.57 0.54 -8.626913e+15 -4.523505e+15 0.44
## Identitiy Age Male Education Education_Mother
## median 8.00 53.00 0.00 6.00 3.00
## mean 7.72 51.13 0.40 6.28 4.13
## SE.mean 0.06 0.43 0.01 0.06 0.06
## CI.mean.0.95 0.12 0.84 0.02 0.12 0.11
## var 6.85 324.50 0.24 7.04 5.84
## std.dev 2.62 18.01 0.49 2.65 2.42
## coef.var 0.34 0.35 1.22 0.42 0.58
## Education_Father Income Religiosity PoliticalRev
## median 5.00 4.00 6.00 5.00
## mean 4.89 4.70 5.63 5.21
## SE.mean 0.07 0.08 0.08 0.07
## CI.mean.0.95 0.13 0.16 0.15 0.13
## var 7.35 8.85 10.27 6.77
## std.dev 2.71 2.98 3.20 2.60
## coef.var 0.55 0.63 0.57 0.50
## LGBTRev ImmigrantsRev IdentityRev
## median 1.400000e-01 3.000000e-02 2.00
## mean 0.000000e+00 0.000000e+00 2.28
## SE.mean 2.000000e-02 2.000000e-02 0.06
## CI.mean.0.95 4.000000e-02 4.000000e-02 0.12
## var 7.400000e-01 8.500000e-01 6.85
## std.dev 8.600000e-01 9.200000e-01 2.62
## coef.var 8.626913e+15 4.523505e+15 1.15
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.9064 -1.3256 0.0815 1.3693 6.7577
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.313713 0.423509 12.547 < 2e-16 ***
## Age 0.011356 0.004027 2.820 0.004886 **
## Male -0.695855 0.138070 -5.040 0.000000537 ***
## Education 0.204989 0.049674 4.127 0.000039324 ***
## Income -0.005615 0.025140 -0.223 0.823311
## Religiosity -0.181036 0.053326 -3.395 0.000709 ***
## Education:Religiosity -0.020805 0.007415 -2.806 0.005102 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.306 on 1209 degrees of freedom
## (584 observations deleted due to missingness)
## Multiple R-squared: 0.1771, Adjusted R-squared: 0.173
## F-statistic: 43.36 on 6 and 1209 DF, p-value: < 2.2e-16
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
## -6.8422 -1.3655 0.0675 1.3646 6.9516
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.585162 0.397774 14.041 < 2e-16 ***
## Age 0.016647 0.004628 3.597 0.000336 ***
## Male -0.709621 0.139765 -5.077 0.000000446 ***
## Education 0.052638 0.029505 1.784 0.074682 .
## Education_Mother 0.001523 0.044132 0.035 0.972468
## Education_Father 0.081460 0.034739 2.345 0.019199 *
## Income -0.000895 0.025581 -0.035 0.972095
## Religiosity -0.310959 0.021857 -14.227 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.294 on 1161 degrees of freedom
## (631 observations deleted due to missingness)
## Multiple R-squared: 0.1797, Adjusted R-squared: 0.1748
## F-statistic: 36.34 on 7 and 1161 DF, p-value: < 2.2e-16
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
## -2.58170 -0.57617 0.09882 0.56240 2.05053
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.137773 0.142763 -0.965 0.33471
## Age -0.002333 0.001349 -1.730 0.08395 .
## Male -0.171265 0.047005 -3.644 0.00028 ***
## Education 0.081445 0.016774 4.856 0.00000135 ***
## Income 0.024446 0.008507 2.874 0.00413 **
## Religiosity -0.020823 0.018030 -1.155 0.24836
## Education:Religiosity -0.005586 0.002533 -2.205 0.02762 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7917 on 1239 degrees of freedom
## (554 observations deleted due to missingness)
## Multiple R-squared: 0.1136, Adjusted R-squared: 0.1093
## F-statistic: 26.46 on 6 and 1239 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.5997 -0.5580 0.1050 0.5522 2.0007
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.0780455 0.1335961 -0.584 0.559203
## Age -0.0006881 0.0015415 -0.446 0.655418
## Male -0.1724154 0.0473105 -3.644 0.000280 ***
## Education 0.0337529 0.0100466 3.360 0.000805 ***
## Education_Mother 0.0135266 0.0147979 0.914 0.360856
## Education_Father 0.0265065 0.0118081 2.245 0.024966 *
## Income 0.0203174 0.0086009 2.362 0.018326 *
## Religiosity -0.0548329 0.0074207 -7.389 2.78e-13 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7823 on 1187 degrees of freedom
## (605 observations deleted due to missingness)
## Multiple R-squared: 0.1181, Adjusted R-squared: 0.1129
## F-statistic: 22.7 on 7 and 1187 DF, p-value: < 2.2e-16
fit3 <- lm(ImmigrantsRev ~ Age + Male + Education + Income + Religiosity + Education:Religiosity,
data = podatki)
summary(fit3)
##
## Call:
## lm(formula = ImmigrantsRev ~ Age + Male + Education + Income +
## Religiosity + Education:Religiosity, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.41209 -0.59808 0.03295 0.62682 1.89125
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.173368 0.161816 -1.071 0.28421
## Age -0.002059 0.001527 -1.348 0.17781
## Male -0.082155 0.052779 -1.557 0.11983
## Education 0.052955 0.018887 2.804 0.00513 **
## Income 0.022351 0.009616 2.324 0.02028 *
## Religiosity 0.019316 0.020380 0.948 0.34342
## Education:Religiosity -0.006198 0.002839 -2.184 0.02919 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8898 on 1224 degrees of freedom
## (569 observations deleted due to missingness)
## Multiple R-squared: 0.02677, Adjusted R-squared: 0.022
## F-statistic: 5.612 on 6 and 1224 DF, p-value: 0.000009293
fit3a <- lm(ImmigrantsRev ~ Age + Male + Education + Education_Mother + Education_Father + Income + Religiosity,
data = podatki)
summary(fit3a)
##
## Call:
## lm(formula = ImmigrantsRev ~ Age + Male + Education + Education_Mother +
## Education_Father + Income + Religiosity, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.23657 -0.59970 0.02374 0.62078 1.97853
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.134580 0.153163 0.879 0.37976
## Age -0.002604 0.001768 -1.473 0.14093
## Male -0.093036 0.053790 -1.730 0.08396 .
## Education 0.018318 0.011503 1.592 0.11155
## Education_Mother -0.015203 0.016858 -0.902 0.36733
## Education_Father 0.011360 0.013461 0.844 0.39887
## Income 0.018636 0.009830 1.896 0.05823 .
## Religiosity -0.023401 0.008410 -2.782 0.00548 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8911 on 1176 degrees of freedom
## (616 observations deleted due to missingness)
## Multiple R-squared: 0.02394, Adjusted R-squared: 0.01813
## F-statistic: 4.12 on 7 and 1176 DF, p-value: 0.0001746
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
## -2.9766 0.4131 0.5277 0.6139 1.1298
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.352556 0.573932 -2.357 0.018441 *
## Age 0.020555 0.004789 4.292 0.0000177 ***
## Male 0.045281 0.168086 0.269 0.787627
## Education 0.315960 0.084567 3.736 0.000187 ***
## Income 0.052515 0.030789 1.706 0.088074 .
## Religiosity 0.211096 0.070964 2.975 0.002933 **
## Education:Religiosity -0.039022 0.011268 -3.463 0.000534 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1048.2 on 1228 degrees of freedom
## Residual deviance: 1007.6 on 1222 degrees of freedom
## (571 observations deleted due to missingness)
## AIC: 1021.6
##
## Number of Fisher Scoring iterations: 5
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.244 -3.084 -0.915 1.057 84.351
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.12081 1.74654 2.359 0.0184 *
## Age 0.06958 0.01631 4.266 0.0000214 ***
## Male -0.90087 0.56695 -1.589 0.1123
## Education -0.11544 0.20552 -0.562 0.5744
## Income -0.05034 0.10316 -0.488 0.6256
## Religiosity 0.26777 0.21780 1.229 0.2191
## Education:Religiosity -0.02677 0.03062 -0.874 0.3821
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.879 on 1314 degrees of freedom
## (479 observations deleted due to missingness)
## Multiple R-squared: 0.03137, Adjusted R-squared: 0.02694
## F-statistic: 7.092 on 6 and 1314 DF, p-value: 0.000000189
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.5314 -1.5732 -0.4288 1.2444 8.3437
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.710685 0.400401 14.262 < 2e-16 ***
## Age -0.037942 0.003741 -10.141 < 2e-16 ***
## Male -0.511277 0.130014 -3.932 0.0000885 ***
## Education -0.018187 0.047102 -0.386 0.699475
## Income 0.034781 0.023659 1.470 0.141767
## Religiosity -0.192332 0.049905 -3.854 0.000122 ***
## Education:Religiosity -0.007666 0.007015 -1.093 0.274722
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.263 on 1312 degrees of freedom
## (481 observations deleted due to missingness)
## Multiple R-squared: 0.1809, Adjusted R-squared: 0.1772
## F-statistic: 48.3 on 6 and 1312 DF, p-value: < 2.2e-16