Income and Trust: Analysis Notebook

# wd temp
setwd("C:/Users/bekes/Documents/GitHub/")
path ="da-w-ai/data/VWS/"
df <- read_csv(paste0(path, "WVS_GDP_merged_data.csv"))
Rows: 66 Columns: 97
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (2): B_COUNTRY_ALPHA, iso3c
dbl (95): A_YEAR, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10, Q11, Q12, Q13, Q1...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
df <- df %>%
  mutate(baseline_trust = 2 - Q57,
         alt_trust = 4 - rowMeans(select(., Q59:Q63), na.rm=TRUE) + 1,
         log_gdppc = log(GDP_USD_PPP_per_capita))
`geom_smooth()` using formula = 'y ~ x'
Warning: Removed 3 rows containing non-finite outside the scale range
(`stat_smooth()`).
Warning: Removed 3 rows containing missing values or values outside the scale range
(`geom_point()`).

summary(lm(baseline_trust ~ log_gdppc, data = df))

Call:
lm(formula = baseline_trust ~ log_gdppc, data = df)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.23286 -0.09800 -0.01321  0.05304  0.44896 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) -0.80042    0.17794  -4.498 3.13e-05 ***
log_gdppc    0.10390    0.01806   5.751 3.04e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.1262 on 61 degrees of freedom
  (3 observations deleted due to missingness)
Multiple R-squared:  0.3516,    Adjusted R-squared:  0.341 
F-statistic: 33.08 on 1 and 61 DF,  p-value: 3.044e-07
summary(lm(alt_trust ~ log_gdppc, data = df))

Call:
lm(formula = alt_trust ~ log_gdppc, data = df)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.53529 -0.12054  0.00505  0.12603  0.45564 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   1.0880     0.2975   3.657 0.000533 ***
log_gdppc     0.1372     0.0302   4.544 2.67e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.2109 on 61 degrees of freedom
  (3 observations deleted due to missingness)
Multiple R-squared:  0.2529,    Adjusted R-squared:  0.2406 
F-statistic: 20.64 on 1 and 61 DF,  p-value: 2.669e-05