Laden Sie die folgenden Packages und Data-Frames:
library(tidyverse)
library(broom)
library(gridExtra)
library(lmerTest)
library(emmeans)
library(MuMIn)
library(afex)
sigmoid = function(x, k = 0, m = 1) {
  exp(m * x + k) / (1 + exp(m * x + k))
}
urla = "https://www.phonetik.uni-muenchen.de/studium_lehre/"
urlb = "lehrmaterialien/R_speech_processing/Rdf"
url = paste0(urla, urlb)
gh = read.table(file.path(url, "gheit_k.txt"), 
                stringsAsFactors = T)
vht = read.table(file.path(url, "vheight.df.txt"), 
                 stringsAsFactors = T)
vht = vht %>% 
  rename(noise = sex) %>%
  mutate(height = 
           factor(height, 
                  levels = c("low", "mid", "high")), 
         noise = ifelse(noise == "female", "loud", "quiet"))
         
wj = read.table(file.path(url, "wj.df.txt"), 
                stringsAsFactors = T)
s.df <- read.csv("https://userpage.fu-berlin.de/soga/200/2010_data_sets/students.csv", stringsAsFactors = T)
s.df = s.df[,-2]
kj = read.table(file.path(url, "kj2.txt"), 
                stringsAsFactors = T)
kj = kj %>%
  mutate(Age = factor(Age, levels = c("young", "mid", "old")), 
         Social = factor(Social, levels = c("WC", "LMC", "UMC")))Gender: Male) im Dataframe s.df,
inwiefern es eine lineare Beziehung zwischen Höhe (height)
und Gewicht (weight) gibt. Was sind die vorhergesagten
Höhen für Gewichte von 80, 100, und 120?##     stud.id          gender          age            height          weight     
##  Min.   :110250   Female:4110   Min.   :18.00   Min.   :135.0   Min.   : 51.4  
##  1st Qu.:331222   Male  :4129   1st Qu.:20.00   1st Qu.:163.0   1st Qu.: 66.5  
##  Median :545132                 Median :21.00   Median :171.0   Median : 71.8  
##  Mean   :548910                 Mean   :22.54   Mean   :171.4   Mean   : 73.0  
##  3rd Qu.:770808                 3rd Qu.:23.00   3rd Qu.:180.0   3rd Qu.: 78.5  
##  Max.   :989901                 Max.   :64.00   Max.   :206.0   Max.   :116.0  
##                                                                                
##        religion       nc.score     semester   
##  Catholic  :2797   Min.   :1.000   >6th: 303  
##  Muslim    : 330   1st Qu.:1.460   1st :1709  
##  Orthodox  : 585   Median :2.040   2nd :1638  
##  Other     :2688   Mean   :2.166   3rd :1641  
##  Protestant:1839   3rd Qu.:2.780   4th :1368  
##                    Max.   :4.000   5th : 876  
##                                    6th : 704  
##                         major                             minor     
##  Biology                   :1597   Biology                   :1318  
##  Economics and Finance     :1324   Economics and Finance     :1382  
##  Environmental Sciences    :1626   Environmental Sciences    :1318  
##  Mathematics and Statistics:1225   Mathematics and Statistics:1446  
##  Political Science         :1455   Political Science         :1387  
##  Social Sciences           :1012   Social Sciences           :1388  
##                                                                     
##      score1          score2     online.tutorial    graduated     
##  Min.   :30.00   Min.   :31.0   Min.   :0.0000   Min.   :0.0000  
##  1st Qu.:58.00   1st Qu.:59.0   1st Qu.:0.0000   1st Qu.:0.0000  
##  Median :70.00   Median :71.0   Median :0.0000   Median :0.0000  
##  Mean   :68.17   Mean   :69.5   Mean   :0.3862   Mean   :0.2128  
##  3rd Qu.:78.00   3rd Qu.:80.0   3rd Qu.:1.0000   3rd Qu.:0.0000  
##  Max.   :97.00   Max.   :98.0   Max.   :1.0000   Max.   :1.0000  
##  NA's   :3347    NA's   :3347                                    
##      salary     
##  Min.   :11444  
##  1st Qu.:35207  
##  Median :41672  
##  Mean   :42522  
##  3rd Qu.:49373  
##  Max.   :75597  
##  NA's   :6486# Ein sehr klarer Fall einer linearen Beziehung
s.df %>%
  filter(gender == "Male") %>%
  slice_head(n = 200) %>%
  ggplot() + 
  aes(y = height, x = weight) + 
  geom_smooth(method = "lm", se = F, color = "blue") +
  geom_point()## `geom_smooth()` using formula = 'y ~ x'# und wie zu erwarten hoch signifikant
s.df %>%
  filter(gender == "Male") %>%
  slice_head(n = 200) %>%
  lm(height ~ weight, .) %>%
  summary()## 
## Call:
## lm(formula = height ~ weight, data = .)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -8.6003 -1.8309  0.1669  1.9423  7.5316 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 98.87431    2.17917   45.37   <2e-16 ***
## weight       1.02184    0.02815   36.31   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.815 on 198 degrees of freedom
## Multiple R-squared:  0.8694, Adjusted R-squared:  0.8687 
## F-statistic:  1318 on 1 and 198 DF,  p-value: < 2.2e-16# die vorhergesagte Höhen
s.df %>%
  filter(gender == "Male") %>%
  slice_head(n = 200) %>%
  lm(height ~ weight, .) %>%
  predict(., data.frame(weight = c(80, 100, 120)))##        1        2        3 
## 180.6213 201.0580 221.4948Es gab eine signifikante lineare Beziehung zwischen Höhe und Gewicht (\(R^2 = 0.87, F[1, 198] = 1318, p < 0.001\)).
vht
wurden Reaktionszeiten gemessen (rt), um zu prüfen, wie
schnell wahrgenommene Vokale (height) produziert in Räumen
mit oder ohne Lärm (noise) identifiziert werden konnten.
Die Reaktionszeiten wurden von mehreren Versuchspersonen
(Vpn) erhoben. Die Vokale kamen in verschiedenen Wörtern
(Wort) vor. Prüfen Sie durch eine Abbildung und
statistischen Test, ob Lärm (noise) und/oder Vokal
(height) die Reaktionzeiten beeinflussten.## [1] 1000    5##       Vpn           Wort           rt           noise            height   
##  S33    : 31   W6     : 48   Min.   :3.800   Length:1000        low :156  
##  S12    : 29   W28    : 47   1st Qu.:5.700   Class :character   mid :372  
##  S48    : 29   W10    : 46   Median :6.300   Mode  :character   high:472  
##  S42    : 27   W14    : 45   Mean   :6.302                                
##  S8     : 26   W21    : 42   3rd Qu.:6.900                                
##  S10    : 25   W7     : 42   Max.   :9.900                                
##  (Other):833   (Other):730# RT zu Frauen > RT zu Männern
# low < (mid, high) in Männern; eventuell mid < high in Frauen.
# wahrscheinlich eine Interaktion
vht %>% 
  ggplot() +
  aes(y = rt, x = noise, fill = height) +
  geom_boxplot()# beide within im Bez. zu Vpn
vht %>%
  mutate(Fac = interaction(noise, height)) %>%
  select(Vpn, Fac) %>%
  table()##      Fac
## Vpn   loud.low quiet.low loud.mid quiet.mid loud.high quiet.high
##   S1         1         4        2         4         4          3
##   S10        6         1        5         5         1          7
##   S11        2         1        7         4         3          4
##   S12        1         1        9         4         5          9
##   S13        3         2        1         6         4          5
##   S14        2         0        8         3         3          2
##   S15        2         2        2         7         5          5
##   S16        1         2        4         3         8          2
##   S17        1         2        0         0         5         11
##   S18        3         1        2         4         6          7
##   S19        1         1        4         7         4          4
##   S2         3         1        4         2         5          5
##   S20        2         1        2         5         3          6
##   S21        0         3        3         6         4          3
##   S22        1         2        3         1         3          5
##   S23        2         0        3         5         0          5
##   S24        0         1        1         2         4          5
##   S25        2         2        2         7         3          8
##   S26        2         1        4         7         0          3
##   S27        1         0        4         7         8          2
##   S28        2         1        2         3         3          7
##   S29        1         2        4         5         3          4
##   S3         1         1        3         5         6          2
##   S30        3         2        3         2         3          3
##   S31        0         5        5         6         3          6
##   S32        3         2        6         2         6          2
##   S33        3         1        5         4         7         11
##   S34        3         1        6         3         2          7
##   S35        2         0        3         3         5          6
##   S36        0         2        1        11         6          5
##   S37        1         2        3         6         4          8
##   S38        1         2        3         1         3          7
##   S39        4         1        3         3         6          4
##   S4         3         1        3         3         7          4
##   S40        1         2        5         4         3          6
##   S41        1         0        4         1         4          3
##   S42        1         1        6         6         5          8
##   S43        2         0        0         2         4          4
##   S44        0         4        3         6         4          7
##   S45        1         2        4         3         4          4
##   S46        1         2        5         6         3          4
##   S47        0         0        4         1         7          3
##   S48        0         0        5         9         6          9
##   S49        2         2        3         4         4          4
##   S5         2         0        1         2         6          4
##   S50        0         2        2         0         2          4
##   S6         4         1        4         2         4          3
##   S7         3         1        2         2         7          2
##   S8         4         1        2         2         6         11
##   S9         2         0        3         3         2          6# beide within im Bez. zu Wort
vht %>%
  mutate(Fac = interaction(noise, height)) %>%
  select(Wort, Fac) %>%
  table()##      Fac
## Wort  loud.low quiet.low loud.mid quiet.mid loud.high quiet.high
##   W1         1         3        5         4         8          6
##   W10        3         5        7        11        10         10
##   W11        2         1        7         9         9          9
##   W12        0         1        3         5         6          7
##   W13        1         3        2         9         4         14
##   W14        1         2       11         8        14          9
##   W15        4         3        5         4         4          4
##   W16        5         3        7         4        15          7
##   W17        3         5        3         4         5          6
##   W18        3         3        4         4         8         12
##   W19        7         0        6         5         8         13
##   W2         4         3        5         6         6          8
##   W20        1         1        3         4         6          6
##   W21        4         2        6         9         8         13
##   W22        5         4       10         4         5         11
##   W23        4         0        6         3         8          7
##   W24        4         1        4         7         1          6
##   W25        1         2        7         4         8          9
##   W26        2         3        9         6         4          7
##   W27        1         2        4        13         7         10
##   W28        4         4        5        10        12         12
##   W29        2         4        6         6         3         14
##   W3         1         2        3         6         6          8
##   W30        3         0        6         3         7          8
##   W4         6         5        7         7         3          6
##   W5         4         0        2         6         7         11
##   W6         7         1        8        14        12          6
##   W7         1         2        8        13         8         10
##   W8         2         3        7         6         7          8
##   W9         1         1        7         5         4          2# Eindeutig ein mixed model
 vht %>%
  lmer(rt ~ noise * height + 
         (noise+height|Vpn) + 
         (noise+height|Wort), .) %>%  step() ## boundary (singular) fit: see help('isSingular')## Warning: Model failed to converge with 1 negative eigenvalue: -9.6e+01## boundary (singular) fit: see help('isSingular')
## boundary (singular) fit: see help('isSingular')
## boundary (singular) fit: see help('isSingular')## Warning: Model failed to converge with 3 negative eigenvalues: -3.3e-02
## -8.1e-01 -4.9e+00## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.00843696 (tol = 0.002, component 1)## boundary (singular) fit: see help('isSingular')
## boundary (singular) fit: see help('isSingular')
## boundary (singular) fit: see help('isSingular')## Warning: Model failed to converge with 1 negative eigenvalue: -2.6e-02## boundary (singular) fit: see help('isSingular')
## boundary (singular) fit: see help('isSingular')## Backward reduced random-effect table:
## 
##                                  Eliminated npar  logLik    AIC    LRT Df
## <none>                                        27 -1126.3 2306.5          
## noise in (noise + height | Vpn)           1   23 -1124.9 2295.8 -2.712  4
## noise in (noise + height | Wort)          2   19 -1125.4 2288.8  0.998  4
## height in (height | Wort)                 3   14 -1128.6 2285.1  6.337  5
## height in (height | Vpn)                  0    9 -1136.1 2290.2 15.086  5
## (1 | Wort)                                0   13 -1162.0 2350.0 66.901  1
##                                  Pr(>Chisq)    
## <none>                                         
## noise in (noise + height | Vpn)      1.0000    
## noise in (noise + height | Wort)     0.9100    
## height in (height | Wort)            0.2748    
## height in (height | Vpn)             0.0100 *  
## (1 | Wort)                        2.855e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Backward reduced fixed-effect table:
## Degrees of freedom method: Satterthwaite 
## 
##              Eliminated Sum Sq Mean Sq NumDF  DenDF F value  Pr(>F)    
## noise:height          0 21.466  10.733     2 648.66  23.174 1.9e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Model found:
## rt ~ noise + height + (height | Vpn) + (1 | Wort) + noise:height## Type III Analysis of Variance Table with Satterthwaite's method
##              Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## noise        41.388  41.388     1 745.15  89.364 < 2.2e-16 ***
## height       32.221  16.110     2  46.14  34.785 6.143e-10 ***
## noise:height 21.466  10.733     2 648.66  23.174 1.900e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1# post-hoc test
vht %>%
  lmer(rt ~ noise + height + 
         (height | Vpn) + (1 | Wort) + noise:height, .) %>%
  emmeans(., ~ noise * height) %>%
  pairs(., simple = "each", combine = T)##  height noise contrast      estimate     SE  df t.ratio p.value
##  low    .     loud - quiet  1.031873 0.1168 418   8.833  <.0001
##  mid    .     loud - quiet  0.127836 0.0742 879   1.722  0.7688
##  high   .     loud - quiet  0.277942 0.0664 886   4.187  0.0003
##  .      loud  low - mid     0.000832 0.0970 109   0.009  1.0000
##  .      loud  low - high   -0.291722 0.1027 101  -2.840  0.0492
##  .      loud  mid - high   -0.292554 0.0803 138  -3.644  0.0034
##  .      quiet low - mid    -0.903205 0.1026 121  -8.801  <.0001
##  .      quiet low - high   -1.045653 0.1077 114  -9.711  <.0001
##  .      quiet mid - high   -0.142448 0.0756 106  -1.884  0.5601
## 
## Degrees-of-freedom method: kenward-roger 
## P value adjustment: bonferroni method for 9 testsDie Reaktionszeiten wurden signifikant vom Lärm (\(F[1, 745.2] = 89.4, p < 0.001\)) und vom Vokal (\(F[2, 46.1] = 34.8, p < 0.001\)) beeinflusst, und es gab eine signifikante Interaktion zwischen diesen beiden Faktoren (\(F[2, 648.7] = 23.2, p < 0.001\)). Post-hoc Tests zeigten signifikante Unterschiede zwischen noise und quiet für low (\(p < 0.001\)) und für high (\(p < 0.001\)) aber nicht für mid. Für loud gab es signifikante Unterschiede zwischen low und high (\(p < 0.05\)), und zwischen mid und high (\(p < 0.01\)) aber nicht zwischen low und mid. Für quiet gab es signifikante Unterschiede zwischen low und mid (\(p < 0.001\)) und low und high (\(p < 0.001\)) aber nicht zwischen mid und high.
## 
##  One Sample t-test
## 
## data:  f0
## t = 29.969, df = 14, p-value = 4.232e-14
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
##  135.0560 155.8773
## sample estimates:
## mean of x 
##  145.4667# 135.0560 155.8773
# Oder für das 95% Konfidenzintervall: 
f0mean = mean(f0)
f0SE = sd(f0)/sqrt(15)
f0mean + f0SE * qt(.025, 14)## [1] 135.056## [1] 155.8773Der Grundfrequenzmittelwert liegt zwischen 135.056 Hz und 155.8773 Hz mit einer Wahrscheinlichkeit von 95%. Ja, ein Grundfrequenzmittelwert von 160 Hz gilt als ungewöhnlich.
wj haben
sich englische Hörer ein 13-stufiges Kontinuum (Stim)
angehört, in dem F2 variiert wurde. Pro Stimulus mussten sie
entscheiden, ob sie will und wool wahrgenommen
hatten. Prüfen Sie, durch eine Abbildung und statistischen Test, ob die
Wahl zwischen will und wool durch das
F2-Kontinuum beeinflusst wurde. Zu welchem Wert kommt der Umkipppunkt
zwischen will und wool vor? Welche
vorhergesagte Proportion von will Antworten kommt vor zu
einem F2-Wert von 1350 Hz?# Proportionen berechnen und abbilden:
wj %>%
  group_by(F2, Urteil) %>%
  summarise(n = n()) %>%
  mutate(prop = n/sum(n)) %>%
  filter(Urteil == levels(Urteil)[2]) %>%
  ggplot() +
  aes(y = prop, x = F2) +
  geom_point() +
  ylab("Proportion wool responses") ## `summarise()` has grouped output by 'F2'. You can override using the `.groups`
## argument.## Analysis of Deviance Table
## 
## Model: binomial, link: logit
## 
## Response: Urteil
## 
## Terms added sequentially (first to last)
## 
## 
##      Df Deviance Resid. Df Resid. Dev  Pr(>Chi)    
## NULL                  1169    1621.88              
## F2    1   1127.2      1168     494.68 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1# Koeffiziente
km = wj %>%
  glm(Urteil ~ F2, family = binomial, .) %>%
  coef()
# Umkipppunkt: 1278.012 Hz
-km[1]/km[2]## (Intercept) 
##    1278.012##        F2 
## 0.8302072# Sigmoid
wj %>%
  group_by(F2, Urteil) %>%
  summarise(n = n()) %>%
  mutate(prop = n/sum(n)) %>%
  filter(Urteil == levels(Urteil)[2]) %>%
  ggplot() +
  aes(y = prop, x = F2) +
  geom_point() +
  ylab("Proportion wool responses") +
  stat_function(fun = sigmoid, args = list(k = km[1], m = km[2]))## `summarise()` has grouped output by 'F2'. You can override using the `.groups`
## argument.Das Urteil ob will oder wool wurde signifikant von F2 beeinflusst (\(X[1] = 1127.2, p < 0.001\)). Die Proportion von will Urteilen bei 1350 Hz ist 0.83.
gh
zeigen die Geschwindigkeit (gw) in Silben/Minute, mit der
10 Versuchpersonen (Vpn) Inhalts- oder Funktionswörter
(Wort) in der Labor- oder Telefonsprache (Art)
produzierten. Prüfen Sie durch eine Abbildung und statistichen Test,
inwiefern die Geschwindigkeit von Wort und Art beeinflusst
wurde.##        gw             Vpn     Wort    Art    
##  Min.   : 5.00   S.1    : 4   F:20   lab:20  
##  1st Qu.: 9.00   S.10   : 4   I:20   tel:20  
##  Median :16.00   S.2    : 4                  
##  Mean   :23.68   S.3    : 4                  
##  3rd Qu.:35.50   S.4    : 4                  
##  Max.   :60.00   S.5    : 4                  
##                  (Other):16## [1] 40  4# I > F aber nur in der Telefonsprache
# tel > lab
# ganz bestimmt eine Interaktion
gh %>%
  ggplot() + 
  aes(y = gw, x = Art, fill = Wort) +
  geom_boxplot()# beide within - und eindeutig ein ANOVA
gh %>% 
  mutate(Fac = interaction(Art, Wort)) %>%
  select(Vpn, Fac) %>%
  table()##       Fac
## Vpn    lab.F tel.F lab.I tel.I
##   S.1      1     1     1     1
##   S.10     1     1     1     1
##   S.2      1     1     1     1
##   S.3      1     1     1     1
##   S.4      1     1     1     1
##   S.5      1     1     1     1
##   S.6      1     1     1     1
##   S.7      1     1     1     1
##   S.8      1     1     1     1
##   S.9      1     1     1     1## Anova Table (Type 3 tests)
## 
## Response: gw
##     Effect   df   MSE          F  ges p.value
## 1      Art 1, 9 57.50 134.88 *** .869   <.001
## 2     Wort 1, 9 21.68  58.38 *** .520   <.001
## 3 Art:Wort 1, 9 20.28  52.82 *** .478   <.001
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1gh %>%
  aov_4(gw ~ Art * Wort + (Art+Wort|Vpn), .) %>%
  emmeans(., ~ Art * Wort) %>%
  pairs(., simple = "each", combine = T)##  Wort Art contrast  estimate   SE df t.ratio p.value
##  F    .   lab - tel    -17.5 2.37  9  -7.377  0.0002
##  I    .   lab - tel    -38.2 3.15  9 -12.123  <.0001
##  .    lab F - I         -0.9 1.29  9  -0.700  1.0000
##  .    tel F - I        -21.6 2.60  9  -8.321  0.0001
## 
## P value adjustment: bonferroni method for 4 testsProduktionsart (\(F[1, 9] = 134.9, p < 0.001\)) sowie Wort (\(F[1, 9] = 58.4, p < 0.001\)) beeinflussten signifikant die Sprechgeschwindigkeit, und es gab eine signifikante Interaktion zwischen diesen beiden Faktoren (\(F[1, 9] = 52.8, p < 0.001\)). Post-hoc Tests zeigten signifikante Unterschiede zwischen Labor- und Telefonsprache in Funktions- und Inhaltswörtern (\(p < 0.001\)). Es gab einen signifikanten Unterschied zwischen Funktions- und Inhaltwörtern in Telefon- (\(p < 0.001\)) aber nicht in der Laborsprache.
dialA = c(100,  99, 107,  99, 103, 101,  93, 106)
dialB = c(103,  99, 105, 118, 117, 113, 111, 119)
dialC = c(114, 116, 102, 111, 116, 106, 108, 106)
# Ein Dataframe bauen. 
# Die f0-Werte
d = c(dialA, dialB, dialC)
# der passende Dialekt
dial = rep(c("A", "B", "C"), each = 8)
# der Dataframe
d.df = data.frame(d, dial, Vpn = paste0("S", 1:24))
# Abbildung. A < (B, C)
d.df %>%
  ggplot() +
  aes(y = d, x = dial) +
  geom_boxplot()## Converting to factor: dial## Contrasts set to contr.sum for the following variables: dial## Anova Table (Type 3 tests)
## 
## Response: d
##   Effect    df   MSE       F  ges p.value
## 1   dial 2, 21 34.42 6.66 ** .388    .006
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '+' 0.1 ' ' 1# Post-hoc test:
d.df %>%
  aov_4(d ~ dial + (1|Vpn), .) %>%
  emmeans(., ~dial) %>%
  pairs(., simple = "each", combine = T)## Converting to factor: dial
## Contrasts set to contr.sum for the following variables: dial##  contrast estimate   SE df t.ratio p.value
##  A - B       -9.62 2.93 21  -3.281  0.0107
##  A - C       -8.88 2.93 21  -3.026  0.0193
##  B - C        0.75 2.93 21   0.256  1.0000
## 
## P value adjustment: bonferroni method for 3 testsDialekt hatte einen signifikanten Einfluss auf die Grundfrequenz (\(F[2, 21] = 6.7, p < 0.01\)). Post-hoc Tests zeigten signifikante Unterschiede zwischen A und B (\(p < 0.05\)) und zwischen A und C (\(p < 0.05\)) aber nicht zwischen B und C.
kj die Wahl
des Frikatives vom Alter (Age) und/oder Gender
beeinflusst wurde.# [S]-Urteil: young > mid > old; w > m; 
# eventuell eine Interaktion, da w > m nur in 'young' und 'mid'
kj %>%
  ggplot() +
  aes(x = Gender, fill = Fric) +
  facet_wrap(~Age) +
  geom_bar(position = "fill") +
  ylab("Proportion")## Analysis of Deviance Table
## 
## Model: binomial, link: logit
## 
## Response: Fric
## 
## Terms added sequentially (first to last)
## 
## 
##            Df Deviance Resid. Df Resid. Dev  Pr(>Chi)    
## NULL                         239     263.13              
## Gender      1   8.4324       238     254.69 0.0036859 ** 
## Age         2  17.9576       236     236.74 0.0001261 ***
## Gender:Age  2   7.2251       234     229.51 0.0269827 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1kj %>%
  glm(Fric ~ Gender * Age, family = binomial, .) %>%
  emmeans(., ~ Gender * Age) %>%
  pairs(., simple = "each", combine = T)##  Age   Gender contrast    estimate    SE  df z.ratio p.value
##  young .      m - w         -1.551 0.523 Inf  -2.967  0.0271
##  mid   .      m - w         -1.145 0.527 Inf  -2.175  0.2670
##  old   .      m - w          0.999 0.869 Inf   1.149  1.0000
##  .     m      young - mid    0.000 0.588 Inf   0.000  1.0000
##  .     m      young - old    0.395 0.634 Inf   0.624  1.0000
##  .     m      mid - old      0.395 0.634 Inf   0.624  1.0000
##  .     w      young - mid    0.405 0.452 Inf   0.897  1.0000
##  .     w      young - old    2.944 0.791 Inf   3.721  0.0018
##  .     w      mid - old      2.539 0.794 Inf   3.198  0.0125
## 
## Results are given on the log odds ratio (not the response) scale. 
## P value adjustment: bonferroni method for 9 testsGeschlecht (\(X^2[1] = 8.4, p < 0.01\)) und Alter (\(X^2[2] = 18.0, p, < 0.001\)) beeinflussten signifikant die Wahl des Frikativs und es gab eine signifikante Interaktion zwischen diesen Faktoren (\(X^2[2] = 7.2, p < 0.05\)). Post-hoc Tests zeigten signifikante männlich-weiblich Unterschiede nur für jung (\(p < 0.05\)); sie zeigten ebenfalls jung-alt (\(p < 0.01\)) und mittelaltrig-alt (\(p < 0.05\)) Unterschiede in Frauen.