PROBLEMI - ne vem kateri pristop izbrati (linearni model, robusti model, winsorizacija, logaritemeska transformacija) - smiselna izbira spremenljivk (problem dobiti podatke za vseh 27 držav) - ne bi rad odstranjeval enot ker je vzorec že tako majhen (n=27) - preveč splošna analiza -
PODATKI
-Vsi podatki za leto 2022, izbrane spremenljivke predvsem zaradi dostopnosti podatkov. vključenih vseh 27 držav članic
tekom regresije želim ohraniti vseh 27 enot
REGRESIJA 1
navadni linearni regresijski model
fit_1 : model vsebuje vse spremenljivke
fit_2 : model ne vsebuje spremenljivke Ren_c_rel
fit_rlm : robusti linearni model: glede na to, da imam enote z visokim vplivom, sem probal robusti pristop. nwm če se ga prav uporabil ker ni nobena spremenljivka značilna.
problemi: cookove razdalje; ne želim odstranjevati enot
podatki <- read.table("D:/Faks/Ljubljana_Ekonomska/Magisterij/1.letnik/Ekonomske politike EU/Seminarska/end projekt/PROJEKT_EU/PROJEKT_EU/data_use.csv", header = TRUE, sep=";", dec=",")
podatki_TEST <- podatki[ ,c("ď.żDrzava","Rene", "Urb", "BDP_pc", "Ren_c_rel", "Carb_pc", "Eng_con_pc", "Ele_p", "Solar_hy_p")]
head(podatki, 5)
## ď.żDrzava Rene Urb BDP_pc Ren_c_rel Carb_pc Eng_con_pc Ele_p
## 1 Austria 33.758 59.256 46697.86 3.128 6.88 42.685 0.15770
## 2 Belgium 13.759 98.153 44184.68 94.172 7.69 58.396 0.17655
## 3 Czechia 18.195 74.377 20237.29 41.993 9.34 44.242 0.16065
## 4 Greece 22.678 80.357 20287.72 65.039 5.75 30.410 0.33775
## 5 Italy 19.131 71.657 33281.34 23.897 5.73 28.910 0.28055
## Solar_hy_p
## 1 5.65
## 2 6.35
## 3 6.25
## 4 3.95
## 5 4.65
summary(podatki[c("Rene", "Urb", "BDP_pc", "Ren_c_rel", "Carb_pc", "Eng_con_pc", "Ele_p", "Solar_hy_p")])
## Rene Urb BDP_pc Ren_c_rel
## Min. :13.11 Min. :53.91 Min. : 9551 Min. : -2.189
## 1st Qu.:17.19 1st Qu.:65.55 1st Qu.: 18707 1st Qu.: 22.600
## Median :20.80 Median :72.55 Median : 27703 Median : 50.363
## Mean :25.68 Mean :74.18 Mean : 35229 Mean : 76.094
## 3rd Qu.:31.68 3rd Qu.:83.59 3rd Qu.: 45441 3rd Qu.: 66.233
## Max. :66.00 Max. :98.15 Max. :109715 Max. :368.344
## Carb_pc Eng_con_pc Ele_p Solar_hy_p
## Min. : 3.100 Min. :18.35 Min. :0.0973 Min. :3.500
## 1st Qu.: 4.525 1st Qu.:27.79 1st Qu.:0.1467 1st Qu.:4.950
## Median : 5.750 Median :34.18 Median :0.1828 Median :5.800
## Mean : 6.034 Mean :38.42 Mean :0.1882 Mean :5.831
## 3rd Qu.: 7.415 3rd Qu.:45.37 3rd Qu.:0.2054 3rd Qu.:6.725
## Max. :11.620 Max. :74.32 Max. :0.3377 Max. :8.550
library(pastecs)
round(stat.desc(podatki)[, -c(1)] , 2)
## Rene Urb BDP_pc Ren_c_rel Carb_pc Eng_con_pc Ele_p
## nbr.val 27.00 27.00 27.00 27.00 27.00 27.00 27.00
## nbr.null 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## nbr.na 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## min 13.11 53.91 9550.94 -2.19 3.10 18.35 0.10
## max 66.00 98.15 109714.92 368.34 11.62 74.32 0.34
## range 52.89 44.24 100163.98 370.53 8.52 55.98 0.24
## sum 693.24 2002.95 951183.69 2054.54 162.91 1037.34 5.08
## median 20.80 72.55 27702.74 50.36 5.75 34.18 0.18
## mean 25.68 74.18 35229.03 76.09 6.03 38.42 0.19
## SE.mean 2.45 2.52 4659.98 18.55 0.38 2.79 0.01
## CI.mean 5.04 5.19 9578.73 38.13 0.79 5.74 0.02
## var 162.35 171.94 586316079.95 9293.06 3.97 210.30 0.00
## std.dev 12.74 13.11 24213.96 96.40 1.99 14.50 0.06
## coef.var 0.50 0.18 0.69 1.27 0.33 0.38 0.32
## Solar_hy_p
## nbr.val 27.00
## nbr.null 0.00
## nbr.na 0.00
## min 3.50
## max 8.55
## range 5.05
## sum 157.45
## median 5.80
## mean 5.83
## SE.mean 0.27
## CI.mean 0.55
## var 1.92
## std.dev 1.39
## coef.var 0.24
podatki_1 <- podatki[ ,c("Rene", "Urb", "BDP_pc", "Ren_c_rel", "Carb_pc", "Eng_con_pc", "Ele_p", "Solar_hy_p")]
library(car)
scatterplotMatrix(podatki_1,
smooth = FALSE)
fit_1 <- lm(Rene ~ Urb + BDP_pc + Ren_c_rel + Carb_pc + Eng_con_pc + Ele_p + Solar_hy_p,
data = podatki)
library(lmtest)
reset_test <- resettest(fit_1, power = 2)
print(reset_test)
##
## RESET test
##
## data: fit_1
## RESET = 11.057, df1 = 1, df2 = 18, p-value = 0.003765
^ Iskreno mi je to chatgpt predlagal da naj naredim. Menda bi lahko izboljšal model, če bi dodal kvadratne ali kubične člene napovedi? Nwm kaj točno naj z tem delam?
podatki$StdOstanki <- round(rstandard(fit_1), 3)
podatki$CooksD <- round(cooks.distance(fit_1), 3)
hist(podatki$StdOstanki,
xlab = "Standardizirani ostanki",
ylab = "Frekvenca",
main = "Histogram standardiziranih ostankov")
shapiro.test(podatki$StdOstanki)
##
## Shapiro-Wilk normality test
##
## data: podatki$StdOstanki
## W = 0.96999, p-value = 0.6014
hist(podatki$CooksD,
xlab = "Cookove razdalje",
ylab = "Frekvenca",
main = "Histogram Cookovih razdalj")
podatki$StdOcenVred <- scale(fit_1$fitted.values)
library(car)
scatterplot(StdOstanki ~ StdOcenVred,
xlab = "Standardizirane ocenjene vrednosti",
ylab = "Standardizirani ostanki",
smooth = FALSE,
regLine = FALSE,
boxplot = FALSE,
data = podatki)
library(olsrr)
ols_test_breusch_pagan(fit_1)
##
## Breusch Pagan Test for Heteroskedasticity
## -----------------------------------------
## Ho: the variance is constant
## Ha: the variance is not constant
##
## Data
## --------------------------------
## Response : Rene
## Variables: fitted values of Rene
##
## Test Summary
## ----------------------------
## DF = 1
## Chi2 = 0.6795345
## Prob > Chi2 = 0.409747
library(Hmisc)
rcorr(as.matrix(podatki[c("Rene", "Urb", "BDP_pc", "Ren_c_rel", "Carb_pc", "Eng_con_pc", "Ele_p", "Solar_hy_p")],
type = "pearson"))
## Rene Urb BDP_pc Ren_c_rel Carb_pc Eng_con_pc Ele_p Solar_hy_p
## Rene 1.00 0.03 -0.01 -0.38 -0.37 0.04 -0.20 0.37
## Urb 0.03 1.00 0.42 0.55 0.14 0.71 -0.27 0.14
## BDP_pc -0.01 0.42 1.00 0.50 0.48 0.50 -0.26 0.48
## Ren_c_rel -0.38 0.55 0.50 1.00 0.28 0.63 -0.28 -0.03
## Carb_pc -0.37 0.14 0.48 0.28 1.00 0.34 -0.15 0.43
## Eng_con_pc 0.04 0.71 0.50 0.63 0.34 1.00 -0.52 0.38
## Ele_p -0.20 -0.27 -0.26 -0.28 -0.15 -0.52 1.00 -0.33
## Solar_hy_p 0.37 0.14 0.48 -0.03 0.43 0.38 -0.33 1.00
##
## n= 27
##
##
## P
## Rene Urb BDP_pc Ren_c_rel Carb_pc Eng_con_pc Ele_p Solar_hy_p
## Rene 0.8728 0.9491 0.0531 0.0544 0.8529 0.3222 0.0574
## Urb 0.8728 0.0274 0.0031 0.4992 0.0000 0.1761 0.4777
## BDP_pc 0.9491 0.0274 0.0086 0.0107 0.0079 0.1851 0.0107
## Ren_c_rel 0.0531 0.0031 0.0086 0.1602 0.0004 0.1568 0.8651
## Carb_pc 0.0544 0.4992 0.0107 0.1602 0.0858 0.4455 0.0244
## Eng_con_pc 0.8529 0.0000 0.0079 0.0004 0.0858 0.0051 0.0505
## Ele_p 0.3222 0.1761 0.1851 0.1568 0.4455 0.0051 0.0954
## Solar_hy_p 0.0574 0.4777 0.0107 0.8651 0.0244 0.0505 0.0954
vif(fit_1)
## Urb BDP_pc Ren_c_rel Carb_pc Eng_con_pc Ele_p Solar_hy_p
## 2.340185 2.157944 2.550723 1.497416 3.886060 1.467176 2.143498
mean(vif(fit_1))
## [1] 2.291858
durbinWatsonTest(fit_1)
## lag Autocorrelation D-W Statistic p-value
## 1 0.05475445 1.842342 0.568
## Alternative hypothesis: rho != 0
fit_2 <- lm(Rene ~ Urb + BDP_pc + Carb_pc + Eng_con_pc + Ele_p + Solar_hy_p,
data = podatki)
summary(fit_2)
##
## Call:
## lm(formula = Rene ~ Urb + BDP_pc + Carb_pc + Eng_con_pc + Ele_p +
## Solar_hy_p, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -14.019 -8.197 1.055 6.489 16.693
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.865e+01 1.975e+01 0.945 0.35611
## Urb 7.526e-02 2.347e-01 0.321 0.75181
## BDP_pc -1.915e-05 1.114e-04 -0.172 0.86523
## Carb_pc -4.049e+00 1.224e+00 -3.308 0.00351 **
## Eng_con_pc -8.465e-02 2.470e-01 -0.343 0.73539
## Ele_p -2.602e+01 4.069e+01 -0.639 0.52981
## Solar_hy_p 5.949e+00 1.805e+00 3.295 0.00362 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 10.27 on 20 degrees of freedom
## Multiple R-squared: 0.4999, Adjusted R-squared: 0.3499
## F-statistic: 3.332 on 6 and 20 DF, p-value: 0.01932
summary(fit_1)
##
## Call:
## lm(formula = Rene ~ Urb + BDP_pc + Ren_c_rel + Carb_pc + Eng_con_pc +
## Ele_p + Solar_hy_p, data = podatki)
##
## Residuals:
## Min 1Q Median 3Q Max
## -15.3081 -4.8294 -0.9866 7.6600 12.6494
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.051e+01 1.861e+01 1.102 0.28429
## Urb 9.801e-02 2.213e-01 0.443 0.66280
## BDP_pc 7.035e-05 1.151e-04 0.611 0.54816
## Ren_c_rel -5.938e-02 3.142e-02 -1.890 0.07416 .
## Carb_pc -3.721e+00 1.165e+00 -3.194 0.00478 **
## Eng_con_pc 1.258e-01 2.578e-01 0.488 0.63107
## Ele_p -2.882e+01 3.833e+01 -0.752 0.46141
## Solar_hy_p 3.939e+00 2.005e+00 1.965 0.06420 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.671 on 19 degrees of freedom
## Multiple R-squared: 0.579, Adjusted R-squared: 0.4239
## F-statistic: 3.733 on 7 and 19 DF, p-value: 0.0104
library(lm.beta)
lm.beta(fit_1)
##
## Call:
## lm(formula = Rene ~ Urb + BDP_pc + Ren_c_rel + Carb_pc + Eng_con_pc +
## Ele_p + Solar_hy_p, data = podatki)
##
## Standardized Coefficients::
## (Intercept) Urb BDP_pc Ren_c_rel Carb_pc Eng_con_pc
## NA 0.1008642 0.1336986 -0.4492337 -0.5817239 0.1432233
## Ele_p Solar_hy_p
## -0.1355416 0.4282413
lm.beta(fit_2)
##
## Call:
## lm(formula = Rene ~ Urb + BDP_pc + Carb_pc + Eng_con_pc + Ele_p +
## Solar_hy_p, data = podatki)
##
## Standardized Coefficients::
## (Intercept) Urb BDP_pc Carb_pc Eng_con_pc Ele_p
## NA 0.07744858 -0.03639488 -0.63294962 -0.09634416 -0.12237984
## Solar_hy_p
## 0.64665757
anova(fit_1, fit_2)
## Analysis of Variance Table
##
## Model 1: Rene ~ Urb + BDP_pc + Ren_c_rel + Carb_pc + Eng_con_pc + Ele_p +
## Solar_hy_p
## Model 2: Rene ~ Urb + BDP_pc + Carb_pc + Eng_con_pc + Ele_p + Solar_hy_p
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 19 1777.0
## 2 20 2110.9 -1 -333.97 3.5709 0.07416 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
podatki$OcenVred <- fitted.values(fit_1)
podatki$Ostanek <- residuals(fit_1)
head(podatki[colnames(podatki) %in% c("ď.żDrzava", "Rene", "OcenVred", "Ostanek")])
## ď.żDrzava Rene OcenVred Ostanek
## 1 Austria 33.758 26.90367 6.854333
## 2 Belgium 13.759 26.31088 -12.551878
## 3 Czechia 18.195 17.53770 0.657301
## 4 Greece 22.678 14.21236 8.465643
## 5 Italy 19.131 21.00817 -1.877166
## 6 Lithuania 29.599 33.70054 -4.101539
sum(podatki$Ostanek)
## [1] 8.65974e-15
library(MASS)
fit_rlm <- rlm(Rene ~ Urb + BDP_pc + Ren_c_rel + Carb_pc + Eng_con_pc + Ele_p + Solar_hy_p,
data = podatki)
summary(fit_rlm)
##
## Call: rlm(formula = Rene ~ Urb + BDP_pc + Ren_c_rel + Carb_pc + Eng_con_pc +
## Ele_p + Solar_hy_p, data = podatki)
## Residuals:
## Min 1Q Median 3Q Max
## -18.551 -4.609 -1.417 6.347 13.598
##
## Coefficients:
## Value Std. Error t value
## (Intercept) 22.5703 22.4994 1.0031
## Urb 0.0946 0.2674 0.3539
## BDP_pc 0.0001 0.0001 0.9746
## Ren_c_rel -0.0649 0.0380 -1.7082
## Carb_pc -3.7980 1.4082 -2.6970
## Eng_con_pc 0.0991 0.3116 0.3182
## Ele_p -26.7136 46.3297 -0.5766
## Solar_hy_p 3.5852 2.4231 1.4796
##
## Residual standard error: 7.273 on 19 degrees of freedom
anova(fit_1, fit_rlm)
## Analysis of Variance Table
##
## Model 1: Rene ~ Urb + BDP_pc + Ren_c_rel + Carb_pc + Eng_con_pc + Ele_p +
## Solar_hy_p
## Model 2: Rene ~ Urb + BDP_pc + Ren_c_rel + Carb_pc + Eng_con_pc + Ele_p +
## Solar_hy_p
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 19 1777.0
## 2 1819.5 -42.555
library(boot)
boot_fun <- function(data, indices) {
sample_data <- data[indices, ]
fit <- lm(Rene ~ Urb + BDP_pc + Ren_c_rel + Carb_pc + Eng_con_pc + Ele_p + Solar_hy_p, data = sample_data)
return(coef(fit))
}
boot_results <- boot(data = podatki, statistic = boot_fun, R = 1000)
print(boot_results)
##
## ORDINARY NONPARAMETRIC BOOTSTRAP
##
##
## Call:
## boot(data = podatki, statistic = boot_fun, R = 1000)
##
##
## Bootstrap Statistics :
## original bias std. error
## t1* 2.051069e+01 3.287096e+00 19.378973278
## t2* 9.800992e-02 -9.031127e-02 0.266299621
## t3* 7.035334e-05 5.261626e-06 0.000180042
## t4* -5.937680e-02 5.285626e-03 0.044822135
## t5* -3.720850e+00 -3.828075e-01 1.659748587
## t6* 1.258409e-01 9.264277e-02 0.364868240
## t7* -2.881502e+01 1.237260e+01 44.655843566
## t8* 3.939423e+00 -1.363666e-01 2.162139367
REGRESIJA 2
podatki_TEST$Rene_log <- log(podatki$Rene)
podatki_TEST$Carb_pc_log <- log(podatki$Carb_pc)
podatki_TEST$Solar_hy_p_log <- log(podatki$Solar_hy_p)
fit_1_TEST <- lm(Rene_log ~ Urb + BDP_pc + Ren_c_rel + Carb_pc_log + Eng_con_pc + Ele_p + Solar_hy_p_log,
data = podatki_TEST)
reset_test <- resettest(fit_1_TEST, power = 2)
print(reset_test)
##
## RESET test
##
## data: fit_1_TEST
## RESET = 4.7024, df1 = 1, df2 = 18, p-value = 0.04376
podatki_TEST$StdOstanki <- round(rstandard(fit_1_TEST), 3)
podatki_TEST$CooksD <- round(cooks.distance(fit_1_TEST), 3)
hist(podatki_TEST$StdOstanki,
xlab = "Standardizirani ostanki",
ylab = "Frekvenca",
main = "Histogram standardiziranih ostankov")
shapiro.test(podatki_TEST$StdOstanki)
##
## Shapiro-Wilk normality test
##
## data: podatki_TEST$StdOstanki
## W = 0.94676, p-value = 0.1788
hist(podatki_TEST$CooksD,
xlab = "Cookove razdalje",
ylab = "Frekvenca",
main = "Histogram Cookovih razdalj")
podatki_TEST$StdOcenVred <- scale(fit_1_TEST$fitted.values)
library(car)
scatterplot(StdOstanki ~ StdOcenVred,
xlab = "Standardizirane ocenjene vrednosti",
ylab = "Standardizirani ostanki",
smooth = FALSE,
regLine = FALSE,
boxplot = FALSE,
data = podatki_TEST)
ols_test_breusch_pagan(fit_1_TEST)
##
## Breusch Pagan Test for Heteroskedasticity
## -----------------------------------------
## Ho: the variance is constant
## Ha: the variance is not constant
##
## Data
## ------------------------------------
## Response : Rene_log
## Variables: fitted values of Rene_log
##
## Test Summary
## ----------------------------
## DF = 1
## Chi2 = 0.2140385
## Prob > Chi2 = 0.6436203
rcorr(as.matrix(podatki_TEST[c("Rene_log", "Urb", "BDP_pc", "Ren_c_rel", "Carb_pc_log", "Eng_con_pc", "Ele_p", "Solar_hy_p_log")],
type = "pearson"))
## Rene_log Urb BDP_pc Ren_c_rel Carb_pc_log Eng_con_pc Ele_p
## Rene_log 1.00 -0.09 -0.13 -0.47 -0.38 -0.12 -0.12
## Urb -0.09 1.00 0.42 0.55 0.08 0.71 -0.27
## BDP_pc -0.13 0.42 1.00 0.50 0.42 0.50 -0.26
## Ren_c_rel -0.47 0.55 0.50 1.00 0.17 0.63 -0.28
## Carb_pc_log -0.38 0.08 0.42 0.17 1.00 0.26 -0.09
## Eng_con_pc -0.12 0.71 0.50 0.63 0.26 1.00 -0.52
## Ele_p -0.12 -0.27 -0.26 -0.28 -0.09 -0.52 1.00
## Solar_hy_p_log 0.23 0.11 0.46 -0.06 0.43 0.35 -0.31
## Solar_hy_p_log
## Rene_log 0.23
## Urb 0.11
## BDP_pc 0.46
## Ren_c_rel -0.06
## Carb_pc_log 0.43
## Eng_con_pc 0.35
## Ele_p -0.31
## Solar_hy_p_log 1.00
##
## n= 27
##
##
## P
## Rene_log Urb BDP_pc Ren_c_rel Carb_pc_log Eng_con_pc Ele_p
## Rene_log 0.6474 0.5098 0.0132 0.0503 0.5604 0.5476
## Urb 0.6474 0.0274 0.0031 0.6964 0.0000 0.1761
## BDP_pc 0.5098 0.0274 0.0086 0.0294 0.0079 0.1851
## Ren_c_rel 0.0132 0.0031 0.0086 0.4103 0.0004 0.1568
## Carb_pc_log 0.0503 0.6964 0.0294 0.4103 0.1827 0.6413
## Eng_con_pc 0.5604 0.0000 0.0079 0.0004 0.1827 0.0051
## Ele_p 0.5476 0.1761 0.1851 0.1568 0.6413 0.0051
## Solar_hy_p_log 0.2462 0.5941 0.0169 0.7684 0.0239 0.0771 0.1138
## Solar_hy_p_log
## Rene_log 0.2462
## Urb 0.5941
## BDP_pc 0.0169
## Ren_c_rel 0.7684
## Carb_pc_log 0.0239
## Eng_con_pc 0.0771
## Ele_p 0.1138
## Solar_hy_p_log
vif(fit_1_TEST)
## Urb BDP_pc Ren_c_rel Carb_pc_log Eng_con_pc
## 2.338064 2.083882 2.469738 1.397758 3.830728
## Ele_p Solar_hy_p_log
## 1.477951 2.045724
mean(vif(fit_1_TEST))
## [1] 2.234835
durbinWatsonTest(fit_1_TEST)
## lag Autocorrelation D-W Statistic p-value
## 1 0.1057444 1.734006 0.4
## Alternative hypothesis: rho != 0
fit_2_TEST <- lm(Rene_log ~ Urb + BDP_pc + Carb_pc_log + Eng_con_pc + Ele_p + Solar_hy_p_log,
data = podatki_TEST)
summary(fit_2_TEST)
##
## Call:
## lm(formula = Rene_log ~ Urb + BDP_pc + Carb_pc_log + Eng_con_pc +
## Ele_p + Solar_hy_p_log, data = podatki_TEST)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.62284 -0.27649 -0.01222 0.25569 0.55279
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.089e+00 9.609e-01 3.215 0.00435 **
## Urb 1.977e-03 8.933e-03 0.221 0.82708
## BDP_pc -1.871e-06 4.134e-06 -0.452 0.65582
## Carb_pc_log -7.020e-01 2.775e-01 -2.530 0.01992 *
## Eng_con_pc -6.661e-03 9.311e-03 -0.715 0.48265
## Ele_p -9.505e-01 1.554e+00 -0.612 0.54768
## Solar_hy_p_log 9.445e-01 3.843e-01 2.458 0.02322 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3908 on 20 degrees of freedom
## Multiple R-squared: 0.3751, Adjusted R-squared: 0.1876
## F-statistic: 2.001 on 6 and 20 DF, p-value: 0.1134
summary(fit_1_TEST)
##
## Call:
## lm(formula = Rene_log ~ Urb + BDP_pc + Ren_c_rel + Carb_pc_log +
## Eng_con_pc + Ele_p + Solar_hy_p_log, data = podatki_TEST)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.67191 -0.17153 0.00718 0.27849 0.54364
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.485e+00 8.953e-01 3.893 0.000978 ***
## Urb 2.599e-03 8.162e-03 0.318 0.753664
## BDP_pc 2.096e-06 4.173e-06 0.502 0.621220
## Ren_c_rel -2.547e-03 1.141e-03 -2.232 0.037851 *
## Carb_pc_log -6.632e-01 2.540e-01 -2.611 0.017171 *
## Eng_con_pc 2.528e-03 9.447e-03 0.268 0.791933
## Ele_p -1.042e+00 1.420e+00 -0.734 0.472158
## Solar_hy_p_log 4.882e-01 4.061e-01 1.202 0.244131
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3569 on 19 degrees of freedom
## Multiple R-squared: 0.5049, Adjusted R-squared: 0.3225
## F-statistic: 2.768 on 7 and 19 DF, p-value: 0.03664
lm.beta(fit_2_TEST)
##
## Call:
## lm(formula = Rene_log ~ Urb + BDP_pc + Carb_pc_log + Eng_con_pc +
## Ele_p + Solar_hy_p_log, data = podatki_TEST)
##
## Standardized Coefficients::
## (Intercept) Urb BDP_pc Carb_pc_log Eng_con_pc
## NA 0.05978595 -0.10445539 -0.52746254 -0.22276007
## Ele_p Solar_hy_p_log
## -0.13138052 0.53694743
lm.beta(fit_1_TEST)
##
## Call:
## lm(formula = Rene_log ~ Urb + BDP_pc + Ren_c_rel + Carb_pc_log +
## Eng_con_pc + Ele_p + Solar_hy_p_log, data = podatki_TEST)
##
## Standardized Coefficients::
## (Intercept) Urb BDP_pc Ren_c_rel Carb_pc_log
## NA 0.07858718 0.11705161 -0.56622446 -0.49833013
## Eng_con_pc Ele_p Solar_hy_p_log
## 0.08452850 -0.14396177 0.27752077
anova(fit_1_TEST, fit_2_TEST)
## Analysis of Variance Table
##
## Model 1: Rene_log ~ Urb + BDP_pc + Ren_c_rel + Carb_pc_log + Eng_con_pc +
## Ele_p + Solar_hy_p_log
## Model 2: Rene_log ~ Urb + BDP_pc + Carb_pc_log + Eng_con_pc + Ele_p +
## Solar_hy_p_log
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 19 2.4204
## 2 20 3.0550 -1 -0.63462 4.9819 0.03785 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1