ich habe einen funktionierenden Code aber bekomme trotzdem eine Meldung finde aber keinen Weg die ganze Sache anders zu machen ohne Meldung bzw. weiß nicht ob die Meldung nicht doch irgendwann einen Effekt haben könnte.
Ich will am Ende eine ANOVA-Zusammenfassung aus den Ergebnissen, die mit dem Paket VCA erstellt wurden. Das klappt auch aber es gibt die Fehlermeldung wenn Zeile 136 ausgeführt wird:
Es gibt bestimmt elegantere Lösungen aber immerhin hab ich es hinbekommen, wenn nicht die Warnmeldung wäreSetting row names on a tibble is deprecated.
Code: Alles auswählen
library(VCA)
library(broom)
library(dplyr)
library(kableExtra)
DAT <- read.table(header = TRUE, dec = ",", text =
"Tag Lauf Wert
1 1 24,8
1 1 24,5
1 2 24,9
1 2 25,1
2 1 25,2
2 1 25,0
2 2 24,9
2 2 24,5
3 1 24,4
3 1 24,9
3 2 24,8
3 2 24,5
4 1 24,9
4 1 25,1
4 2 25,2
4 2 25,0
5 1 24,9
5 1 24,5
5 2 24,4
5 2 24,9
6 1 24,8
6 1 24,5
6 2 24,9
6 2 25,1
7 1 25,2
7 1 25,0
7 2 24,9
7 2 24,5
8 1 24,4
8 1 24,9
8 2 24,8
8 2 24,5
9 1 24,9
9 1 25,1
9 2 25,2
9 2 25,0
10 1 24,9
10 1 24,5
10 2 24,4
10 2 24,9
11 1 24,8
11 1 24,5
11 2 24,9
11 2 25,1
12 1 25,2
12 1 25,0
12 2 24,9
12 2 24,5
13 1 24,4
13 1 24,9
13 2 24,8
13 2 24,5
14 1 24,9
14 1 25,1
14 2 25,2
14 2 25,0
15 1 24,9
15 1 24,5
15 2 24,4
15 2 24,9
16 1 24,8
16 1 24,5
16 2 24,9
16 2 25,1
17 1 25,2
17 1 25,0
17 2 24,9
17 2 24,5
18 1 24,4
18 1 24,9
18 2 24,8
18 2 24,5
19 1 24,9
19 1 25,1
19 2 25,2
19 2 25,0
20 1 24,9
20 1 24,5
20 2 24,4
20 2 24,9
")
# fit 20 x 2 x 2 model to data
fit.SS1 <- fitVCA(Wert~Tag/Lauf, DAT)
# estimate 95% confidence intervals, request CI for
# all variance components via 'VarVC=TRUE'
inf.SS1 <- VCAinference(fit.SS1, VarVC=TRUE)
#Freiheitsgrade ziehen
wl_df <- inf.SS1$VCAobj$ aov.tab[1,1]
Tag_df <- inf.SS1$VCAobj$ aov.tab[2,1]
Lauf_Tag_df <- inf.SS1$VCAobj$ aov.tab[3,1]
error_df <- inf.SS1$VCAobj$ aov.tab[4,1]
total_df <- error_df + Lauf_Tag_df + Tag_df
#SS (sum of squares due to the source) ziehen
Tag_ss <- inf.SS1$VCAobj$aov.tab[2,2]
Lauf_Tag_ss <- inf.SS1$VCAobj$aov.tab[3,2]
error_ss <- inf.SS1$VCAobj$aov.tab[4,2]
total_ss <- ((Tag_ss)+(Lauf_Tag_ss)+(error_ss))
#MS (mean sum of squares due to the source) ziehen
Tag_ms <- inf.SS1$VCAobj$aov.tab[2,3]
Lauf_Tag_ms <- inf.SS1$VCAobj$aov.tab[3,3]
error_ms <- inf.SS1$VCAobj$aov.tab[4,3]
#Übeprüfen ob die "Variance components (VC) positi oder negativ sind siehe CLSI EP05 S.77 unten. Aus diesen wird auch die SD der within-laboratory precision berechnet.
error_v <- error_ms
Lauf_v <- inf.SS1$VCAobj$aov.tab[3,4]
Tag_v <- inf.SS1$VCAobj$aov.tab[2,4]
#Standardabweichung und CV für Repeatability (SD error) und Within-Laboratory precision (sd total)
repeat_sd <- inf.SS1$VCAobj$aov.tab[4,6]
repeat_cv <- inf.SS1$VCAobj$aov.tab[4,7]
within_sd <- inf.SS1$VCAobj$aov.tab[1,6]
within_cv <- inf.SS1$VCAobj$aov.tab[1,7]
ss <- round((c(Tag_ss, Lauf_Tag_ss, error_ss, total_ss)), digits = 2)
df <- c(Tag_df, Lauf_Tag_df, error_df, total_df)
ms <- round((c(Tag_ms, Lauf_Tag_ms, error_ms, NA)), digits = 2)
name <- c("Tag", "Lauf", "Error", "Total")
tabelle <- cbind(df, ss,ms)
tabelle <- as_data_frame(tabelle)
rownames(tabelle) <- name
tabelle <- rownames_to_column(tabelle, var = "C")
tabelle <- as_tibble(tabelle)
tabelle %>%
mutate_all(linebreak) %>%
kable(
"latex",
booktabs = T,
linesep = "",
caption = "ANOVA-Zusammenfassung entsprechend CLSI EP05-A3",
col.names = linebreak(
c(
"Namen",
"SS",
"DF",
"MF"
),
align = "r"
)
) %>%
kable_styling(latex_options = c("hold_position")) %>%
kable_styling(latex_options = "striped", stripe_index = c(2, 4))
VG,
Andreas