Protokoll: 01_Mokken 
R: R version 4.5.1 (2025-06-13) | Locale: en_US.UTF-8 
Zeit: 2026-08-09 10:32:55 
====================================================================== 


> prepare_data()          # Teile 1 bis 4 des Paper-1-Skripts

> suppressPackageStartupMessages({
+   library(mokken); library(dplyr); library(tidyr); library(purrr); library(tibble)
+ })

> # coefH gibt bei nice.output = FALSE die Koeffizientenmatrizen auf der Konsole
> # aus und liefert H je nach se-Argument einmal benannt und einmal u .... [TRUNCATED] 

> Hval <- function(h) as.numeric(h$H)[1]

> HTq  <- function(X) { r <- NULL; invisible(capture.output(r <- check.iio(X))); r$HT }

> set.seed(20260809)

> N_SPLIT <- 200          # Wiederholungen der Halbierung

> # --- Itemlabels, uebernommen aus Teil 7 des Paper-1-Skripts ------------------
> label_e4 <- c("Appointment scheduling and organization",
+         .... [TRUNCATED] 

> stopifnot(length(label_e4) == 16, length(e4_vars) == 16)

> # --- Zwei Dichotomisierungen -------------------------------------------------
> # A (Hauptanalyse): Unsicherheitsantworten zaehlen als nicht akzep .... [TRUNCATED] 

> X_B <- as.data.frame(lapply(df[e4_vars], function(x)
+          ifelse(as.character(x) %in% c("Ja", "Nein"), as.integer(as.character(x) == "Ja"), NA .... [TRUNCATED] 

> names(X_A) <- names(X_B) <- e4_vars

> cat("\n=== Datengrundlage ===\n")

=== Datengrundlage ===

> cat("N =", nrow(X_A), "| Variante A: keine fehlenden Werte\n")
N = 901 | Variante A: keine fehlenden Werte

> cat("Variante B: vollstaendige Faelle =", sum(complete.cases(X_B)),
+     "| fehlende Werte gesamt =", sum(is.na(X_B)), "\n")
Variante B: vollstaendige Faelle = 199 | fehlende Werte gesamt = 4197 

> # --- 1 Skalierbarkeit --------------------------------------------------------
> cat("\n\n=== 1  Skalierbarkeitskoeffizienten (Variante A) ===\n")


=== 1  Skalierbarkeitskoeffizienten (Variante A) ===

> H_A <- coefH_q(X_A, se = TRUE)

> cat("\nGesamtskala H =", round(Hval(H_A), 3),
+     " (SE =", round(as.numeric(H_A$se.H["H"]), 3), ")\n")

Gesamtskala H = 0.491  (SE = NA )

> Hi_tab <- tibble(item = e4_vars, application = label_e4,
+                  Hi = round(as.numeric(H_A$Hi), 3),
+                  se_Hi = round(as.n .... [TRUNCATED] 

> cat("\nItemkoeffizienten, nach Zustimmungsanteil geordnet:\n"); print(Hi_tab, n = 16)

Itemkoeffizienten, nach Zustimmungsanteil geordnet:
# A tibble: 16 × 5
   item     application                                         Hi se_Hi p_yes
   <chr>    <chr>                                            <dbl> <dbl> <dbl>
 1 E4_SQ014 Automated medication reminders                   0.613 0.036 0.8  
 2 E4_SQ001 Appointment scheduling and organization          0.481 0.035 0.751
 3 E4_SQ015 Management of the electronic health record       0.503 0.027 0.679
 4 E4_SQ008 Analysis of clinical data (patterns, anomalies)  0.567 0.022 0.668
 5 E4_SQ016 Planning and coordination of treatment           0.521 0.022 0.624
 6 E4_SQ002 Documentation of findings, visits, or therapy    0.472 0.023 0.608
 7 E4_SQ003 Monitoring of vital parameters                   0.478 0.021 0.552
 8 E4_SQ006 Support in individualized treatment plans        0.505 0.019 0.514
 9 E4_SQ005 Support in diagnosis                             0.462 0.02  0.513
10 E4_SQ004 Evaluation of diagnostic tests (eg, x-ray, CT)   0.479 0.019 0.482
11 E4_SQ007 Risk assessment and prognosis in chronic disease 0.474 0.02  0.456
12 E4_SQ013 Surgical procedures using robotic systems        0.422 0.022 0.411
13 E4_SQ012 Nursing support                                  0.479 0.02  0.401
14 E4_SQ011 Patient information and education (chatbots)     0.393 0.024 0.381
15 E4_SQ009 Support in medical emergencies and triage        0.52  0.022 0.335
16 E4_SQ010 Support in urgent decisions                      0.558 0.025 0.282

> cat("\nBewertung: H >= .30 schwach, >= .40 mittel, >= .50 stark.\n")

Bewertung: H >= .30 schwach, >= .40 mittel, >= .50 stark.

> cat("Items unter Hi = .30:", sum(as.numeric(H_A$Hi) < .30), "\n")
Items unter Hi = .30: 0 

> cat("\n--- Itempaare mit dem kleinsten Hij ---\n")

--- Itempaare mit dem kleinsten Hij ---

> Hij <- as.matrix(H_A$Hij); diag(Hij) <- NA

> pair <- which(Hij == min(Hij, na.rm = TRUE), arr.ind = TRUE)[1, ]

> cat(sprintf("kleinstes Hij = %.3f zwischen %s und %s\n", min(Hij, na.rm = TRUE),
+             label_e4[pair[1]], label_e4[pair[2]]))
kleinstes Hij = 0.248 zwischen Surgical procedures using robotic systems und Patient information and education (chatbots)

> cat("negative Hij:", sum(Hij < 0, na.rm = TRUE) / 2, "Paare\n")
negative Hij: 0 Paare

> cat("\n\n=== 1b  Skalierbarkeit, Variante B (Unsicher = fehlend) ===\n")


=== 1b  Skalierbarkeit, Variante B (Unsicher = fehlend) ===

> H_B <- coefH_q(X_B[complete.cases(X_B), ], se = TRUE)

> cat("H =", round(Hval(H_B), 3),
+     "bei n =", sum(complete.cases(X_B)), "vollstaendigen Faellen\n")
H = 0.637 bei n = 199 vollstaendigen Faellen

> cat("Vergleich A gegen B:", round(Hval(H_A), 3), "gegen",
+     round(Hval(H_B), 3), "\n")
Vergleich A gegen B: 0.491 gegen 0.637 

> # --- 2 Monotonie -------------------------------------------------------------
> cat("\n\n=== 2  Monotonie (check.monotonicity) ===\n")


=== 2  Monotonie (check.monotonicity) ===

> mono <- check.monotonicity(X_A)

> mono_s <- summary(mono)

> print(round(mono_s, 3))
         ItemH #ac #vi #vi/#ac maxvi  sum sum/#ac zmax #zsig crit
E4_SQ001  0.48  21   1    0.05  0.07 0.07   0.003 1.62     0   18
E4_SQ002  0.47  21   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ003  0.48  21   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ004  0.48  15   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ005  0.46  15   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ006  0.50  15   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ007  0.47  15   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ008  0.57  21   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ009  0.52  15   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ010  0.56  21   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ011  0.39  15   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ012  0.48  21   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ013  0.42  21   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ014  0.61  21   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ015  0.50  21   0    0.00  0.00 0.00   0.000 0.00     0    0
E4_SQ016  0.52  15   0    0.00  0.00 0.00   0.000 0.00     0    0

> cat("\nItems mit signifikanten Verletzungen (#zsig > 0):",
+     sum(mono_s[, "#zsig"] > 0), "von 16\n")

Items mit signifikanten Verletzungen (#zsig > 0): 0 von 16

> cat("Groesster Crit-Wert:", max(mono_s[, "crit"]),
+     "  (Faustregel: crit < 40 unproblematisch, > 80 kritisch)\n")
Groesster Crit-Wert: 18   (Faustregel: crit < 40 unproblematisch, > 80 kritisch)

> # --- 3 Invariante Itemreihenfolge -------------------------------------------
> cat("\n\n=== 3  Invariante Itemreihenfolge (check.iio) ===\n")


=== 3  Invariante Itemreihenfolge (check.iio) ===

> cat("Das ist die eigentlich starke Annahme. Faellt sie, bleibt die Skala fuer\n")
Das ist die eigentlich starke Annahme. Faellt sie, bleibt die Skala fuer

> cat("Gruppenvergleiche brauchbar, aber die Aussage, einzelne Personen liessen\n")
Gruppenvergleiche brauchbar, aber die Aussage, einzelne Personen liessen

> cat("sich ordnen, muss zurueckgenommen werden.\n\n")
sich ordnen, muss zurueckgenommen werden.


> iio <- check.iio(X_A)

> print(summary(iio))
$method
[1] "MIIO"

$item.summary
         ItemH #ac #vi #vi/#ac maxvi  sum sum/#ac zmax #zsig crit
E4_SQ014  0.61  91   0    0.00  0.00 0.00  0.0000 0.00     0    0
E4_SQ001  0.48  90   6    0.07  0.08 0.31  0.0034 2.28     3   49
E4_SQ015  0.50  90   4    0.04  0.08 0.21  0.0023 1.87     1   31
E4_SQ008  0.57  91   5    0.05  0.08 0.34  0.0038 2.28     3   44
E4_SQ016  0.52  91   6    0.07  0.06 0.25  0.0027 1.55     0   19
E4_SQ002  0.47  90   6    0.07  0.08 0.29  0.0032 1.55     0   25
E4_SQ003  0.48  90   5    0.06  0.06 0.22  0.0024 1.25     0   17
E4_SQ006  0.50  90   9    0.10  0.09 0.54  0.0060 2.11     3   56
E4_SQ005  0.46  90   4    0.04  0.09 0.22  0.0024 2.11     1   36
E4_SQ004  0.48  90   4    0.04  0.10 0.24  0.0027 2.22     1   37
E4_SQ007  0.47  90   4    0.04  0.10 0.29  0.0032 2.22     2   43
E4_SQ013  0.42  91  11    0.12  0.07 0.39  0.0043 1.86     1   47
E4_SQ012  0.48  90   3    0.03  0.08 0.24  0.0026 1.97     2   38
E4_SQ011  0.39  90   8    0.09  0.08 0.52  0.0057 1.97     1   49
E4_SQ009  0.52  90   3    0.03  0.07 0.16  0.0018 1.49     0   14
E4_SQ010  0.56  92   0    0.00  0.00 0.00  0.0000 0.00     0    0

$backward.selection
         step 1 step 2 step 3 step 4 step 5
E4_SQ014      0      0      0      0      0
E4_SQ001      2      1      1      0      0
E4_SQ015      1      1      1      0      0
E4_SQ008      2      2      2     NA     NA
E4_SQ016      0      0      0      0      0
E4_SQ002      0      0      0      0      0
E4_SQ003      0      0      0      0      0
E4_SQ006      3     NA     NA     NA     NA
E4_SQ005      1      0      0      0      0
E4_SQ004      1      1      1      1      0
E4_SQ007      2      1      1      1     NA
E4_SQ013      1      1      0      0      0
E4_SQ012      2      2     NA     NA     NA
E4_SQ011      1      1      0      0      0
E4_SQ009      0      0      0      0      0
E4_SQ010      0      0      0      0      0

$HT
[1] 0.3028641


> cat("\nHT =", round(iio$HT, 3), "\n")

HT = 0.303 

> cat("Bewertung: HT < .30 schwach, .30-.40 mittel, > .40 stark.\n")
Bewertung: HT < .30 schwach, .30-.40 mittel, > .40 stark.

> if (length(iio$items.removed))
+   cat("Von check.iio entfernte Items:",
+       paste(label_e4[iio$items.removed], collapse = "; "), "\n") else
+   .... [TRUNCATED] 
Von check.iio entfernte Items: Analysis of clinical data (patterns, anomalies); Surgical procedures using robotic systems; Evaluation of diagnostic tests (eg, x-ray, CT); Patient information and education (chatbots) 

> # --- 4 Lokale Unabhaengigkeit ------------------------------------------------
> cat("\n\n=== 4  Lokale Unabhaengigkeit (check.ca) ===\n")


=== 4  Lokale Unabhaengigkeit (check.ca) ===

> cat("Erwartete Kandidaten fuer Verletzungen sind inhaltlich verwandte Paare:\n")
Erwartete Kandidaten fuer Verletzungen sind inhaltlich verwandte Paare:

> cat("Diagnosestellung und Auswertung diagnostischer Tests; Notfall und Triage\n")
Diagnosestellung und Auswertung diagnostischer Tests; Notfall und Triage

> cat("gegen dringende Entscheidungen.\n\n")
gegen dringende Entscheidungen.


> ca <- check.ca(X_A, TRUE)

> in_last <- ca$InScale[[length(ca$InScale)]]

> ca_tab <- tibble(item = e4_vars, application = label_e4,
+                  ausgeschlossen = as.integer(!in_last))

> print(ca_tab, n = 16)
# A tibble: 16 × 3
   item     application                                      ausgeschlossen
   <chr>    <chr>                                                     <int>
 1 E4_SQ001 Appointment scheduling and organization                       1
 2 E4_SQ002 Documentation of findings, visits, or therapy                 1
 3 E4_SQ003 Monitoring of vital parameters                                0
 4 E4_SQ004 Evaluation of diagnostic tests (eg, x-ray, CT)                1
 5 E4_SQ005 Support in diagnosis                                          1
 6 E4_SQ006 Support in individualized treatment plans                     1
 7 E4_SQ007 Risk assessment and prognosis in chronic disease              1
 8 E4_SQ008 Analysis of clinical data (patterns, anomalies)               0
 9 E4_SQ009 Support in medical emergencies and triage                     1
10 E4_SQ010 Support in urgent decisions                                   0
11 E4_SQ011 Patient information and education (chatbots)                  1
12 E4_SQ012 Nursing support                                               1
13 E4_SQ013 Surgical procedures using robotic systems                     0
14 E4_SQ014 Automated medication reminders                                1
15 E4_SQ015 Management of the electronic health record                    0
16 E4_SQ016 Planning and coordination of treatment                        0

> cat("\nVon check.ca ausgeschlossene Items:", sum(ca_tab$ausgeschlossen), "von 16\n")

Von check.ca ausgeschlossene Items: 10 von 16

> cat("check.ca schliesst bei grossen Stichproben erfahrungsgemaess viele Items\n")
check.ca schliesst bei grossen Stichproben erfahrungsgemaess viele Items

> cat("aus. Die folgende Residualkorrelation ist besser interpretierbar.\n")
aus. Die folgende Residualkorrelation ist besser interpretierbar.

> # Yens Q3: Korrelation der Residuen nach Kontrolle des Restscores. Ueblich ist,
> # Paare als lokal abhaengig zu betrachten, deren Q3 den Median deu .... [TRUNCATED] 

> resid <- sapply(seq_along(e4_vars), function(i) {
+   r <- rest - X_A[[i]]
+   residuals(lm(X_A[[i]] ~ r))
+ })

> colnames(resid) <- e4_vars

> Q3 <- cor(resid)

> diag(Q3) <- NA

> q3_med <- median(Q3, na.rm = TRUE)

> q3_pairs <- which(upper.tri(Q3), arr.ind = TRUE)

> q3_tab <- tibble(
+   Item_1 = label_e4[q3_pairs[, 1]], Item_2 = label_e4[q3_pairs[, 2]],
+   Q3 = round(Q3[upper.tri(Q3)], 3)) %>%
+   mutate(Q3_ze .... [TRUNCATED] 

> cat(sprintf("\nMedian Q3 = %.3f. Die zehn hoechsten Paare:\n", q3_med))

Median Q3 = -0.074. Die zehn hoechsten Paare:

> print(head(q3_tab, 10), n = 10)
# A tibble: 10 × 4
   Item_1                                           Item_2                 Q3 Q3_zentriert
   <chr>                                            <chr>               <dbl>        <dbl>
 1 Support in medical emergencies and triage        Support in urgent … 0.363        0.437
 2 Appointment scheduling and organization          Documentation of f… 0.23         0.304
 3 Automated medication reminders                   Management of the … 0.221        0.295
 4 Management of the electronic health record       Planning and coord… 0.159        0.233
 5 Support in diagnosis                             Support in individ… 0.152        0.226
 6 Appointment scheduling and organization          Automated medicati… 0.144        0.218
 7 Documentation of findings, visits, or therapy    Management of the … 0.132        0.206
 8 Risk assessment and prognosis in chronic disease Analysis of clinic… 0.119        0.193
 9 Appointment scheduling and organization          Planning and coord… 0.112        0.186
10 Appointment scheduling and organization          Management of the … 0.104        0.178

> cat("\nPaare ueber dem Kriterium (Q3 - Median > .20):",
+     sum(q3_tab$Q3_zentriert > .20), "\n")

Paare ueber dem Kriterium (Q3 - Median > .20): 7 

> cat("\nGezielte Pruefung der inhaltlich verwandten Paare:\n")

Gezielte Pruefung der inhaltlich verwandten Paare:

> watch <- list(c("E4_SQ005", "E4_SQ004"),   # Diagnose / Auswertung diagn. Tests
+               c("E4_SQ009", "E4_SQ010"))   # Notfall und Triage /  .... [TRUNCATED] 

> for (p in watch)
+   cat(sprintf("  %-50s %-50s Q3 = %+.3f (zentriert %+.3f)\n",
+               label_e4[match(p[1], e4_vars)], label_e4[match(p[2] .... [TRUNCATED] 
  Support in diagnosis                               Evaluation of diagnostic tests (eg, x-ray, CT)     Q3 = +0.006 (zentriert +0.080)
  Support in medical emergencies and triage          Support in urgent decisions                        Q3 = +0.363 (zentriert +0.437)

> # --- 5 Automatische Itemselektion -------------------------------------------
> cat("\n\n=== 5  Automatisches Itemselektionsverfahren (aisp) ===\n" .... [TRUNCATED] 


=== 5  Automatisches Itemselektionsverfahren (aisp) ===

> maxHij <- max(Hij, na.rm = TRUE)

> for (lb in c(.30, .40, .50)) {
+   # aisp bricht ab, wenn der Lowerbound ueber max(Hij) liegt und deshalb kein
+   # Item mehr skalierbar ist. Solch .... [TRUNCATED] 

Lowerbound 0.30: 1 Skala(en), nicht zugeordnet: 0 Items
# A tibble: 16 × 2
   application                                      scale
   <chr>                                            <int>
 1 Appointment scheduling and organization              1
 2 Documentation of findings, visits, or therapy        1
 3 Monitoring of vital parameters                       1
 4 Evaluation of diagnostic tests (eg, x-ray, CT)       1
 5 Support in diagnosis                                 1
 6 Support in individualized treatment plans            1
 7 Risk assessment and prognosis in chronic disease     1
 8 Analysis of clinical data (patterns, anomalies)      1
 9 Support in medical emergencies and triage            1
10 Support in urgent decisions                          1
11 Patient information and education (chatbots)         1
12 Nursing support                                      1
13 Surgical procedures using robotic systems            1
14 Automated medication reminders                       1
15 Management of the electronic health record           1
16 Planning and coordination of treatment               1

Lowerbound 0.40: 1 Skala(en), nicht zugeordnet: 1 Items
# A tibble: 16 × 2
   application                                      scale
   <chr>                                            <int>
 1 Patient information and education (chatbots)         0
 2 Appointment scheduling and organization              1
 3 Documentation of findings, visits, or therapy        1
 4 Monitoring of vital parameters                       1
 5 Evaluation of diagnostic tests (eg, x-ray, CT)       1
 6 Support in diagnosis                                 1
 7 Support in individualized treatment plans            1
 8 Risk assessment and prognosis in chronic disease     1
 9 Analysis of clinical data (patterns, anomalies)      1
10 Support in medical emergencies and triage            1
11 Support in urgent decisions                          1
12 Nursing support                                      1
13 Surgical procedures using robotic systems            1
14 Automated medication reminders                       1
15 Management of the electronic health record           1
16 Planning and coordination of treatment               1

Lowerbound 0.50: 2 Skala(en), nicht zugeordnet: 2 Items
# A tibble: 16 × 2
   application                                      scale
   <chr>                                            <int>
 1 Patient information and education (chatbots)         0
 2 Surgical procedures using robotic systems            0
 3 Evaluation of diagnostic tests (eg, x-ray, CT)       1
 4 Support in diagnosis                                 1
 5 Support in individualized treatment plans            1
 6 Risk assessment and prognosis in chronic disease     1
 7 Analysis of clinical data (patterns, anomalies)      1
 8 Support in medical emergencies and triage            1
 9 Support in urgent decisions                          1
10 Automated medication reminders                       1
11 Management of the electronic health record           1
12 Planning and coordination of treatment               1
13 Appointment scheduling and organization              2
14 Documentation of findings, visits, or therapy        2
15 Monitoring of vital parameters                       2
16 Nursing support                                      2

> # --- 6 Itemschwierigkeiten und Invarianz der Rangfolge ----------------------
> cat("\n\n=== 6  Rangfolge der Itemschwierigkeiten ueber Untergruppe ..." ... [TRUNCATED] 


=== 6  Rangfolge der Itemschwierigkeiten ueber Untergruppen ===

> order_all <- rank(-colMeans(X_A))

> subgroups <- list(
+   "Deutsch"            = df$lang  == "German",
+   "Italienisch"        = df$lang  == "Italian",
+   "18-40 Jahre"        = df$ .... [TRUNCATED] 

> rank_tab <- imap_dfr(subgroups, function(idx, nm)
+   tibble(Untergruppe = nm, n = sum(idx),
+          rho = round(cor(order_all, rank(-colMeans(X_ .... [TRUNCATED] 

> print(rank_tab)
# A tibble: 8 × 3
  Untergruppe       n   rho
  <chr>         <int> <dbl>
1 Deutsch         613 0.985
2 Italienisch     213 0.987
3 18-40 Jahre     287 0.965
4 61-80 Jahre     247 0.962
5 Maenner         426 0.988
6 Frauen          475 1    
7 Bozen           170 0.984
8 uebriges Land   731 0.994

> cat("\nKleinstes rho:", min(rank_tab$rho), "\n")

Kleinstes rho: 0.962 

> # --- 7 Kurzform --------------------------------------------------------------
> cat("\n\n=== 7  Kurzform ===\n")


=== 7  Kurzform ===

> short7 <- c("E4_SQ014",  # Automated medication reminders
+             "E4_SQ008",  # Analysis of clinical data
+             "E4_SQ016",  # Planni .... [TRUNCATED] 

> stopifnot(all(short7 %in% e4_vars))

> cat("Sieben-Item-Kandidat:\n")
Sieben-Item-Kandidat:

> cat(paste0("  ", label_e4[match(short7, e4_vars)], collapse = "\n"), "\n")
  Automated medication reminders
  Analysis of clinical data (patterns, anomalies)
  Planning and coordination of treatment
  Support in individualized treatment plans
  Risk assessment and prognosis in chronic disease
  Support in medical emergencies and triage
  Support in urgent decisions 

> H7 <- coefH_q(X_A[short7], se = TRUE)

> cat("\nH (7 Items) =", round(Hval(H7), 3),
+     " (SE =", round(as.numeric(H7$se.H["H"]), 3), ")\n")

H (7 Items) = 0.602  (SE = NA )

> cat("HT (7 Items) =", round(HTq(X_A[short7]), 3), "\n")
HT (7 Items) = 0.451 

> score16 <- rowSums(X_A); score7 <- rowSums(X_A[short7])

> cat(sprintf("Korrelation Summenscore 7 gegen 16: Pearson %.3f, Spearman %.3f\n",
+             cor(score7, score16), cor(score7, score16, method = " ..." ... [TRUNCATED] 
Korrelation Summenscore 7 gegen 16: Pearson 0.937, Spearman 0.932

> # Sechs-Item-Fassung: jedes der sieben Items einmal weglassen
> cat("\n--- Sechs-Item-Fassungen (je ein Item entfernt) ---\n")

--- Sechs-Item-Fassungen (je ein Item entfernt) ---

> six_tab <- map_dfr(short7, function(drop) {
+   it <- setdiff(short7, drop)
+   h  <- coefH_q(X_A[it])
+   s  <- rowSums(X_A[it])
+   tibble(entfern .... [TRUNCATED] 

> print(six_tab)
# A tibble: 7 × 4
  entferntes_Item                                      H    HT r_mit_16
  <chr>                                            <dbl> <dbl>    <dbl>
1 Planning and coordination of treatment           0.633 0.514    0.907
2 Risk assessment and prognosis in chronic disease 0.614 0.505    0.922
3 Support in individualized treatment plans        0.602 0.591    0.918
4 Automated medication reminders                   0.596 0.36     0.924
5 Support in medical emergencies and triage        0.594 0.442    0.924
6 Analysis of clinical data (patterns, anomalies)  0.593 0.466    0.918
7 Support in urgent decisions                      0.588 0.393    0.921

> # --- 8 Kreuzvalidierung ueber wiederholte Halbierung ------------------------
> cat("\n\n=== 8  Wiederholte Halbierung,", N_SPLIT, "Wiederholungen  ..." ... [TRUNCATED] 


=== 8  Wiederholte Halbierung, 200 Wiederholungen ===

> cat("Liefert Verteilungen statt Punktschaetzern und nutzt die Stichprobe\n")
Liefert Verteilungen statt Punktschaetzern und nutzt die Stichprobe

> cat("effizienter als eine einzelne Teilung.\n")
effizienter als eine einzelne Teilung.

> split_res <- map_dfr(seq_len(N_SPLIT), function(i) {
+   idx <- sample(rep(c(TRUE, FALSE), length.out = nrow(X_A)))
+   h1 <- Hval(coefH_q(X_A[idx,  .... [TRUNCATED] 

> qs <- function(x) { x <- x[is.finite(x)]
+   sprintf("M = %.3f, 95%%-Bereich %.3f bis %.3f (n = %d)",
+           mean(x), quantile(x, .025), quanti .... [TRUNCATED] 

> cat("\nH der 16 Items, Haelfte A:", qs(split_res$H16_a), "\n")

H der 16 Items, Haelfte A: M = 0.490, 95%-Bereich 0.458 bis 0.520 (n = 200) 

> cat("H der 16 Items, Haelfte B:", qs(split_res$H16_b), "\n")
H der 16 Items, Haelfte B: M = 0.491, 95%-Bereich 0.461 bis 0.523 (n = 200) 

> cat("H der Kurzform, Haelfte A:", qs(split_res$H7_a), "\n")
H der Kurzform, Haelfte A: M = 0.600, 95%-Bereich 0.557 bis 0.640 (n = 200) 

> cat("H der Kurzform, Haelfte B:", qs(split_res$H7_b), "\n")
H der Kurzform, Haelfte B: M = 0.604, 95%-Bereich 0.563 bis 0.644 (n = 200) 

> cat("Rangkorrelation der Itemschwierigkeiten zwischen den Haelften:",
+     qs(split_res$rho_order), "\n")
Rangkorrelation der Itemschwierigkeiten zwischen den Haelften: M = 0.989, 95%-Bereich 0.974 bis 0.997 (n = 200) 

> # --- 9 Umrechnung zwischen Kurz- und Langform -------------------------------
> cat("\n\n=== 9  Umrechnung Kurzform in Langform ===\n")


=== 9  Umrechnung Kurzform in Langform ===

> cat("Erwartungswert des 16-Item-Scores je Punktwert der Kurzform, damit beide\n")
Erwartungswert des 16-Item-Scores je Punktwert der Kurzform, damit beide

> cat("Fassungen vergleichbar bleiben.\n\n")
Fassungen vergleichbar bleiben.


> conv <- tibble(score7 = score7, score16 = score16) %>%
+   group_by(score7) %>%
+   summarise(n = n(), M_16 = round(mean(score16), 2), SD = round(sd .... [TRUNCATED] 

> print(conv, n = 8)
# A tibble: 8 × 5
  score7     n  M_16    SD Median
   <dbl> <int> <dbl> <dbl>  <dbl>
1      0   112  0.38  0.85    0  
2      1    70  3.19  1.4     3  
3      2   103  5.78  1.97    6  
4      3   140  7.62  1.82    8  
5      4   123  9.25  1.79   10  
6      5   126 11.0   1.71   11  
7      6    92 12.6   1.51   12.5
8      7   135 14.9   1.46   15  

> lm_fit <- lm(score16 ~ score7)

> cat(sprintf("\nLineare Umrechnung: score16 = %.3f + %.3f * score7  (R2 = %.3f)\n",
+             coef(lm_fit)[1], coef(lm_fit)[2], summary(lm_fit)$r .... [TRUNCATED] 

Lineare Umrechnung: score16 = 1.181 + 1.977 * score7  (R2 = 0.878)

> # --- Export ------------------------------------------------------------------
> save_tab(Hi_tab,    "01_Mokken_Itemkoeffizienten")
  geschrieben: 01_Mokken_Itemkoeffizienten.csv 

> save_tab(rank_tab,  "01_Mokken_Rangfolge_Untergruppen")
  geschrieben: 01_Mokken_Rangfolge_Untergruppen.csv 

> save_tab(six_tab,   "01_Mokken_Sechs_Item_Varianten")
  geschrieben: 01_Mokken_Sechs_Item_Varianten.csv 

> save_tab(split_res, "01_Mokken_Halbierungen_roh")
  geschrieben: 01_Mokken_Halbierungen_roh.csv 

> save_tab(conv,      "01_Mokken_Umrechnung_Kurz_Lang")
  geschrieben: 01_Mokken_Umrechnung_Kurz_Lang.csv 

> save_tab(ca_tab,    "01_Mokken_Lokale_Unabhaengigkeit")
  geschrieben: 01_Mokken_Lokale_Unabhaengigkeit.csv 

> cat("\n\n=== Kennzahlen zum Abgleich mit den Voranalysen ===\n")


=== Kennzahlen zum Abgleich mit den Voranalysen ===

> cat(sprintf("H (16 Items)   berechnet %.3f   Voranalyse 0.491\n", Hval(H_A)))
H (16 Items)   berechnet 0.491   Voranalyse 0.491

> cat(sprintf("H (7 Items)    berechnet %.3f   Voranalyse 0.602\n", Hval(H7)))
H (7 Items)    berechnet 0.602   Voranalyse 0.602

> cat(sprintf("r(7,16) Spearman berechnet %.3f  Voranalyse 0.93\n",
+             cor(score7, score16, method = "spearman")))
r(7,16) Spearman berechnet 0.932  Voranalyse 0.93

> cat("Abweichungen sind zu erwarten, weil die Voranalysen in Python liefen;\n")
Abweichungen sind zu erwarten, weil die Voranalysen in Python liefen;

> cat("groessere Abweichungen sind vor der Weiterverwendung zu klaeren.\n")
groessere Abweichungen sind vor der Weiterverwendung zu klaeren.

> end_log()

 ====================================================================== 
Ende: 2026-08-09 10:33:01 
