APA_: APA Syle Table

Description Usage Arguments Value Examples

Description

All functions in stringr start with APA_ and take a Object (formula, data.frame, lm, ...) as the first argument.

APA_ICC Intra-Klassen-Korrelation ( mit psych ).

APA_PCA: Faktoranalyse wie SPSS PCA

APA_Validation Validation of Linear Models Assumptions (Testing Linear Regression Models)

APA_R2: R2-Tabelle (noch nicht fretig)

APA_Durbin_Watson(fit, max.lag=1, simulate=TRUE, reps=1000, method=c("resample","normal"), alternative=c("two.sided", "positive", "negative")): Durbin-Watson Test for Autocorrelated Errors. Kopie der Funktion car::durbinWatsonTest

APA_vif: variance inflation factor, aka VIF

APA_Correlation: Korrelationstabelle (Interkorrelationen mit der Hilfe der Funktion Hmisc::rcorr. Erlaubt ist die getrennte Auswertung ueber by=~b

APA_Ttest: Berechnung von Mittelwerten und Mittelwertdifferenzen und des T-Test.

Kreuztabellen APA_Xtabs, APA2.xtabs : Die Funktion Formatiert xtabs() mit NxM und NxMxO Tabellen.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
APA_NULL(x, ...)

APA_Likert(...)

APA2_multiresponse(Formula, data, caption = "", note = "",
  test = FALSE, order = FALSE, decreasing = TRUE,
  sig_test = "fischer.test", na.action = na.pass, use.level = 1, ...)

APA_ICC(x, ..., caption = "ICC", type = c(1, 4))

ICC2(x, ..., caption = "ICC", type = c(1, 4))

APA_PCA(data, ..., include.pca = TRUE, include.plot = FALSE,
  include.kmo = TRUE, w = 5, h = 5,
  caption = "Standardized loadings (pattern matrix) based upon correlation matrix",
  note = "", main = "")

APA_Reliability(..., caption = "", note = "")

APA_Validation(..., include.ftest = TRUE, include.loglik = FALSE,
  include.minus.LL = include.loglik, include.pseudo = TRUE,
  include.r = include.pseudo, include.heteroskedasticity = TRUE,
  include.durbin = TRUE, include.levene = FALSE,
  include.bartlett = FALSE, include.vif = FALSE,
  include.sigma = FALSE, include.rmse = FALSE, include.aic = TRUE,
  include.bic = include.aic, include.residual = TRUE,
  include.normality = TRUE, include.multicollin = include.vif,
  include.deviance = TRUE, caption = "Testing Regression Models",
  note = "", names = NULL)

APA_R2(..., caption, note)

APA_Durbin_Watson(x,
  caption = "Durbin-Watson Test for Autocorrelated Errors",
  note = NULL, ...)

APA_vif(..., caption = "VIF", notes = "")

APA_Correlation(..., caption = "Korrelation", note = NULL,
  output = stp25output::which_output(), col_names = NULL,
  cor_diagonale_up = TRUE, type = c("pearson", "spearman"),
  include.mean = FALSE, include.n = TRUE, stars = TRUE,
  p.value = FALSE, include.stars = stars, include.p = p.value)

Hmisc_rcorr(..., cor_diagonale_up = TRUE, include.stars = TRUE,
  include.p = FALSE, include.mean = FALSE, include.n = TRUE,
  type = c("pearson", "spearman"))

APA_Ttest(x, data, caption = "T Test", note = alternative,
  output = stp25output::which_output(), var.equal = FALSE,
  paired = FALSE, alternative = "two.sided", include.mean = TRUE,
  include.d = TRUE, include.mean.diff = TRUE, include.se = FALSE,
  type = "t.test", digits = 2, ...)

APA_Xtabs(x, ...)

## S3 method for class 'glm'
APA_Xtabs(x, caption = "",
  output = stp25output::which_output(), thresh = 0.5, ...)

## S3 method for class 'formula'
APA_Xtabs(x, data = NULL, caption = "",
  output = stp25output::which_output(), labels = FALSE,
  addNA = FALSE, exclude = if (!addNA) c(NA, NaN),
  drop.unused.levels = FALSE, include.prop.chisq = TRUE,
  include.chisq = FALSE, include.correlation = FALSE,
  include.fisher = FALSE, include.mcnemar = FALSE,
  include.resid = FALSE, include.sresid = FALSE,
  include.sensitivity = FALSE, test = include.prop.chisq |
  include.chisq | include.fisher | include.mcnemar, ...)

## S3 method for class 'data.frame'
APA_Xtabs(data = NULL, formula, caption = "",
  output = stp25output::which_output(), labels = FALSE, ...)

## Default S3 method:
APA_Xtabs(x, ...)

Arguments

x

An object to be converted into a tidy data.frame or Formula

...

extra arguments

data

data.frame wenn x eine Formel ist

caption, note

Ueberschrift an Output

type

enweder "pearson" oder "spearman"

include.pca, include.plot, include.kmo

type=c("pca", "plot", "kmo")

w, h, main

Grafik Fenster w=5 h=5 Ueberschrift

include.ftest, include.loglik

F-sratistik

include.r, include.pseudo

R-Quadrat

include.heteroskedasticity

Breusch-Pagan test

include.durbin

autocorrelation

include.levene

homogeneity of variance across groupssiehe T-Test

include.bartlett

Homogeneity of Variances siehe T-Test

include.vif

noch nicht Implementiert

include.sigma, include.rmse

RMSE Extract Residual Standard Deviation Sigma

output

Html oder Text

col_names

nicht benutzt

cor_diagonale_up

Diagonale oben oder unter

include.mean

Mittelwerte

include.n

Anzahl an gueltigen Werten

include.stars

Sternchen als p-Werte

include.p

Explizite p-Werte

var.equal, paired, alternative

an t.Test var.equal = FALSE "two.sided"

include.d

Cohens d

include.mean.diff

Mittlere Differenzen

include.se

Standardfehler noch nicht Fertig

digits

Nachkommastellen

addNA, exclude, drop.unused.levels

An xtabs() default = FALSE

x

model- fit

...

Formel mit Daten wird von prepare_data2()aufgedroeselt

caption, note

Ueberschrift

include.mean

Mittelwerte mit SD

Value

a data.frame or list with data.frame

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
 APA_Reliability(~F3+F2+F10+F11, fkv, check.keys =TRUE)
 

hkarz$Lai <- factor(hkarz$lai, 0:1, Cs(.neg, .pos))
fit2 <- glm(gruppe ~ tzell + Lai, hkarz, family = binomial)
fit1<-lm(score ~ grade + treatment + stdTest, schools)
APA_Validation(x) 
APA_Validation(fit1,fit2, include.pseudo = TRUE, include.r = TRUE, include.loglik = TRUE,
               include.rmse = TRUE)
               
               

fit1<-lm(score ~ grade + treatment, schools)
fit2<-lm(score ~ grade + treatment + stdTest, schools)
APA_R2(fit1, fit2)

x<-lm(score ~ grade + treatment + stdTest, schools)
APA2(car::durbinWatsonTest(x))
DW_Test2(x)

lmtest::dwtest(x)
car::durbinWatsonTest(x)


n <- 2 * 20
e <- rnorm(n)
dat <- Label(
  data.frame(
    a = rnorm(n) + e / 2,
    b = rnorm(n) + e,
    c = rnorm(n),
    d = rnorm(n) + e * 10,
    g = gl(2, 20, labels = c("Control", "Treat"))
  ),
  a = "Alpha",
  b = "Beta",
  c = "Gamma"
)


APA_Correlation( ~ a + b + c, dat)
APA_Correlation(a ~ c, dat)
APA_Correlation(a + b + c ~ d, dat)
APA_Correlation(a + b ~ c +  d, dat)
APA_Correlation(a + b + c ~ d, dat, groups = ~ g)
APA_Correlation( ~ a + b + c, dat)
APA_Correlation( ~ a + b + c, dat, include.p = TRUE)
APA_Correlation( ~ a + b + c, dat, include.p = TRUE, include.stars = FALSE)

 # library(arm)
 # windows(7,7)
 # corrplot(data[Cs(a,b,c,d)], abs=TRUE, n.col.legend=7)

 # install.packages("PerformanceAnalytics")

 #library("PerformanceAnalytics")
 #?chart.Correlation#(decathlon2.active[, 1:6], histogram=TRUE, pch=19)
 #data(managers)
 #chart.Correlation(managers[,1:8], histogram=TRUE, pch="+")

#require(stpvers)

#Projekt("html")

APA_Ttest(m1+m2 ~ geschl, varana)
varanax<-Melt2(m1+m2~nr,varana , key="time", value="m")

# broom::tidy(with(varana, t.test(m1,m2 ) ))
# broom::tidy(  t.test(m~time, varanax, var.equal=FALSE)) )

APA_Ttest(m~time, varanax, paired = TRUE)

APA_Ttest(m~time, varanax, var.equal=TRUE)
APA_Ttest(m~time, varanax, var.equal=FALSE)
#broom::tidy(t.test(m~time, varanax, var.equal=TRUE))
#broom::tidy(t.test(m~time, varanax, var.equal=FALSE))

#End()

#  APA_Xtabs ################################
# Projekt("html")

 dat<-GetData("
sex treatment  neg  pos
f   KG         10	   9
f   UG         14	   5
m   KG         23	   7
m   UG         18	  14",Tabel_Expand = TRUE, id.vars = 1:2, value="befund")

x1<-xtabs( ~ sex + treatment , dat)
x2<-xtabs( ~ sex + befund + treatment , dat)
APA2(x1)
APA2(x1, include.total=TRUE, percent=F)
APA2(x2, include.total=TRUE)

APA2(x1, include.total.columns=T)
APA2(x2, include.total.columns=T)

APA2(x1, include.total.rows=T)
APA2(x2,include.total.rows=T)
APA2(x2,include.total.sub=T)
APA2(x2,include.total.sub=T, include.total.rows=T)
APA2(x2,
include.total.columns = T,
include.total.rows = T)






hkarz$LAI<- factor(hkarz$lai, 0:1, c("pos", "neg"))
hkarz$Tzell<- cut(hkarz$tzell, 3, c("low", "med", "hig"))


xtab <- xtabs(~ gruppe+LAI, hkarz)
APA2(xtab, 
caption="Harnblasenkarzinom", test=FALSE)
APA2(xtab, type="sens", 
test=TRUE, caption = "type=sens")
APA2(xtab, type="sens", 
caption = "geht nur mit teat=TRUE +  type=sens")
APA2(xtabs(~ gruppe+Tzell, hkarz), 
caption="APA_Xtabs: 2x3 Tabelle", test=FALSE)
APA2(xtabs(~ gruppe+LAI+Tzell, hkarz), 
caption="APA_Xtabs: 2x2x3 Tabelle", test=FALSE)


APA2(xtab, 
include.total.columns=TRUE, caption = "include.total.columns")
APA2(xtab, 
include.total.sub=TRUE, caption = "include.total.sub")




xtab <- xtabs(~ gruppe+Tzell, hkarz)
APA2(xtab, test=FALSE, caption="APA2: 2x3 Tabelle")


 #################################
 
 

stp4/stp25APA2 documentation built on May 24, 2019, 9:59 p.m.