Kapitel 65 Fragebogen und fehlende Daten

65.0.1 Pakete die wir brauchen

library(tidyverse)
library(simstudy)
library(Hmisc)
library(missMethods)
library(mice)

In diesem Kapitel schauen wir uns ein spezielles Problem und eine mögliche Lösung an.

Wir haben einen Fragebogen, der aus mehreren Fragen besteht. Für die Analysen benutzen wir später nur den Summenscore aller Fragen.

Leider haben wir in den Fragen fehlende Werte und wir möchten eine Multiple Imputation Strategie anwenden. Wir möchten die fehlenden Fragen ersetzen und nicht den Summenscore. Den Summenscore möchten wir mit den ersetzten Fragen neu berechnen.

Da der Summenscore später ein der Analyse benutzt wird, sollten wir diesen Summenscore jedoch benutzen, um andere fehlende Werte zu ersetzen. Wir müssen also während des Multiple Imputation Prozess einerseits die Items ersetzen, den Summenscore mit den ersetzten Werten in jedem der m Datensätzen der multiplen Imputation berechnen und gleich für das Ersetzen anderer fehlender Werte benutzen.

Hier ein Text zu dieser Lösung

65.1 Beispiel

Zur Illustration der Lösung benutzen wir einen Datensatz einer veröffentlichten Studie Liu, T. W., & Ng, S. S. (2019). The reliability and validity of the Survey of Activities and Fear of Falling in the Elderly for assessing fear and activity avoidance among stroke survivors. PloS one, 14(4), e0214796.. Dieser Datensatz ist im Original komplett. Für unsere Übung werden wir jedoch fehlende Werte einfügen.

Laden wir zuerst die Daten

Wir haben nur in den Re-Test Fragebögen fehlende Werte, diese werden wir jedoch nicht ersetzen, da sie für unsere Analyse nicht benutzt werden.

Wir definieren die kategoriellen Variablen noch als Faktor-Variablen.

options(width = 1000)

data<-rio::import("https://doi.org/10.1371/journal.pone.0214796.s001", format="xlsx")

data$Faller<-ifelse(data$number_of_fall_6>0,1,0)



data<-data %>% 
  mutate(across(c(Gender, Education, Living_arrangement, Employment, type_of_stroke, affected_side, Faller, mobility_status, contains("SAFE_Q")), factor))
summary(data)
##       code             Age        Gender Education Living_arrangement Employment      BMI        type_of_stroke affected_side number_of_fall_6 Numberofstroke mobility_status     ABC_C         LawtonADL     SAFE_Q1 SAFE_Q2 SAFE_Q3 SAFE_Q4 SAFE_Q5 SAFE_Q6 SAFE_Q7 SAFE_Q8 SAFE_Q9 SAFE_Q10 SAFE_Q11   Retest_Q1      Retest_Q2     Retest_Q3      Retest_Q4      Retest_Q5     Retest_Q6     Retest_Q7      Retest_Q8      Retest_Q9     Retest_Q10     Retest_Q11   Retest_total    SAFE_total    Faller
##  Min.   :  1.00   Min.   :50.00   0:37   0:23      0:  6              0: 3       Min.   :15.96   0:46           0:55          Min.   :0.0000   Min.   :1.00   0:27            Min.   :21.56   Min.   : 2.00   0:52    0:63    0:30    0:81    0:64    0:17    0:56    0:41    0:23    0:60     0:60     Min.   :0.00   Min.   :0.0   Min.   :0.00   Min.   :0.00   Min.   :0.0   Min.   :0.0   Min.   :0.00   Min.   :0.00   Min.   :0.0   Min.   :0.00   Min.   :0.0   Min.   : 0.0   Min.   : 0.00   0:85  
##  1st Qu.: 27.75   1st Qu.:55.00   1:71   1:68      1:102              1: 6       1st Qu.:22.00   1:62           1:53          1st Qu.:0.0000   1st Qu.:1.00   1:52            1st Qu.:49.22   1st Qu.:10.00   1:25    1:26    1:35    1:18    1:28    1:45    1:31    1:35    1:41    1:20     1:27     1st Qu.:0.00   1st Qu.:0.0   1st Qu.:0.00   1st Qu.:0.00   1st Qu.:0.0   1st Qu.:0.0   1st Qu.:0.00   1st Qu.:0.00   1st Qu.:0.0   1st Qu.:0.00   1st Qu.:0.0   1st Qu.: 2.0   1st Qu.: 4.00   1:23  
##  Median : 54.50   Median :59.00          2:17                         2:53       Median :24.31                                Median :0.0000   Median :1.00   2:15            Median :64.69   Median :14.00   2:27    2:13    2:24    2: 6    2:11    2:28    2:15    2:25    2:27    2:19     2:13     Median :0.00   Median :0.0   Median :1.00   Median :0.00   Median :0.0   Median :1.0   Median :0.00   Median :1.00   Median :1.0   Median :0.00   Median :0.5   Median : 5.0   Median : 8.50         
##  Mean   : 54.50   Mean   :60.37                                       3:46       Mean   :24.19                                Mean   :0.4074   Mean   :1.12   3: 5            Mean   :63.79   Mean   :12.94   3: 4    3: 6    3:19    3: 3    3: 5    3:18    3: 6    3: 7    3:17    3: 9     3: 8     Mean   :0.25   Mean   :0.4   Mean   :0.95   Mean   :0.15   Mean   :0.2   Mean   :1.2   Mean   :0.45   Mean   :0.90   Mean   :1.2   Mean   :0.30   Mean   :0.6   Mean   : 6.6   Mean   : 9.75         
##  3rd Qu.: 81.25   3rd Qu.:65.25                                                  3rd Qu.:26.22                                3rd Qu.:0.0000   3rd Qu.:1.00   4: 1            3rd Qu.:78.75   3rd Qu.:16.00                                                                                             3rd Qu.:0.00   3rd Qu.:1.0   3rd Qu.:1.25   3rd Qu.:0.00   3rd Qu.:0.0   3rd Qu.:2.0   3rd Qu.:1.00   3rd Qu.:1.25   3rd Qu.:2.0   3rd Qu.:0.25   3rd Qu.:1.0   3rd Qu.:10.0   3rd Qu.:14.00         
##  Max.   :108.00   Max.   :78.00                                                  Max.   :32.65                                Max.   :7.0000   Max.   :2.00   6: 8            Max.   :99.38   Max.   :19.00                                                                                             Max.   :2.00   Max.   :3.0   Max.   :3.00   Max.   :2.00   Max.   :1.0   Max.   :3.0   Max.   :2.00   Max.   :2.00   Max.   :3.0   Max.   :2.00   Max.   :2.0   Max.   :21.0   Max.   :28.00         
##                                                                                                                                                                                                                                                                                                         NA's   :88     NA's   :88    NA's   :88     NA's   :88     NA's   :88    NA's   :88    NA's   :88     NA's   :88     NA's   :88    NA's   :88     NA's   :88    NA's   :88

Unsere Analyse ist ein logistisches Modell mit der abhängigen Variable Faller, die wir selber aus der Variable number_of_fall_6 erstellt haben. Hier unten sehen wir die Analyse, die wir durchführen möchten.

  • Bemerkung: Diese Analye hat nichts mit der Analyse im veröffentlichten Artikel zu tun und dient nur der Illustration für dieses Kapitel.

Dieses Result gilt für unser Beispiel als das korrekte Resultat, da hier der komplette Datensatz benutzt wurde.

res.log.reg<-glm(Faller~SAFE_total+Gender+Education+BMI+mobility_status+Age, data=data, family='binomial')
jtools::summ(res.log.reg,exp=TRUE, confint=TRUE)
Observations 108
Dependent variable Faller
Type Generalized linear model
Family binomial
Link logit
χ²(11) 8.00
Pseudo-R² (Cragg-Uhler) 0.11
Pseudo-R² (McFadden) 0.07
AIC 127.85
BIC 160.04
exp(Est.) 2.5% 97.5% z val. p
(Intercept) 0.19 0.00 249.09 -0.45 0.65
SAFE_total 1.02 0.95 1.09 0.47 0.64
Gender1 1.67 0.55 5.06 0.91 0.36
Education1 0.69 0.20 2.39 -0.58 0.56
Education2 0.46 0.08 2.63 -0.87 0.38
BMI 0.99 0.84 1.16 -0.16 0.87
mobility_status1 1.70 0.39 7.40 0.70 0.48
mobility_status2 4.63 0.85 25.37 1.77 0.08
mobility_status3 1.42 0.10 21.09 0.25 0.80
mobility_status4 0.00 0.00 Inf -0.01 0.99
mobility_status6 4.50 0.62 32.58 1.49 0.14
Age 1.00 0.92 1.08 -0.07 0.95
Standard errors: MLE

Generieren der fehlenden Werte, so dass die fehlenden Werte Missing At Random sind.

Wir löschen auch die Retest Variablen, da wir die nicht brauchen für unser Beispiel. Wir müssen nun auch die Totalscores neu berechnen, das ja nun Items fehlen. Wir haben oben die Item Variablen als Faktoren definiert (da sie nur die Antwortsoptionen 0 bis 3 haben). Für den Summenscore müssen wir das wieder Rückgängig machen.

data<-data %>% 
  dplyr::select(-contains("Retest"))
set.seed(666)
df_mar <- missMethods::delete_MAR_1_to_x(data, p=c(0.02,0.1,0.075, 0.1,0.2, 0.2,0.4,0.3,0.2,0.2, 0.1, 0.05, 0.1), cols_mis=c("SAFE_Q1", "SAFE_Q2", "SAFE_Q3", "SAFE_Q4", "SAFE_Q5", "SAFE_Q6","SAFE_Q7","SAFE_Q8", "SAFE_Q9","SAFE_Q10", "SAFE_Q11", "Gender", "BMI"), cols_ctrl=rep("Age",13), x_stochastic=TRUE, n.mis_stochastic=TRUE, x=4)

df_mar<-df_mar %>% 
  mutate(across(contains("SAFE_Q"), as.character)) %>% 
  mutate(across(contains("SAFE_Q"), as.numeric)) %>% 
  sjmisc::row_sums(SAFE_Q1:SAFE_Q11 ,n=1, var="new_SAFE_Total") %>% 
  mutate(across(contains("SAFE_Q"), as.factor))

head(df_mar[c("SAFE_Q9","SAFE_Q10","SAFE_Q11", "SAFE_total", "new_SAFE_Total")])
##   SAFE_Q9 SAFE_Q10 SAFE_Q11 SAFE_total new_SAFE_Total
## 1       1        0        1          8              8
## 2       3     <NA>        3         24             19
## 3       0        0        0          0              0
## 4    <NA>        0        0          2              1
## 5       3        1        1         16             16
## 6       0        0        0          4              4
df_mar<-df_mar %>% 
  mutate(SAFE_total=new_SAFE_Total) %>% 
  dplyr::select(-new_SAFE_Total)
summary(df_mar)
##       code             Age         Gender   Education Living_arrangement Employment      BMI        type_of_stroke affected_side number_of_fall_6 Numberofstroke mobility_status     ABC_C         LawtonADL     SAFE_Q1   SAFE_Q2   SAFE_Q3   SAFE_Q4   SAFE_Q5   SAFE_Q6   SAFE_Q7   SAFE_Q8   SAFE_Q9   SAFE_Q10  SAFE_Q11    SAFE_total     Faller
##  Min.   :  1.00   Min.   :50.00   0   :36   0:23      0:  6              0: 3       Min.   :15.96   0:46           0:55          Min.   :0.0000   Min.   :1.00   0:27            Min.   :21.56   Min.   : 2.00   0   :52   0   :54   0   :28   0   :74   0   :50   0   :10   0   :33   0   :29   0   :16   0   :49   0   :54   Min.   : 0.000   0:85  
##  1st Qu.: 27.75   1st Qu.:55.00   1   :67   1:68      1:102              1: 6       1st Qu.:21.99   1:62           1:53          1st Qu.:0.0000   1st Qu.:1.00   1:52            1st Qu.:49.22   1st Qu.:10.00   1   :25   1   :24   1   :33   1   :17   1   :24   1   :39   1   :21   1   :24   1   :33   1   :15   1   :23   1st Qu.: 3.750   1:23  
##  Median : 54.50   Median :59.00   NA's: 5   2:17                         2:53       Median :24.39                                Median :0.0000   Median :1.00   2:15            Median :64.69   Median :14.00   2   :25   2   :13   2   :23   2   : 4   2   : 8   2   :23   2   : 7   2   :18   2   :25   2   :15   2   :12   Median : 7.000         
##  Mean   : 54.50   Mean   :60.37                                          3:46       Mean   :24.20                                Mean   :0.4074   Mean   :1.12   3: 5            Mean   :63.79   Mean   :12.94   3   : 4   3   : 6   3   :16   3   : 2   3   : 4   3   :14   3   : 4   3   : 5   3   :12   3   : 7   3   : 8   Mean   : 8.056         
##  3rd Qu.: 81.25   3rd Qu.:65.25                                                     3rd Qu.:26.25                                3rd Qu.:0.0000   3rd Qu.:1.00   4: 1            3rd Qu.:78.75   3rd Qu.:16.00   NA's: 2   NA's:11   NA's: 8   NA's:11   NA's:22   NA's:22   NA's:43   NA's:32   NA's:22   NA's:22   NA's:11   3rd Qu.:12.000         
##  Max.   :108.00   Max.   :78.00                                                     Max.   :32.65                                Max.   :7.0000   Max.   :2.00   6: 8            Max.   :99.38   Max.   :19.00                                                                                                                 Max.   :24.000         
##                                                                                     NA's   :11
df_mar %>%
  naniar::add_prop_miss() %>% # Adds Column Containing Proportion Of Missing Data Values
  rpart::rpart(prop_miss_all ~ ., data = ., model=TRUE) %>% # the rpart function does the regression tree 
  rpart.plot::prp(type = 4, extra = 101, prefix = "Prop. Miss = ") # plots the tree

Das Resultat mit dem Datensatz mit den fehlenden Werten sieht nun doch etwas anders aus.

res.log.reg.mar<-glm(Faller~SAFE_total+Gender+Education+BMI+mobility_status+Age, data=df_mar, family='binomial')
jtools::summ(res.log.reg.mar,exp=TRUE, confint=TRUE)
Observations 93 (15 missing obs. deleted)
Dependent variable Faller
Type Generalized linear model
Family binomial
Link logit
χ²(11) 9.96
Pseudo-R² (Cragg-Uhler) 0.15
Pseudo-R² (McFadden) 0.10
AIC 113.40
BIC 143.79
exp(Est.) 2.5% 97.5% z val. p
(Intercept) 0.20 0.00 384.48 -0.42 0.68
SAFE_total 1.02 0.93 1.12 0.46 0.65
Gender1 2.16 0.65 7.20 1.26 0.21
Education1 0.72 0.18 2.82 -0.47 0.64
Education2 0.26 0.03 2.12 -1.25 0.21
BMI 0.99 0.83 1.18 -0.11 0.91
mobility_status1 1.45 0.32 6.68 0.48 0.63
mobility_status2 4.91 0.81 29.62 1.74 0.08
mobility_status3 2.11 0.11 39.07 0.50 0.62
mobility_status4 0.00 0.00 Inf -0.01 0.99
mobility_status6 4.10 0.55 30.73 1.37 0.17
Age 0.99 0.91 1.09 -0.12 0.90
Standard errors: MLE

65.1.1 Multiple Imputation

Wir möchten nun für die fehlenden Werte in den Items des Fragebogens die Werte der anderen Items benutzen, da wir denken, dass diese am besten die fehlenden Werte schätzen können. Mit dem mice Paket können wir dies mit der predictorMatrix tun.

Hier die predictorMatrix.

predictorMatrix <- make.predictorMatrix(df_mar)
predictorMatrix
##                    code Age Gender Education Living_arrangement Employment BMI type_of_stroke affected_side number_of_fall_6 Numberofstroke mobility_status ABC_C LawtonADL SAFE_Q1 SAFE_Q2 SAFE_Q3 SAFE_Q4 SAFE_Q5 SAFE_Q6 SAFE_Q7 SAFE_Q8 SAFE_Q9 SAFE_Q10 SAFE_Q11 SAFE_total Faller
## code                  0   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Age                   1   0      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Gender                1   1      0         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Education             1   1      1         0                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Living_arrangement    1   1      1         1                  0          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Employment            1   1      1         1                  1          0   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## BMI                   1   1      1         1                  1          1   0              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## type_of_stroke        1   1      1         1                  1          1   1              0             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## affected_side         1   1      1         1                  1          1   1              1             0                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## number_of_fall_6      1   1      1         1                  1          1   1              1             1                0              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Numberofstroke        1   1      1         1                  1          1   1              1             1                1              0               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## mobility_status       1   1      1         1                  1          1   1              1             1                1              1               0     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## ABC_C                 1   1      1         1                  1          1   1              1             1                1              1               1     0         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## LawtonADL             1   1      1         1                  1          1   1              1             1                1              1               1     1         0       1       1       1       1       1       1       1       1       1        1        1          1      1
## SAFE_Q1               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       0       1       1       1       1       1       1       1       1        1        1          1      1
## SAFE_Q2               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       0       1       1       1       1       1       1       1        1        1          1      1
## SAFE_Q3               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       0       1       1       1       1       1       1        1        1          1      1
## SAFE_Q4               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       0       1       1       1       1       1        1        1          1      1
## SAFE_Q5               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       0       1       1       1       1        1        1          1      1
## SAFE_Q6               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       0       1       1       1        1        1          1      1
## SAFE_Q7               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       0       1       1        1        1          1      1
## SAFE_Q8               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       0       1        1        1          1      1
## SAFE_Q9               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       0        1        1          1      1
## SAFE_Q10              1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        0        1          1      1
## SAFE_Q11              1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        0          1      1
## SAFE_total            1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          0      1
## Faller                1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      0

Die Zeilen zeigen die Variablen, die imputiert werden sollen, die Spalten zeigen die Variablen, die benutzt werden zum Imputieren. Eine 0 bedeutet, dass die Spaltenvariable nicht benutzt wird, um die Zeilenvariable zu imputieren.

Falls Sie die Matrix der Prädiktoren lieber in Excel anschauen und verändern möchten, können Sie dies tun. Dazu einfach die Matrix in eine Excel-Tabelle speichern - zuerst müssen Sie einfach noch die Zeilennamen in eine Spalte tranfsformieren:

df <- tibble::rownames_to_column(as.data.frame(predictorMatrix), "VALUE")
rio::export(df, "predictorMatrix.xlsx")

Sie können nach dem Modifizieren der Exceltabelle, können Sie diese wieder einlesen.

predictorMatrix<-rio::import("predictorMatrix.xlsx")

predictorMatrix<-predictorMatrix %>% 
  column_to_rownames(var="VALUE")

predictorMatrix<-data.matrix(predictorMatrix, rownames.force = TRUE)

Wir modifizieren nun die Matrix in R (aber Sie könnten Sie auch in Excel ändern und danach in R importieren).

  • Wir möchten den Summenscore nicht zum Ersetzen der Items benutzen.
predictorMatrix[15:25,26]<-0
predictorMatrix
##                    code Age Gender Education Living_arrangement Employment BMI type_of_stroke affected_side number_of_fall_6 Numberofstroke mobility_status ABC_C LawtonADL SAFE_Q1 SAFE_Q2 SAFE_Q3 SAFE_Q4 SAFE_Q5 SAFE_Q6 SAFE_Q7 SAFE_Q8 SAFE_Q9 SAFE_Q10 SAFE_Q11 SAFE_total Faller
## code                  0   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Age                   1   0      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Gender                1   1      0         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Education             1   1      1         0                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Living_arrangement    1   1      1         1                  0          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Employment            1   1      1         1                  1          0   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## BMI                   1   1      1         1                  1          1   0              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## type_of_stroke        1   1      1         1                  1          1   1              0             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## affected_side         1   1      1         1                  1          1   1              1             0                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## number_of_fall_6      1   1      1         1                  1          1   1              1             1                0              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## Numberofstroke        1   1      1         1                  1          1   1              1             1                1              0               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## mobility_status       1   1      1         1                  1          1   1              1             1                1              1               0     1         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## ABC_C                 1   1      1         1                  1          1   1              1             1                1              1               1     0         1       1       1       1       1       1       1       1       1       1        1        1          1      1
## LawtonADL             1   1      1         1                  1          1   1              1             1                1              1               1     1         0       1       1       1       1       1       1       1       1       1        1        1          1      1
## SAFE_Q1               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       0       1       1       1       1       1       1       1       1        1        1          0      1
## SAFE_Q2               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       0       1       1       1       1       1       1       1        1        1          0      1
## SAFE_Q3               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       0       1       1       1       1       1       1        1        1          0      1
## SAFE_Q4               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       0       1       1       1       1       1        1        1          0      1
## SAFE_Q5               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       0       1       1       1       1        1        1          0      1
## SAFE_Q6               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       0       1       1       1        1        1          0      1
## SAFE_Q7               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       0       1       1        1        1          0      1
## SAFE_Q8               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       0       1        1        1          0      1
## SAFE_Q9               1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       0        1        1          0      1
## SAFE_Q10              1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        0        1          0      1
## SAFE_Q11              1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        0          0      1
## SAFE_total            1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          0      1
## Faller                1   1      1         1                  1          1   1              1             1                1              1               1     1         1       1       1       1       1       1       1       1       1       1        1        1          1      0

65.1.2 Hilfestellung vom Paket mice

mice bietet funktionen an, die uns beim Auswählen der Prädiktoren helfen. Der Befehl quickpred https://www.rdocumentation.org/packages/mice/versions/2.7/topics/quickpred folgt einem Variablenselektionsprozedere, dass von Van Buuren und Kolleg:innen entwickelt wurde [].

Im ersten Beispiel wählen wir nur Variablen, die mindestens 30% nicht-fehlende Werte haben um andere Variable zu imputieren.

predictorMatrix_withQuickpred<-quickpred(df_mar, minpuc=0.3)

Im Lösungsansatz von Iris Eekhout https://www.iriseekhout.com/post/2022-03-02-passive-mi/ werden nur die Items der jeweiligen Fragebogen benutzt benutzt um die fehlenden Werte in den Items zu ersetzen. Wir möchten jedoch alle Variablen ausser des Summenscores benutzen.

Wir möchten nun für den Summenscore die sogenannte passive Imputation benutzen

    1. Imputation von Item-Scores unter Verwendung von Items aus dem eigenen Fragebogen, Gesamtscore(s) aus anderen Fragebögen und Kovariate(n).
    1. Die Gesamtpunktzahl wird anhand der bestehenden und den ersetzten Itemwerte neu berechnet.
    1. Der aktualisierte Summenscore wird in der nächsten Iteration als Prädiktor für die Kovariate(n) und Items anderer Fragebögen, etc., verwendet. Damit der Summenscore neu berechnet wird, müssen wir ihn jedoch als Missing (NA) setzen.
df_mar$SAFE_total<-NA
df_mar$SAFE_total=as.numeric(df_mar$SAFE_total)
summary(df_mar)
##       code             Age         Gender   Education Living_arrangement Employment      BMI        type_of_stroke affected_side number_of_fall_6 Numberofstroke mobility_status     ABC_C         LawtonADL     SAFE_Q1   SAFE_Q2   SAFE_Q3   SAFE_Q4   SAFE_Q5   SAFE_Q6   SAFE_Q7   SAFE_Q8   SAFE_Q9   SAFE_Q10  SAFE_Q11    SAFE_total  Faller
##  Min.   :  1.00   Min.   :50.00   0   :36   0:23      0:  6              0: 3       Min.   :15.96   0:46           0:55          Min.   :0.0000   Min.   :1.00   0:27            Min.   :21.56   Min.   : 2.00   0   :52   0   :54   0   :28   0   :74   0   :50   0   :10   0   :33   0   :29   0   :16   0   :49   0   :54   Min.   : NA   0:85  
##  1st Qu.: 27.75   1st Qu.:55.00   1   :67   1:68      1:102              1: 6       1st Qu.:21.99   1:62           1:53          1st Qu.:0.0000   1st Qu.:1.00   1:52            1st Qu.:49.22   1st Qu.:10.00   1   :25   1   :24   1   :33   1   :17   1   :24   1   :39   1   :21   1   :24   1   :33   1   :15   1   :23   1st Qu.: NA   1:23  
##  Median : 54.50   Median :59.00   NA's: 5   2:17                         2:53       Median :24.39                                Median :0.0000   Median :1.00   2:15            Median :64.69   Median :14.00   2   :25   2   :13   2   :23   2   : 4   2   : 8   2   :23   2   : 7   2   :18   2   :25   2   :15   2   :12   Median : NA         
##  Mean   : 54.50   Mean   :60.37                                          3:46       Mean   :24.20                                Mean   :0.4074   Mean   :1.12   3: 5            Mean   :63.79   Mean   :12.94   3   : 4   3   : 6   3   :16   3   : 2   3   : 4   3   :14   3   : 4   3   : 5   3   :12   3   : 7   3   : 8   Mean   :NaN         
##  3rd Qu.: 81.25   3rd Qu.:65.25                                                     3rd Qu.:26.25                                3rd Qu.:0.0000   3rd Qu.:1.00   4: 1            3rd Qu.:78.75   3rd Qu.:16.00   NA's: 2   NA's:11   NA's: 8   NA's:11   NA's:22   NA's:22   NA's:43   NA's:32   NA's:22   NA's:22   NA's:11   3rd Qu.: NA         
##  Max.   :108.00   Max.   :78.00                                                     Max.   :32.65                                Max.   :7.0000   Max.   :2.00   6: 8            Max.   :99.38   Max.   :19.00                                                                                                                 Max.   : NA         
##                                                                                     NA's   :11                                                                                                                                                                                                                                 NA's   :108

Für die Imputation geben wir bei *meth = c(…) für jede Variable an, was für ein Regressionsmodell wir möchten, und für unseren Summenscore geben wir die Formel für die passive Imputation an:

  • “~I(as.numeric(as.character(SAFE_Q1))+as.numeric(as.character(SAFE_Q2))+as.numeric(as.character(SAFE_Q3))+as.numeric(as.character(SAFE_Q4))+as.numeric(as.character(SAFE_Q5))+as.numeric(as.character(SAFE_Q6))+as.numeric(as.character(SAFE_Q7))+as.numeric(as.character(SAFE_Q8))+as.numeric(as.character(SAFE_Q9))+as.numeric(as.character(SAFE_Q10))+as.numeric(as.character(SAFE_Q11)))”
## 
##  iter imp variable
##   1   1  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   1   2  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   1   3  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   1   4  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   1   5  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   2   1  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   2   2  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   2   3  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   2   4  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   2   5  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   3   1  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   3   2  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   3   3  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   3   4  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   3   5  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   4   1  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   4   2  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   4   3  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   4   4  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   4   5  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   5   1  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   5   2  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   5   3  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   5   4  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   5   5  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
## Warning: Number of logged events: 40

Alternativ können wir auch zuerst ein Objekt erstellen, in dem alle Variablen und die Methoden gespeichert sind.

imp0 <- mice(df_mar, pred = predictorMatrix, m =1, maxit =0)
## Warning: Number of logged events: 1
method <- imp0$method
method
##               code                Age             Gender          Education Living_arrangement         Employment                BMI     type_of_stroke      affected_side   number_of_fall_6     Numberofstroke    mobility_status              ABC_C          LawtonADL            SAFE_Q1            SAFE_Q2            SAFE_Q3            SAFE_Q4            SAFE_Q5            SAFE_Q6            SAFE_Q7            SAFE_Q8            SAFE_Q9           SAFE_Q10           SAFE_Q11         SAFE_total             Faller 
##                 ""                 ""           "logreg"                 ""                 ""                 ""              "pmm"                 ""                 ""                 ""                 ""                 ""                 ""                 ""          "polyreg"          "polyreg"          "polyreg"          "polyreg"          "polyreg"          "polyreg"          "polyreg"          "polyreg"          "polyreg"          "polyreg"          "polyreg"                 ""                 ""

Wir ändern spezifisch die Variable für den Summenscore SAFE_total.

method["SAFE_total"]<-"~I(as.numeric(as.character(SAFE_Q1))+as.numeric(as.character(SAFE_Q2))+as.numeric(as.character(SAFE_Q3))+as.numeric(as.character(SAFE_Q4))+as.numeric(as.character(SAFE_Q5))+as.numeric(as.character(SAFE_Q6))+as.numeric(as.character(SAFE_Q7))+as.numeric(as.character(SAFE_Q8))+as.numeric(as.character(SAFE_Q9))+as.numeric(as.character(SAFE_Q10))+as.numeric(as.character(SAFE_Q11)))"

Die multiple Imputation:

df_imputed<-mice(df_mar, meth = method, predictorMatrix = predictorMatrix)
## 
##  iter imp variable
##   1   1  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   1   2  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   1   3  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   1   4  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   1   5  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   2   1  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   2   2  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   2   3  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   2   4  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   2   5  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   3   1  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   3   2  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   3   3  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   3   4  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   3   5  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   4   1  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   4   2  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   4   3  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   4   4  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   4   5  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   5   1  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   5   2  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   5   3  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   5   4  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
##   5   5  Gender  BMI  SAFE_Q1  SAFE_Q2  SAFE_Q3  SAFE_Q4  SAFE_Q5  SAFE_Q6  SAFE_Q7  SAFE_Q8  SAFE_Q9  SAFE_Q10  SAFE_Q11  SAFE_total
## Warning: Number of logged events: 42
m_imputed_datasets<-df_imputed %>% 
  mice::complete("long")
densityplot(df_imputed)

Wieder die Analyse, jetzt mit über alle imputierten Datensätze (wir haben hier nur 5 Datensätze erstellt).

fit <- with(df_imputed, glm(Faller~SAFE_total+Gender+Education+BMI+mobility_status+Age,  family='binomial'))
est.imputed<-pool(fit)
summary(est.imputed, exp=TRUE)
##                term     estimate    std.error    statistic       df    p.value
## 1       (Intercept) 7.166861e-02 3.865306e+00 -0.681887065 72.50806 0.49748279
## 2        SAFE_total 1.011891e+00 3.983832e-02  0.296711785 81.01124 0.76744596
## 3           Gender1 1.885327e+00 5.698125e-01  1.112824608 93.12157 0.26864821
## 4        Education1 6.688741e-01 6.411532e-01 -0.627243986 93.85486 0.53202230
## 5        Education2 4.323288e-01 8.963345e-01 -0.935553532 93.65194 0.35190927
## 6               BMI 1.017472e+00 9.052834e-02  0.191336720 39.34628 0.84924576
## 7  mobility_status1 1.821331e+00 7.530343e-01  0.796202054 92.43021 0.42795482
## 8  mobility_status2 5.085130e+00 8.838198e-01  1.840104270 89.85612 0.06905419
## 9  mobility_status3 1.471780e+00 1.413754e+00  0.273366163 93.31827 0.78517586
## 10 mobility_status4 1.719248e-06 1.455398e+03 -0.009120271 94.05118 0.99274250
## 11 mobility_status6 4.830593e+00 1.020791e+00  1.542890514 93.06266 0.12625107
## 12              Age 9.999274e-01 4.252819e-02 -0.001706100 93.61147 0.99864236

Da wir das jtools Paket mit dem Befehl summ hier nicht benutzen können, vergleichen wir die Regression mit folgendem Code Dank an Francis L Huang Leider können wir die gepoolten (d.h. Analyse nach Imputation) nicht direkt in dieser Tabelle darstellen, deswegen müssen wir die Resultate der Tabelle mit den Resultaten hier oberhalb vergleichen. (https://francish.netlify.app/post/01_missing/).

stargazer::stargazer(res.log.reg,res.log.reg.mar,apply.coef = exp, star.cutoffs = c(.05, .01, .001), no.space = T, type = 'text')
## 
## ================================================
##                        Dependent variable:      
##                   ------------------------------
##                               Faller            
##                         (1)            (2)      
## ------------------------------------------------
## SAFE_total           1.017***        1.022***   
##                       (0.036)        (0.047)    
## Gender1               1.670**        2.164***   
##                       (0.566)        (0.613)    
## Education1             0.691          0.721     
##                       (0.633)        (0.697)    
## Education2             0.460          0.264     
##                       (0.889)        (1.062)    
## BMI                  0.986***        0.990***   
##                       (0.083)        (0.090)    
## mobility_status1      1.698*          1.451     
##                       (0.751)        (0.779)    
## mobility_status2     4.635***        4.910***   
##                       (0.867)        (0.917)    
## mobility_status3       1.416          2.108     
##                       (1.378)        (1.490)    
## mobility_status4      0.00000        0.00000    
##                     (1,455.398)    (1,455.398)  
## mobility_status6     4.499***        4.096***   
##                       (1.010)        (1.028)    
## Age                  0.997***        0.994***   
##                       (0.042)        (0.046)    
## Constant               0.189          0.200     
##                       (3.665)        (3.859)    
## ------------------------------------------------
## Observations            108             93      
## Log Likelihood        -51.927        -44.699    
## Akaike Inf. Crit.     127.855        113.398    
## ================================================
## Note:              *p<0.05; **p<0.01; ***p<0.001

Für mehr Details: https://www.gerkovink.com/miceVignettes/Passive_Post_processing/Passive_imputation_post_processing.html.

Wir können übrigens auch die zur Imputation benutzten Methoden für jede Variable anschauen:

DT::datatable(data.frame(df_imputed$method), filter='top')