R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

packages <- c("tidyverse", "infer", "fst", "modelsummary", "effects", "survey", "MASS", "flextable", "equatiomatic") # add any you need here

new_packages <- packages[!(packages %in% installed.packages()[,"Package"])]
if(length(new_packages)) install.packages(new_packages)

# Load the packages
lapply(packages, library, character.only = TRUE)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.4.4     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## Loading required package: carData
## 
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
## 
## Loading required package: grid
## 
## Loading required package: Matrix
## 
## 
## Attaching package: 'Matrix'
## 
## 
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
## 
## 
## Loading required package: survival
## 
## 
## Attaching package: 'survey'
## 
## 
## The following object is masked from 'package:graphics':
## 
##     dotchart
## 
## 
## 
## Attaching package: 'MASS'
## 
## 
## The following object is masked from 'package:dplyr':
## 
##     select
## 
## 
## 
## Attaching package: 'flextable'
## 
## 
## The following object is masked from 'package:purrr':
## 
##     compose
## [[1]]
##  [1] "lubridate" "forcats"   "stringr"   "dplyr"     "purrr"     "readr"    
##  [7] "tidyr"     "tibble"    "ggplot2"   "tidyverse" "stats"     "graphics" 
## [13] "grDevices" "utils"     "datasets"  "methods"   "base"     
## 
## [[2]]
##  [1] "infer"     "lubridate" "forcats"   "stringr"   "dplyr"     "purrr"    
##  [7] "readr"     "tidyr"     "tibble"    "ggplot2"   "tidyverse" "stats"    
## [13] "graphics"  "grDevices" "utils"     "datasets"  "methods"   "base"     
## 
## [[3]]
##  [1] "fst"       "infer"     "lubridate" "forcats"   "stringr"   "dplyr"    
##  [7] "purrr"     "readr"     "tidyr"     "tibble"    "ggplot2"   "tidyverse"
## [13] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"  
## [19] "base"     
## 
## [[4]]
##  [1] "modelsummary" "fst"          "infer"        "lubridate"    "forcats"     
##  [6] "stringr"      "dplyr"        "purrr"        "readr"        "tidyr"       
## [11] "tibble"       "ggplot2"      "tidyverse"    "stats"        "graphics"    
## [16] "grDevices"    "utils"        "datasets"     "methods"      "base"        
## 
## [[5]]
##  [1] "effects"      "carData"      "modelsummary" "fst"          "infer"       
##  [6] "lubridate"    "forcats"      "stringr"      "dplyr"        "purrr"       
## [11] "readr"        "tidyr"        "tibble"       "ggplot2"      "tidyverse"   
## [16] "stats"        "graphics"     "grDevices"    "utils"        "datasets"    
## [21] "methods"      "base"        
## 
## [[6]]
##  [1] "survey"       "survival"     "Matrix"       "grid"         "effects"     
##  [6] "carData"      "modelsummary" "fst"          "infer"        "lubridate"   
## [11] "forcats"      "stringr"      "dplyr"        "purrr"        "readr"       
## [16] "tidyr"        "tibble"       "ggplot2"      "tidyverse"    "stats"       
## [21] "graphics"     "grDevices"    "utils"        "datasets"     "methods"     
## [26] "base"        
## 
## [[7]]
##  [1] "MASS"         "survey"       "survival"     "Matrix"       "grid"        
##  [6] "effects"      "carData"      "modelsummary" "fst"          "infer"       
## [11] "lubridate"    "forcats"      "stringr"      "dplyr"        "purrr"       
## [16] "readr"        "tidyr"        "tibble"       "ggplot2"      "tidyverse"   
## [21] "stats"        "graphics"     "grDevices"    "utils"        "datasets"    
## [26] "methods"      "base"        
## 
## [[8]]
##  [1] "flextable"    "MASS"         "survey"       "survival"     "Matrix"      
##  [6] "grid"         "effects"      "carData"      "modelsummary" "fst"         
## [11] "infer"        "lubridate"    "forcats"      "stringr"      "dplyr"       
## [16] "purrr"        "readr"        "tidyr"        "tibble"       "ggplot2"     
## [21] "tidyverse"    "stats"        "graphics"     "grDevices"    "utils"       
## [26] "datasets"     "methods"      "base"        
## 
## [[9]]
##  [1] "equatiomatic" "flextable"    "MASS"         "survey"       "survival"    
##  [6] "Matrix"       "grid"         "effects"      "carData"      "modelsummary"
## [11] "fst"          "infer"        "lubridate"    "forcats"      "stringr"     
## [16] "dplyr"        "purrr"        "readr"        "tidyr"        "tibble"      
## [21] "ggplot2"      "tidyverse"    "stats"        "graphics"     "grDevices"   
## [26] "utils"        "datasets"     "methods"      "base"
library(fst)
ess <- read_fst("All-ESS-Data.fst")
france_data <- ess %>%
  filter(cntry == "FR")
df <- france_data
df <- df %>%
  mutate(
    trstplt = ifelse(trstplt %in% c(77, 88, 99), NA, trstplt),
        impfree = case_when(
      impfree == 1 ~ "Very much like me",
      impfree == 2 ~ "Like me",
      impfree == 3 ~ "Somewhat like me",
      impfree == 4 ~ "A little like me",
      impfree == 5 ~ "Not like me",
      impfree == 6 ~ "Not like me at all",
      impfree %in% c(7, 8, 9) ~ NA_character_,
      TRUE ~ as.character(impfree)
    ),
      hincfel = case_when(
      hincfel == 1 ~ "Living comfortably on present income",  
      hincfel == 2 ~ "Coping on present income",  
      hincfel == 3 ~ "Difficult on present income",  
      hincfel == 4 ~ "Very difficult on present income",  
      hincfel %in% c(7, 8, 9) ~ NA_character_,  
      TRUE ~ as.character(hincfel)  
      )
  )
table(df$trstplt)
## 
##    0    1    2    3    4    5    6    7    8    9   10 
## 2642 1566 2738 2959 2580 3615 1460  850  362   71   49
table(df$impfree)
## 
##   A little like me            Like me        Not like me Not like me at all 
##               2605               5021               1578                350 
##   Somewhat like me  Very much like me 
##               3485               5657
table(df$hincfel)
## 
##             Coping on present income          Difficult on present income 
##                                 7868                                 2469 
## Living comfortably on present income     Very difficult on present income 
##                                 4981                                  356
df <- df %>% filter(!is.na(trstplt))
df <- df %>% filter(!is.na(impfree))
df <- df %>% filter(!is.na(hincfel))
d <- df %>%
   mutate(
   trstplt = as.numeric(trstplt)
  )
table1 <- datasummary_skim(d  %>% dplyr::select(trstplt, impfree, hincfel), output = "flextable")
## Warning: The histogram argument is only supported for (a) output types "default",
##   "html", "kableExtra", or "gt"; (b) writing to file paths with extensions
##   ".html", ".jpg", or ".png"; and (c) Rmarkdown, knitr or Quarto documents
##   compiled to PDF (via kableExtra)  or HTML (via kableExtra or gt). Use
##   `histogram=FALSE` to silence this warning.
table1

Unique (#)

Missing (%)

Mean

SD

Min

Median

Max

trstplt

11

0

3.3

2.2

0.0

3.0

10.0

d <- d %>%
  rename(
    `trust in politicians` = trstplt
  )
  
  table1_v2 <- datasummary_skim(d %>% dplyr::select(`trust in politicians`), title = "Table 1. Descriptive statistics of main variables", output = "flextable")
## Warning: The histogram argument is only supported for (a) output types "default",
##   "html", "kableExtra", or "gt"; (b) writing to file paths with extensions
##   ".html", ".jpg", or ".png"; and (c) Rmarkdown, knitr or Quarto documents
##   compiled to PDF (via kableExtra)  or HTML (via kableExtra or gt). Use
##   `histogram=FALSE` to silence this warning.
  table1_v2
Table 1. Descriptive statistics of main variables

Unique (#)

Missing (%)

Mean

SD

Min

Median

Max

trust in politicians

11

0

3.3

2.2

0.0

3.0

10.0

table2 <- datasummary_skim(d  %>% dplyr::select(impfree, hincfel), type = "categorical", title = "Table 1. Categorical Predictors Summary", output = "flextable")

table2
Table 1. Categorical Predictors Summary

N

%

impfree

A little like me

2173

14.0

Like me

4148

26.8

Not like me

1373

8.9

Not like me at all

297

1.9

Somewhat like me

2850

18.4

Very much like me

4643

30.0

hincfel

Coping on present income

7767

50.2

Difficult on present income

2424

15.7

Living comfortably on present income

4942

31.9

Very difficult on present income

351

2.3

test_stat <- df %>%
  specify(explanatory = impfree, # change variable name for explanatory variable
          response = trstplt) %>% # change variable name for outcome of interest
  hypothesize(null = "independence") %>%
  calculate(stat = "F") 
print(test_stat$stat)
## [1] 23.01784
null_dist <- df %>%
   specify(trstplt ~ impfree) %>%
   hypothesize(null = "independence") %>%
   generate(reps = 1000, type = "permute") %>%
   calculate(stat = "F")

null_dist
## Response: trstplt (numeric)
## Explanatory: impfree (factor)
## Null Hypothesis: independence
## # A tibble: 1,000 × 2
##    replicate  stat
##        <int> <dbl>
##  1         1 0.548
##  2         2 1.48 
##  3         3 0.492
##  4         4 0.982
##  5         5 0.884
##  6         6 1.41 
##  7         7 0.498
##  8         8 0.896
##  9         9 0.827
## 10        10 0.518
## # ℹ 990 more rows
p_val <- null_dist %>% # 
  get_pvalue(obs_stat = test_stat, direction = "greater")
## Warning: Please be cautious in reporting a p-value of 0. This result is an
## approximation based on the number of `reps` chosen in the `generate()` step.
## See `?get_p_value()` for more information.
p_val
## # A tibble: 1 × 1
##   p_value
##     <dbl>
## 1       0
conf_int <- null_dist%>%
  get_confidence_interval(level = 0.95, type = "percentile")


null_dist %>%
  visualize(data, bins = 10, method = "simulation", dens_color = "black") +
  shade_p_value(obs_stat = test_stat, direction = "greater") +
  shade_confidence_interval(endpoints = conf_int)
## Warning in min(diff(unique_loc)): no non-missing arguments to min; returning
## Inf

test_stat <- 330.3334

conf_int <- null_dist %>%
  get_confidence_interval(level = 0.95, type = "percentile")

null_dist %>%
  visualize(bins = 15, method = "simulation", dens_color = "black") +
  geom_vline(aes(xintercept = test_stat), color = "red", linetype = "dashed", size = 1) +
  shade_p_value(obs_stat = test_stat, direction = "greater") +
  shade_confidence_interval(endpoints = conf_int) +
  coord_cartesian(xlim = c(0, max(null_dist$stat) * 1.1)) + 
  labs(title = "Simulation-Based Null Distribution",
       x = "F statistic",
       y = "Count")
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning in min(diff(unique_loc)): no non-missing arguments to min; returning
## Inf

df$weight <- df$dweight * df$pweight
model1 <- lm(trstplt ~ impfree, data = df, weights = weight)
model2 <- lm(trstplt ~ hincfel, data = df, weights = weight)
model3 <- lm(trstplt ~ impfree + hincfel + impfree*hincfel, data = df, weights = weight)
modelsummary(
  list(model1, model2, model3),
  fmt = 1,
  estimate  = c( "{estimate} ({std.error}){stars}",
                "{estimate} ({std.error}){stars}",
                "{estimate} ({std.error}){stars}"),
  statistic = NULL,
  coef_omit = "Intercept")

(1)

(2)

(3)

impfreeLike me

0.0 (0.1)

0.0 (0.1)

impfreeNot like me

0.0 (0.1)

0.0 (0.1)

impfreeNot like me at all

-0.5 (0.1)***

-0.7 (0.2)***

impfreeSomewhat like me

0.1 (0.1)

0.0 (0.1)

impfreeVery much like me

-0.4 (0.1)***

-0.4 (0.1)***

hincfelDifficult on present income

-0.4 (0.1)***

-0.4 (0.1)**

hincfelLiving comfortably on present income

0.5 (0.0)***

0.6 (0.1)***

hincfelVery difficult on present income

-0.9 (0.1)***

-1.0 (0.4)**

impfreeLike me × hincfelDifficult on present income

0.1 (0.2)

impfreeNot like me × hincfelDifficult on present income

-0.1 (0.2)

impfreeNot like me at all × hincfelDifficult on present income

1.0 (0.4)**

impfreeSomewhat like me × hincfelDifficult on present income

0.0 (0.2)

impfreeVery much like me × hincfelDifficult on present income

0.0 (0.2)

impfreeLike me × hincfelLiving comfortably on present income

-0.2 (0.1)

impfreeNot like me × hincfelLiving comfortably on present income

-0.1 (0.2)

impfreeNot like me at all × hincfelLiving comfortably on present income

0.1 (0.3)

impfreeSomewhat like me × hincfelLiving comfortably on present income

-0.1 (0.1)

impfreeVery much like me × hincfelLiving comfortably on present income

-0.1 (0.1)

impfreeLike me × hincfelVery difficult on present income

0.2 (0.4)

impfreeNot like me × hincfelVery difficult on present income

-0.2 (0.7)

impfreeNot like me at all × hincfelVery difficult on present income

-0.1 (0.8)

impfreeSomewhat like me × hincfelVery difficult on present income

0.1 (0.5)

impfreeVery much like me × hincfelVery difficult on present income

0.4 (0.4)

Num.Obs.

15484

15484

15484

R2

0.007

0.025

0.032

R2 Adj.

0.007

0.025

0.031

AIC

69224.9

68940.7

68865.8

BIC

69278.5

68978.9

69057.0

Log.Lik.

-34605.461

-34465.350

-34407.882

RMSE

2.15

2.13

2.12

interaction_plot <- effect("impfree*hincfel", model3, na.rm=TRUE)

plot(interaction_plot,
     main="Interaction effect",
     xlab="income attainment",
     ylab="Trust in politican")

interaction_plot
## 
##  impfree*hincfel effect
##                     hincfel
## impfree              Coping on present income Difficult on present income
##   A little like me                   3.287451                    2.861997
##   Like me                            3.264967                    2.972804
##   Not like me                        3.301728                    2.817228
##   Not like me at all                 2.629994                    3.219327
##   Somewhat like me                   3.330469                    2.897095
##   Very much like me                  2.935174                    2.471495
##                     hincfel
## impfree              Living comfortably on present income
##   A little like me                               3.893024
##   Like me                                        3.704242
##   Not like me                                    3.786700
##   Not like me at all                             3.294488
##   Somewhat like me                               3.842607
##   Very much like me                              3.457479
##                     hincfel
## impfree              Very difficult on present income
##   A little like me                           2.268992
##   Like me                                    2.433893
##   Not like me                                2.060092
##   Not like me at all                         1.520194
##   Somewhat like me                           2.418355
##   Very much like me                          2.273773
models <- list(
  "Model 1" = lm(trstplt ~ impfree, data = df, weights = weight),
  "Model 2" = lm(trstplt ~ hincfel, data = df, weights = weight),
  "Model 3" = lm(trstplt ~ impfree + hincfel + impfree*hincfel, data = df, weights = weight)
)

modelsummary(models)

Model 1

Model 2

Model 3

(Intercept)

3.400

3.184

3.287

(0.045)

(0.024)

(0.061)

impfreeLike me

-0.043

-0.022

(0.056)

(0.077)

impfreeNot like me

-0.008

0.014

(0.072)

(0.097)

impfreeNot like me at all

-0.544

-0.657

(0.129)

(0.172)

impfreeSomewhat like me

0.051

0.043

(0.060)

(0.082)

impfreeVery much like me

-0.383

-0.352

(0.055)

(0.077)

hincfelDifficult on present income

-0.411

-0.425

(0.051)

(0.131)

hincfelLiving comfortably on present income

0.505

0.606

(0.038)

(0.100)

hincfelVery difficult on present income

-0.882

-1.018

(0.126)

(0.363)

impfreeLike me × hincfelDifficult on present income

0.133

(0.164)

impfreeNot like me × hincfelDifficult on present income

-0.059

(0.219)

impfreeNot like me at all × hincfelDifficult on present income

1.015

(0.377)

impfreeSomewhat like me × hincfelDifficult on present income

-0.008

(0.184)

impfreeVery much like me × hincfelDifficult on present income

-0.038

(0.160)

impfreeLike me × hincfelLiving comfortably on present income

-0.166

(0.124)

impfreeNot like me × hincfelLiving comfortably on present income

-0.121

(0.158)

impfreeNot like me at all × hincfelLiving comfortably on present income

0.059

(0.298)

impfreeSomewhat like me × hincfelLiving comfortably on present income

-0.093

(0.131)

impfreeVery much like me × hincfelLiving comfortably on present income

-0.083

(0.123)

impfreeLike me × hincfelVery difficult on present income

0.187

(0.436)

impfreeNot like me × hincfelVery difficult on present income

-0.223

(0.723)

impfreeNot like me at all × hincfelVery difficult on present income

-0.091

(0.759)

impfreeSomewhat like me × hincfelVery difficult on present income

0.106

(0.487)

impfreeVery much like me × hincfelVery difficult on present income

0.357

(0.417)

Num.Obs.

15484

15484

15484

R2

0.007

0.025

0.032

R2 Adj.

0.007

0.025

0.031

AIC

69224.9

68940.7

68865.8

BIC

69278.5

68978.9

69057.0

Log.Lik.

-34605.461

-34465.350

-34407.882

RMSE

2.15

2.13

2.12

modelsummary(models, vcov = "robust")

Model 1

Model 2

Model 3

(Intercept)

3.400

3.184

3.287

(0.049)

(0.027)

(0.067)

impfreeLike me

-0.043

-0.022

(0.061)

(0.084)

impfreeNot like me

-0.008

0.014

(0.082)

(0.111)

impfreeNot like me at all

-0.544

-0.657

(0.165)

(0.209)

impfreeSomewhat like me

0.051

0.043

(0.065)

(0.090)

impfreeVery much like me

-0.383

-0.352

(0.061)

(0.084)

hincfelDifficult on present income

-0.411

-0.425

(0.060)

(0.160)

hincfelLiving comfortably on present income

0.505

0.606

(0.041)

(0.102)

hincfelVery difficult on present income

-0.882

-1.018

(0.139)

(0.309)

impfreeLike me × hincfelDifficult on present income

0.133

(0.194)

impfreeNot like me × hincfelDifficult on present income

-0.059

(0.271)

impfreeNot like me at all × hincfelDifficult on present income

1.015

(0.618)

impfreeSomewhat like me × hincfelDifficult on present income

-0.008

(0.209)

impfreeVery much like me × hincfelDifficult on present income

-0.038

(0.192)

impfreeLike me × hincfelLiving comfortably on present income

-0.166

(0.130)

impfreeNot like me × hincfelLiving comfortably on present income

-0.121

(0.174)

impfreeNot like me at all × hincfelLiving comfortably on present income

0.059

(0.360)

impfreeSomewhat like me × hincfelLiving comfortably on present income

-0.093

(0.136)

impfreeVery much like me × hincfelLiving comfortably on present income

-0.083

(0.129)

impfreeLike me × hincfelVery difficult on present income

0.187

(0.415)

impfreeNot like me × hincfelVery difficult on present income

-0.223

(0.649)

impfreeNot like me at all × hincfelVery difficult on present income

-0.091

(0.764)

impfreeSomewhat like me × hincfelVery difficult on present income

0.106

(0.500)

impfreeVery much like me × hincfelVery difficult on present income

0.357

(0.390)

Num.Obs.

15484

15484

15484

R2

0.007

0.025

0.032

R2 Adj.

0.007

0.025

0.031

AIC

69224.9

68940.7

68865.8

BIC

69278.5

68978.9

69057.0

Log.Lik.

-34605.461

-34465.350

-34407.882

RMSE

2.15

2.13

2.12

Std.Errors

HC3

HC3

HC3

modelsummary(models, fmt = 1,
  estimate  = c("{estimate} ({std.error}){stars}",
                "{estimate} ({std.error}){stars}",
                "{estimate} ({std.error}){stars}"),
  statistic = NULL,
  coef_rename = c("impfree" = "Important to make own decisions and be free", "hincfel" = "Feeling about household's income nowadays"),
  title = 'Table 2. Regression models predicting authoritarian attitudes (0 to 100)')
Table 2. Regression models predicting authoritarian attitudes (0 to 100)

Model 1

Model 2

Model 3

(Intercept)

3.4 (0.0)***

3.2 (0.0)***

3.3 (0.1)***

impfreeLike me

0.0 (0.1)

0.0 (0.1)

impfreeNot like me

0.0 (0.1)

0.0 (0.1)

impfreeNot like me at all

-0.5 (0.1)***

-0.7 (0.2)***

impfreeSomewhat like me

0.1 (0.1)

0.0 (0.1)

impfreeVery much like me

-0.4 (0.1)***

-0.4 (0.1)***

hincfelDifficult on present income

-0.4 (0.1)***

-0.4 (0.1)**

hincfelLiving comfortably on present income

0.5 (0.0)***

0.6 (0.1)***

hincfelVery difficult on present income

-0.9 (0.1)***

-1.0 (0.4)**

impfreeLike me:Feeling about household's income nowadaysDifficult on present income

0.1 (0.2)

impfreeNot like me:Feeling about household's income nowadaysDifficult on present income

-0.1 (0.2)

impfreeNot like me at all:Feeling about household's income nowadaysDifficult on present income

1.0 (0.4)**

impfreeSomewhat like me:Feeling about household's income nowadaysDifficult on present income

0.0 (0.2)

impfreeVery much like me:Feeling about household's income nowadaysDifficult on present income

0.0 (0.2)

impfreeLike me:Feeling about household's income nowadaysLiving comfortably on present income

-0.2 (0.1)

impfreeNot like me:Feeling about household's income nowadaysLiving comfortably on present income

-0.1 (0.2)

impfreeNot like me at all:Feeling about household's income nowadaysLiving comfortably on present income

0.1 (0.3)

impfreeSomewhat like me:Feeling about household's income nowadaysLiving comfortably on present income

-0.1 (0.1)

impfreeVery much like me:Feeling about household's income nowadaysLiving comfortably on present income

-0.1 (0.1)

impfreeLike me:Feeling about household's income nowadaysVery difficult on present income

0.2 (0.4)

impfreeNot like me:Feeling about household's income nowadaysVery difficult on present income

-0.2 (0.7)

impfreeNot like me at all:Feeling about household's income nowadaysVery difficult on present income

-0.1 (0.8)

impfreeSomewhat like me:Feeling about household's income nowadaysVery difficult on present income

0.1 (0.5)

impfreeVery much like me:Feeling about household's income nowadaysVery difficult on present income

0.4 (0.4)

Num.Obs.

15484

15484

15484

R2

0.007

0.025

0.032

R2 Adj.

0.007

0.025

0.031

AIC

69224.9

68940.7

68865.8

BIC

69278.5

68978.9

69057.0

Log.Lik.

-34605.461

-34465.350

-34407.882

RMSE

2.15

2.13

2.12

par(mfrow = c(2,2))
plot(model2, pch = 19, col = scales::alpha("grey", .8), cex = .5)

equatiomatic::extract_eq(model3, use_coefs = TRUE)

\[ \operatorname{\widehat{trstplt}} = 3.29 - 0.02(\operatorname{impfree}_{\operatorname{Like\ me}}) + 0.01(\operatorname{impfree}_{\operatorname{Not\ like\ me}}) - 0.66(\operatorname{impfree}_{\operatorname{Not\ like\ me\ at\ all}}) + 0.04(\operatorname{impfree}_{\operatorname{Somewhat\ like\ me}}) - 0.35(\operatorname{impfree}_{\operatorname{Very\ much\ like\ me}}) - 0.43(\operatorname{hincfel}_{\operatorname{Difficult\ on\ present\ income}}) + 0.61(\operatorname{hincfel}_{\operatorname{Living\ comfortably\ on\ present\ income}}) - 1.02(\operatorname{hincfel}_{\operatorname{Very\ difficult\ on\ present\ income}}) + 0.13(\operatorname{impfree}_{\operatorname{Like\ me}} \times \operatorname{hincfel}_{\operatorname{Difficult\ on\ present\ income}}) - 0.06(\operatorname{impfree}_{\operatorname{Not\ like\ me}} \times \operatorname{hincfel}_{\operatorname{Difficult\ on\ present\ income}}) + 1.01(\operatorname{impfree}_{\operatorname{Not\ like\ me\ at\ all}} \times \operatorname{hincfel}_{\operatorname{Difficult\ on\ present\ income}}) - 0.01(\operatorname{impfree}_{\operatorname{Somewhat\ like\ me}} \times \operatorname{hincfel}_{\operatorname{Difficult\ on\ present\ income}}) - 0.04(\operatorname{impfree}_{\operatorname{Very\ much\ like\ me}} \times \operatorname{hincfel}_{\operatorname{Difficult\ on\ present\ income}}) - 0.17(\operatorname{impfree}_{\operatorname{Like\ me}} \times \operatorname{hincfel}_{\operatorname{Living\ comfortably\ on\ present\ income}}) - 0.12(\operatorname{impfree}_{\operatorname{Not\ like\ me}} \times \operatorname{hincfel}_{\operatorname{Living\ comfortably\ on\ present\ income}}) + 0.06(\operatorname{impfree}_{\operatorname{Not\ like\ me\ at\ all}} \times \operatorname{hincfel}_{\operatorname{Living\ comfortably\ on\ present\ income}}) - 0.09(\operatorname{impfree}_{\operatorname{Somewhat\ like\ me}} \times \operatorname{hincfel}_{\operatorname{Living\ comfortably\ on\ present\ income}}) - 0.08(\operatorname{impfree}_{\operatorname{Very\ much\ like\ me}} \times \operatorname{hincfel}_{\operatorname{Living\ comfortably\ on\ present\ income}}) + 0.19(\operatorname{impfree}_{\operatorname{Like\ me}} \times \operatorname{hincfel}_{\operatorname{Very\ difficult\ on\ present\ income}}) - 0.22(\operatorname{impfree}_{\operatorname{Not\ like\ me}} \times \operatorname{hincfel}_{\operatorname{Very\ difficult\ on\ present\ income}}) - 0.09(\operatorname{impfree}_{\operatorname{Not\ like\ me\ at\ all}} \times \operatorname{hincfel}_{\operatorname{Very\ difficult\ on\ present\ income}}) + 0.11(\operatorname{impfree}_{\operatorname{Somewhat\ like\ me}} \times \operatorname{hincfel}_{\operatorname{Very\ difficult\ on\ present\ income}}) + 0.36(\operatorname{impfree}_{\operatorname{Very\ much\ like\ me}} \times \operatorname{hincfel}_{\operatorname{Very\ difficult\ on\ present\ income}}) \]